ПИбд-23 Насыров Артур Газинурович Лабораторная работа №2 #3

Closed
gaillard wants to merge 11 commits from lab2 into lab1
8 changed files with 16 additions and 16 deletions
Showing only changes of commit d1dff985e1 - Show all commits

View File

@ -1,6 +1,6 @@
namespace ProjectFlowerShop
{
partial class FormProduct
partial class FormFlower
{
/// <summary>
/// Required designer variable.

View File

@ -15,7 +15,7 @@ using System.Windows.Forms;
namespace ProjectFlowerShop
{
public partial class FormProduct : Form
public partial class FormFlower : Form
{
private readonly ILogger _logger;
private readonly IFlowerLogic _logic;
@ -23,7 +23,7 @@ namespace ProjectFlowerShop
private Dictionary<int, (IComponentModel, int)> _flowerComponents;
public int Id { set { _id = value; } }
public FormProduct(ILogger<FormProduct> logger, IFlowerLogic logic)
public FormFlower(ILogger<FormFlower> logger, IFlowerLogic logic)
{
InitializeComponent();
_logger = logger;
@ -95,8 +95,8 @@ namespace ProjectFlowerShop
private void buttonAdd_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormProductComponent));
if (service is FormProductComponent form)
var service = Program.ServiceProvider?.GetService(typeof(FormFlowerComponent));
if (service is FormFlowerComponent form)
{
if (form.ShowDialog() == DialogResult.OK)
{
@ -124,8 +124,8 @@ namespace ProjectFlowerShop
if (dataGridView.SelectedRows.Count == 1)
{
var service =
Program.ServiceProvider?.GetService(typeof(FormProductComponent));
if (service is FormProductComponent form)
Program.ServiceProvider?.GetService(typeof(FormFlowerComponent));
if (service is FormFlowerComponent form)
{
int id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);

View File

@ -1,6 +1,6 @@
namespace ProjectFlowerShop
{
partial class FormProductComponent
partial class FormFlowerComponent
{
/// <summary>
/// Required designer variable.

View File

@ -13,7 +13,7 @@ using System.Windows.Forms;
namespace ProjectFlowerShop
{
public partial class FormProductComponent : Form
public partial class FormFlowerComponent : Form
{
private readonly List<ComponentViewModel>? _list;
public int Id
@ -52,7 +52,7 @@ namespace ProjectFlowerShop
set
{ textBoxNumber.Text = value.ToString(); }
}
public FormProductComponent(IComponentLogic logic)
public FormFlowerComponent(IComponentLogic logic)
{
InitializeComponent();
_list = logic.ReadList(null);

View File

@ -53,8 +53,8 @@ namespace ProjectFlowerShop
private void AddButton_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormProduct));
if (service is FormProduct form)
var service = Program.ServiceProvider?.GetService(typeof(FormFlower));
if (service is FormFlower form)
{
if (form.ShowDialog() == DialogResult.OK)
{
@ -67,8 +67,8 @@ namespace ProjectFlowerShop
{
if (DataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormProduct));
if (service is FormProduct form)
var service = Program.ServiceProvider?.GetService(typeof(FormFlower));
if (service is FormFlower form)
{
var tmp = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);

View File

@ -47,8 +47,8 @@ namespace ProjectFlowerShop
services.AddTransient<ComponentForm>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormProduct>();
services.AddTransient<FormProductComponent>();
services.AddTransient<FormFlower>();
services.AddTransient<FormFlowerComponent>();
services.AddTransient<FormFlowers>();
services.AddTransient<ShopForm>();
services.AddTransient<ShopsForm>();