From e17b3bfe83329f2256a45bb6d3b5ebc48a82a50a Mon Sep 17 00:00:00 2001 From: Yourdax Date: Tue, 29 Oct 2024 02:59:16 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B2=D1=80=D0=BE=D0=B4=D0=B5=20=D0=BF=D0=BE?= =?UTF-8?q?=D1=87=D1=82=D0=B8=20done,=20=D1=82=D0=BE=D0=BA=20=D0=BE=D1=82?= =?UTF-8?q?=D1=87=D0=B5=D1=82=D0=B8=D0=BA=D0=B8=20=D0=BE=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D1=81=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KopLab1/Forms/MainForm.Designer.cs | 2 +- KopLab1/Forms/MainForm.cs | 8 +- .../BusinessLogics/CityLogic.cs | 16 +- .../BindingModels/OrderBindingModel.cs | 2 +- .../Implements/CityStorage.cs | 8 +- .../Models/Orders.cs | 7 +- KopLab1/KopLab1.sln | 24 +-- KopLab1/Lab3Form/FormCities.Designer.cs | 84 +++++++++ KopLab1/Lab3Form/FormCities.cs | 106 +++++++++++ KopLab1/Lab3Form/FormCities.resx | 126 +++++++++++++ KopLab1/Lab3Form/FormMain.Designer.cs | 173 +++++++++++++++++ KopLab1/Lab3Form/FormMain.cs | 150 +++++++++++++++ KopLab1/Lab3Form/FormMain.resx | 132 +++++++++++++ KopLab1/Lab3Form/FormOrder.Designer.cs | 177 ++++++++++++++++++ KopLab1/Lab3Form/FormOrder.cs | 75 ++++++++ KopLab1/Lab3Form/FormOrder.resx | 126 +++++++++++++ KopLab1/Lab3Form/Lab3Form.csproj | 29 +++ KopLab1/Lab3Form/Program.cs | 41 ++++ 18 files changed, 1250 insertions(+), 36 deletions(-) create mode 100644 KopLab1/Lab3Form/FormCities.Designer.cs create mode 100644 KopLab1/Lab3Form/FormCities.cs create mode 100644 KopLab1/Lab3Form/FormCities.resx create mode 100644 KopLab1/Lab3Form/FormMain.Designer.cs create mode 100644 KopLab1/Lab3Form/FormMain.cs create mode 100644 KopLab1/Lab3Form/FormMain.resx create mode 100644 KopLab1/Lab3Form/FormOrder.Designer.cs create mode 100644 KopLab1/Lab3Form/FormOrder.cs create mode 100644 KopLab1/Lab3Form/FormOrder.resx create mode 100644 KopLab1/Lab3Form/Lab3Form.csproj create mode 100644 KopLab1/Lab3Form/Program.cs diff --git a/KopLab1/Forms/MainForm.Designer.cs b/KopLab1/Forms/MainForm.Designer.cs index 50d9457..900d0bc 100644 --- a/KopLab1/Forms/MainForm.Designer.cs +++ b/KopLab1/Forms/MainForm.Designer.cs @@ -52,7 +52,7 @@ // customListBox1.Location = new Point(12, 12); customListBox1.Name = "customListBox1"; - customListBox1.SelectedItem = ""; + customListBox1.city = ""; customListBox1.Size = new Size(237, 176); customListBox1.TabIndex = 0; // diff --git a/KopLab1/Forms/MainForm.cs b/KopLab1/Forms/MainForm.cs index 68be1b4..80b775e 100644 --- a/KopLab1/Forms/MainForm.cs +++ b/KopLab1/Forms/MainForm.cs @@ -22,17 +22,17 @@ namespace Forms public MainForm() { InitializeComponent(); - customListBox1.SelectedItemChanged += CustomListBox1_SelectedItemChanged; + customListBox1.cityChanged += CustomListBox1_cityChanged; integerInputControl1.ValueChanged += IntegerInputControl1_ValueChanged; integerInputControl1.CheckBoxChanged += IntegerInputControl_CheckBoxChanged; } - private void CustomListBox1_SelectedItemChanged(object? sender, EventArgs e) + private void CustomListBox1_cityChanged(object? sender, EventArgs e) { if (sender is CustomListBox customListBox) { - string selectedItem = customListBox.SelectedItem; - MessageBox.Show($"Выбранный элемент: {selectedItem}", "Выбор элемента", MessageBoxButtons.OK, MessageBoxIcon.Information); + string city = customListBox.city; + MessageBox.Show($"Выбранный элемент: {city}", "Выбор элемента", MessageBoxButtons.OK, MessageBoxIcon.Information); } } private void ButtonLoad_Click(object? sender, EventArgs e) diff --git a/KopLab1/InternetShopOrdersBusinessLogic/BusinessLogics/CityLogic.cs b/KopLab1/InternetShopOrdersBusinessLogic/BusinessLogics/CityLogic.cs index e64c193..0c3fb4f 100644 --- a/KopLab1/InternetShopOrdersBusinessLogic/BusinessLogics/CityLogic.cs +++ b/KopLab1/InternetShopOrdersBusinessLogic/BusinessLogics/CityLogic.cs @@ -8,16 +8,16 @@ namespace InternetShopOrdersBusinessLogic.BusinessLogics { public class CityLogic : ICityLogic { - private readonly ICityStorage _selectedItemStorage; + private readonly ICityStorage _cityStorage; - public CityLogic(ICityStorage selectedItemStorage) + public CityLogic(ICityStorage cityStorage) { - _selectedItemStorage = selectedItemStorage; + _cityStorage = cityStorage; } public List? ReadList(CitySearchModel? model) { - var list = model == null ? _selectedItemStorage.GetFullList() : _selectedItemStorage.GetFilteredList(model); + var list = model == null ? _cityStorage.GetFullList() : _cityStorage.GetFilteredList(model); if (list == null) { return null; @@ -31,7 +31,7 @@ namespace InternetShopOrdersBusinessLogic.BusinessLogics { throw new ArgumentNullException(nameof(model)); } - var element = _selectedItemStorage.GetElement(model); + var element = _cityStorage.GetElement(model); if (element == null) { return null; @@ -42,7 +42,7 @@ namespace InternetShopOrdersBusinessLogic.BusinessLogics public bool Create(CityBindingModel model) { CheckModel(model); - if (_selectedItemStorage.Insert(model) == null) + if (_cityStorage.Insert(model) == null) { return false; } @@ -52,7 +52,7 @@ namespace InternetShopOrdersBusinessLogic.BusinessLogics public bool Update(CityBindingModel model) { CheckModel(model); - if (_selectedItemStorage.Update(model) == null) + if (_cityStorage.Update(model) == null) { return false; } @@ -61,7 +61,7 @@ namespace InternetShopOrdersBusinessLogic.BusinessLogics public bool Delete(CityBindingModel model) { CheckModel(model, false); - if (_selectedItemStorage.Delete(model) == null) + if (_cityStorage.Delete(model) == null) { return false; } diff --git a/KopLab1/InternetShopOrdersContracts/BindingModels/OrderBindingModel.cs b/KopLab1/InternetShopOrdersContracts/BindingModels/OrderBindingModel.cs index 8926dee..e50147d 100644 --- a/KopLab1/InternetShopOrdersContracts/BindingModels/OrderBindingModel.cs +++ b/KopLab1/InternetShopOrdersContracts/BindingModels/OrderBindingModel.cs @@ -10,7 +10,7 @@ namespace InternetShopOrdersContracts.BindingModels public string Fullname { get; set; } = string.Empty; public List OrderStatusHistory { get; set; } = new List(); public int DestinationCityId { get; set; } - public ICityModel DestinationCity { get; set; } + //public ICityModel DestinationCity { get; set; } public DateTime ExpectedDeliveryDate { get; set; } } } diff --git a/KopLab1/InternetShopOrdersDatabaseImplement/Implements/CityStorage.cs b/KopLab1/InternetShopOrdersDatabaseImplement/Implements/CityStorage.cs index 75c7285..042774b 100644 --- a/KopLab1/InternetShopOrdersDatabaseImplement/Implements/CityStorage.cs +++ b/KopLab1/InternetShopOrdersDatabaseImplement/Implements/CityStorage.cs @@ -41,15 +41,15 @@ namespace InternetShopOrdersDatabaseImplement.Implements } public CityViewModel? Insert(CityBindingModel model) { - var newSelectedItem = Cities.Create(model); - if (newSelectedItem == null) + var newcity = Cities.Create(model); + if (newcity == null) { return null; } using var context = new OrdersDatabase(); - context.Cities.Add(newSelectedItem); + context.Cities.Add(newcity); context.SaveChanges(); - return newSelectedItem.GetViewModel; + return newcity.GetViewModel; } public CityViewModel? Update(CityBindingModel model) { diff --git a/KopLab1/InternetShopOrdersDatabaseImplement/Models/Orders.cs b/KopLab1/InternetShopOrdersDatabaseImplement/Models/Orders.cs index f72c0af..4a10fb2 100644 --- a/KopLab1/InternetShopOrdersDatabaseImplement/Models/Orders.cs +++ b/KopLab1/InternetShopOrdersDatabaseImplement/Models/Orders.cs @@ -36,8 +36,9 @@ namespace InternetShopOrdersDatabaseImplement.Models { Id = model.Id, Fullname = model.Fullname, - DestinationCity = context.Cities.First(x => x.Id == model.Id), - ExpectedDeliveryDate = model.ExpectedDeliveryDate + DestinationCity = context.Cities.First(x => x.Id == model.DestinationCityId), + OrderStatusHistory = model.OrderStatusHistory, + ExpectedDeliveryDate = model.ExpectedDeliveryDate.ToUniversalTime() }; } @@ -50,7 +51,7 @@ namespace InternetShopOrdersDatabaseImplement.Models Fullname = model.Fullname; DestinationCity = context.Cities.First(x => x.Id == model.Id); OrderStatusHistory = model.OrderStatusHistory.ToList(); - ExpectedDeliveryDate = model.ExpectedDeliveryDate; + ExpectedDeliveryDate = model.ExpectedDeliveryDate.ToUniversalTime(); } public OrderViewModel GetViewModel => new() diff --git a/KopLab1/KopLab1.sln b/KopLab1/KopLab1.sln index 70ce9ee..53e75fd 100644 --- a/KopLab1/KopLab1.sln +++ b/KopLab1/KopLab1.sln @@ -3,17 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.11.35222.181 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FormLibrary", "FormLibrary\FormLibrary.csproj", "{E840E4D9-B195-449A-AB24-ECAAE2655D58}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersDataModels", "InetShopDataModels\InternetShopOrdersDataModels.csproj", "{FC789ABE-4687-4521-871C-72E1130C6BE6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Forms", "Forms\Forms.csproj", "{83F3C50D-D872-48B6-8932-1D5B7E0A40F0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersDatabaseImplement", "InternetShopOrdersDatabaseImplement\InternetShopOrdersDatabaseImplement.csproj", "{AE2BEC62-31AA-4043-B1EC-C4B3F674A4AF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternetShopOrdersDataModels", "InetShopDataModels\InternetShopOrdersDataModels.csproj", "{FC789ABE-4687-4521-871C-72E1130C6BE6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersContracts", "InternetShopOrdersContracts\InternetShopOrdersContracts.csproj", "{21E46342-A4FE-437D-BE39-9950919DECDC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternetShopOrdersDatabaseImplement", "InternetShopOrdersDatabaseImplement\InternetShopOrdersDatabaseImplement.csproj", "{AE2BEC62-31AA-4043-B1EC-C4B3F674A4AF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersBusinessLogic", "InternetShopOrdersBusinessLogic\InternetShopOrdersBusinessLogic.csproj", "{148CAD37-ECDC-4B97-9AD0-1D0990B1B8BE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternetShopOrdersContracts", "InternetShopOrdersContracts\InternetShopOrdersContracts.csproj", "{21E46342-A4FE-437D-BE39-9950919DECDC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternetShopOrdersBusinessLogic", "InternetShopOrdersBusinessLogic\InternetShopOrdersBusinessLogic.csproj", "{148CAD37-ECDC-4B97-9AD0-1D0990B1B8BE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab3Form", "Lab3Form\Lab3Form.csproj", "{3329D6FC-A78D-46A7-9EA3-C0ECD21143CB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,14 +19,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E840E4D9-B195-449A-AB24-ECAAE2655D58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E840E4D9-B195-449A-AB24-ECAAE2655D58}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E840E4D9-B195-449A-AB24-ECAAE2655D58}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E840E4D9-B195-449A-AB24-ECAAE2655D58}.Release|Any CPU.Build.0 = Release|Any CPU - {83F3C50D-D872-48B6-8932-1D5B7E0A40F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {83F3C50D-D872-48B6-8932-1D5B7E0A40F0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {83F3C50D-D872-48B6-8932-1D5B7E0A40F0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {83F3C50D-D872-48B6-8932-1D5B7E0A40F0}.Release|Any CPU.Build.0 = Release|Any CPU {FC789ABE-4687-4521-871C-72E1130C6BE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FC789ABE-4687-4521-871C-72E1130C6BE6}.Debug|Any CPU.Build.0 = Debug|Any CPU {FC789ABE-4687-4521-871C-72E1130C6BE6}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -45,6 +35,10 @@ Global {148CAD37-ECDC-4B97-9AD0-1D0990B1B8BE}.Debug|Any CPU.Build.0 = Debug|Any CPU {148CAD37-ECDC-4B97-9AD0-1D0990B1B8BE}.Release|Any CPU.ActiveCfg = Release|Any CPU {148CAD37-ECDC-4B97-9AD0-1D0990B1B8BE}.Release|Any CPU.Build.0 = Release|Any CPU + {3329D6FC-A78D-46A7-9EA3-C0ECD21143CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3329D6FC-A78D-46A7-9EA3-C0ECD21143CB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3329D6FC-A78D-46A7-9EA3-C0ECD21143CB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3329D6FC-A78D-46A7-9EA3-C0ECD21143CB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/KopLab1/Lab3Form/FormCities.Designer.cs b/KopLab1/Lab3Form/FormCities.Designer.cs new file mode 100644 index 0000000..e979268 --- /dev/null +++ b/KopLab1/Lab3Form/FormCities.Designer.cs @@ -0,0 +1,84 @@ +namespace Lab3Form +{ + partial class FormCities + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + NameCol = new DataGridViewTextBoxColumn(); + Id = new DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { NameCol, Id }); + dataGridView.Location = new Point(0, 0); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 47; + dataGridView.Size = new Size(800, 356); + dataGridView.TabIndex = 0; + dataGridView.CellValueChanged += dataGridView_CellValueChanged; + dataGridView.UserDeletingRow += dataGridView_UserDeletingRow; + dataGridView.KeyUp += dataGridView_KeyUp; + // + // NameCol + // + NameCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + NameCol.HeaderText = "Название товара"; + NameCol.MinimumWidth = 6; + NameCol.Name = "NameCol"; + // + // Id + // + Id.HeaderText = "Id"; + Id.MinimumWidth = 6; + Id.Name = "Id"; + Id.Visible = false; + Id.Width = 125; + // + // Formcitys + // + AutoScaleDimensions = new SizeF(8F, 19F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 356); + Controls.Add(dataGridView); + Name = "Formcitys"; + Text = "Выбранные товары"; + Load += Formcitys_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private DataGridViewTextBoxColumn NameCol; + private DataGridViewTextBoxColumn Id; + } +} \ No newline at end of file diff --git a/KopLab1/Lab3Form/FormCities.cs b/KopLab1/Lab3Form/FormCities.cs new file mode 100644 index 0000000..d4cda97 --- /dev/null +++ b/KopLab1/Lab3Form/FormCities.cs @@ -0,0 +1,106 @@ +using InternetShopOrdersContracts.BindingModels; +using InternetShopOrdersContracts.BusinessLogicContracts; +using Microsoft.EntityFrameworkCore.Diagnostics; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Lab3Form +{ + public partial class FormCities : Form + { + private readonly ICityLogic _logic; + private bool loading = false; + + public FormCities(ICityLogic logic) + { + InitializeComponent(); + _logic = logic; + } + + private void LoadData() + { + loading = true; + try + { + var list = _logic.ReadList(null); + if (list != null) + { + foreach (var city in list) + { + int rowIndex = dataGridView.Rows.Add(); + dataGridView.Rows[rowIndex].Cells[0].Value = city.Name; + dataGridView.Rows[rowIndex].Cells[1].Value = city.Id; + } + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + finally + { + loading = false; + } + } + + private void Formcitys_Load(object sender, EventArgs e) + { + LoadData(); + } + + private void dataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e) + { + if (loading || e.RowIndex < 0 || e.ColumnIndex != 0) return; + if (dataGridView.Rows[e.RowIndex].Cells[1].Value != null && !string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString())) + { + var name = dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; + if (name is null) return; + _logic.Update(new CityBindingModel { Id = Convert.ToInt32(dataGridView.Rows[e.RowIndex].Cells[1].Value), Name = name.ToString() }); + } + else + { + var name = dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; + if (name is null) return; + _logic.Create(new CityBindingModel { Id = 0, Name = name.ToString() }); + int newInterestId = _logic.ReadList(null).ToList().Last().Id; + dataGridView.Rows[e.RowIndex].Cells[1].Value = newInterestId; + } + } + + private void dataGridView_KeyUp(object sender, KeyEventArgs e) + { + switch (e.KeyCode) + { + case Keys.Insert: + dataGridView.Rows.Add(); + break; + } + } + + private void deleteRows(DataGridViewSelectedRowCollection rows) + { + for (int i = 0; i < rows.Count; i++) + { + DataGridViewRow row = rows[i]; + if (!_logic.Delete(new CityBindingModel { Id = Convert.ToInt32(row.Cells[1].Value) })) continue; + } + dataGridView.Rows.Clear(); + LoadData(); + } + + private void dataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e) + { + e.Cancel = true; + if (dataGridView.SelectedRows == null) return; + if (MessageBox.Show("Удалить записи?", "Подтвердите действие", MessageBoxButtons.YesNo) == DialogResult.No) return; + deleteRows(dataGridView.SelectedRows); + } + } +} diff --git a/KopLab1/Lab3Form/FormCities.resx b/KopLab1/Lab3Form/FormCities.resx new file mode 100644 index 0000000..d012256 --- /dev/null +++ b/KopLab1/Lab3Form/FormCities.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + \ No newline at end of file diff --git a/KopLab1/Lab3Form/FormMain.Designer.cs b/KopLab1/Lab3Form/FormMain.Designer.cs new file mode 100644 index 0000000..fa403c5 --- /dev/null +++ b/KopLab1/Lab3Form/FormMain.Designer.cs @@ -0,0 +1,173 @@ +namespace Lab3Form +{ + partial class FormMain + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + menuStrip = new MenuStrip(); + заказыToolStripMenuItem = new ToolStripMenuItem(); + создатьToolStripMenuItem = new ToolStripMenuItem(); + редактироватьToolStripMenuItem = new ToolStripMenuItem(); + удалитьToolStripMenuItem = new ToolStripMenuItem(); + отчётыToolStripMenuItem = new ToolStripMenuItem(); + документToolStripMenuItem = new ToolStripMenuItem(); + документСТаблицейToolStripMenuItem = new ToolStripMenuItem(); + документСДиаграммойToolStripMenuItem = new ToolStripMenuItem(); + выбранныеТоварыToolStripMenuItem = new ToolStripMenuItem(); + controlDataTable = new ControlsLibraryNet60.Data.ControlDataTableTable(); + excelImagesComponent = new WinFormsLibraryVolkov.NonVisualComponents.ExcelImagesComponent(components); + componentDocumentWithTableMultiHeaderWord = new ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderWord(components); + menuStrip.SuspendLayout(); + SuspendLayout(); + // + // menuStrip + // + menuStrip.ImageScalingSize = new Size(18, 18); + menuStrip.Items.AddRange(new ToolStripItem[] { заказыToolStripMenuItem, отчётыToolStripMenuItem, выбранныеТоварыToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Padding = new Padding(5, 2, 0, 2); + menuStrip.Size = new Size(853, 24); + menuStrip.TabIndex = 0; + menuStrip.Text = "menuStrip"; + // + // заказыToolStripMenuItem + // + заказыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { создатьToolStripMenuItem, редактироватьToolStripMenuItem, удалитьToolStripMenuItem }); + заказыToolStripMenuItem.Name = "заказыToolStripMenuItem"; + заказыToolStripMenuItem.Size = new Size(58, 20); + заказыToolStripMenuItem.Text = "Заказы"; + // + // создатьToolStripMenuItem + // + создатьToolStripMenuItem.Name = "создатьToolStripMenuItem"; + создатьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.A; + создатьToolStripMenuItem.Size = new Size(196, 22); + создатьToolStripMenuItem.Text = "Создать"; + создатьToolStripMenuItem.Click += создатьToolStripMenuItem_Click; + // + // редактироватьToolStripMenuItem + // + редактироватьToolStripMenuItem.Name = "редактироватьToolStripMenuItem"; + редактироватьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.U; + редактироватьToolStripMenuItem.Size = new Size(196, 22); + редактироватьToolStripMenuItem.Text = "Редактировать"; + редактироватьToolStripMenuItem.Click += редактироватьToolStripMenuItem_Click; + // + // удалитьToolStripMenuItem + // + удалитьToolStripMenuItem.Name = "удалитьToolStripMenuItem"; + удалитьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.D; + удалитьToolStripMenuItem.Size = new Size(196, 22); + удалитьToolStripMenuItem.Text = "Удалить"; + удалитьToolStripMenuItem.Click += удалитьToolStripMenuItem_Click; + // + // отчётыToolStripMenuItem + // + отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { документToolStripMenuItem, документСТаблицейToolStripMenuItem, документСДиаграммойToolStripMenuItem }); + отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; + отчётыToolStripMenuItem.Size = new Size(60, 20); + отчётыToolStripMenuItem.Text = "Отчёты"; + // + // документToolStripMenuItem + // + документToolStripMenuItem.Name = "документToolStripMenuItem"; + документToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S; + документToolStripMenuItem.Size = new Size(309, 22); + документToolStripMenuItem.Text = "Документ с простой таблицей"; + документToolStripMenuItem.Click += документToolStripMenuItem_Click; + // + // документСТаблицейToolStripMenuItem + // + документСТаблицейToolStripMenuItem.Name = "документСТаблицейToolStripMenuItem"; + документСТаблицейToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.T; + документСТаблицейToolStripMenuItem.Size = new Size(309, 22); + документСТаблицейToolStripMenuItem.Text = "Отчет по всем заказам"; + документСТаблицейToolStripMenuItem.Click += документСТаблицейToolStripMenuItem_Click; + // + // документСДиаграммойToolStripMenuItem + // + документСДиаграммойToolStripMenuItem.Name = "документСДиаграммойToolStripMenuItem"; + документСДиаграммойToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.C; + документСДиаграммойToolStripMenuItem.Size = new Size(309, 22); + документСДиаграммойToolStripMenuItem.Text = "Документ с линейной диаграммой"; + документСДиаграммойToolStripMenuItem.Click += документСДиаграммойToolStripMenuItem_Click; + // + // выбранныеТоварыToolStripMenuItem + // + выбранныеТоварыToolStripMenuItem.Name = "выбранныеТоварыToolStripMenuItem"; + выбранныеТоварыToolStripMenuItem.Size = new Size(125, 20); + выбранныеТоварыToolStripMenuItem.Text = "Города назначения"; + выбранныеТоварыToolStripMenuItem.Click += выбранныеТоварыToolStripMenuItem_Click; + // + // controlDataTable + // + controlDataTable.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + controlDataTable.AutoSize = true; + controlDataTable.Location = new Point(0, 24); + controlDataTable.Margin = new Padding(4, 3, 4, 3); + controlDataTable.Name = "controlDataTable"; + controlDataTable.SelectedRowIndex = -1; + controlDataTable.Size = new Size(853, 419); + controlDataTable.TabIndex = 1; + // + // FormMain + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(853, 442); + Controls.Add(controlDataTable); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; + Margin = new Padding(3, 2, 3, 2); + Name = "FormMain"; + Text = "Заказы"; + Load += FormMain_Load; + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private MenuStrip menuStrip; + private ToolStripMenuItem заказыToolStripMenuItem; + private ToolStripMenuItem создатьToolStripMenuItem; + private ToolStripMenuItem редактироватьToolStripMenuItem; + private ToolStripMenuItem удалитьToolStripMenuItem; + private ToolStripMenuItem отчётыToolStripMenuItem; + private ToolStripMenuItem документToolStripMenuItem; + private ToolStripMenuItem документСТаблицейToolStripMenuItem; + private ToolStripMenuItem выбранныеТоварыToolStripMenuItem; + private ToolStripMenuItem документСДиаграммойToolStripMenuItem; + private ControlsLibraryNet60.Data.ControlDataTableTable controlDataTable; + private WinFormsLibraryVolkov.NonVisualComponents.ExcelImagesComponent excelImagesComponent; + private ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderWord componentDocumentWithTableMultiHeaderWord; + } +} \ No newline at end of file diff --git a/KopLab1/Lab3Form/FormMain.cs b/KopLab1/Lab3Form/FormMain.cs new file mode 100644 index 0000000..e9cd1a7 --- /dev/null +++ b/KopLab1/Lab3Form/FormMain.cs @@ -0,0 +1,150 @@ +using InternetShopOrdersBusinessLogic.BusinessLogics; +using InternetShopOrdersContracts.BusinessLogicContracts; +using InternetShopOrdersContracts.ViewModels; +using InternetShopOrdersContracts.BindingModels; +using InternetShopOrdersContracts.SearchModels; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ControlsLibraryNet60.Models; +using Microsoft.EntityFrameworkCore.Diagnostics; +using WinFormsLibraryVolkov.NonVisualComponents; +using ComponentsLibraryNet60.Core; +using ComponentsLibraryNet60.DocumentWithTable; +using ComponentsLibraryNet60.Models; + +namespace Lab3Form +{ + public partial class FormMain : Form + { + private IOrderLogic _logic; + + public FormMain(IOrderLogic logic) + { + InitializeComponent(); + _logic = logic; + controlDataTable.LoadColumns(new List + { + new DataTableColumnConfig { ColumnHeader = "Идентификатор", PropertyName = "Id", Visible = true, Width = 100 }, + new DataTableColumnConfig { ColumnHeader = "ФИО заказчика", PropertyName = "Fullname", Visible = true, Width = 200 }, + new DataTableColumnConfig { ColumnHeader = "Город назначения", PropertyName = "DestinationCityName", Visible = true, Width = 150 }, + new DataTableColumnConfig { ColumnHeader = "История передвижения", PropertyName = "OrderStatusHistory", Visible = true, Width = 250 }, + new DataTableColumnConfig { ColumnHeader = "Дата выдачи", PropertyName = "ExpectedDeliveryDate", Visible = true, Width = 125 }, + }); + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + } + + private void LoadData() + { + controlDataTable.Clear(); + var orders = _logic.ReadList(null); + if (orders != null) + { + // Преобразуем List в строку для отображения + var displayOrders = orders.Select(order => new + { + order.Id, + order.Fullname, + order.DestinationCityName, + // Преобразуем OrderStatusHistory в строку + OrderStatusHistory = string.Join(", ", order.OrderStatusHistory), + order.ExpectedDeliveryDate + }).ToList(); + + // Передаем преобразованный список в таблицу + controlDataTable.AddTable(displayOrders); + } + } + private void FormMain_Load(object sender, EventArgs e) + { + LoadData(); + } + private void создатьToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormOrder)); + if (service is FormOrder form) + { + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + + private void редактироватьToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormOrder)); + if (service is FormOrder form) + { + form.Id = controlDataTable.GetSelectedObject().Id ?? 0; + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + + private void удалитьToolStripMenuItem_Click(object sender, EventArgs e) + { + // Получаем выбранный объект + var selectedOrder = controlDataTable.GetSelectedObject(); + if (selectedOrder == null) + { + MessageBox.Show("Не выбрана запись для удаления."); + return; + } + + // Подтверждение удаления + if (MessageBox.Show("Удалить запись?", "", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + // Вызываем метод Delete, передавая модель с ID + var isDeleted = _logic.Delete(new OrderBindingModel { Id = selectedOrder.Id ?? 0 }); + if (isDeleted) + { + // Если удаление успешно, обновляем данные + LoadData(); + MessageBox.Show("Запись успешно удалена."); + } + else + { + MessageBox.Show("Ошибка при удалении записи."); + } + } + } + + + private void документToolStripMenuItem_Click(object sender, EventArgs e) + { + List orderImages = new List(); + string path = AppDomain.CurrentDomain.BaseDirectory + "Фотокарточки заказов с интернет-магазина.xlsx"; + if (excelImagesComponent.createWithImages(new ExcelImageInfo(path, "Фотокарточки заказов", orderImages.ToArray()))) MessageBox.Show("Документ был создан"); + } + + private void документСТаблицейToolStripMenuItem_Click(object sender, EventArgs e) + { + string path = AppDomain.CurrentDomain.BaseDirectory + "Отчет по всем заказам.docx"; + + } + + private void документСДиаграммойToolStripMenuItem_Click(object sender, EventArgs e) + { + string path = AppDomain.CurrentDomain.BaseDirectory + "Гистограмма товаров.pdf"; + + } + + private void выбранныеТоварыToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormCities)); + if (service is FormCities form) + { + form.ShowDialog(); + } + } + } +} diff --git a/KopLab1/Lab3Form/FormMain.resx b/KopLab1/Lab3Form/FormMain.resx new file mode 100644 index 0000000..8743b19 --- /dev/null +++ b/KopLab1/Lab3Form/FormMain.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 138, 17 + + + 347, 18 + + + 177 + + \ No newline at end of file diff --git a/KopLab1/Lab3Form/FormOrder.Designer.cs b/KopLab1/Lab3Form/FormOrder.Designer.cs new file mode 100644 index 0000000..c590a9c --- /dev/null +++ b/KopLab1/Lab3Form/FormOrder.Designer.cs @@ -0,0 +1,177 @@ +namespace Lab3Form +{ + partial class FormOrder + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + labelFIO = new Label(); + textBoxFIO = new TextBox(); + labelcity = new Label(); + customSelectedCheckedListBox = new WinFormsLibraryVolkov.CustomSelectedCheckedListBox(); + buttonCancel = new Button(); + buttonSave = new Button(); + openFileDialog = new OpenFileDialog(); + label1 = new Label(); + label2 = new Label(); + customInputRangeDate1 = new WinFormsLibraryVolkov.CustomInputRangeDate(); + listBox1 = new ListBox(); + SuspendLayout(); + // + // labelFIO + // + labelFIO.AutoSize = true; + labelFIO.Location = new Point(10, 7); + labelFIO.Name = "labelFIO"; + labelFIO.Size = new Size(91, 15); + labelFIO.TabIndex = 0; + labelFIO.Text = "ФИО заказчика"; + // + // textBoxFIO + // + textBoxFIO.Location = new Point(10, 24); + textBoxFIO.Margin = new Padding(3, 2, 3, 2); + textBoxFIO.Name = "textBoxFIO"; + textBoxFIO.Size = new Size(277, 23); + textBoxFIO.TabIndex = 1; + // + // labelcity + // + labelcity.AutoSize = true; + labelcity.Location = new Point(10, 62); + labelcity.Name = "labelcity"; + labelcity.Size = new Size(107, 15); + labelcity.TabIndex = 4; + labelcity.Text = "Город назначения"; + // + // customSelectedCheckedListBox + // + customSelectedCheckedListBox.Location = new Point(10, 81); + customSelectedCheckedListBox.Name = "customSelectedCheckedListBox"; + customSelectedCheckedListBox.SelectedElement = ""; + customSelectedCheckedListBox.Size = new Size(277, 65); + customSelectedCheckedListBox.TabIndex = 5; + // + // buttonCancel + // + buttonCancel.Location = new Point(204, 323); + buttonCancel.Margin = new Padding(3, 2, 3, 2); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(83, 21); + buttonCancel.TabIndex = 7; + buttonCancel.Text = "Отменить"; + buttonCancel.UseVisualStyleBackColor = true; + // + // buttonSave + // + buttonSave.Location = new Point(10, 325); + buttonSave.Margin = new Padding(3, 2, 3, 2); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(94, 21); + buttonSave.TabIndex = 8; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // openFileDialog + // + openFileDialog.FileName = "openFileDialog"; + openFileDialog.Multiselect = true; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(10, 262); + label1.Name = "label1"; + label1.Size = new Size(132, 15); + label1.TabIndex = 10; + label1.Text = "Дата получения заказа"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(10, 172); + label2.Name = "label2"; + label2.Size = new Size(123, 15); + label2.TabIndex = 12; + label2.Text = "Точки передвижения"; + // + // customInputRangeDate1 + // + customInputRangeDate1.Location = new Point(10, 280); + customInputRangeDate1.MaxDate = new DateTime(0L); + customInputRangeDate1.MinDate = new DateTime(0L); + customInputRangeDate1.Name = "customInputRangeDate1"; + customInputRangeDate1.Size = new Size(277, 40); + customInputRangeDate1.TabIndex = 13; + // + // listBox1 + // + listBox1.FormattingEnabled = true; + listBox1.ItemHeight = 15; + listBox1.Location = new Point(10, 190); + listBox1.Name = "listBox1"; + listBox1.SelectionMode = SelectionMode.MultiExtended; + listBox1.Size = new Size(277, 64); + listBox1.TabIndex = 14; + // + // FormOrder + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(299, 355); + Controls.Add(listBox1); + Controls.Add(customInputRangeDate1); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(buttonSave); + Controls.Add(buttonCancel); + Controls.Add(customSelectedCheckedListBox); + Controls.Add(labelcity); + Controls.Add(textBoxFIO); + Controls.Add(labelFIO); + Margin = new Padding(3, 2, 3, 2); + Name = "FormOrder"; + Text = "Заказ"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelFIO; + private TextBox textBoxFIO; + private Label labelcity; + private WinFormsLibraryVolkov.CustomSelectedCheckedListBox customSelectedCheckedListBox; + private Button buttonCancel; + private Button buttonSave; + private OpenFileDialog openFileDialog; + private Label label1; + private Label label2; + private WinFormsLibraryVolkov.CustomInputRangeDate customInputRangeDate1; + private ListBox listBox1; + } +} \ No newline at end of file diff --git a/KopLab1/Lab3Form/FormOrder.cs b/KopLab1/Lab3Form/FormOrder.cs new file mode 100644 index 0000000..e2238bd --- /dev/null +++ b/KopLab1/Lab3Form/FormOrder.cs @@ -0,0 +1,75 @@ +using InternetShopOrdersContracts.BindingModels; +using InternetShopOrdersContracts.BusinessLogicContracts; +using InternetShopOrdersContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Lab3Form +{ + public partial class FormOrder : Form + { + private int? _id; + private readonly IOrderLogic _logic; + private readonly ICityLogic _cityLogic; + private List _Cities; + public int Id { set { _id = value; } } + + public FormOrder(IOrderLogic logic, ICityLogic cityLogic) + { + InitializeComponent(); + _logic = logic; + _cityLogic = cityLogic; + _Cities = new List(); + _Cities = _cityLogic.ReadList(null); + var cityNames = _Cities.Select(city => city.Name).ToList(); + customSelectedCheckedListBox.PopulateList(cityNames); + var orderStatuses = new List { "Создан", "Подтвержден", "Отправлен", "Доставлен" }; + listBox1.Items.AddRange(orderStatuses.ToArray()); + DateTime now = DateTime.Now; + customInputRangeDate1.MinDate = now.AddYears(-1); + customInputRangeDate1.MaxDate = now.AddYears(1); + } + + private void buttonSave_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(textBoxFIO.Text)) + { + MessageBox.Show("Заполните ФИО заказчика", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + if (customSelectedCheckedListBox.SelectedElement == null) + { + MessageBox.Show("Укажите город назначения", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + try + { + var model = new OrderBindingModel + { + Id = _id ?? 0, + Fullname = textBoxFIO.Text, + DestinationCityId = _Cities.First(x => x.Name == customSelectedCheckedListBox.SelectedElement).Id, + ExpectedDeliveryDate = customInputRangeDate1.Date, + OrderStatusHistory = listBox1.SelectedItems.Cast().ToList(), + }; + var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); + if (!operationResult) + { + throw new Exception("Возникла ошибка при сохранении. Дополнительная информация в логах"); + } + MessageBox.Show("Сохранение прошло успешно", "Успешное сохранение", MessageBoxButtons.OK, MessageBoxIcon.Information); + DialogResult = DialogResult.OK; + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/KopLab1/Lab3Form/FormOrder.resx b/KopLab1/Lab3Form/FormOrder.resx new file mode 100644 index 0000000..68d5403 --- /dev/null +++ b/KopLab1/Lab3Form/FormOrder.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 90 + + \ No newline at end of file diff --git a/KopLab1/Lab3Form/Lab3Form.csproj b/KopLab1/Lab3Form/Lab3Form.csproj new file mode 100644 index 0000000..b09d564 --- /dev/null +++ b/KopLab1/Lab3Form/Lab3Form.csproj @@ -0,0 +1,29 @@ + + + + WinExe + net8.0-windows + enable + true + enable + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + \ No newline at end of file diff --git a/KopLab1/Lab3Form/Program.cs b/KopLab1/Lab3Form/Program.cs new file mode 100644 index 0000000..f9dad60 --- /dev/null +++ b/KopLab1/Lab3Form/Program.cs @@ -0,0 +1,41 @@ +using InternetShopOrdersBusinessLogic.BusinessLogics; +using InternetShopOrdersContracts.BusinessLogicContracts; +using InternetShopOrdersContracts.StorageContracts; +using InternetShopOrdersDatabaseImplement.Implements; +using Microsoft.Extensions.DependencyInjection; +using System; + +namespace Lab3Form +{ + internal static class Program + { + private static ServiceProvider? _serviceProvider; + public static ServiceProvider? ServiceProvider => _serviceProvider; + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + var services = new ServiceCollection(); + ConfigureServices(services); + _serviceProvider = services.BuildServiceProvider(); + Application.Run(_serviceProvider.GetRequiredService()); + } + + private static void ConfigureServices(ServiceCollection services) + { + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + } + } +} \ No newline at end of file