From 6610112df2fe54fd44a0979df5fbe9479864d821 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Wed, 7 Feb 2024 16:24:04 +0400 Subject: [PATCH 01/23] =?UTF-8?q?=D0=9D=D0=B0=D0=B2=D0=B5=D1=80=D0=BD?= =?UTF-8?q?=D0=BE=D0=B5=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IceCreamShop/MainForm.Designer.cs | 64 ++++-- IceCreamShop/IceCreamShop/MainForm.cs | 18 ++ IceCreamShop/IceCreamShop/Program.cs | 5 + .../IceCreamShop/ShopForm.Designer.cs | 187 ++++++++++++++++++ IceCreamShop/IceCreamShop/ShopForm.cs | 124 ++++++++++++ IceCreamShop/IceCreamShop/ShopForm.resx | 132 +++++++++++++ .../IceCreamShop/ShopsForm.Designer.cs | 117 +++++++++++ IceCreamShop/IceCreamShop/ShopsForm.cs | 118 +++++++++++ IceCreamShop/IceCreamShop/ShopsForm.resx | 120 +++++++++++ .../IceCreamShop/SupplyForm.Designer.cs | 105 ++++++++++ IceCreamShop/IceCreamShop/SupplyForm.cs | 153 ++++++++++++++ IceCreamShop/IceCreamShop/SupplyForm.resx | 120 +++++++++++ .../BusinessLogic/ShopLogic.cs | 137 +++++++++++++ .../BindingModels/ShopBindingModel.cs | 18 ++ .../BusinessLogicsContracts/IShopLogic.cs | 22 +++ .../SearchModels/ShopSearchModel.cs | 15 ++ .../StoragesContracts/IShopStorage.cs | 23 +++ .../ViewModels/ShopViewModel.cs | 22 +++ .../IceCreamShopDataModels/IShopModel.cs | 16 ++ .../DataListSingleton.cs | 2 + .../Implements/ShopStorage.cs | 139 +++++++++++++ .../IceCreamShopListImplement/Models/Shop.cs | 56 ++++++ 22 files changed, 1694 insertions(+), 19 deletions(-) create mode 100644 IceCreamShop/IceCreamShop/ShopForm.Designer.cs create mode 100644 IceCreamShop/IceCreamShop/ShopForm.cs create mode 100644 IceCreamShop/IceCreamShop/ShopForm.resx create mode 100644 IceCreamShop/IceCreamShop/ShopsForm.Designer.cs create mode 100644 IceCreamShop/IceCreamShop/ShopsForm.cs create mode 100644 IceCreamShop/IceCreamShop/ShopsForm.resx create mode 100644 IceCreamShop/IceCreamShop/SupplyForm.Designer.cs create mode 100644 IceCreamShop/IceCreamShop/SupplyForm.cs create mode 100644 IceCreamShop/IceCreamShop/SupplyForm.resx create mode 100644 IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs create mode 100644 IceCreamShop/IceCreamShopContracts/BindingModels/ShopBindingModel.cs create mode 100644 IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IShopLogic.cs create mode 100644 IceCreamShop/IceCreamShopContracts/SearchModels/ShopSearchModel.cs create mode 100644 IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs create mode 100644 IceCreamShop/IceCreamShopContracts/ViewModels/ShopViewModel.cs create mode 100644 IceCreamShop/IceCreamShopDataModels/IShopModel.cs create mode 100644 IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs create mode 100644 IceCreamShop/IceCreamShopListImplement/Models/Shop.cs diff --git a/IceCreamShop/IceCreamShop/MainForm.Designer.cs b/IceCreamShop/IceCreamShop/MainForm.Designer.cs index 2b62d4f..6627a9c 100644 --- a/IceCreamShop/IceCreamShop/MainForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/MainForm.Designer.cs @@ -32,12 +32,14 @@ ToolStripMenu = new ToolStripMenuItem(); КомпонентыStripMenuItem = new ToolStripMenuItem(); МороженноеStripMenuItem = new ToolStripMenuItem(); + магазиныToolStripMenuItem = new ToolStripMenuItem(); DataGridView = new DataGridView(); CreateOrderButton = new Button(); TakeInWorkButton = new Button(); ReadyButton = new Button(); IssuedButton = new Button(); RefreshButton = new Button(); + поставкиToolStripMenuItem = new ToolStripMenuItem(); menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit(); SuspendLayout(); @@ -48,45 +50,55 @@ menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenu }); menuStrip1.Location = new Point(0, 0); menuStrip1.Name = "menuStrip1"; - menuStrip1.Size = new Size(1296, 28); + menuStrip1.Padding = new Padding(5, 2, 0, 2); + menuStrip1.Size = new Size(1134, 24); menuStrip1.TabIndex = 0; menuStrip1.Text = "menuStrip1"; // // ToolStripMenu // - ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыStripMenuItem, МороженноеStripMenuItem }); + ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыStripMenuItem, МороженноеStripMenuItem, магазиныToolStripMenuItem, поставкиToolStripMenuItem }); ToolStripMenu.Name = "ToolStripMenu"; - ToolStripMenu.Size = new Size(117, 24); + ToolStripMenu.Size = new Size(94, 20); ToolStripMenu.Text = "Справочники"; // // КомпонентыStripMenuItem // КомпонентыStripMenuItem.Name = "КомпонентыStripMenuItem"; - КомпонентыStripMenuItem.Size = new Size(186, 26); + КомпонентыStripMenuItem.Size = new Size(180, 22); КомпонентыStripMenuItem.Text = "Компоненты"; КомпонентыStripMenuItem.Click += КомпонентыStripMenuItem_Click; // // МороженноеStripMenuItem // МороженноеStripMenuItem.Name = "МороженноеStripMenuItem"; - МороженноеStripMenuItem.Size = new Size(186, 26); + МороженноеStripMenuItem.Size = new Size(180, 22); МороженноеStripMenuItem.Text = "Мороженное"; МороженноеStripMenuItem.Click += МороженноеStripMenuItem_Click; // + // магазиныToolStripMenuItem + // + магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem"; + магазиныToolStripMenuItem.Size = new Size(180, 22); + магазиныToolStripMenuItem.Text = "Магазины"; + магазиныToolStripMenuItem.Click += магазиныToolStripMenuItem_Click; + // // DataGridView // DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - DataGridView.Location = new Point(12, 31); + DataGridView.Location = new Point(10, 23); + DataGridView.Margin = new Padding(3, 2, 3, 2); DataGridView.Name = "DataGridView"; DataGridView.RowHeadersWidth = 51; - DataGridView.Size = new Size(1007, 407); + DataGridView.Size = new Size(881, 305); DataGridView.TabIndex = 1; // // CreateOrderButton // - CreateOrderButton.Location = new Point(1025, 31); + CreateOrderButton.Location = new Point(897, 23); + CreateOrderButton.Margin = new Padding(3, 2, 3, 2); CreateOrderButton.Name = "CreateOrderButton"; - CreateOrderButton.Size = new Size(259, 29); + CreateOrderButton.Size = new Size(227, 22); CreateOrderButton.TabIndex = 2; CreateOrderButton.Text = "Создать заказ"; CreateOrderButton.UseVisualStyleBackColor = true; @@ -94,9 +106,10 @@ // // TakeInWorkButton // - TakeInWorkButton.Location = new Point(1025, 66); + TakeInWorkButton.Location = new Point(897, 50); + TakeInWorkButton.Margin = new Padding(3, 2, 3, 2); TakeInWorkButton.Name = "TakeInWorkButton"; - TakeInWorkButton.Size = new Size(259, 29); + TakeInWorkButton.Size = new Size(227, 22); TakeInWorkButton.TabIndex = 3; TakeInWorkButton.Text = "Отдать заказ в работу"; TakeInWorkButton.UseVisualStyleBackColor = true; @@ -104,9 +117,10 @@ // // ReadyButton // - ReadyButton.Location = new Point(1025, 101); + ReadyButton.Location = new Point(897, 76); + ReadyButton.Margin = new Padding(3, 2, 3, 2); ReadyButton.Name = "ReadyButton"; - ReadyButton.Size = new Size(259, 29); + ReadyButton.Size = new Size(227, 22); ReadyButton.TabIndex = 4; ReadyButton.Text = "Заказ готов"; ReadyButton.UseVisualStyleBackColor = true; @@ -114,9 +128,10 @@ // // IssuedButton // - IssuedButton.Location = new Point(1025, 136); + IssuedButton.Location = new Point(897, 102); + IssuedButton.Margin = new Padding(3, 2, 3, 2); IssuedButton.Name = "IssuedButton"; - IssuedButton.Size = new Size(259, 29); + IssuedButton.Size = new Size(227, 22); IssuedButton.TabIndex = 5; IssuedButton.Text = "Заказ выдан"; IssuedButton.UseVisualStyleBackColor = true; @@ -124,19 +139,27 @@ // // RefreshButton // - RefreshButton.Location = new Point(1025, 171); + RefreshButton.Location = new Point(897, 128); + RefreshButton.Margin = new Padding(3, 2, 3, 2); RefreshButton.Name = "RefreshButton"; - RefreshButton.Size = new Size(259, 29); + RefreshButton.Size = new Size(227, 22); RefreshButton.TabIndex = 6; RefreshButton.Text = "Обновить"; RefreshButton.UseVisualStyleBackColor = true; RefreshButton.Click += RefreshButton_Click; // + // поставкиToolStripMenuItem + // + поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem"; + поставкиToolStripMenuItem.Size = new Size(180, 22); + поставкиToolStripMenuItem.Text = "Поставки"; + поставкиToolStripMenuItem.Click += поставкиToolStripMenuItem_Click; + // // MainForm // - AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1296, 450); + ClientSize = new Size(1134, 338); Controls.Add(RefreshButton); Controls.Add(IssuedButton); Controls.Add(ReadyButton); @@ -145,6 +168,7 @@ Controls.Add(DataGridView); Controls.Add(menuStrip1); MainMenuStrip = menuStrip1; + Margin = new Padding(3, 2, 3, 2); Name = "MainForm"; Text = "MainForm"; Load += MainForm_Load; @@ -167,5 +191,7 @@ private Button ReadyButton; private Button IssuedButton; private Button RefreshButton; + private ToolStripMenuItem магазиныToolStripMenuItem; + private ToolStripMenuItem поставкиToolStripMenuItem; } } \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/MainForm.cs b/IceCreamShop/IceCreamShop/MainForm.cs index 600e794..e523217 100644 --- a/IceCreamShop/IceCreamShop/MainForm.cs +++ b/IceCreamShop/IceCreamShop/MainForm.cs @@ -180,5 +180,23 @@ Program.ServiceProvider?.GetService(typeof(OrderForm)); { LoadData(); } + + private void магазиныToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(ShopsForm)); + if (service is ShopsForm form) + { + form.ShowDialog(); + } + } + + private void поставкиToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(SupplyForm)); + if (service is SupplyForm form) + { + form.ShowDialog(); + } + } } } diff --git a/IceCreamShop/IceCreamShop/Program.cs b/IceCreamShop/IceCreamShop/Program.cs index f670921..4a1e77e 100644 --- a/IceCreamShop/IceCreamShop/Program.cs +++ b/IceCreamShop/IceCreamShop/Program.cs @@ -34,6 +34,8 @@ namespace IceCreamShop option.AddNLog("nlog.config"); }); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -46,6 +48,9 @@ namespace IceCreamShop services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } diff --git a/IceCreamShop/IceCreamShop/ShopForm.Designer.cs b/IceCreamShop/IceCreamShop/ShopForm.Designer.cs new file mode 100644 index 0000000..964b16f --- /dev/null +++ b/IceCreamShop/IceCreamShop/ShopForm.Designer.cs @@ -0,0 +1,187 @@ +namespace IceCreamShop +{ + partial class ShopForm + { + /// + /// 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() + { + DateTimePicker = new DateTimePicker(); + NameTextBox = new TextBox(); + AddressTextBox = new TextBox(); + NameLabel = new Label(); + AdressLabel = new Label(); + DateLabel = new Label(); + SaveButton = new Button(); + CancelButton = new Button(); + DataGridView = new DataGridView(); + Column1 = new DataGridViewTextBoxColumn(); + Название = new DataGridViewTextBoxColumn(); + Цена = new DataGridViewTextBoxColumn(); + Количество = new DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit(); + SuspendLayout(); + // + // DateTimePicker + // + DateTimePicker.Location = new Point(85, 70); + DateTimePicker.Name = "DateTimePicker"; + DateTimePicker.Size = new Size(318, 23); + DateTimePicker.TabIndex = 0; + // + // NameTextBox + // + NameTextBox.Location = new Point(85, 12); + NameTextBox.Name = "NameTextBox"; + NameTextBox.Size = new Size(318, 23); + NameTextBox.TabIndex = 1; + // + // AddressTextBox + // + AddressTextBox.Location = new Point(85, 41); + AddressTextBox.Name = "AddressTextBox"; + AddressTextBox.Size = new Size(318, 23); + AddressTextBox.TabIndex = 2; + // + // NameLabel + // + NameLabel.AutoSize = true; + NameLabel.Location = new Point(12, 15); + NameLabel.Name = "NameLabel"; + NameLabel.Size = new Size(59, 15); + NameLabel.TabIndex = 3; + NameLabel.Text = "Название"; + // + // AdressLabel + // + AdressLabel.AutoSize = true; + AdressLabel.Location = new Point(12, 44); + AdressLabel.Name = "AdressLabel"; + AdressLabel.Size = new Size(40, 15); + AdressLabel.TabIndex = 4; + AdressLabel.Text = "Адрес"; + // + // DateLabel + // + DateLabel.AutoSize = true; + DateLabel.Location = new Point(12, 76); + DateLabel.Name = "DateLabel"; + DateLabel.Size = new Size(32, 15); + DateLabel.TabIndex = 5; + DateLabel.Text = "Дата"; + // + // SaveButton + // + SaveButton.Location = new Point(247, 255); + SaveButton.Name = "SaveButton"; + SaveButton.Size = new Size(75, 23); + SaveButton.TabIndex = 6; + SaveButton.Text = "Сохранить"; + SaveButton.UseVisualStyleBackColor = true; + SaveButton.Click += SaveButton_Click; + // + // CancelButton + // + CancelButton.Location = new Point(328, 255); + CancelButton.Name = "CancelButton"; + CancelButton.Size = new Size(75, 23); + CancelButton.TabIndex = 7; + CancelButton.Text = "Отмена"; + CancelButton.UseVisualStyleBackColor = true; + CancelButton.Click += CancelButton_Click; + // + // DataGridView + // + DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + DataGridView.Columns.AddRange(new DataGridViewColumn[] { Column1, Название, Цена, Количество }); + DataGridView.Location = new Point(12, 99); + DataGridView.Name = "DataGridView"; + DataGridView.Size = new Size(391, 150); + DataGridView.TabIndex = 8; + // + // Column1 + // + Column1.HeaderText = "Column1"; + Column1.Name = "Column1"; + Column1.Visible = false; + // + // Название + // + Название.HeaderText = "Название"; + Название.Name = "Название"; + Название.ReadOnly = true; + Название.Width = 150; + // + // Цена + // + Цена.HeaderText = "Цена"; + Цена.Name = "Цена"; + Цена.ReadOnly = true; + // + // Количество + // + Количество.HeaderText = "Количество"; + Количество.Name = "Количество"; + Количество.ReadOnly = true; + // + // ShopForm + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(411, 285); + Controls.Add(DataGridView); + Controls.Add(CancelButton); + Controls.Add(SaveButton); + Controls.Add(DateLabel); + Controls.Add(AdressLabel); + Controls.Add(NameLabel); + Controls.Add(AddressTextBox); + Controls.Add(NameTextBox); + Controls.Add(DateTimePicker); + Name = "ShopForm"; + Text = "ShopForm"; + Load += ShopForm_Load; + ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private DateTimePicker DateTimePicker; + private TextBox NameTextBox; + private TextBox AddressTextBox; + private Label NameLabel; + private Label AdressLabel; + private Label DateLabel; + private Button SaveButton; + private Button CancelButton; + private DataGridView DataGridView; + private DataGridViewTextBoxColumn Column1; + private DataGridViewTextBoxColumn Название; + private DataGridViewTextBoxColumn Цена; + private DataGridViewTextBoxColumn Количество; + } +} \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/ShopForm.cs b/IceCreamShop/IceCreamShop/ShopForm.cs new file mode 100644 index 0000000..7af90da --- /dev/null +++ b/IceCreamShop/IceCreamShop/ShopForm.cs @@ -0,0 +1,124 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.BusinessLogicsContracts; +using IceCreamShopContracts.SearchModels; +using IceCreamShopDataModels.Models; +using Microsoft.Extensions.Logging; +using System; +using System.Collections; +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 IceCreamShop +{ + public partial class ShopForm : Form + { + private readonly ILogger _logger; + private readonly IShopLogic _logic; + public int? _id; + private Dictionary _iceCreams; + public ShopForm(ILogger logger, IShopLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + + private void ShopForm_Load(object sender, EventArgs e) + { + if (_id.HasValue) + { + _logger.LogInformation("Загрузка магазина"); + try + { + var shop = _logic.ReadElement(new ShopSearchModel { Id = _id }); + if (shop != null) + { + NameTextBox.Text = shop.ShopName; + AddressTextBox.Text = shop.Address; + DateTimePicker.Text = shop.DateOpen.ToString(); + _iceCreams = shop.ShopIceCreams; + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки магазина"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } + + private void LoadData() + { + _logger.LogInformation("Загрузка товаров магазина"); + try + { + if (_iceCreams != null) + { + foreach (var iceCream in _iceCreams) + { + DataGridView.Rows.Add(new object[] { iceCream.Key, iceCream.Value.Item1.IceCreamName, iceCream.Value.Item1.Price, iceCream.Value.Item2 }); + } + } + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки изделий магазина"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + + private void CancelButton_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + private void SaveButton_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(NameTextBox.Text)) + { + MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (string.IsNullOrEmpty(AddressTextBox.Text)) + { + MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + _logger.LogInformation("Сохранение магазина"); + try + { + var model = new ShopBindingModel + { + Id = _id ?? 0, + ShopName = NameTextBox.Text, + Address = AddressTextBox.Text, + DateOpen = DateTimePicker.Value.Date, + ShopIceCreams = _iceCreams + }; + 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) + { + _logger.LogError(ex, "Ошибка сохранения магазина"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/IceCreamShop/IceCreamShop/ShopForm.resx b/IceCreamShop/IceCreamShop/ShopForm.resx new file mode 100644 index 0000000..ba02ef3 --- /dev/null +++ b/IceCreamShop/IceCreamShop/ShopForm.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 + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/ShopsForm.Designer.cs b/IceCreamShop/IceCreamShop/ShopsForm.Designer.cs new file mode 100644 index 0000000..ba6dcaf --- /dev/null +++ b/IceCreamShop/IceCreamShop/ShopsForm.Designer.cs @@ -0,0 +1,117 @@ +namespace IceCreamShop +{ + partial class ShopsForm + { + /// + /// 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(); + AddButton = new Button(); + UpdateButton = new Button(); + RefreshButton = new Button(); + DeleteButton = new Button(); + ((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit(); + SuspendLayout(); + // + // DataGridView + // + DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + DataGridView.Location = new Point(12, 12); + DataGridView.Name = "DataGridView"; + DataGridView.Size = new Size(393, 374); + DataGridView.TabIndex = 0; + // + // AddButton + // + AddButton.Location = new Point(411, 12); + AddButton.Name = "AddButton"; + AddButton.Size = new Size(114, 23); + AddButton.TabIndex = 1; + AddButton.Text = "Добавить"; + AddButton.UseVisualStyleBackColor = true; + AddButton.Click += AddButton_Click; + // + // UpdateButton + // + UpdateButton.Location = new Point(411, 41); + UpdateButton.Name = "UpdateButton"; + UpdateButton.Size = new Size(114, 23); + UpdateButton.TabIndex = 2; + UpdateButton.Text = "Изменить"; + UpdateButton.UseVisualStyleBackColor = true; + UpdateButton.Click += UpdateButton_Click; + // + // RefreshButton + // + RefreshButton.Location = new Point(411, 70); + RefreshButton.Name = "RefreshButton"; + RefreshButton.Size = new Size(114, 23); + RefreshButton.TabIndex = 3; + RefreshButton.Text = "Обновить"; + RefreshButton.UseVisualStyleBackColor = true; + RefreshButton.Click += RefreshButton_Click; + // + // DeleteButton + // + DeleteButton.Location = new Point(411, 99); + DeleteButton.Name = "DeleteButton"; + DeleteButton.Size = new Size(114, 23); + DeleteButton.TabIndex = 4; + DeleteButton.Text = "Удалить"; + DeleteButton.UseVisualStyleBackColor = true; + DeleteButton.Click += DeleteButton_Click; + // + // ShopsForm + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(539, 403); + Controls.Add(DeleteButton); + Controls.Add(RefreshButton); + Controls.Add(UpdateButton); + Controls.Add(AddButton); + Controls.Add(DataGridView); + Name = "ShopsForm"; + Text = "ShopsForm"; + Load += ShopsForm_Load; + ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView DataGridView; + private Button AddButton; + private Button UpdateButton; + private Button RefreshButton; + private Button DeleteButton; + private DataGridViewTextBoxColumn Column1; + private DataGridViewTextBoxColumn Column2; + private DataGridViewTextBoxColumn Column3; + private DataGridViewTextBoxColumn Column4; + private DataGridViewTextBoxColumn Column5; + } +} \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/ShopsForm.cs b/IceCreamShop/IceCreamShop/ShopsForm.cs new file mode 100644 index 0000000..19caee5 --- /dev/null +++ b/IceCreamShop/IceCreamShop/ShopsForm.cs @@ -0,0 +1,118 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.BusinessLogicsContracts; +using Microsoft.Extensions.Logging; +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 IceCreamShop +{ + public partial class ShopsForm : Form + { + private readonly ILogger _logger; + private readonly IShopLogic _logic; + public ShopsForm(ILogger logger, IShopLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + + + private void LoadData() + { + try + { + var list = _logic.ReadList(null); + if (list != null) + { + DataGridView.DataSource = list; + DataGridView.Columns["Id"].Visible = false; + DataGridView.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + DataGridView.Columns["Address"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + DataGridView.Columns["DateOpen"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + DataGridView.Columns["ShopIceCreams"].Visible = false; + } + _logger.LogInformation("Загрузка магазинов"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки магазинов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ShopsForm_Load(object sender, EventArgs e) + { + LoadData(); + } + + private void AddButton_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(ShopForm)); + if (service is ShopForm form) + { + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + + private void UpdateButton_Click(object sender, EventArgs e) + { + if (DataGridView.SelectedRows.Count == 1) + { + var service = Program.ServiceProvider?.GetService(typeof(ShopForm)); + if (service is ShopForm form) + { + var tmp = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value); + form._id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value); + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + } + + private void RefreshButton_Click(object sender, EventArgs e) + { + LoadData(); + } + + private void DeleteButton_Click(object sender, EventArgs e) + { + if (DataGridView.SelectedRows.Count == 1) + { + if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Удаление магазина"); + try + { + if (!_logic.Delete(new ShopBindingModel + { + Id = id + })) + { + throw new Exception("Ошибка при удалении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка удаления магазина"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + } + } +} diff --git a/IceCreamShop/IceCreamShop/ShopsForm.resx b/IceCreamShop/IceCreamShop/ShopsForm.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/IceCreamShop/IceCreamShop/ShopsForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/SupplyForm.Designer.cs b/IceCreamShop/IceCreamShop/SupplyForm.Designer.cs new file mode 100644 index 0000000..665a3e0 --- /dev/null +++ b/IceCreamShop/IceCreamShop/SupplyForm.Designer.cs @@ -0,0 +1,105 @@ +namespace IceCreamShop +{ + partial class SupplyForm + { + /// + /// 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() + { + ShopComboBox = new ComboBox(); + IceCreamComboBox = new ComboBox(); + CountTextBox = new TextBox(); + SaveButton = new Button(); + CancelButton = new Button(); + SuspendLayout(); + // + // ShopComboBox + // + ShopComboBox.FormattingEnabled = true; + ShopComboBox.Location = new Point(12, 12); + ShopComboBox.Name = "ShopComboBox"; + ShopComboBox.Size = new Size(331, 23); + ShopComboBox.TabIndex = 0; + // + // IceCreamComboBox + // + IceCreamComboBox.FormattingEnabled = true; + IceCreamComboBox.Location = new Point(12, 41); + IceCreamComboBox.Name = "IceCreamComboBox"; + IceCreamComboBox.Size = new Size(331, 23); + IceCreamComboBox.TabIndex = 1; + // + // CountTextBox + // + CountTextBox.Location = new Point(12, 70); + CountTextBox.Name = "CountTextBox"; + CountTextBox.Size = new Size(331, 23); + CountTextBox.TabIndex = 2; + // + // SaveButton + // + SaveButton.Location = new Point(187, 99); + SaveButton.Name = "SaveButton"; + SaveButton.Size = new Size(75, 23); + SaveButton.TabIndex = 3; + SaveButton.Text = "Сохранить"; + SaveButton.UseVisualStyleBackColor = true; + SaveButton.Click += SaveButton_Click; + // + // CancelButton + // + CancelButton.Location = new Point(268, 99); + CancelButton.Name = "CancelButton"; + CancelButton.Size = new Size(75, 23); + CancelButton.TabIndex = 4; + CancelButton.Text = "Отмена"; + CancelButton.UseVisualStyleBackColor = true; + CancelButton.Click += CancelButton_Click; + // + // SupplyForm + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(355, 136); + Controls.Add(CancelButton); + Controls.Add(SaveButton); + Controls.Add(CountTextBox); + Controls.Add(IceCreamComboBox); + Controls.Add(ShopComboBox); + Name = "SupplyForm"; + Text = "SupplyForm"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox ShopComboBox; + private ComboBox IceCreamComboBox; + private TextBox CountTextBox; + private Button SaveButton; + private Button CancelButton; + } +} \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/SupplyForm.cs b/IceCreamShop/IceCreamShop/SupplyForm.cs new file mode 100644 index 0000000..83c1961 --- /dev/null +++ b/IceCreamShop/IceCreamShop/SupplyForm.cs @@ -0,0 +1,153 @@ +using IceCreamShopBusinessLogic.BusinessLogic; +using IceCreamShopContracts.BusinessLogicsContracts; +using IceCreamShopContracts.SearchModels; +using IceCreamShopContracts.ViewModels; +using IceCreamShopDataModels.Models; +using System; +using System.Collections; +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 IceCreamShop +{ + public partial class SupplyForm : Form + { + private readonly List? _iceCreamList; + private readonly List? _shopsList; + IShopLogic _shopLogic; + IIceCreamLogic _iceCreamLogic; + public int ShopId + { + get + { + return + Convert.ToInt32(ShopComboBox.SelectedValue); + } + set + { + ShopComboBox.SelectedValue = value; + } + } + public int IceCreamId + { + get + { + return + Convert.ToInt32(IceCreamComboBox.SelectedValue); + } + set + { + IceCreamComboBox.SelectedValue = value; + } + } + + public IIceCreamModel? IceCreamModel + { + get + { + if (_iceCreamList == null) + { + return null; + } + foreach (var elem in _iceCreamList) + { + if (elem.Id == IceCreamId) + { + return elem; + } + } + return null; + } + } + + + public int Count + { + get { return Convert.ToInt32(CountTextBox.Text); } + set + { CountTextBox.Text = value.ToString(); } + } + public SupplyForm(IIceCreamLogic iceCreamLogic, IShopLogic shopLogic) + { + InitializeComponent(); + _shopLogic = shopLogic; + _iceCreamLogic = iceCreamLogic; + _iceCreamList = iceCreamLogic.ReadList(null); + _shopsList = shopLogic.ReadList(null); + if (_iceCreamList != null) + { + IceCreamComboBox.DisplayMember = "IceCreamName"; + IceCreamComboBox.ValueMember = "Id"; + IceCreamComboBox.DataSource = _iceCreamList; + IceCreamComboBox.SelectedItem = null; + } + if (_shopsList != null) + { + ShopComboBox.DisplayMember = "ShopName"; + ShopComboBox.ValueMember = "Id"; + ShopComboBox.DataSource = _shopsList; + ShopComboBox.SelectedItem = null; + } + } + + private void SaveButton_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(CountTextBox.Text)) + { + MessageBox.Show("Заполните поле Количество", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (IceCreamComboBox.SelectedValue == null) + { + MessageBox.Show("Выберите мороженное", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (ShopComboBox.SelectedValue == null) + { + MessageBox.Show("Выберите магазин", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + try + { + int count = Convert.ToInt32(CountTextBox.Text); + + bool res = _shopLogic.MakeSupply( + new ShopSearchModel() { Id = Convert.ToInt32(ShopComboBox.SelectedValue) }, + _iceCreamLogic.ReadElement(new() { Id = Convert.ToInt32(IceCreamComboBox.SelectedValue) }), + count + ); + + if (!res) + { + throw new Exception("Ошибка при пополнении. Дополнительная информация в логах"); + } + + MessageBox.Show("Пополнение прошло успешно"); + DialogResult = DialogResult.OK; + Close(); + + } + catch (Exception err) + { + MessageBox.Show("Ошибка пополнения"); + return; + } + } + + private void CancelButton_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + } +} diff --git a/IceCreamShop/IceCreamShop/SupplyForm.resx b/IceCreamShop/IceCreamShop/SupplyForm.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/IceCreamShop/IceCreamShop/SupplyForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs new file mode 100644 index 0000000..fcf4dac --- /dev/null +++ b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs @@ -0,0 +1,137 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.BusinessLogicsContracts; +using IceCreamShopContracts.SearchModels; +using IceCreamShopContracts.StoragesContracts; +using IceCreamShopContracts.ViewModels; +using IceCreamShopDataModels.Models; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopBusinessLogic.BusinessLogic +{ + public class ShopLogic : IShopLogic + { + private readonly ILogger _logger; + private readonly IShopStorage _shopStorage; + + public ShopLogic(ILogger logger, IShopStorage shopStorage) + { + _logger = logger; + _shopStorage = shopStorage; + } + + public List ReadList(ShopSearchModel model) + { + _logger.LogInformation("ReadList. ShopName:{Name}. Id:{ Id}", model?.Name, model?.Id); + var list = model == null ? _shopStorage.GetFullList() : +_shopStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + + } + + public bool MakeSupply(ShopSearchModel model, IIceCreamModel iceCream, int count) + { + if (model == null) + return false; + return _shopStorage.SupplyIceCream(model, iceCream, count); + } + + public ShopViewModel ReadElement(ShopSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. ShopName:{ShopName}.Id:{ Id}", model.Name, model.Id); + var element = _shopStorage.GetElement(model); + if (element == null) + { + _logger.LogWarning("ReadElement element not found"); + return null; + } + _logger.LogInformation("ReadElement find. Id:{Id}", element.Id); + return element; + } + + public bool Create(ShopBindingModel model) + { + CheckModel(model); + if (_shopStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Update(ShopBindingModel model) + { + CheckModel(model); + if (_shopStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + public bool Delete(ShopBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_shopStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + private void CheckModel(ShopBindingModel model, bool withParams = +true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (string.IsNullOrEmpty(model.ShopName)) + { + throw new ArgumentNullException("Нет названия магазина", + nameof(model.ShopName)); + } + if (string.IsNullOrEmpty(model.Address)) + { + throw new ArgumentNullException("Нет адресса магазина", + nameof(model.ShopName)); + } + if(model.DateOpen == null) + { + throw new ArgumentNullException("Нет даты открытия магазина", + nameof(model.ShopName)); + } + _logger.LogInformation("Shop. ShopName:{ShopName}.Address:{Address}. DateOpen:{DateOpen}. Id: { Id}", model.ShopName, model.Address, model.DateOpen, model.Id); + var element = _shopStorage.GetElement(new ShopSearchModel + { + Name = model.ShopName + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Магазин с таким названием уже есть"); + } + } + + } +} diff --git a/IceCreamShop/IceCreamShopContracts/BindingModels/ShopBindingModel.cs b/IceCreamShop/IceCreamShopContracts/BindingModels/ShopBindingModel.cs new file mode 100644 index 0000000..9b202bf --- /dev/null +++ b/IceCreamShop/IceCreamShopContracts/BindingModels/ShopBindingModel.cs @@ -0,0 +1,18 @@ +using IceCreamShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopContracts.BindingModels +{ + public class ShopBindingModel : IShopModel + { + public int Id { get; set; } + public string ShopName { get; set; } + public string Address { get; set; } + public DateTime DateOpen { get; set; } + public Dictionary ShopIceCreams { get; set; } = new(); + } +} diff --git a/IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IShopLogic.cs b/IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IShopLogic.cs new file mode 100644 index 0000000..c9ee0e2 --- /dev/null +++ b/IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IShopLogic.cs @@ -0,0 +1,22 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.SearchModels; +using IceCreamShopContracts.ViewModels; +using IceCreamShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopContracts.BusinessLogicsContracts +{ + public interface IShopLogic + { + List? ReadList(ShopSearchModel? model); + ShopViewModel? ReadElement(ShopSearchModel model); + bool Create(ShopBindingModel model); + bool Update(ShopBindingModel model); + bool Delete(ShopBindingModel model); + bool MakeSupply(ShopSearchModel model, IIceCreamModel iceCream, int count); + } +} diff --git a/IceCreamShop/IceCreamShopContracts/SearchModels/ShopSearchModel.cs b/IceCreamShop/IceCreamShopContracts/SearchModels/ShopSearchModel.cs new file mode 100644 index 0000000..7aa5eb4 --- /dev/null +++ b/IceCreamShop/IceCreamShopContracts/SearchModels/ShopSearchModel.cs @@ -0,0 +1,15 @@ +using IceCreamShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopContracts.SearchModels +{ + public class ShopSearchModel + { + public int? Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs b/IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs new file mode 100644 index 0000000..500cf16 --- /dev/null +++ b/IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs @@ -0,0 +1,23 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.SearchModels; +using IceCreamShopContracts.ViewModels; +using IceCreamShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopContracts.StoragesContracts +{ + public interface IShopStorage + { + List GetFullList(); + List GetFilteredList(ShopSearchModel model); + ShopViewModel? GetElement(ShopSearchModel model); + ShopViewModel? Insert(ShopBindingModel model); + ShopViewModel? Update(ShopBindingModel model); + ShopViewModel? Delete(ShopBindingModel model); + bool SupplyIceCream(ShopSearchModel model, IIceCreamModel iceCream, int Count); + } +} diff --git a/IceCreamShop/IceCreamShopContracts/ViewModels/ShopViewModel.cs b/IceCreamShop/IceCreamShopContracts/ViewModels/ShopViewModel.cs new file mode 100644 index 0000000..0b93fb1 --- /dev/null +++ b/IceCreamShop/IceCreamShopContracts/ViewModels/ShopViewModel.cs @@ -0,0 +1,22 @@ +using IceCreamShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopContracts.ViewModels +{ + public class ShopViewModel : IShopModel + { + public int Id { get; set; } + [DisplayName("Название магазина")] + public string ShopName { get; set; } + [DisplayName("Адрес магазина")] + public string Address { get; set; } + [DisplayName("Дата открытия")] + public DateTime DateOpen { get; set; } + public Dictionary ShopIceCreams { get; set; } = new(); + } +} diff --git a/IceCreamShop/IceCreamShopDataModels/IShopModel.cs b/IceCreamShop/IceCreamShopDataModels/IShopModel.cs new file mode 100644 index 0000000..b852783 --- /dev/null +++ b/IceCreamShop/IceCreamShopDataModels/IShopModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopDataModels.Models +{ + public interface IShopModel : IId + { + string ShopName { get; } + string Address { get; } + DateTime DateOpen { get; } + Dictionary ShopIceCreams { get; } + } +} diff --git a/IceCreamShop/IceCreamShopListImplement/DataListSingleton.cs b/IceCreamShop/IceCreamShopListImplement/DataListSingleton.cs index 56da6b9..c3be853 100644 --- a/IceCreamShop/IceCreamShopListImplement/DataListSingleton.cs +++ b/IceCreamShop/IceCreamShopListImplement/DataListSingleton.cs @@ -13,11 +13,13 @@ namespace IceCreamShopListImplement public List Components { get; set; } public List Orders { get; set; } public List IceCreams { get; set; } + public List Shops { get; set; } private DataListSingleton() { Components = new List(); Orders = new List(); IceCreams = new List(); + Shops = new List(); } public static DataListSingleton GetInstance() { diff --git a/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs b/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs new file mode 100644 index 0000000..b9a24f6 --- /dev/null +++ b/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs @@ -0,0 +1,139 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.SearchModels; +using IceCreamShopContracts.StoragesContracts; +using IceCreamShopContracts.ViewModels; +using IceCreamShopDataModels.Models; +using IceCreamShopListImplement.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopListImplement.Implements +{ + public class ShopStorage : IShopStorage + { + private readonly DataListSingleton _source; + public ShopStorage() + { + _source = DataListSingleton.GetInstance(); + } + public List GetFullList() + { + var result = new List(); + foreach (var shop in _source.Shops) + { + result.Add(shop.GetViewModel); + } + return result; + } + public List GetFilteredList(ShopSearchModel + model) + { + var result = new List(); + if (string.IsNullOrEmpty(model.Name)) + { + return result; + } + foreach (var shop in _source.Shops) + { + if (shop.ShopName.Contains(model.Name)) + { + result.Add(shop.GetViewModel); + } + } + return result; + } + public ShopViewModel? GetElement(ShopSearchModel model) + { + if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue) + { + return null; + } + foreach (var shop in _source.Shops) + { + if ((!string.IsNullOrEmpty(model.Name) && + shop.ShopName == model.Name) || + (model.Id.HasValue && shop.Id == model.Id)) + { + return shop.GetViewModel; + } + } + return null; + } + public ShopViewModel? Insert(ShopBindingModel model) + { + model.Id = 1; + foreach (var shop in _source.Shops) + { + if (model.Id <= shop.Id) + { + model.Id = shop.Id + 1; + } + } + var newShop = Shop.Create(model); + if (newShop == null) + { + return null; + } + _source.Shops.Add(newShop); + return newShop.GetViewModel; + } + public ShopViewModel? Update(ShopBindingModel model) + { + foreach (var shop in _source.Shops) + { + if (shop.Id == model.Id) + { + shop.Update(model); + return shop.GetViewModel; + } + } + return null; + } + public ShopViewModel? Delete(ShopBindingModel model) + { + for (int i = 0; i < _source.Shops.Count; ++i) + { + if (_source.Shops[i].Id == model.Id) + { + var element = _source.Shops[i]; + _source.Shops.RemoveAt(i); + return element.GetViewModel; + } + } + return null; + } + + public bool SupplyIceCream(ShopSearchModel model, IIceCreamModel iceCream, int count) { + if (model == null) + throw new ArgumentNullException(nameof(model)); + if (iceCream == null) + throw new ArgumentNullException(nameof(iceCream)); + if (count <= 0) + throw new ArgumentNullException("Количество должно быть положительным числом"); + + ShopViewModel curModel = GetElement(model); + if(curModel == null) + throw new ArgumentNullException(nameof(curModel)); + if (curModel.ShopIceCreams.TryGetValue(iceCream.Id, out var pair)) + { + curModel.ShopIceCreams[iceCream.Id] = (pair.Item1, pair.Item2 + count); + } + else + { + curModel.ShopIceCreams.Add(iceCream.Id, (iceCream, count)); + } + Update(new() + { + Id = curModel.Id, + ShopName = curModel.ShopName, + DateOpen = curModel.DateOpen, + Address = curModel.Address, + ShopIceCreams = curModel.ShopIceCreams, + }); + return true; + } + } +} diff --git a/IceCreamShop/IceCreamShopListImplement/Models/Shop.cs b/IceCreamShop/IceCreamShopListImplement/Models/Shop.cs new file mode 100644 index 0000000..239004a --- /dev/null +++ b/IceCreamShop/IceCreamShopListImplement/Models/Shop.cs @@ -0,0 +1,56 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.ViewModels; +using IceCreamShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace IceCreamShopListImplement.Models +{ + public class Shop : IShopModel + { + public int Id { get; private set; } + public string ShopName { get; private set; } + public string Address { get; private set; } + public DateTime DateOpen { get; private set; } + public Dictionary ShopIceCreams { get; private set; } = new(); + + public static Shop? Create (ShopBindingModel model) + { + if (model == null) + return null; + return new Shop() + { + Id = model.Id, + ShopName = model.ShopName, + Address = model.Address, + DateOpen = model.DateOpen, + ShopIceCreams = new() + }; + } + + public void Update(ShopBindingModel? model) + { + if (model == null) + { + return; + } + ShopName = model.ShopName; + Address = model.Address; + DateOpen = model.DateOpen; + ShopIceCreams = model.ShopIceCreams; + } + + public ShopViewModel GetViewModel => new() + { + Id = Id, + ShopName = ShopName, + Address = Address, + DateOpen = DateOpen, + ShopIceCreams = ShopIceCreams + }; + } +} -- 2.25.1 From 1ba81fdfeadb6fd6fc7fd5547b5c680f12905637 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Tue, 13 Feb 2024 13:35:33 +0400 Subject: [PATCH 02/23] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BB=20=D1=84=D0=BE=D1=80=D0=BC?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IceCreamShop/ComponentForm.Designer.cs | 35 ++++++++----------- .../IceCreamShop/ComponentsForm.Designer.cs | 2 +- .../IceCreamComponentForm.Designer.cs | 35 ++++++++----------- .../IceCreamShop/IceCreamForm.Designer.cs | 2 +- 4 files changed, 32 insertions(+), 42 deletions(-) diff --git a/IceCreamShop/IceCreamShop/ComponentForm.Designer.cs b/IceCreamShop/IceCreamShop/ComponentForm.Designer.cs index 510512c..52c0a82 100644 --- a/IceCreamShop/IceCreamShop/ComponentForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/ComponentForm.Designer.cs @@ -38,45 +38,42 @@ // // NameTextBox // - NameTextBox.Location = new Point(92, 13); - NameTextBox.Margin = new Padding(3, 4, 3, 4); + NameTextBox.Location = new Point(80, 10); NameTextBox.Name = "NameTextBox"; - NameTextBox.Size = new Size(277, 27); + NameTextBox.Size = new Size(243, 23); NameTextBox.TabIndex = 0; // // CostTextBox // - CostTextBox.Location = new Point(92, 56); - CostTextBox.Margin = new Padding(3, 4, 3, 4); + CostTextBox.Location = new Point(80, 42); CostTextBox.Name = "CostTextBox"; - CostTextBox.Size = new Size(135, 27); + CostTextBox.Size = new Size(119, 23); CostTextBox.TabIndex = 1; // // NameLabel // NameLabel.AutoSize = true; - NameLabel.Location = new Point(8, 27); + NameLabel.Location = new Point(7, 20); NameLabel.Name = "NameLabel"; - NameLabel.Size = new Size(77, 20); + NameLabel.Size = new Size(59, 15); NameLabel.TabIndex = 2; NameLabel.Text = "Название"; // // CostLabel // CostLabel.AutoSize = true; - CostLabel.Location = new Point(8, 65); + CostLabel.Location = new Point(7, 49); CostLabel.Name = "CostLabel"; - CostLabel.Size = new Size(45, 20); + CostLabel.Size = new Size(35, 15); CostLabel.TabIndex = 3; CostLabel.Text = "Цена"; // // CancelButton // CancelButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - CancelButton.Location = new Point(282, 91); - CancelButton.Margin = new Padding(3, 4, 3, 4); + CancelButton.Location = new Point(247, 68); CancelButton.Name = "CancelButton"; - CancelButton.Size = new Size(86, 31); + CancelButton.Size = new Size(75, 23); CancelButton.TabIndex = 4; CancelButton.Text = "Отмена"; CancelButton.UseVisualStyleBackColor = true; @@ -85,10 +82,9 @@ // SaveButton // SaveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - SaveButton.Location = new Point(189, 91); - SaveButton.Margin = new Padding(3, 4, 3, 4); + SaveButton.Location = new Point(165, 68); SaveButton.Name = "SaveButton"; - SaveButton.Size = new Size(86, 31); + SaveButton.Size = new Size(75, 23); SaveButton.TabIndex = 5; SaveButton.Text = "Сохранить"; SaveButton.UseVisualStyleBackColor = true; @@ -96,19 +92,18 @@ // // ComponentForm // - AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; AutoSizeMode = AutoSizeMode.GrowAndShrink; - ClientSize = new Size(381, 129); + ClientSize = new Size(333, 97); Controls.Add(SaveButton); Controls.Add(CancelButton); Controls.Add(CostLabel); Controls.Add(NameLabel); Controls.Add(CostTextBox); Controls.Add(NameTextBox); - Margin = new Padding(3, 4, 3, 4); Name = "ComponentForm"; - Text = "Компонент"; + Text = "ComponentForm"; Load += ComponentForm_Load; ResumeLayout(false); PerformLayout(); diff --git a/IceCreamShop/IceCreamShop/ComponentsForm.Designer.cs b/IceCreamShop/IceCreamShop/ComponentsForm.Designer.cs index 9a2ef3d..f2c8139 100644 --- a/IceCreamShop/IceCreamShop/ComponentsForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/ComponentsForm.Designer.cs @@ -95,7 +95,7 @@ Controls.Add(AddButton); Controls.Add(DataGridView); Name = "ComponentsForm"; - Text = "Компоненты"; + Text = "ComponentsForm"; Load += ComponentsForm_Load; ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); ResumeLayout(false); diff --git a/IceCreamShop/IceCreamShop/IceCreamComponentForm.Designer.cs b/IceCreamShop/IceCreamShop/IceCreamComponentForm.Designer.cs index cfa4ba4..7406dd4 100644 --- a/IceCreamShop/IceCreamShop/IceCreamComponentForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/IceCreamComponentForm.Designer.cs @@ -39,44 +39,41 @@ // ComponentLabel // ComponentLabel.AutoSize = true; - ComponentLabel.Location = new Point(14, 12); + ComponentLabel.Location = new Point(12, 9); ComponentLabel.Name = "ComponentLabel"; - ComponentLabel.Size = new Size(88, 20); + ComponentLabel.Size = new Size(69, 15); ComponentLabel.TabIndex = 0; ComponentLabel.Text = "Компонент"; // // CountLabel // CountLabel.AutoSize = true; - CountLabel.Location = new Point(14, 53); + CountLabel.Location = new Point(12, 40); CountLabel.Name = "CountLabel"; - CountLabel.Size = new Size(90, 20); + CountLabel.Size = new Size(72, 15); CountLabel.TabIndex = 1; CountLabel.Text = "Количество"; // // CountTextBox // - CountTextBox.Location = new Point(99, 49); - CountTextBox.Margin = new Padding(3, 4, 3, 4); + CountTextBox.Location = new Point(87, 37); CountTextBox.Name = "CountTextBox"; - CountTextBox.Size = new Size(333, 27); + CountTextBox.Size = new Size(292, 23); CountTextBox.TabIndex = 2; // // ComboBox // ComboBox.FormattingEnabled = true; - ComboBox.Location = new Point(99, 8); - ComboBox.Margin = new Padding(3, 4, 3, 4); + ComboBox.Location = new Point(87, 6); ComboBox.Name = "ComboBox"; - ComboBox.Size = new Size(333, 28); + ComboBox.Size = new Size(292, 23); ComboBox.TabIndex = 3; // // SaveButton // - SaveButton.Location = new Point(249, 88); - SaveButton.Margin = new Padding(3, 4, 3, 4); + SaveButton.Location = new Point(218, 66); SaveButton.Name = "SaveButton"; - SaveButton.Size = new Size(86, 31); + SaveButton.Size = new Size(75, 23); SaveButton.TabIndex = 4; SaveButton.Text = "Сохранить"; SaveButton.UseVisualStyleBackColor = true; @@ -84,10 +81,9 @@ // // CancelButton // - CancelButton.Location = new Point(342, 88); - CancelButton.Margin = new Padding(3, 4, 3, 4); + CancelButton.Location = new Point(299, 66); CancelButton.Name = "CancelButton"; - CancelButton.Size = new Size(86, 31); + CancelButton.Size = new Size(75, 23); CancelButton.TabIndex = 5; CancelButton.Text = "Отмена"; CancelButton.UseVisualStyleBackColor = true; @@ -95,18 +91,17 @@ // // IceCreamComponentForm // - AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(447, 128); + ClientSize = new Size(391, 96); Controls.Add(CancelButton); Controls.Add(SaveButton); Controls.Add(ComboBox); Controls.Add(CountTextBox); Controls.Add(CountLabel); Controls.Add(ComponentLabel); - Margin = new Padding(3, 4, 3, 4); Name = "IceCreamComponentForm"; - Text = "Компонент мороженного"; + Text = "IceCreamComponentForm"; ResumeLayout(false); PerformLayout(); } diff --git a/IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs b/IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs index 9c2476e..c799428 100644 --- a/IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs @@ -198,7 +198,7 @@ Controls.Add(PriceLabel); Controls.Add(NameLabel); Name = "IceCreamForm"; - Text = "Мороженное"; + Text = "IceCreamForm"; Load += IceCreamForm_Load; ComponentsGroupBox.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); -- 2.25.1 From 2d37575b1e8058b74ae987883ba20c9611a3d3e8 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Tue, 20 Feb 2024 12:36:06 +0400 Subject: [PATCH 03/23] =?UTF-8?q?=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IceCreamShop/ComponentForm.Designer.cs | 35 +++++----- .../IceCreamShop/ComponentsForm.Designer.cs | 33 ++++++---- .../IceCreamComponentForm.Designer.cs | 35 +++++----- .../IceCreamShop/IceCreamForm.Designer.cs | 66 +++++++++++-------- .../IceCreamShop/IceCreamsForm.Designer.cs | 2 +- .../IceCreamShop/MainForm.Designer.cs | 65 ++++++++---------- .../IceCreamShop/ShopForm.Designer.cs | 57 ++++++++++------ .../IceCreamShop/ShopsForm.Designer.cs | 33 ++++++---- .../IceCreamShop/SupplyForm.Designer.cs | 32 +++++---- 9 files changed, 204 insertions(+), 154 deletions(-) diff --git a/IceCreamShop/IceCreamShop/ComponentForm.Designer.cs b/IceCreamShop/IceCreamShop/ComponentForm.Designer.cs index 52c0a82..c3bb312 100644 --- a/IceCreamShop/IceCreamShop/ComponentForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/ComponentForm.Designer.cs @@ -38,42 +38,45 @@ // // NameTextBox // - NameTextBox.Location = new Point(80, 10); + NameTextBox.Location = new Point(91, 13); + NameTextBox.Margin = new Padding(3, 4, 3, 4); NameTextBox.Name = "NameTextBox"; - NameTextBox.Size = new Size(243, 23); + NameTextBox.Size = new Size(277, 27); NameTextBox.TabIndex = 0; // // CostTextBox // - CostTextBox.Location = new Point(80, 42); + CostTextBox.Location = new Point(91, 56); + CostTextBox.Margin = new Padding(3, 4, 3, 4); CostTextBox.Name = "CostTextBox"; - CostTextBox.Size = new Size(119, 23); + CostTextBox.Size = new Size(135, 27); CostTextBox.TabIndex = 1; // // NameLabel // NameLabel.AutoSize = true; - NameLabel.Location = new Point(7, 20); + NameLabel.Location = new Point(8, 27); NameLabel.Name = "NameLabel"; - NameLabel.Size = new Size(59, 15); + NameLabel.Size = new Size(77, 20); NameLabel.TabIndex = 2; NameLabel.Text = "Название"; // // CostLabel // CostLabel.AutoSize = true; - CostLabel.Location = new Point(7, 49); + CostLabel.Location = new Point(8, 65); CostLabel.Name = "CostLabel"; - CostLabel.Size = new Size(35, 15); + CostLabel.Size = new Size(45, 20); CostLabel.TabIndex = 3; CostLabel.Text = "Цена"; // // CancelButton // CancelButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - CancelButton.Location = new Point(247, 68); + CancelButton.Location = new Point(282, 91); + CancelButton.Margin = new Padding(3, 4, 3, 4); CancelButton.Name = "CancelButton"; - CancelButton.Size = new Size(75, 23); + CancelButton.Size = new Size(86, 31); CancelButton.TabIndex = 4; CancelButton.Text = "Отмена"; CancelButton.UseVisualStyleBackColor = true; @@ -82,9 +85,10 @@ // SaveButton // SaveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - SaveButton.Location = new Point(165, 68); + SaveButton.Location = new Point(189, 91); + SaveButton.Margin = new Padding(3, 4, 3, 4); SaveButton.Name = "SaveButton"; - SaveButton.Size = new Size(75, 23); + SaveButton.Size = new Size(86, 31); SaveButton.TabIndex = 5; SaveButton.Text = "Сохранить"; SaveButton.UseVisualStyleBackColor = true; @@ -92,18 +96,19 @@ // // ComponentForm // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; AutoSizeMode = AutoSizeMode.GrowAndShrink; - ClientSize = new Size(333, 97); + ClientSize = new Size(381, 129); Controls.Add(SaveButton); Controls.Add(CancelButton); Controls.Add(CostLabel); Controls.Add(NameLabel); Controls.Add(CostTextBox); Controls.Add(NameTextBox); + Margin = new Padding(3, 4, 3, 4); Name = "ComponentForm"; - Text = "ComponentForm"; + Text = "Форма компонент"; Load += ComponentForm_Load; ResumeLayout(false); PerformLayout(); diff --git a/IceCreamShop/IceCreamShop/ComponentsForm.Designer.cs b/IceCreamShop/IceCreamShop/ComponentsForm.Designer.cs index f2c8139..f030d2f 100644 --- a/IceCreamShop/IceCreamShop/ComponentsForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/ComponentsForm.Designer.cs @@ -39,16 +39,19 @@ // DataGridView // DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - DataGridView.Location = new Point(12, 12); + DataGridView.Location = new Point(14, 16); + DataGridView.Margin = new Padding(3, 4, 3, 4); DataGridView.Name = "DataGridView"; - DataGridView.Size = new Size(369, 350); + DataGridView.RowHeadersWidth = 51; + DataGridView.Size = new Size(422, 467); DataGridView.TabIndex = 0; // // AddButton // - AddButton.Location = new Point(387, 12); + AddButton.Location = new Point(442, 16); + AddButton.Margin = new Padding(3, 4, 3, 4); AddButton.Name = "AddButton"; - AddButton.Size = new Size(126, 23); + AddButton.Size = new Size(144, 31); AddButton.TabIndex = 1; AddButton.Text = "Добавить"; AddButton.UseVisualStyleBackColor = true; @@ -56,9 +59,10 @@ // // ChangeButton // - ChangeButton.Location = new Point(387, 41); + ChangeButton.Location = new Point(442, 55); + ChangeButton.Margin = new Padding(3, 4, 3, 4); ChangeButton.Name = "ChangeButton"; - ChangeButton.Size = new Size(126, 23); + ChangeButton.Size = new Size(144, 31); ChangeButton.TabIndex = 2; ChangeButton.Text = "Изменить"; ChangeButton.UseVisualStyleBackColor = true; @@ -66,9 +70,10 @@ // // DeleteButton // - DeleteButton.Location = new Point(387, 70); + DeleteButton.Location = new Point(442, 93); + DeleteButton.Margin = new Padding(3, 4, 3, 4); DeleteButton.Name = "DeleteButton"; - DeleteButton.Size = new Size(126, 23); + DeleteButton.Size = new Size(144, 31); DeleteButton.TabIndex = 3; DeleteButton.Text = "Удалить"; DeleteButton.UseVisualStyleBackColor = true; @@ -76,9 +81,10 @@ // // RefreshButton // - RefreshButton.Location = new Point(387, 99); + RefreshButton.Location = new Point(442, 132); + RefreshButton.Margin = new Padding(3, 4, 3, 4); RefreshButton.Name = "RefreshButton"; - RefreshButton.Size = new Size(126, 23); + RefreshButton.Size = new Size(144, 31); RefreshButton.TabIndex = 4; RefreshButton.Text = "Обновить"; RefreshButton.UseVisualStyleBackColor = true; @@ -86,16 +92,17 @@ // // ComponentsForm // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(525, 374); + ClientSize = new Size(600, 499); Controls.Add(RefreshButton); Controls.Add(DeleteButton); Controls.Add(ChangeButton); Controls.Add(AddButton); Controls.Add(DataGridView); + Margin = new Padding(3, 4, 3, 4); Name = "ComponentsForm"; - Text = "ComponentsForm"; + Text = "Форма компонентов"; Load += ComponentsForm_Load; ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); ResumeLayout(false); diff --git a/IceCreamShop/IceCreamShop/IceCreamComponentForm.Designer.cs b/IceCreamShop/IceCreamShop/IceCreamComponentForm.Designer.cs index 7406dd4..616115a 100644 --- a/IceCreamShop/IceCreamShop/IceCreamComponentForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/IceCreamComponentForm.Designer.cs @@ -39,41 +39,44 @@ // ComponentLabel // ComponentLabel.AutoSize = true; - ComponentLabel.Location = new Point(12, 9); + ComponentLabel.Location = new Point(14, 12); ComponentLabel.Name = "ComponentLabel"; - ComponentLabel.Size = new Size(69, 15); + ComponentLabel.Size = new Size(88, 20); ComponentLabel.TabIndex = 0; ComponentLabel.Text = "Компонент"; // // CountLabel // CountLabel.AutoSize = true; - CountLabel.Location = new Point(12, 40); + CountLabel.Location = new Point(14, 53); CountLabel.Name = "CountLabel"; - CountLabel.Size = new Size(72, 15); + CountLabel.Size = new Size(90, 20); CountLabel.TabIndex = 1; CountLabel.Text = "Количество"; // // CountTextBox // - CountTextBox.Location = new Point(87, 37); + CountTextBox.Location = new Point(99, 49); + CountTextBox.Margin = new Padding(3, 4, 3, 4); CountTextBox.Name = "CountTextBox"; - CountTextBox.Size = new Size(292, 23); + CountTextBox.Size = new Size(333, 27); CountTextBox.TabIndex = 2; // // ComboBox // ComboBox.FormattingEnabled = true; - ComboBox.Location = new Point(87, 6); + ComboBox.Location = new Point(99, 8); + ComboBox.Margin = new Padding(3, 4, 3, 4); ComboBox.Name = "ComboBox"; - ComboBox.Size = new Size(292, 23); + ComboBox.Size = new Size(333, 28); ComboBox.TabIndex = 3; // // SaveButton // - SaveButton.Location = new Point(218, 66); + SaveButton.Location = new Point(249, 88); + SaveButton.Margin = new Padding(3, 4, 3, 4); SaveButton.Name = "SaveButton"; - SaveButton.Size = new Size(75, 23); + SaveButton.Size = new Size(86, 31); SaveButton.TabIndex = 4; SaveButton.Text = "Сохранить"; SaveButton.UseVisualStyleBackColor = true; @@ -81,9 +84,10 @@ // // CancelButton // - CancelButton.Location = new Point(299, 66); + CancelButton.Location = new Point(342, 88); + CancelButton.Margin = new Padding(3, 4, 3, 4); CancelButton.Name = "CancelButton"; - CancelButton.Size = new Size(75, 23); + CancelButton.Size = new Size(86, 31); CancelButton.TabIndex = 5; CancelButton.Text = "Отмена"; CancelButton.UseVisualStyleBackColor = true; @@ -91,17 +95,18 @@ // // IceCreamComponentForm // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(391, 96); + ClientSize = new Size(447, 128); Controls.Add(CancelButton); Controls.Add(SaveButton); Controls.Add(ComboBox); Controls.Add(CountTextBox); Controls.Add(CountLabel); Controls.Add(ComponentLabel); + Margin = new Padding(3, 4, 3, 4); Name = "IceCreamComponentForm"; - Text = "IceCreamComponentForm"; + Text = "Форма компонент мороженного"; ResumeLayout(false); PerformLayout(); } diff --git a/IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs b/IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs index c799428..4f50382 100644 --- a/IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/IceCreamForm.Designer.cs @@ -50,34 +50,36 @@ // NameLabel // NameLabel.AutoSize = true; - NameLabel.Location = new Point(12, 9); + NameLabel.Location = new Point(14, 12); NameLabel.Name = "NameLabel"; - NameLabel.Size = new Size(59, 15); + NameLabel.Size = new Size(77, 20); NameLabel.TabIndex = 0; NameLabel.Text = "Название"; // // PriceLabel // PriceLabel.AutoSize = true; - PriceLabel.Location = new Point(12, 35); + PriceLabel.Location = new Point(14, 47); PriceLabel.Name = "PriceLabel"; - PriceLabel.Size = new Size(35, 15); + PriceLabel.Size = new Size(45, 20); PriceLabel.TabIndex = 1; PriceLabel.Text = "Цена"; // // NameTextBox // - NameTextBox.Location = new Point(77, 6); + NameTextBox.Location = new Point(88, 8); + NameTextBox.Margin = new Padding(3, 4, 3, 4); NameTextBox.Name = "NameTextBox"; - NameTextBox.Size = new Size(237, 23); + NameTextBox.Size = new Size(270, 27); NameTextBox.TabIndex = 2; // // PriceTextBox // - PriceTextBox.Location = new Point(77, 32); + PriceTextBox.Location = new Point(88, 43); + PriceTextBox.Margin = new Padding(3, 4, 3, 4); PriceTextBox.Name = "PriceTextBox"; PriceTextBox.ReadOnly = true; - PriceTextBox.Size = new Size(100, 23); + PriceTextBox.Size = new Size(114, 27); PriceTextBox.TabIndex = 3; // // ComponentsGroupBox @@ -87,18 +89,21 @@ ComponentsGroupBox.Controls.Add(UpdateButton); ComponentsGroupBox.Controls.Add(AddButton); ComponentsGroupBox.Controls.Add(DataGridView); - ComponentsGroupBox.Location = new Point(12, 64); + ComponentsGroupBox.Location = new Point(14, 85); + ComponentsGroupBox.Margin = new Padding(3, 4, 3, 4); ComponentsGroupBox.Name = "ComponentsGroupBox"; - ComponentsGroupBox.Size = new Size(582, 287); + ComponentsGroupBox.Padding = new Padding(3, 4, 3, 4); + ComponentsGroupBox.Size = new Size(665, 383); ComponentsGroupBox.TabIndex = 4; ComponentsGroupBox.TabStop = false; ComponentsGroupBox.Text = "Компоненты"; // // RefreshButton // - RefreshButton.Location = new Point(481, 109); + RefreshButton.Location = new Point(550, 145); + RefreshButton.Margin = new Padding(3, 4, 3, 4); RefreshButton.Name = "RefreshButton"; - RefreshButton.Size = new Size(75, 23); + RefreshButton.Size = new Size(86, 31); RefreshButton.TabIndex = 4; RefreshButton.Text = "Обновить"; RefreshButton.UseVisualStyleBackColor = true; @@ -106,9 +111,10 @@ // // DeleteButton // - DeleteButton.Location = new Point(481, 80); + DeleteButton.Location = new Point(550, 107); + DeleteButton.Margin = new Padding(3, 4, 3, 4); DeleteButton.Name = "DeleteButton"; - DeleteButton.Size = new Size(75, 23); + DeleteButton.Size = new Size(86, 31); DeleteButton.TabIndex = 3; DeleteButton.Text = "Удалить"; DeleteButton.UseVisualStyleBackColor = true; @@ -116,9 +122,10 @@ // // UpdateButton // - UpdateButton.Location = new Point(481, 51); + UpdateButton.Location = new Point(550, 68); + UpdateButton.Margin = new Padding(3, 4, 3, 4); UpdateButton.Name = "UpdateButton"; - UpdateButton.Size = new Size(75, 23); + UpdateButton.Size = new Size(86, 31); UpdateButton.TabIndex = 2; UpdateButton.Text = "Изменить"; UpdateButton.UseVisualStyleBackColor = true; @@ -126,9 +133,10 @@ // // AddButton // - AddButton.Location = new Point(481, 22); + AddButton.Location = new Point(550, 29); + AddButton.Margin = new Padding(3, 4, 3, 4); AddButton.Name = "AddButton"; - AddButton.Size = new Size(75, 23); + AddButton.Size = new Size(86, 31); AddButton.TabIndex = 1; AddButton.Text = "Добавить"; AddButton.UseVisualStyleBackColor = true; @@ -138,10 +146,11 @@ // DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; DataGridView.Columns.AddRange(new DataGridViewColumn[] { IdColumn, ComponentNameColumn, CountColumn }); - DataGridView.Location = new Point(6, 22); + DataGridView.Location = new Point(7, 29); + DataGridView.Margin = new Padding(3, 4, 3, 4); DataGridView.Name = "DataGridView"; DataGridView.RowHeadersWidth = 51; - DataGridView.Size = new Size(442, 259); + DataGridView.Size = new Size(505, 345); DataGridView.TabIndex = 0; // // IdColumn @@ -168,9 +177,10 @@ // // SaveButton // - SaveButton.Location = new Point(424, 363); + SaveButton.Location = new Point(485, 484); + SaveButton.Margin = new Padding(3, 4, 3, 4); SaveButton.Name = "SaveButton"; - SaveButton.Size = new Size(75, 23); + SaveButton.Size = new Size(86, 31); SaveButton.TabIndex = 5; SaveButton.Text = "Сохранить"; SaveButton.UseVisualStyleBackColor = true; @@ -178,18 +188,19 @@ // // CancelButton // - CancelButton.Location = new Point(505, 363); + CancelButton.Location = new Point(577, 484); + CancelButton.Margin = new Padding(3, 4, 3, 4); CancelButton.Name = "CancelButton"; - CancelButton.Size = new Size(75, 23); + CancelButton.Size = new Size(86, 31); CancelButton.TabIndex = 6; CancelButton.Text = "Отмена"; CancelButton.UseVisualStyleBackColor = true; // // IceCreamForm // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(606, 398); + ClientSize = new Size(693, 531); Controls.Add(CancelButton); Controls.Add(SaveButton); Controls.Add(ComponentsGroupBox); @@ -197,8 +208,9 @@ Controls.Add(NameTextBox); Controls.Add(PriceLabel); Controls.Add(NameLabel); + Margin = new Padding(3, 4, 3, 4); Name = "IceCreamForm"; - Text = "IceCreamForm"; + Text = "Форма мороженного"; Load += IceCreamForm_Load; ComponentsGroupBox.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); diff --git a/IceCreamShop/IceCreamShop/IceCreamsForm.Designer.cs b/IceCreamShop/IceCreamShop/IceCreamsForm.Designer.cs index 4bb5d0d..d61e558 100644 --- a/IceCreamShop/IceCreamShop/IceCreamsForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/IceCreamsForm.Designer.cs @@ -96,7 +96,7 @@ Controls.Add(AddButton); Controls.Add(DataGridView); Name = "IceCreamsForm"; - Text = "IceCreamsForm"; + Text = "Форма мороженных"; Load += IceCreamsForm_Load; ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); ResumeLayout(false); diff --git a/IceCreamShop/IceCreamShop/MainForm.Designer.cs b/IceCreamShop/IceCreamShop/MainForm.Designer.cs index 6627a9c..c419e35 100644 --- a/IceCreamShop/IceCreamShop/MainForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/MainForm.Designer.cs @@ -33,13 +33,13 @@ КомпонентыStripMenuItem = new ToolStripMenuItem(); МороженноеStripMenuItem = new ToolStripMenuItem(); магазиныToolStripMenuItem = new ToolStripMenuItem(); + поставкиToolStripMenuItem = new ToolStripMenuItem(); DataGridView = new DataGridView(); CreateOrderButton = new Button(); TakeInWorkButton = new Button(); ReadyButton = new Button(); IssuedButton = new Button(); RefreshButton = new Button(); - поставкиToolStripMenuItem = new ToolStripMenuItem(); menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit(); SuspendLayout(); @@ -50,8 +50,8 @@ menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenu }); menuStrip1.Location = new Point(0, 0); menuStrip1.Name = "menuStrip1"; - menuStrip1.Padding = new Padding(5, 2, 0, 2); - menuStrip1.Size = new Size(1134, 24); + menuStrip1.Padding = new Padding(6, 3, 0, 3); + menuStrip1.Size = new Size(1296, 30); menuStrip1.TabIndex = 0; menuStrip1.Text = "menuStrip1"; // @@ -59,46 +59,51 @@ // ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыStripMenuItem, МороженноеStripMenuItem, магазиныToolStripMenuItem, поставкиToolStripMenuItem }); ToolStripMenu.Name = "ToolStripMenu"; - ToolStripMenu.Size = new Size(94, 20); + ToolStripMenu.Size = new Size(117, 24); ToolStripMenu.Text = "Справочники"; // // КомпонентыStripMenuItem // КомпонентыStripMenuItem.Name = "КомпонентыStripMenuItem"; - КомпонентыStripMenuItem.Size = new Size(180, 22); + КомпонентыStripMenuItem.Size = new Size(186, 26); КомпонентыStripMenuItem.Text = "Компоненты"; КомпонентыStripMenuItem.Click += КомпонентыStripMenuItem_Click; // // МороженноеStripMenuItem // МороженноеStripMenuItem.Name = "МороженноеStripMenuItem"; - МороженноеStripMenuItem.Size = new Size(180, 22); + МороженноеStripMenuItem.Size = new Size(186, 26); МороженноеStripMenuItem.Text = "Мороженное"; МороженноеStripMenuItem.Click += МороженноеStripMenuItem_Click; // // магазиныToolStripMenuItem // магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem"; - магазиныToolStripMenuItem.Size = new Size(180, 22); + магазиныToolStripMenuItem.Size = new Size(186, 26); магазиныToolStripMenuItem.Text = "Магазины"; магазиныToolStripMenuItem.Click += магазиныToolStripMenuItem_Click; // + // поставкиToolStripMenuItem + // + поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem"; + поставкиToolStripMenuItem.Size = new Size(186, 26); + поставкиToolStripMenuItem.Text = "Поставки"; + поставкиToolStripMenuItem.Click += поставкиToolStripMenuItem_Click; + // // DataGridView // DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - DataGridView.Location = new Point(10, 23); - DataGridView.Margin = new Padding(3, 2, 3, 2); + DataGridView.Location = new Point(11, 31); DataGridView.Name = "DataGridView"; DataGridView.RowHeadersWidth = 51; - DataGridView.Size = new Size(881, 305); + DataGridView.Size = new Size(1007, 407); DataGridView.TabIndex = 1; // // CreateOrderButton // - CreateOrderButton.Location = new Point(897, 23); - CreateOrderButton.Margin = new Padding(3, 2, 3, 2); + CreateOrderButton.Location = new Point(1025, 31); CreateOrderButton.Name = "CreateOrderButton"; - CreateOrderButton.Size = new Size(227, 22); + CreateOrderButton.Size = new Size(259, 29); CreateOrderButton.TabIndex = 2; CreateOrderButton.Text = "Создать заказ"; CreateOrderButton.UseVisualStyleBackColor = true; @@ -106,10 +111,9 @@ // // TakeInWorkButton // - TakeInWorkButton.Location = new Point(897, 50); - TakeInWorkButton.Margin = new Padding(3, 2, 3, 2); + TakeInWorkButton.Location = new Point(1025, 67); TakeInWorkButton.Name = "TakeInWorkButton"; - TakeInWorkButton.Size = new Size(227, 22); + TakeInWorkButton.Size = new Size(259, 29); TakeInWorkButton.TabIndex = 3; TakeInWorkButton.Text = "Отдать заказ в работу"; TakeInWorkButton.UseVisualStyleBackColor = true; @@ -117,10 +121,9 @@ // // ReadyButton // - ReadyButton.Location = new Point(897, 76); - ReadyButton.Margin = new Padding(3, 2, 3, 2); + ReadyButton.Location = new Point(1025, 101); ReadyButton.Name = "ReadyButton"; - ReadyButton.Size = new Size(227, 22); + ReadyButton.Size = new Size(259, 29); ReadyButton.TabIndex = 4; ReadyButton.Text = "Заказ готов"; ReadyButton.UseVisualStyleBackColor = true; @@ -128,10 +131,9 @@ // // IssuedButton // - IssuedButton.Location = new Point(897, 102); - IssuedButton.Margin = new Padding(3, 2, 3, 2); + IssuedButton.Location = new Point(1025, 136); IssuedButton.Name = "IssuedButton"; - IssuedButton.Size = new Size(227, 22); + IssuedButton.Size = new Size(259, 29); IssuedButton.TabIndex = 5; IssuedButton.Text = "Заказ выдан"; IssuedButton.UseVisualStyleBackColor = true; @@ -139,27 +141,19 @@ // // RefreshButton // - RefreshButton.Location = new Point(897, 128); - RefreshButton.Margin = new Padding(3, 2, 3, 2); + RefreshButton.Location = new Point(1025, 171); RefreshButton.Name = "RefreshButton"; - RefreshButton.Size = new Size(227, 22); + RefreshButton.Size = new Size(259, 29); RefreshButton.TabIndex = 6; RefreshButton.Text = "Обновить"; RefreshButton.UseVisualStyleBackColor = true; RefreshButton.Click += RefreshButton_Click; // - // поставкиToolStripMenuItem - // - поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem"; - поставкиToolStripMenuItem.Size = new Size(180, 22); - поставкиToolStripMenuItem.Text = "Поставки"; - поставкиToolStripMenuItem.Click += поставкиToolStripMenuItem_Click; - // // MainForm // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1134, 338); + ClientSize = new Size(1296, 451); Controls.Add(RefreshButton); Controls.Add(IssuedButton); Controls.Add(ReadyButton); @@ -168,9 +162,8 @@ Controls.Add(DataGridView); Controls.Add(menuStrip1); MainMenuStrip = menuStrip1; - Margin = new Padding(3, 2, 3, 2); Name = "MainForm"; - Text = "MainForm"; + Text = "Форма главная"; Load += MainForm_Load; menuStrip1.ResumeLayout(false); menuStrip1.PerformLayout(); diff --git a/IceCreamShop/IceCreamShop/ShopForm.Designer.cs b/IceCreamShop/IceCreamShop/ShopForm.Designer.cs index 964b16f..e2dec45 100644 --- a/IceCreamShop/IceCreamShop/ShopForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/ShopForm.Designer.cs @@ -46,57 +46,61 @@ // // DateTimePicker // - DateTimePicker.Location = new Point(85, 70); + DateTimePicker.Location = new Point(97, 93); + DateTimePicker.Margin = new Padding(3, 4, 3, 4); DateTimePicker.Name = "DateTimePicker"; - DateTimePicker.Size = new Size(318, 23); + DateTimePicker.Size = new Size(363, 27); DateTimePicker.TabIndex = 0; // // NameTextBox // - NameTextBox.Location = new Point(85, 12); + NameTextBox.Location = new Point(97, 16); + NameTextBox.Margin = new Padding(3, 4, 3, 4); NameTextBox.Name = "NameTextBox"; - NameTextBox.Size = new Size(318, 23); + NameTextBox.Size = new Size(363, 27); NameTextBox.TabIndex = 1; // // AddressTextBox // - AddressTextBox.Location = new Point(85, 41); + AddressTextBox.Location = new Point(97, 55); + AddressTextBox.Margin = new Padding(3, 4, 3, 4); AddressTextBox.Name = "AddressTextBox"; - AddressTextBox.Size = new Size(318, 23); + AddressTextBox.Size = new Size(363, 27); AddressTextBox.TabIndex = 2; // // NameLabel // NameLabel.AutoSize = true; - NameLabel.Location = new Point(12, 15); + NameLabel.Location = new Point(14, 20); NameLabel.Name = "NameLabel"; - NameLabel.Size = new Size(59, 15); + NameLabel.Size = new Size(77, 20); NameLabel.TabIndex = 3; NameLabel.Text = "Название"; // // AdressLabel // AdressLabel.AutoSize = true; - AdressLabel.Location = new Point(12, 44); + AdressLabel.Location = new Point(14, 59); AdressLabel.Name = "AdressLabel"; - AdressLabel.Size = new Size(40, 15); + AdressLabel.Size = new Size(51, 20); AdressLabel.TabIndex = 4; AdressLabel.Text = "Адрес"; // // DateLabel // DateLabel.AutoSize = true; - DateLabel.Location = new Point(12, 76); + DateLabel.Location = new Point(14, 101); DateLabel.Name = "DateLabel"; - DateLabel.Size = new Size(32, 15); + DateLabel.Size = new Size(41, 20); DateLabel.TabIndex = 5; DateLabel.Text = "Дата"; // // SaveButton // - SaveButton.Location = new Point(247, 255); + SaveButton.Location = new Point(282, 340); + SaveButton.Margin = new Padding(3, 4, 3, 4); SaveButton.Name = "SaveButton"; - SaveButton.Size = new Size(75, 23); + SaveButton.Size = new Size(86, 31); SaveButton.TabIndex = 6; SaveButton.Text = "Сохранить"; SaveButton.UseVisualStyleBackColor = true; @@ -104,9 +108,10 @@ // // CancelButton // - CancelButton.Location = new Point(328, 255); + CancelButton.Location = new Point(375, 340); + CancelButton.Margin = new Padding(3, 4, 3, 4); CancelButton.Name = "CancelButton"; - CancelButton.Size = new Size(75, 23); + CancelButton.Size = new Size(86, 31); CancelButton.TabIndex = 7; CancelButton.Text = "Отмена"; CancelButton.UseVisualStyleBackColor = true; @@ -116,20 +121,25 @@ // DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; DataGridView.Columns.AddRange(new DataGridViewColumn[] { Column1, Название, Цена, Количество }); - DataGridView.Location = new Point(12, 99); + DataGridView.Location = new Point(14, 132); + DataGridView.Margin = new Padding(3, 4, 3, 4); DataGridView.Name = "DataGridView"; - DataGridView.Size = new Size(391, 150); + DataGridView.RowHeadersWidth = 51; + DataGridView.Size = new Size(447, 200); DataGridView.TabIndex = 8; // // Column1 // Column1.HeaderText = "Column1"; + Column1.MinimumWidth = 6; Column1.Name = "Column1"; Column1.Visible = false; + Column1.Width = 125; // // Название // Название.HeaderText = "Название"; + Название.MinimumWidth = 6; Название.Name = "Название"; Название.ReadOnly = true; Название.Width = 150; @@ -137,20 +147,24 @@ // Цена // Цена.HeaderText = "Цена"; + Цена.MinimumWidth = 6; Цена.Name = "Цена"; Цена.ReadOnly = true; + Цена.Width = 125; // // Количество // Количество.HeaderText = "Количество"; + Количество.MinimumWidth = 6; Количество.Name = "Количество"; Количество.ReadOnly = true; + Количество.Width = 125; // // ShopForm // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(411, 285); + ClientSize = new Size(470, 380); Controls.Add(DataGridView); Controls.Add(CancelButton); Controls.Add(SaveButton); @@ -160,8 +174,9 @@ Controls.Add(AddressTextBox); Controls.Add(NameTextBox); Controls.Add(DateTimePicker); + Margin = new Padding(3, 4, 3, 4); Name = "ShopForm"; - Text = "ShopForm"; + Text = "Форма магазина"; Load += ShopForm_Load; ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); ResumeLayout(false); diff --git a/IceCreamShop/IceCreamShop/ShopsForm.Designer.cs b/IceCreamShop/IceCreamShop/ShopsForm.Designer.cs index ba6dcaf..3d7f9e1 100644 --- a/IceCreamShop/IceCreamShop/ShopsForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/ShopsForm.Designer.cs @@ -39,16 +39,19 @@ // DataGridView // DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - DataGridView.Location = new Point(12, 12); + DataGridView.Location = new Point(14, 16); + DataGridView.Margin = new Padding(3, 4, 3, 4); DataGridView.Name = "DataGridView"; - DataGridView.Size = new Size(393, 374); + DataGridView.RowHeadersWidth = 51; + DataGridView.Size = new Size(449, 499); DataGridView.TabIndex = 0; // // AddButton // - AddButton.Location = new Point(411, 12); + AddButton.Location = new Point(470, 16); + AddButton.Margin = new Padding(3, 4, 3, 4); AddButton.Name = "AddButton"; - AddButton.Size = new Size(114, 23); + AddButton.Size = new Size(130, 31); AddButton.TabIndex = 1; AddButton.Text = "Добавить"; AddButton.UseVisualStyleBackColor = true; @@ -56,9 +59,10 @@ // // UpdateButton // - UpdateButton.Location = new Point(411, 41); + UpdateButton.Location = new Point(470, 55); + UpdateButton.Margin = new Padding(3, 4, 3, 4); UpdateButton.Name = "UpdateButton"; - UpdateButton.Size = new Size(114, 23); + UpdateButton.Size = new Size(130, 31); UpdateButton.TabIndex = 2; UpdateButton.Text = "Изменить"; UpdateButton.UseVisualStyleBackColor = true; @@ -66,9 +70,10 @@ // // RefreshButton // - RefreshButton.Location = new Point(411, 70); + RefreshButton.Location = new Point(470, 93); + RefreshButton.Margin = new Padding(3, 4, 3, 4); RefreshButton.Name = "RefreshButton"; - RefreshButton.Size = new Size(114, 23); + RefreshButton.Size = new Size(130, 31); RefreshButton.TabIndex = 3; RefreshButton.Text = "Обновить"; RefreshButton.UseVisualStyleBackColor = true; @@ -76,9 +81,10 @@ // // DeleteButton // - DeleteButton.Location = new Point(411, 99); + DeleteButton.Location = new Point(470, 132); + DeleteButton.Margin = new Padding(3, 4, 3, 4); DeleteButton.Name = "DeleteButton"; - DeleteButton.Size = new Size(114, 23); + DeleteButton.Size = new Size(130, 31); DeleteButton.TabIndex = 4; DeleteButton.Text = "Удалить"; DeleteButton.UseVisualStyleBackColor = true; @@ -86,16 +92,17 @@ // // ShopsForm // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(539, 403); + ClientSize = new Size(616, 537); Controls.Add(DeleteButton); Controls.Add(RefreshButton); Controls.Add(UpdateButton); Controls.Add(AddButton); Controls.Add(DataGridView); + Margin = new Padding(3, 4, 3, 4); Name = "ShopsForm"; - Text = "ShopsForm"; + Text = "Форма магазинов"; Load += ShopsForm_Load; ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); ResumeLayout(false); diff --git a/IceCreamShop/IceCreamShop/SupplyForm.Designer.cs b/IceCreamShop/IceCreamShop/SupplyForm.Designer.cs index 665a3e0..2c16b86 100644 --- a/IceCreamShop/IceCreamShop/SupplyForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/SupplyForm.Designer.cs @@ -38,31 +38,35 @@ // ShopComboBox // ShopComboBox.FormattingEnabled = true; - ShopComboBox.Location = new Point(12, 12); + ShopComboBox.Location = new Point(14, 16); + ShopComboBox.Margin = new Padding(3, 4, 3, 4); ShopComboBox.Name = "ShopComboBox"; - ShopComboBox.Size = new Size(331, 23); + ShopComboBox.Size = new Size(378, 28); ShopComboBox.TabIndex = 0; // // IceCreamComboBox // IceCreamComboBox.FormattingEnabled = true; - IceCreamComboBox.Location = new Point(12, 41); + IceCreamComboBox.Location = new Point(14, 55); + IceCreamComboBox.Margin = new Padding(3, 4, 3, 4); IceCreamComboBox.Name = "IceCreamComboBox"; - IceCreamComboBox.Size = new Size(331, 23); + IceCreamComboBox.Size = new Size(378, 28); IceCreamComboBox.TabIndex = 1; // // CountTextBox // - CountTextBox.Location = new Point(12, 70); + CountTextBox.Location = new Point(14, 93); + CountTextBox.Margin = new Padding(3, 4, 3, 4); CountTextBox.Name = "CountTextBox"; - CountTextBox.Size = new Size(331, 23); + CountTextBox.Size = new Size(378, 27); CountTextBox.TabIndex = 2; // // SaveButton // - SaveButton.Location = new Point(187, 99); + SaveButton.Location = new Point(214, 132); + SaveButton.Margin = new Padding(3, 4, 3, 4); SaveButton.Name = "SaveButton"; - SaveButton.Size = new Size(75, 23); + SaveButton.Size = new Size(86, 31); SaveButton.TabIndex = 3; SaveButton.Text = "Сохранить"; SaveButton.UseVisualStyleBackColor = true; @@ -70,9 +74,10 @@ // // CancelButton // - CancelButton.Location = new Point(268, 99); + CancelButton.Location = new Point(306, 132); + CancelButton.Margin = new Padding(3, 4, 3, 4); CancelButton.Name = "CancelButton"; - CancelButton.Size = new Size(75, 23); + CancelButton.Size = new Size(86, 31); CancelButton.TabIndex = 4; CancelButton.Text = "Отмена"; CancelButton.UseVisualStyleBackColor = true; @@ -80,16 +85,17 @@ // // SupplyForm // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(355, 136); + ClientSize = new Size(406, 181); Controls.Add(CancelButton); Controls.Add(SaveButton); Controls.Add(CountTextBox); Controls.Add(IceCreamComboBox); Controls.Add(ShopComboBox); + Margin = new Padding(3, 4, 3, 4); Name = "SupplyForm"; - Text = "SupplyForm"; + Text = "Форма поставок"; ResumeLayout(false); PerformLayout(); } -- 2.25.1 From 2ef8238d7d5608fd7d7069e36a11e1a3bfc06182 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Tue, 20 Feb 2024 12:40:57 +0400 Subject: [PATCH 04/23] =?UTF-8?q?=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IceCreamShop/IceCreamShopListImplement/Models/Order.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/IceCreamShop/IceCreamShopListImplement/Models/Order.cs b/IceCreamShop/IceCreamShopListImplement/Models/Order.cs index 2444fac..08b4c19 100644 --- a/IceCreamShop/IceCreamShopListImplement/Models/Order.cs +++ b/IceCreamShop/IceCreamShopListImplement/Models/Order.cs @@ -46,12 +46,7 @@ namespace IceCreamShopListImplement.Models { return; } - Id = model.Id; - IceCreamId = model.IceCreamId; - Count = model.Count; - Sum = model.Sum; Status = model.Status; - DateCreate = model.DateCreate; DateImplement = model.DateImplement; } public OrderViewModel GetViewModel => new() -- 2.25.1 From fdc11812dd83da227a6856596687038b8034c505 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Tue, 20 Feb 2024 12:47:31 +0400 Subject: [PATCH 05/23] =?UTF-8?q?=D0=B5=D1=89=D0=B5=20=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IceCreamShop/OrderForm.Designer.cs | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/IceCreamShop/IceCreamShop/OrderForm.Designer.cs b/IceCreamShop/IceCreamShop/OrderForm.Designer.cs index 78d58c6..5149eb0 100644 --- a/IceCreamShop/IceCreamShop/OrderForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/OrderForm.Designer.cs @@ -41,34 +41,38 @@ // IceCreamComboBox // IceCreamComboBox.FormattingEnabled = true; - IceCreamComboBox.Location = new Point(103, 12); + IceCreamComboBox.Location = new Point(118, 16); + IceCreamComboBox.Margin = new Padding(3, 4, 3, 4); IceCreamComboBox.Name = "IceCreamComboBox"; - IceCreamComboBox.Size = new Size(232, 23); + IceCreamComboBox.Size = new Size(265, 28); IceCreamComboBox.TabIndex = 0; IceCreamComboBox.SelectedIndexChanged += IceCreamComboBox_SelectedIndexChanged; // // CountTextBox // - CountTextBox.Location = new Point(103, 41); + CountTextBox.Location = new Point(118, 55); + CountTextBox.Margin = new Padding(3, 4, 3, 4); CountTextBox.Name = "CountTextBox"; - CountTextBox.Size = new Size(232, 23); + CountTextBox.Size = new Size(265, 27); CountTextBox.TabIndex = 1; CountTextBox.TextChanged += CountTextBox_TextChanged; // // SumTextBox // - SumTextBox.Location = new Point(103, 70); + SumTextBox.Location = new Point(118, 93); + SumTextBox.Margin = new Padding(3, 4, 3, 4); SumTextBox.Name = "SumTextBox"; SumTextBox.ReadOnly = true; - SumTextBox.Size = new Size(232, 23); + SumTextBox.Size = new Size(265, 27); SumTextBox.TabIndex = 2; SumTextBox.TextChanged += SumTextBox_TextChanged; // // SaveButton // - SaveButton.Location = new Point(173, 99); + SaveButton.Location = new Point(198, 132); + SaveButton.Margin = new Padding(3, 4, 3, 4); SaveButton.Name = "SaveButton"; - SaveButton.Size = new Size(81, 23); + SaveButton.Size = new Size(93, 31); SaveButton.TabIndex = 3; SaveButton.Text = "Сохранить"; SaveButton.UseVisualStyleBackColor = true; @@ -76,9 +80,10 @@ // // CancelButton // - CancelButton.Location = new Point(260, 99); + CancelButton.Location = new Point(297, 132); + CancelButton.Margin = new Padding(3, 4, 3, 4); CancelButton.Name = "CancelButton"; - CancelButton.Size = new Size(75, 23); + CancelButton.Size = new Size(86, 31); CancelButton.TabIndex = 4; CancelButton.Text = "Отмена"; CancelButton.UseVisualStyleBackColor = true; @@ -87,35 +92,35 @@ // IceCreamLabel // IceCreamLabel.AutoSize = true; - IceCreamLabel.Location = new Point(12, 15); + IceCreamLabel.Location = new Point(14, 20); IceCreamLabel.Name = "IceCreamLabel"; - IceCreamLabel.Size = new Size(81, 15); + IceCreamLabel.Size = new Size(103, 20); IceCreamLabel.TabIndex = 5; IceCreamLabel.Text = "Мороженное"; // // CountLabel // CountLabel.AutoSize = true; - CountLabel.Location = new Point(12, 44); + CountLabel.Location = new Point(14, 59); CountLabel.Name = "CountLabel"; - CountLabel.Size = new Size(72, 15); + CountLabel.Size = new Size(90, 20); CountLabel.TabIndex = 6; CountLabel.Text = "Количество"; // // SumLabel // SumLabel.AutoSize = true; - SumLabel.Location = new Point(12, 73); + SumLabel.Location = new Point(14, 97); SumLabel.Name = "SumLabel"; - SumLabel.Size = new Size(45, 15); + SumLabel.Size = new Size(55, 20); SumLabel.TabIndex = 7; SumLabel.Text = "Сумма"; // // OrderForm // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(348, 128); + ClientSize = new Size(398, 171); Controls.Add(SumLabel); Controls.Add(CountLabel); Controls.Add(IceCreamLabel); @@ -124,8 +129,9 @@ Controls.Add(SumTextBox); Controls.Add(CountTextBox); Controls.Add(IceCreamComboBox); + Margin = new Padding(3, 4, 3, 4); Name = "OrderForm"; - Text = "OrderForm"; + Text = "Форма заказа"; Load += OrderForm_Load; ResumeLayout(false); PerformLayout(); -- 2.25.1 From 67d814b43d4a28070ce0eda940012bca1290e953 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Fri, 1 Mar 2024 22:42:15 +0400 Subject: [PATCH 06/23] =?UTF-8?q?=D0=96=D0=B8=D0=B7=D0=BD=D1=8C,=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=82=D1=80=D0=B0=D1=87=D0=B5=D0=BD=D0=BD=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=81=D0=BE=D0=B2=D0=B5=D1=80=D1=88=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA,=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=B1=D0=BE?= =?UTF-8?q?=D0=BB=D0=B5=D0=B5=20=D0=BF=D0=BE=D1=87=D0=B5=D1=82=D0=BD=D0=B0?= =?UTF-8?q?,=20=D0=BD=D0=BE=20=D0=B8=20=D0=B1=D0=BE=D0=BB=D0=B5=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=B5=D0=B7=D0=BD=D0=B0,=20=D1=87=D0=B5?= =?UTF-8?q?=D0=BC=20=D0=B6=D0=B8=D0=B7=D0=BD=D1=8C,=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D0=B4=D0=B5=D0=BD=D0=BD=D0=B0=D1=8F=20=D0=B2=20?= =?UTF-8?q?=D0=BD=D0=B8=D1=87=D0=B5=D0=B3=D0=BE=D0=BD=D0=B5=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B0=D0=BD=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogic/ShopLogic.cs | 29 +++- .../StoragesContracts/IShopStorage.cs | 1 - .../Implements/ShopStorage.cs | 29 ---- IceCreamShop/temp/temp.sln | 25 +++ IceCreamShop/temp/temp/Form1.Designer.cs | 123 ++++++++++++++ IceCreamShop/temp/temp/Form1.cs | 25 +++ IceCreamShop/temp/temp/Form1.resx | 123 ++++++++++++++ IceCreamShop/temp/temp/Form2.Designer.cs | 112 +++++++++++++ IceCreamShop/temp/temp/Form2.cs | 25 +++ IceCreamShop/temp/temp/Form2.resx | 126 ++++++++++++++ IceCreamShop/temp/temp/Form3.Designer.cs | 104 ++++++++++++ IceCreamShop/temp/temp/Form3.cs | 20 +++ IceCreamShop/temp/temp/Form3.resx | 123 ++++++++++++++ IceCreamShop/temp/temp/Form4.Designer.cs | 110 ++++++++++++ IceCreamShop/temp/temp/Form4.cs | 20 +++ IceCreamShop/temp/temp/Form4.resx | 126 ++++++++++++++ IceCreamShop/temp/temp/Form5.Designer.cs | 157 ++++++++++++++++++ IceCreamShop/temp/temp/Form5.cs | 20 +++ IceCreamShop/temp/temp/Form5.resx | 132 +++++++++++++++ IceCreamShop/temp/temp/Form6.Designer.cs | 116 +++++++++++++ IceCreamShop/temp/temp/Form6.cs | 20 +++ IceCreamShop/temp/temp/Form6.resx | 120 +++++++++++++ IceCreamShop/temp/temp/Form7.Designer.cs | 139 ++++++++++++++++ IceCreamShop/temp/temp/Form7.cs | 20 +++ IceCreamShop/temp/temp/Form7.resx | 120 +++++++++++++ IceCreamShop/temp/temp/Form8.Designer.cs | 137 +++++++++++++++ IceCreamShop/temp/temp/Form8.cs | 20 +++ IceCreamShop/temp/temp/Form8.resx | 120 +++++++++++++ IceCreamShop/temp/temp/Program.cs | 17 ++ IceCreamShop/temp/temp/temp.csproj | 11 ++ 30 files changed, 2238 insertions(+), 32 deletions(-) create mode 100644 IceCreamShop/temp/temp.sln create mode 100644 IceCreamShop/temp/temp/Form1.Designer.cs create mode 100644 IceCreamShop/temp/temp/Form1.cs create mode 100644 IceCreamShop/temp/temp/Form1.resx create mode 100644 IceCreamShop/temp/temp/Form2.Designer.cs create mode 100644 IceCreamShop/temp/temp/Form2.cs create mode 100644 IceCreamShop/temp/temp/Form2.resx create mode 100644 IceCreamShop/temp/temp/Form3.Designer.cs create mode 100644 IceCreamShop/temp/temp/Form3.cs create mode 100644 IceCreamShop/temp/temp/Form3.resx create mode 100644 IceCreamShop/temp/temp/Form4.Designer.cs create mode 100644 IceCreamShop/temp/temp/Form4.cs create mode 100644 IceCreamShop/temp/temp/Form4.resx create mode 100644 IceCreamShop/temp/temp/Form5.Designer.cs create mode 100644 IceCreamShop/temp/temp/Form5.cs create mode 100644 IceCreamShop/temp/temp/Form5.resx create mode 100644 IceCreamShop/temp/temp/Form6.Designer.cs create mode 100644 IceCreamShop/temp/temp/Form6.cs create mode 100644 IceCreamShop/temp/temp/Form6.resx create mode 100644 IceCreamShop/temp/temp/Form7.Designer.cs create mode 100644 IceCreamShop/temp/temp/Form7.cs create mode 100644 IceCreamShop/temp/temp/Form7.resx create mode 100644 IceCreamShop/temp/temp/Form8.Designer.cs create mode 100644 IceCreamShop/temp/temp/Form8.cs create mode 100644 IceCreamShop/temp/temp/Form8.resx create mode 100644 IceCreamShop/temp/temp/Program.cs create mode 100644 IceCreamShop/temp/temp/temp.csproj diff --git a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs index fcf4dac..e5e9410 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs @@ -41,9 +41,34 @@ _shopStorage.GetFilteredList(model); public bool MakeSupply(ShopSearchModel model, IIceCreamModel iceCream, int count) { + if (model == null) - return false; - return _shopStorage.SupplyIceCream(model, iceCream, count); + throw new ArgumentNullException(nameof(model)); + if (iceCream == null) + throw new ArgumentNullException(nameof(iceCream)); + if (count <= 0) + throw new ArgumentNullException("Количество должно быть положительным числом"); + + ShopViewModel curModel = _shopStorage.GetElement(model); + if (curModel == null) + throw new ArgumentNullException(nameof(curModel)); + if (curModel.ShopIceCreams.TryGetValue(iceCream.Id, out var pair)) + { + curModel.ShopIceCreams[iceCream.Id] = (pair.Item1, pair.Item2 + count); + } + else + { + curModel.ShopIceCreams.Add(iceCream.Id, (iceCream, count)); + } + Update(new() + { + Id = curModel.Id, + ShopName = curModel.ShopName, + DateOpen = curModel.DateOpen, + Address = curModel.Address, + ShopIceCreams = curModel.ShopIceCreams, + }); + return true; } public ShopViewModel ReadElement(ShopSearchModel model) diff --git a/IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs b/IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs index 500cf16..1a7eb3c 100644 --- a/IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs +++ b/IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs @@ -18,6 +18,5 @@ namespace IceCreamShopContracts.StoragesContracts ShopViewModel? Insert(ShopBindingModel model); ShopViewModel? Update(ShopBindingModel model); ShopViewModel? Delete(ShopBindingModel model); - bool SupplyIceCream(ShopSearchModel model, IIceCreamModel iceCream, int Count); } } diff --git a/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs b/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs index b9a24f6..0d6e6ea 100644 --- a/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs +++ b/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs @@ -106,34 +106,5 @@ namespace IceCreamShopListImplement.Implements return null; } - public bool SupplyIceCream(ShopSearchModel model, IIceCreamModel iceCream, int count) { - if (model == null) - throw new ArgumentNullException(nameof(model)); - if (iceCream == null) - throw new ArgumentNullException(nameof(iceCream)); - if (count <= 0) - throw new ArgumentNullException("Количество должно быть положительным числом"); - - ShopViewModel curModel = GetElement(model); - if(curModel == null) - throw new ArgumentNullException(nameof(curModel)); - if (curModel.ShopIceCreams.TryGetValue(iceCream.Id, out var pair)) - { - curModel.ShopIceCreams[iceCream.Id] = (pair.Item1, pair.Item2 + count); - } - else - { - curModel.ShopIceCreams.Add(iceCream.Id, (iceCream, count)); - } - Update(new() - { - Id = curModel.Id, - ShopName = curModel.ShopName, - DateOpen = curModel.DateOpen, - Address = curModel.Address, - ShopIceCreams = curModel.ShopIceCreams, - }); - return true; - } } } diff --git a/IceCreamShop/temp/temp.sln b/IceCreamShop/temp/temp.sln new file mode 100644 index 0000000..b48fb0e --- /dev/null +++ b/IceCreamShop/temp/temp.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34309.116 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "temp", "temp\temp.csproj", "{8E23C6A9-181D-481E-B340-2A5B9DC97EFC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E23C6A9-181D-481E-B340-2A5B9DC97EFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E23C6A9-181D-481E-B340-2A5B9DC97EFC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E23C6A9-181D-481E-B340-2A5B9DC97EFC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E23C6A9-181D-481E-B340-2A5B9DC97EFC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C349FDB8-8C35-41F7-A5DD-7396B0FAD7DE} + EndGlobalSection +EndGlobal diff --git a/IceCreamShop/temp/temp/Form1.Designer.cs b/IceCreamShop/temp/temp/Form1.Designer.cs new file mode 100644 index 0000000..f543f58 --- /dev/null +++ b/IceCreamShop/temp/temp/Form1.Designer.cs @@ -0,0 +1,123 @@ +namespace temp +{ + partial class Form1 + { + /// + /// 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() + { + menuStrip1 = new MenuStrip(); + справочникToolStripMenuItem = new ToolStripMenuItem(); + привязToolStripMenuItem = new ToolStripMenuItem(); + выгрузкаСписковToolStripMenuItem = new ToolStripMenuItem(); + отчетToolStripMenuItem = new ToolStripMenuItem(); + медикаментыToolStripMenuItem = new ToolStripMenuItem(); + услугиToolStripMenuItem = new ToolStripMenuItem(); + рекомендацииToolStripMenuItem = new ToolStripMenuItem(); + menuStrip1.SuspendLayout(); + SuspendLayout(); + // + // menuStrip1 + // + menuStrip1.Items.AddRange(new ToolStripItem[] { справочникToolStripMenuItem, привязToolStripMenuItem, выгрузкаСписковToolStripMenuItem, отчетToolStripMenuItem }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Size = new Size(800, 24); + menuStrip1.TabIndex = 0; + menuStrip1.Text = "menuStrip1"; + menuStrip1.ItemClicked += menuStrip1_ItemClicked; + // + // справочникToolStripMenuItem + // + справочникToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { медикаментыToolStripMenuItem, услугиToolStripMenuItem, рекомендацииToolStripMenuItem }); + справочникToolStripMenuItem.Name = "справочникToolStripMenuItem"; + справочникToolStripMenuItem.Size = new Size(85, 20); + справочникToolStripMenuItem.Text = "справочник"; + // + // привязToolStripMenuItem + // + привязToolStripMenuItem.Name = "привязToolStripMenuItem"; + привязToolStripMenuItem.Size = new Size(131, 20); + привязToolStripMenuItem.Text = "привязать животное"; + привязToolStripMenuItem.Click += привязToolStripMenuItem_Click; + // + // выгрузкаСписковToolStripMenuItem + // + выгрузкаСписковToolStripMenuItem.Name = "выгрузкаСписковToolStripMenuItem"; + выгрузкаСписковToolStripMenuItem.Size = new Size(117, 20); + выгрузкаСписковToolStripMenuItem.Text = "выгрузка списков"; + // + // отчетToolStripMenuItem + // + отчетToolStripMenuItem.Name = "отчетToolStripMenuItem"; + отчетToolStripMenuItem.Size = new Size(49, 20); + отчетToolStripMenuItem.Text = "отчет"; + // + // медикаментыToolStripMenuItem + // + медикаментыToolStripMenuItem.Name = "медикаментыToolStripMenuItem"; + медикаментыToolStripMenuItem.Size = new Size(180, 22); + медикаментыToolStripMenuItem.Text = "медикаменты"; + // + // услугиToolStripMenuItem + // + услугиToolStripMenuItem.Name = "услугиToolStripMenuItem"; + услугиToolStripMenuItem.Size = new Size(180, 22); + услугиToolStripMenuItem.Text = "услуги"; + // + // рекомендацииToolStripMenuItem + // + рекомендацииToolStripMenuItem.Name = "рекомендацииToolStripMenuItem"; + рекомендацииToolStripMenuItem.Size = new Size(180, 22); + рекомендацииToolStripMenuItem.Text = "рекомендации"; + // + // Form1 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(menuStrip1); + MainMenuStrip = menuStrip1; + Name = "Form1"; + Text = "Form1"; + Load += Form1_Load; + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private MenuStrip menuStrip1; + private ToolStripMenuItem справочникToolStripMenuItem; + private ToolStripMenuItem привязToolStripMenuItem; + private ToolStripMenuItem медикаментыToolStripMenuItem; + private ToolStripMenuItem услугиToolStripMenuItem; + private ToolStripMenuItem рекомендацииToolStripMenuItem; + private ToolStripMenuItem выгрузкаСписковToolStripMenuItem; + private ToolStripMenuItem отчетToolStripMenuItem; + } +} diff --git a/IceCreamShop/temp/temp/Form1.cs b/IceCreamShop/temp/temp/Form1.cs new file mode 100644 index 0000000..a244d22 --- /dev/null +++ b/IceCreamShop/temp/temp/Form1.cs @@ -0,0 +1,25 @@ +namespace temp +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) + { + + } + + private void Form1_Load(object sender, EventArgs e) + { + + } + + private void ToolStripMenuItem_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/IceCreamShop/temp/temp/Form1.resx b/IceCreamShop/temp/temp/Form1.resx new file mode 100644 index 0000000..a0623c8 --- /dev/null +++ b/IceCreamShop/temp/temp/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form2.Designer.cs b/IceCreamShop/temp/temp/Form2.Designer.cs new file mode 100644 index 0000000..81d73ee --- /dev/null +++ b/IceCreamShop/temp/temp/Form2.Designer.cs @@ -0,0 +1,112 @@ +namespace temp +{ + partial class Form2 + { + /// + /// 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() + { + dataGridView1 = new DataGridView(); + button1 = new Button(); + изменить = new Button(); + удалить = new Button(); + название = new DataGridViewTextBoxColumn(); + Column1 = new DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + SuspendLayout(); + // + // dataGridView1 + // + dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView1.Columns.AddRange(new DataGridViewColumn[] { название, Column1 }); + dataGridView1.Location = new Point(12, 12); + dataGridView1.Name = "dataGridView1"; + dataGridView1.Size = new Size(288, 124); + dataGridView1.TabIndex = 0; + // + // button1 + // + button1.Location = new Point(306, 12); + button1.Name = "button1"; + button1.Size = new Size(75, 23); + button1.TabIndex = 1; + button1.Text = "создать"; + button1.UseVisualStyleBackColor = true; + button1.Click += button1_Click; + // + // изменить + // + изменить.Location = new Point(306, 41); + изменить.Name = "изменить"; + изменить.Size = new Size(75, 23); + изменить.TabIndex = 2; + изменить.Text = "изменить"; + изменить.UseVisualStyleBackColor = true; + // + // удалить + // + удалить.Location = new Point(306, 70); + удалить.Name = "удалить"; + удалить.Size = new Size(75, 23); + удалить.TabIndex = 3; + удалить.Text = "удалить"; + удалить.UseVisualStyleBackColor = true; + // + // название + // + название.HeaderText = "название"; + название.Name = "название"; + название.Width = 150; + // + // Column1 + // + Column1.HeaderText = "цена"; + Column1.Name = "Column1"; + // + // Form2 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(555, 450); + Controls.Add(удалить); + Controls.Add(изменить); + Controls.Add(button1); + Controls.Add(dataGridView1); + Name = "Form2"; + Text = "Form2"; + ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView1; + private Button button1; + private Button изменить; + private DataGridViewTextBoxColumn название; + private DataGridViewTextBoxColumn Column1; + private Button удалить; + } +} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form2.cs b/IceCreamShop/temp/temp/Form2.cs new file mode 100644 index 0000000..bed0096 --- /dev/null +++ b/IceCreamShop/temp/temp/Form2.cs @@ -0,0 +1,25 @@ +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 temp +{ + public partial class Form2 : Form + { + public Form2() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/IceCreamShop/temp/temp/Form2.resx b/IceCreamShop/temp/temp/Form2.resx new file mode 100644 index 0000000..63ab778 --- /dev/null +++ b/IceCreamShop/temp/temp/Form2.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/IceCreamShop/temp/temp/Form3.Designer.cs b/IceCreamShop/temp/temp/Form3.Designer.cs new file mode 100644 index 0000000..b3f0453 --- /dev/null +++ b/IceCreamShop/temp/temp/Form3.Designer.cs @@ -0,0 +1,104 @@ +namespace temp +{ + partial class Form3 + { + /// + /// 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() + { + comboBox1 = new ComboBox(); + dataGridView1 = new DataGridView(); + Column1 = new DataGridViewTextBoxColumn(); + button1 = new Button(); + отмена = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + SuspendLayout(); + // + // comboBox1 + // + comboBox1.FormattingEnabled = true; + comboBox1.Location = new Point(12, 24); + comboBox1.Name = "comboBox1"; + comboBox1.Size = new Size(240, 23); + comboBox1.TabIndex = 0; + comboBox1.Text = "медикаменты"; + // + // dataGridView1 + // + dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView1.Columns.AddRange(new DataGridViewColumn[] { Column1 }); + dataGridView1.Location = new Point(12, 53); + dataGridView1.Name = "dataGridView1"; + dataGridView1.Size = new Size(240, 150); + dataGridView1.TabIndex = 1; + // + // Column1 + // + Column1.HeaderText = "название животного"; + Column1.Name = "Column1"; + Column1.Width = 200; + // + // button1 + // + button1.Location = new Point(12, 209); + button1.Name = "button1"; + button1.Size = new Size(98, 23); + button1.TabIndex = 2; + button1.Text = "привязать"; + button1.UseVisualStyleBackColor = true; + // + // отмена + // + отмена.Location = new Point(154, 209); + отмена.Name = "отмена"; + отмена.Size = new Size(98, 23); + отмена.TabIndex = 3; + отмена.Text = "привязать"; + отмена.UseVisualStyleBackColor = true; + // + // Form3 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(отмена); + Controls.Add(button1); + Controls.Add(dataGridView1); + Controls.Add(comboBox1); + Name = "Form3"; + Text = "Form3"; + ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + ResumeLayout(false); + } + + #endregion + + private ComboBox comboBox1; + private DataGridView dataGridView1; + private DataGridViewTextBoxColumn Column1; + private Button button1; + private Button отмена; + } +} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form3.cs b/IceCreamShop/temp/temp/Form3.cs new file mode 100644 index 0000000..88e10f2 --- /dev/null +++ b/IceCreamShop/temp/temp/Form3.cs @@ -0,0 +1,20 @@ +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 temp +{ + public partial class Form3 : Form + { + public Form3() + { + InitializeComponent(); + } + } +} diff --git a/IceCreamShop/temp/temp/Form3.resx b/IceCreamShop/temp/temp/Form3.resx new file mode 100644 index 0000000..909d3b7 --- /dev/null +++ b/IceCreamShop/temp/temp/Form3.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form4.Designer.cs b/IceCreamShop/temp/temp/Form4.Designer.cs new file mode 100644 index 0000000..cea557b --- /dev/null +++ b/IceCreamShop/temp/temp/Form4.Designer.cs @@ -0,0 +1,110 @@ +namespace temp +{ + partial class Form4 + { + /// + /// 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() + { + dataGridView1 = new DataGridView(); + название = new DataGridViewTextBoxColumn(); + цена = new DataGridViewTextBoxColumn(); + button1 = new Button(); + button2 = new Button(); + button3 = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + SuspendLayout(); + // + // dataGridView1 + // + dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView1.Columns.AddRange(new DataGridViewColumn[] { название, цена }); + dataGridView1.Location = new Point(12, 12); + dataGridView1.Name = "dataGridView1"; + dataGridView1.Size = new Size(244, 150); + dataGridView1.TabIndex = 0; + // + // название + // + название.HeaderText = "услуга"; + название.Name = "название"; + // + // цена + // + цена.HeaderText = "цена"; + цена.Name = "цена"; + // + // button1 + // + button1.Location = new Point(262, 12); + button1.Name = "button1"; + button1.Size = new Size(75, 23); + button1.TabIndex = 1; + button1.Text = "добавить"; + button1.UseVisualStyleBackColor = true; + // + // button2 + // + button2.Location = new Point(262, 41); + button2.Name = "button2"; + button2.Size = new Size(75, 23); + button2.TabIndex = 2; + button2.Text = "изменить"; + button2.UseVisualStyleBackColor = true; + // + // button3 + // + button3.Location = new Point(262, 70); + button3.Name = "button3"; + button3.Size = new Size(75, 23); + button3.TabIndex = 3; + button3.Text = "удалить"; + button3.UseVisualStyleBackColor = true; + // + // Form4 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(button3); + Controls.Add(button2); + Controls.Add(button1); + Controls.Add(dataGridView1); + Name = "Form4"; + Text = "Form4"; + ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView1; + private DataGridViewTextBoxColumn название; + private DataGridViewTextBoxColumn цена; + private Button button1; + private Button button2; + private Button button3; + } +} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form4.cs b/IceCreamShop/temp/temp/Form4.cs new file mode 100644 index 0000000..b270e75 --- /dev/null +++ b/IceCreamShop/temp/temp/Form4.cs @@ -0,0 +1,20 @@ +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 temp +{ + public partial class Form4 : Form + { + public Form4() + { + InitializeComponent(); + } + } +} diff --git a/IceCreamShop/temp/temp/Form4.resx b/IceCreamShop/temp/temp/Form4.resx new file mode 100644 index 0000000..9caca4b --- /dev/null +++ b/IceCreamShop/temp/temp/Form4.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/IceCreamShop/temp/temp/Form5.Designer.cs b/IceCreamShop/temp/temp/Form5.Designer.cs new file mode 100644 index 0000000..b8cd5b1 --- /dev/null +++ b/IceCreamShop/temp/temp/Form5.Designer.cs @@ -0,0 +1,157 @@ +namespace temp +{ + partial class Form5 + { + /// + /// 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() + { + textBox1 = new TextBox(); + textBox2 = new TextBox(); + label1 = new Label(); + label2 = new Label(); + dataGridView1 = new DataGridView(); + v = new DataGridViewTextBoxColumn(); + Column1 = new DataGridViewTextBoxColumn(); + button1 = new Button(); + button2 = new Button(); + button3 = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); + SuspendLayout(); + // + // textBox1 + // + textBox1.Location = new Point(75, 29); + textBox1.Name = "textBox1"; + textBox1.Size = new Size(179, 23); + textBox1.TabIndex = 0; + // + // textBox2 + // + textBox2.Enabled = false; + textBox2.Location = new Point(75, 58); + textBox2.Name = "textBox2"; + textBox2.Size = new Size(82, 23); + textBox2.TabIndex = 1; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(12, 37); + label1.Name = "label1"; + label1.Size = new Size(57, 15); + label1.TabIndex = 2; + label1.Text = "название"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(36, 61); + label2.Name = "label2"; + label2.Size = new Size(33, 15); + label2.TabIndex = 3; + label2.Text = "цена"; + // + // dataGridView1 + // + dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView1.Columns.AddRange(new DataGridViewColumn[] { v, Column1 }); + dataGridView1.Location = new Point(12, 87); + dataGridView1.Name = "dataGridView1"; + dataGridView1.Size = new Size(242, 150); + dataGridView1.TabIndex = 4; + // + // v + // + v.HeaderText = "медикамент"; + v.Name = "v"; + // + // Column1 + // + Column1.HeaderText = "количество"; + Column1.Name = "Column1"; + // + // button1 + // + button1.Location = new Point(260, 87); + button1.Name = "button1"; + button1.Size = new Size(75, 23); + button1.TabIndex = 5; + button1.Text = "добавить"; + button1.UseVisualStyleBackColor = true; + // + // button2 + // + button2.Location = new Point(260, 116); + button2.Name = "button2"; + button2.Size = new Size(75, 23); + button2.TabIndex = 6; + button2.Text = "изменить"; + button2.UseVisualStyleBackColor = true; + // + // button3 + // + button3.Location = new Point(260, 145); + button3.Name = "button3"; + button3.RightToLeft = RightToLeft.Yes; + button3.Size = new Size(75, 23); + button3.TabIndex = 7; + button3.Text = "удалить"; + button3.UseVisualStyleBackColor = true; + // + // Form5 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(button3); + Controls.Add(button2); + Controls.Add(button1); + Controls.Add(dataGridView1); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(textBox2); + Controls.Add(textBox1); + Name = "Form5"; + Text = "Form5"; + ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private TextBox textBox1; + private TextBox textBox2; + private Label label1; + private Label label2; + private DataGridView dataGridView1; + private DataGridViewTextBoxColumn v; + private DataGridViewTextBoxColumn Column1; + private Button button1; + private Button button2; + private Button button3; + } +} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form5.cs b/IceCreamShop/temp/temp/Form5.cs new file mode 100644 index 0000000..35a60b5 --- /dev/null +++ b/IceCreamShop/temp/temp/Form5.cs @@ -0,0 +1,20 @@ +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 temp +{ + public partial class Form5 : Form + { + public Form5() + { + InitializeComponent(); + } + } +} diff --git a/IceCreamShop/temp/temp/Form5.resx b/IceCreamShop/temp/temp/Form5.resx new file mode 100644 index 0000000..8417479 --- /dev/null +++ b/IceCreamShop/temp/temp/Form5.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 + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form6.Designer.cs b/IceCreamShop/temp/temp/Form6.Designer.cs new file mode 100644 index 0000000..1fd2993 --- /dev/null +++ b/IceCreamShop/temp/temp/Form6.Designer.cs @@ -0,0 +1,116 @@ +namespace temp +{ + partial class Form6 + { + /// + /// 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() + { + comboBox1 = new ComboBox(); + textBox1 = new TextBox(); + label1 = new Label(); + label2 = new Label(); + сохранить = new Button(); + button2 = new Button(); + SuspendLayout(); + // + // comboBox1 + // + comboBox1.FormattingEnabled = true; + comboBox1.Location = new Point(36, 25); + comboBox1.Name = "comboBox1"; + comboBox1.Size = new Size(184, 23); + comboBox1.TabIndex = 0; + // + // textBox1 + // + textBox1.Location = new Point(36, 69); + textBox1.Name = "textBox1"; + textBox1.Size = new Size(184, 23); + textBox1.TabIndex = 1; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(36, 7); + label1.Name = "label1"; + label1.Size = new Size(74, 15); + label1.TabIndex = 2; + label1.Text = "медикамент"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(36, 51); + label2.Name = "label2"; + label2.Size = new Size(71, 15); + label2.TabIndex = 3; + label2.Text = "количество"; + // + // сохранить + // + сохранить.Location = new Point(36, 98); + сохранить.Name = "сохранить"; + сохранить.Size = new Size(75, 23); + сохранить.TabIndex = 4; + сохранить.Text = "сохранить"; + сохранить.UseVisualStyleBackColor = true; + // + // button2 + // + button2.Location = new Point(145, 98); + button2.Name = "button2"; + button2.Size = new Size(75, 23); + button2.TabIndex = 5; + button2.Text = "отмена"; + button2.UseVisualStyleBackColor = true; + // + // Form6 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(button2); + Controls.Add(сохранить); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(textBox1); + Controls.Add(comboBox1); + Name = "Form6"; + Text = "Form6"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox comboBox1; + private TextBox textBox1; + private Label label1; + private Label label2; + private Button сохранить; + private Button button2; + } +} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form6.cs b/IceCreamShop/temp/temp/Form6.cs new file mode 100644 index 0000000..e1c25d0 --- /dev/null +++ b/IceCreamShop/temp/temp/Form6.cs @@ -0,0 +1,20 @@ +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 temp +{ + public partial class Form6 : Form + { + public Form6() + { + InitializeComponent(); + } + } +} diff --git a/IceCreamShop/temp/temp/Form6.resx b/IceCreamShop/temp/temp/Form6.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/IceCreamShop/temp/temp/Form6.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form7.Designer.cs b/IceCreamShop/temp/temp/Form7.Designer.cs new file mode 100644 index 0000000..d7dccd1 --- /dev/null +++ b/IceCreamShop/temp/temp/Form7.Designer.cs @@ -0,0 +1,139 @@ +namespace temp +{ + partial class Form7 + { + /// + /// 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() + { + comboBox1 = new ComboBox(); + comboBox2 = new ComboBox(); + услуга = new Label(); + label1 = new Label(); + label2 = new Label(); + textBox1 = new TextBox(); + button1 = new Button(); + button2 = new Button(); + SuspendLayout(); + // + // comboBox1 + // + comboBox1.FormattingEnabled = true; + comboBox1.Location = new Point(70, 32); + comboBox1.Name = "comboBox1"; + comboBox1.Size = new Size(158, 23); + comboBox1.TabIndex = 0; + // + // comboBox2 + // + comboBox2.FormattingEnabled = true; + comboBox2.Location = new Point(70, 76); + comboBox2.Name = "comboBox2"; + comboBox2.Size = new Size(158, 23); + comboBox2.TabIndex = 1; + // + // услуга + // + услуга.AutoSize = true; + услуга.Location = new Point(70, 14); + услуга.Name = "услуга"; + услуга.Size = new Size(43, 15); + услуга.TabIndex = 2; + услуга.Text = "услуга"; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(70, 58); + label1.Name = "label1"; + label1.Size = new Size(46, 15); + label1.TabIndex = 3; + label1.Text = "оценка"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(70, 102); + label2.Name = "label2"; + label2.Size = new Size(35, 15); + label2.TabIndex = 4; + label2.Text = "текст"; + // + // textBox1 + // + textBox1.Location = new Point(70, 120); + textBox1.Name = "textBox1"; + textBox1.Size = new Size(158, 23); + textBox1.TabIndex = 5; + // + // button1 + // + button1.Location = new Point(70, 149); + button1.Name = "button1"; + button1.Size = new Size(75, 23); + button1.TabIndex = 6; + button1.Text = "сохранить"; + button1.UseVisualStyleBackColor = true; + // + // button2 + // + button2.Location = new Point(153, 149); + button2.Name = "button2"; + button2.Size = new Size(75, 23); + button2.TabIndex = 7; + button2.Text = "отмена"; + button2.UseVisualStyleBackColor = true; + // + // Form7 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(button2); + Controls.Add(button1); + Controls.Add(textBox1); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(услуга); + Controls.Add(comboBox2); + Controls.Add(comboBox1); + Name = "Form7"; + Text = "Form7"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox comboBox1; + private ComboBox comboBox2; + private Label услуга; + private Label label1; + private Label label2; + private TextBox textBox1; + private Button button1; + private Button button2; + } +} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form7.cs b/IceCreamShop/temp/temp/Form7.cs new file mode 100644 index 0000000..087bf56 --- /dev/null +++ b/IceCreamShop/temp/temp/Form7.cs @@ -0,0 +1,20 @@ +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 temp +{ + public partial class Form7 : Form + { + public Form7() + { + InitializeComponent(); + } + } +} diff --git a/IceCreamShop/temp/temp/Form7.resx b/IceCreamShop/temp/temp/Form7.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/IceCreamShop/temp/temp/Form7.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form8.Designer.cs b/IceCreamShop/temp/temp/Form8.Designer.cs new file mode 100644 index 0000000..a27f3e5 --- /dev/null +++ b/IceCreamShop/temp/temp/Form8.Designer.cs @@ -0,0 +1,137 @@ +namespace temp +{ + partial class Form8 + { + /// + /// 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() + { + checkBox1 = new CheckBox(); + checkBox2 = new CheckBox(); + checkBox3 = new CheckBox(); + groupBox1 = new GroupBox(); + button1 = new Button(); + button2 = new Button(); + button3 = new Button(); + groupBox1.SuspendLayout(); + SuspendLayout(); + // + // checkBox1 + // + checkBox1.AutoSize = true; + checkBox1.Location = new Point(6, 22); + checkBox1.Name = "checkBox1"; + checkBox1.Size = new Size(71, 19); + checkBox1.TabIndex = 0; + checkBox1.Text = "услуга 1"; + checkBox1.UseVisualStyleBackColor = true; + // + // checkBox2 + // + checkBox2.AutoSize = true; + checkBox2.Location = new Point(6, 47); + checkBox2.Name = "checkBox2"; + checkBox2.Size = new Size(71, 19); + checkBox2.TabIndex = 1; + checkBox2.Text = "услуга 2"; + checkBox2.UseVisualStyleBackColor = true; + // + // checkBox3 + // + checkBox3.AutoSize = true; + checkBox3.Location = new Point(6, 72); + checkBox3.Name = "checkBox3"; + checkBox3.Size = new Size(71, 19); + checkBox3.TabIndex = 2; + checkBox3.Text = "услуга 3"; + checkBox3.UseVisualStyleBackColor = true; + // + // groupBox1 + // + groupBox1.Controls.Add(checkBox1); + groupBox1.Controls.Add(checkBox3); + groupBox1.Controls.Add(checkBox2); + groupBox1.Location = new Point(270, 106); + groupBox1.Name = "groupBox1"; + groupBox1.Size = new Size(237, 100); + groupBox1.TabIndex = 3; + groupBox1.TabStop = false; + groupBox1.Text = "услуги"; + // + // button1 + // + button1.Location = new Point(270, 212); + button1.Name = "button1"; + button1.RightToLeft = RightToLeft.No; + button1.Size = new Size(75, 23); + button1.TabIndex = 4; + button1.Text = "word"; + button1.UseVisualStyleBackColor = true; + // + // button2 + // + button2.Location = new Point(351, 212); + button2.Name = "button2"; + button2.Size = new Size(75, 23); + button2.TabIndex = 5; + button2.Text = "excel"; + button2.UseVisualStyleBackColor = true; + // + // button3 + // + button3.Location = new Point(432, 212); + button3.Name = "button3"; + button3.Size = new Size(75, 23); + button3.TabIndex = 6; + button3.Text = "отмена"; + button3.UseVisualStyleBackColor = true; + // + // Form8 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(button3); + Controls.Add(button2); + Controls.Add(button1); + Controls.Add(groupBox1); + Name = "Form8"; + Text = "Form8"; + groupBox1.ResumeLayout(false); + groupBox1.PerformLayout(); + ResumeLayout(false); + } + + #endregion + + private CheckBox checkBox1; + private CheckBox checkBox2; + private CheckBox checkBox3; + private GroupBox groupBox1; + private Button button1; + private Button button2; + private Button button3; + } +} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form8.cs b/IceCreamShop/temp/temp/Form8.cs new file mode 100644 index 0000000..fa44bd7 --- /dev/null +++ b/IceCreamShop/temp/temp/Form8.cs @@ -0,0 +1,20 @@ +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 temp +{ + public partial class Form8 : Form + { + public Form8() + { + InitializeComponent(); + } + } +} diff --git a/IceCreamShop/temp/temp/Form8.resx b/IceCreamShop/temp/temp/Form8.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/IceCreamShop/temp/temp/Form8.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Program.cs b/IceCreamShop/temp/temp/Program.cs new file mode 100644 index 0000000..9515381 --- /dev/null +++ b/IceCreamShop/temp/temp/Program.cs @@ -0,0 +1,17 @@ +namespace temp +{ + internal static class Program + { + /// + /// 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(); + Application.Run(new Form1()); + } + } +} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/temp.csproj b/IceCreamShop/temp/temp/temp.csproj new file mode 100644 index 0000000..663fdb8 --- /dev/null +++ b/IceCreamShop/temp/temp/temp.csproj @@ -0,0 +1,11 @@ + + + + WinExe + net8.0-windows + enable + true + enable + + + \ No newline at end of file -- 2.25.1 From 92cbbc7280ad09e4e8d79ef12db3072edb50a9e6 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Fri, 1 Mar 2024 22:53:12 +0400 Subject: [PATCH 07/23] =?UTF-8?q?=D0=AF=20=D0=BD=D0=B5=20=D0=B7=D0=BD?= =?UTF-8?q?=D0=B0=D1=8E=20=20=D0=BA=D0=B0=D0=BA=20=20=D1=8D=D1=82=D0=BE=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B8=D0=B7=D0=BE=D1=88=D0=BB=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IceCreamShop/temp/temp.sln | 25 ---- IceCreamShop/temp/temp/Form1.Designer.cs | 123 ------------------ IceCreamShop/temp/temp/Form1.cs | 25 ---- IceCreamShop/temp/temp/Form1.resx | 123 ------------------ IceCreamShop/temp/temp/Form2.Designer.cs | 112 ---------------- IceCreamShop/temp/temp/Form2.cs | 25 ---- IceCreamShop/temp/temp/Form2.resx | 126 ------------------ IceCreamShop/temp/temp/Form3.Designer.cs | 104 --------------- IceCreamShop/temp/temp/Form3.cs | 20 --- IceCreamShop/temp/temp/Form3.resx | 123 ------------------ IceCreamShop/temp/temp/Form4.Designer.cs | 110 ---------------- IceCreamShop/temp/temp/Form4.cs | 20 --- IceCreamShop/temp/temp/Form4.resx | 126 ------------------ IceCreamShop/temp/temp/Form5.Designer.cs | 157 ----------------------- IceCreamShop/temp/temp/Form5.cs | 20 --- IceCreamShop/temp/temp/Form5.resx | 132 ------------------- IceCreamShop/temp/temp/Form6.Designer.cs | 116 ----------------- IceCreamShop/temp/temp/Form6.cs | 20 --- IceCreamShop/temp/temp/Form6.resx | 120 ----------------- IceCreamShop/temp/temp/Form7.Designer.cs | 139 -------------------- IceCreamShop/temp/temp/Form7.cs | 20 --- IceCreamShop/temp/temp/Form7.resx | 120 ----------------- IceCreamShop/temp/temp/Form8.Designer.cs | 137 -------------------- IceCreamShop/temp/temp/Form8.cs | 20 --- IceCreamShop/temp/temp/Form8.resx | 120 ----------------- IceCreamShop/temp/temp/Program.cs | 17 --- IceCreamShop/temp/temp/temp.csproj | 11 -- 27 files changed, 2211 deletions(-) delete mode 100644 IceCreamShop/temp/temp.sln delete mode 100644 IceCreamShop/temp/temp/Form1.Designer.cs delete mode 100644 IceCreamShop/temp/temp/Form1.cs delete mode 100644 IceCreamShop/temp/temp/Form1.resx delete mode 100644 IceCreamShop/temp/temp/Form2.Designer.cs delete mode 100644 IceCreamShop/temp/temp/Form2.cs delete mode 100644 IceCreamShop/temp/temp/Form2.resx delete mode 100644 IceCreamShop/temp/temp/Form3.Designer.cs delete mode 100644 IceCreamShop/temp/temp/Form3.cs delete mode 100644 IceCreamShop/temp/temp/Form3.resx delete mode 100644 IceCreamShop/temp/temp/Form4.Designer.cs delete mode 100644 IceCreamShop/temp/temp/Form4.cs delete mode 100644 IceCreamShop/temp/temp/Form4.resx delete mode 100644 IceCreamShop/temp/temp/Form5.Designer.cs delete mode 100644 IceCreamShop/temp/temp/Form5.cs delete mode 100644 IceCreamShop/temp/temp/Form5.resx delete mode 100644 IceCreamShop/temp/temp/Form6.Designer.cs delete mode 100644 IceCreamShop/temp/temp/Form6.cs delete mode 100644 IceCreamShop/temp/temp/Form6.resx delete mode 100644 IceCreamShop/temp/temp/Form7.Designer.cs delete mode 100644 IceCreamShop/temp/temp/Form7.cs delete mode 100644 IceCreamShop/temp/temp/Form7.resx delete mode 100644 IceCreamShop/temp/temp/Form8.Designer.cs delete mode 100644 IceCreamShop/temp/temp/Form8.cs delete mode 100644 IceCreamShop/temp/temp/Form8.resx delete mode 100644 IceCreamShop/temp/temp/Program.cs delete mode 100644 IceCreamShop/temp/temp/temp.csproj diff --git a/IceCreamShop/temp/temp.sln b/IceCreamShop/temp/temp.sln deleted file mode 100644 index b48fb0e..0000000 --- a/IceCreamShop/temp/temp.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.8.34309.116 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "temp", "temp\temp.csproj", "{8E23C6A9-181D-481E-B340-2A5B9DC97EFC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8E23C6A9-181D-481E-B340-2A5B9DC97EFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8E23C6A9-181D-481E-B340-2A5B9DC97EFC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8E23C6A9-181D-481E-B340-2A5B9DC97EFC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8E23C6A9-181D-481E-B340-2A5B9DC97EFC}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {C349FDB8-8C35-41F7-A5DD-7396B0FAD7DE} - EndGlobalSection -EndGlobal diff --git a/IceCreamShop/temp/temp/Form1.Designer.cs b/IceCreamShop/temp/temp/Form1.Designer.cs deleted file mode 100644 index f543f58..0000000 --- a/IceCreamShop/temp/temp/Form1.Designer.cs +++ /dev/null @@ -1,123 +0,0 @@ -namespace temp -{ - partial class Form1 - { - /// - /// 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() - { - menuStrip1 = new MenuStrip(); - справочникToolStripMenuItem = new ToolStripMenuItem(); - привязToolStripMenuItem = new ToolStripMenuItem(); - выгрузкаСписковToolStripMenuItem = new ToolStripMenuItem(); - отчетToolStripMenuItem = new ToolStripMenuItem(); - медикаментыToolStripMenuItem = new ToolStripMenuItem(); - услугиToolStripMenuItem = new ToolStripMenuItem(); - рекомендацииToolStripMenuItem = new ToolStripMenuItem(); - menuStrip1.SuspendLayout(); - SuspendLayout(); - // - // menuStrip1 - // - menuStrip1.Items.AddRange(new ToolStripItem[] { справочникToolStripMenuItem, привязToolStripMenuItem, выгрузкаСписковToolStripMenuItem, отчетToolStripMenuItem }); - menuStrip1.Location = new Point(0, 0); - menuStrip1.Name = "menuStrip1"; - menuStrip1.Size = new Size(800, 24); - menuStrip1.TabIndex = 0; - menuStrip1.Text = "menuStrip1"; - menuStrip1.ItemClicked += menuStrip1_ItemClicked; - // - // справочникToolStripMenuItem - // - справочникToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { медикаментыToolStripMenuItem, услугиToolStripMenuItem, рекомендацииToolStripMenuItem }); - справочникToolStripMenuItem.Name = "справочникToolStripMenuItem"; - справочникToolStripMenuItem.Size = new Size(85, 20); - справочникToolStripMenuItem.Text = "справочник"; - // - // привязToolStripMenuItem - // - привязToolStripMenuItem.Name = "привязToolStripMenuItem"; - привязToolStripMenuItem.Size = new Size(131, 20); - привязToolStripMenuItem.Text = "привязать животное"; - привязToolStripMenuItem.Click += привязToolStripMenuItem_Click; - // - // выгрузкаСписковToolStripMenuItem - // - выгрузкаСписковToolStripMenuItem.Name = "выгрузкаСписковToolStripMenuItem"; - выгрузкаСписковToolStripMenuItem.Size = new Size(117, 20); - выгрузкаСписковToolStripMenuItem.Text = "выгрузка списков"; - // - // отчетToolStripMenuItem - // - отчетToolStripMenuItem.Name = "отчетToolStripMenuItem"; - отчетToolStripMenuItem.Size = new Size(49, 20); - отчетToolStripMenuItem.Text = "отчет"; - // - // медикаментыToolStripMenuItem - // - медикаментыToolStripMenuItem.Name = "медикаментыToolStripMenuItem"; - медикаментыToolStripMenuItem.Size = new Size(180, 22); - медикаментыToolStripMenuItem.Text = "медикаменты"; - // - // услугиToolStripMenuItem - // - услугиToolStripMenuItem.Name = "услугиToolStripMenuItem"; - услугиToolStripMenuItem.Size = new Size(180, 22); - услугиToolStripMenuItem.Text = "услуги"; - // - // рекомендацииToolStripMenuItem - // - рекомендацииToolStripMenuItem.Name = "рекомендацииToolStripMenuItem"; - рекомендацииToolStripMenuItem.Size = new Size(180, 22); - рекомендацииToolStripMenuItem.Text = "рекомендации"; - // - // Form1 - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(menuStrip1); - MainMenuStrip = menuStrip1; - Name = "Form1"; - Text = "Form1"; - Load += Form1_Load; - menuStrip1.ResumeLayout(false); - menuStrip1.PerformLayout(); - ResumeLayout(false); - PerformLayout(); - } - - #endregion - - private MenuStrip menuStrip1; - private ToolStripMenuItem справочникToolStripMenuItem; - private ToolStripMenuItem привязToolStripMenuItem; - private ToolStripMenuItem медикаментыToolStripMenuItem; - private ToolStripMenuItem услугиToolStripMenuItem; - private ToolStripMenuItem рекомендацииToolStripMenuItem; - private ToolStripMenuItem выгрузкаСписковToolStripMenuItem; - private ToolStripMenuItem отчетToolStripMenuItem; - } -} diff --git a/IceCreamShop/temp/temp/Form1.cs b/IceCreamShop/temp/temp/Form1.cs deleted file mode 100644 index a244d22..0000000 --- a/IceCreamShop/temp/temp/Form1.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace temp -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - - private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) - { - - } - - private void Form1_Load(object sender, EventArgs e) - { - - } - - private void ToolStripMenuItem_Click(object sender, EventArgs e) - { - - } - } -} diff --git a/IceCreamShop/temp/temp/Form1.resx b/IceCreamShop/temp/temp/Form1.resx deleted file mode 100644 index a0623c8..0000000 --- a/IceCreamShop/temp/temp/Form1.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form2.Designer.cs b/IceCreamShop/temp/temp/Form2.Designer.cs deleted file mode 100644 index 81d73ee..0000000 --- a/IceCreamShop/temp/temp/Form2.Designer.cs +++ /dev/null @@ -1,112 +0,0 @@ -namespace temp -{ - partial class Form2 - { - /// - /// 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() - { - dataGridView1 = new DataGridView(); - button1 = new Button(); - изменить = new Button(); - удалить = new Button(); - название = new DataGridViewTextBoxColumn(); - Column1 = new DataGridViewTextBoxColumn(); - ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); - SuspendLayout(); - // - // dataGridView1 - // - dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView1.Columns.AddRange(new DataGridViewColumn[] { название, Column1 }); - dataGridView1.Location = new Point(12, 12); - dataGridView1.Name = "dataGridView1"; - dataGridView1.Size = new Size(288, 124); - dataGridView1.TabIndex = 0; - // - // button1 - // - button1.Location = new Point(306, 12); - button1.Name = "button1"; - button1.Size = new Size(75, 23); - button1.TabIndex = 1; - button1.Text = "создать"; - button1.UseVisualStyleBackColor = true; - button1.Click += button1_Click; - // - // изменить - // - изменить.Location = new Point(306, 41); - изменить.Name = "изменить"; - изменить.Size = new Size(75, 23); - изменить.TabIndex = 2; - изменить.Text = "изменить"; - изменить.UseVisualStyleBackColor = true; - // - // удалить - // - удалить.Location = new Point(306, 70); - удалить.Name = "удалить"; - удалить.Size = new Size(75, 23); - удалить.TabIndex = 3; - удалить.Text = "удалить"; - удалить.UseVisualStyleBackColor = true; - // - // название - // - название.HeaderText = "название"; - название.Name = "название"; - название.Width = 150; - // - // Column1 - // - Column1.HeaderText = "цена"; - Column1.Name = "Column1"; - // - // Form2 - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(555, 450); - Controls.Add(удалить); - Controls.Add(изменить); - Controls.Add(button1); - Controls.Add(dataGridView1); - Name = "Form2"; - Text = "Form2"; - ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); - ResumeLayout(false); - } - - #endregion - - private DataGridView dataGridView1; - private Button button1; - private Button изменить; - private DataGridViewTextBoxColumn название; - private DataGridViewTextBoxColumn Column1; - private Button удалить; - } -} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form2.cs b/IceCreamShop/temp/temp/Form2.cs deleted file mode 100644 index bed0096..0000000 --- a/IceCreamShop/temp/temp/Form2.cs +++ /dev/null @@ -1,25 +0,0 @@ -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 temp -{ - public partial class Form2 : Form - { - public Form2() - { - InitializeComponent(); - } - - private void button1_Click(object sender, EventArgs e) - { - - } - } -} diff --git a/IceCreamShop/temp/temp/Form2.resx b/IceCreamShop/temp/temp/Form2.resx deleted file mode 100644 index 63ab778..0000000 --- a/IceCreamShop/temp/temp/Form2.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/IceCreamShop/temp/temp/Form3.Designer.cs b/IceCreamShop/temp/temp/Form3.Designer.cs deleted file mode 100644 index b3f0453..0000000 --- a/IceCreamShop/temp/temp/Form3.Designer.cs +++ /dev/null @@ -1,104 +0,0 @@ -namespace temp -{ - partial class Form3 - { - /// - /// 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() - { - comboBox1 = new ComboBox(); - dataGridView1 = new DataGridView(); - Column1 = new DataGridViewTextBoxColumn(); - button1 = new Button(); - отмена = new Button(); - ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); - SuspendLayout(); - // - // comboBox1 - // - comboBox1.FormattingEnabled = true; - comboBox1.Location = new Point(12, 24); - comboBox1.Name = "comboBox1"; - comboBox1.Size = new Size(240, 23); - comboBox1.TabIndex = 0; - comboBox1.Text = "медикаменты"; - // - // dataGridView1 - // - dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView1.Columns.AddRange(new DataGridViewColumn[] { Column1 }); - dataGridView1.Location = new Point(12, 53); - dataGridView1.Name = "dataGridView1"; - dataGridView1.Size = new Size(240, 150); - dataGridView1.TabIndex = 1; - // - // Column1 - // - Column1.HeaderText = "название животного"; - Column1.Name = "Column1"; - Column1.Width = 200; - // - // button1 - // - button1.Location = new Point(12, 209); - button1.Name = "button1"; - button1.Size = new Size(98, 23); - button1.TabIndex = 2; - button1.Text = "привязать"; - button1.UseVisualStyleBackColor = true; - // - // отмена - // - отмена.Location = new Point(154, 209); - отмена.Name = "отмена"; - отмена.Size = new Size(98, 23); - отмена.TabIndex = 3; - отмена.Text = "привязать"; - отмена.UseVisualStyleBackColor = true; - // - // Form3 - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(отмена); - Controls.Add(button1); - Controls.Add(dataGridView1); - Controls.Add(comboBox1); - Name = "Form3"; - Text = "Form3"; - ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); - ResumeLayout(false); - } - - #endregion - - private ComboBox comboBox1; - private DataGridView dataGridView1; - private DataGridViewTextBoxColumn Column1; - private Button button1; - private Button отмена; - } -} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form3.cs b/IceCreamShop/temp/temp/Form3.cs deleted file mode 100644 index 88e10f2..0000000 --- a/IceCreamShop/temp/temp/Form3.cs +++ /dev/null @@ -1,20 +0,0 @@ -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 temp -{ - public partial class Form3 : Form - { - public Form3() - { - InitializeComponent(); - } - } -} diff --git a/IceCreamShop/temp/temp/Form3.resx b/IceCreamShop/temp/temp/Form3.resx deleted file mode 100644 index 909d3b7..0000000 --- a/IceCreamShop/temp/temp/Form3.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form4.Designer.cs b/IceCreamShop/temp/temp/Form4.Designer.cs deleted file mode 100644 index cea557b..0000000 --- a/IceCreamShop/temp/temp/Form4.Designer.cs +++ /dev/null @@ -1,110 +0,0 @@ -namespace temp -{ - partial class Form4 - { - /// - /// 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() - { - dataGridView1 = new DataGridView(); - название = new DataGridViewTextBoxColumn(); - цена = new DataGridViewTextBoxColumn(); - button1 = new Button(); - button2 = new Button(); - button3 = new Button(); - ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); - SuspendLayout(); - // - // dataGridView1 - // - dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView1.Columns.AddRange(new DataGridViewColumn[] { название, цена }); - dataGridView1.Location = new Point(12, 12); - dataGridView1.Name = "dataGridView1"; - dataGridView1.Size = new Size(244, 150); - dataGridView1.TabIndex = 0; - // - // название - // - название.HeaderText = "услуга"; - название.Name = "название"; - // - // цена - // - цена.HeaderText = "цена"; - цена.Name = "цена"; - // - // button1 - // - button1.Location = new Point(262, 12); - button1.Name = "button1"; - button1.Size = new Size(75, 23); - button1.TabIndex = 1; - button1.Text = "добавить"; - button1.UseVisualStyleBackColor = true; - // - // button2 - // - button2.Location = new Point(262, 41); - button2.Name = "button2"; - button2.Size = new Size(75, 23); - button2.TabIndex = 2; - button2.Text = "изменить"; - button2.UseVisualStyleBackColor = true; - // - // button3 - // - button3.Location = new Point(262, 70); - button3.Name = "button3"; - button3.Size = new Size(75, 23); - button3.TabIndex = 3; - button3.Text = "удалить"; - button3.UseVisualStyleBackColor = true; - // - // Form4 - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(button3); - Controls.Add(button2); - Controls.Add(button1); - Controls.Add(dataGridView1); - Name = "Form4"; - Text = "Form4"; - ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); - ResumeLayout(false); - } - - #endregion - - private DataGridView dataGridView1; - private DataGridViewTextBoxColumn название; - private DataGridViewTextBoxColumn цена; - private Button button1; - private Button button2; - private Button button3; - } -} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form4.cs b/IceCreamShop/temp/temp/Form4.cs deleted file mode 100644 index b270e75..0000000 --- a/IceCreamShop/temp/temp/Form4.cs +++ /dev/null @@ -1,20 +0,0 @@ -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 temp -{ - public partial class Form4 : Form - { - public Form4() - { - InitializeComponent(); - } - } -} diff --git a/IceCreamShop/temp/temp/Form4.resx b/IceCreamShop/temp/temp/Form4.resx deleted file mode 100644 index 9caca4b..0000000 --- a/IceCreamShop/temp/temp/Form4.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/IceCreamShop/temp/temp/Form5.Designer.cs b/IceCreamShop/temp/temp/Form5.Designer.cs deleted file mode 100644 index b8cd5b1..0000000 --- a/IceCreamShop/temp/temp/Form5.Designer.cs +++ /dev/null @@ -1,157 +0,0 @@ -namespace temp -{ - partial class Form5 - { - /// - /// 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() - { - textBox1 = new TextBox(); - textBox2 = new TextBox(); - label1 = new Label(); - label2 = new Label(); - dataGridView1 = new DataGridView(); - v = new DataGridViewTextBoxColumn(); - Column1 = new DataGridViewTextBoxColumn(); - button1 = new Button(); - button2 = new Button(); - button3 = new Button(); - ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); - SuspendLayout(); - // - // textBox1 - // - textBox1.Location = new Point(75, 29); - textBox1.Name = "textBox1"; - textBox1.Size = new Size(179, 23); - textBox1.TabIndex = 0; - // - // textBox2 - // - textBox2.Enabled = false; - textBox2.Location = new Point(75, 58); - textBox2.Name = "textBox2"; - textBox2.Size = new Size(82, 23); - textBox2.TabIndex = 1; - // - // label1 - // - label1.AutoSize = true; - label1.Location = new Point(12, 37); - label1.Name = "label1"; - label1.Size = new Size(57, 15); - label1.TabIndex = 2; - label1.Text = "название"; - // - // label2 - // - label2.AutoSize = true; - label2.Location = new Point(36, 61); - label2.Name = "label2"; - label2.Size = new Size(33, 15); - label2.TabIndex = 3; - label2.Text = "цена"; - // - // dataGridView1 - // - dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView1.Columns.AddRange(new DataGridViewColumn[] { v, Column1 }); - dataGridView1.Location = new Point(12, 87); - dataGridView1.Name = "dataGridView1"; - dataGridView1.Size = new Size(242, 150); - dataGridView1.TabIndex = 4; - // - // v - // - v.HeaderText = "медикамент"; - v.Name = "v"; - // - // Column1 - // - Column1.HeaderText = "количество"; - Column1.Name = "Column1"; - // - // button1 - // - button1.Location = new Point(260, 87); - button1.Name = "button1"; - button1.Size = new Size(75, 23); - button1.TabIndex = 5; - button1.Text = "добавить"; - button1.UseVisualStyleBackColor = true; - // - // button2 - // - button2.Location = new Point(260, 116); - button2.Name = "button2"; - button2.Size = new Size(75, 23); - button2.TabIndex = 6; - button2.Text = "изменить"; - button2.UseVisualStyleBackColor = true; - // - // button3 - // - button3.Location = new Point(260, 145); - button3.Name = "button3"; - button3.RightToLeft = RightToLeft.Yes; - button3.Size = new Size(75, 23); - button3.TabIndex = 7; - button3.Text = "удалить"; - button3.UseVisualStyleBackColor = true; - // - // Form5 - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(button3); - Controls.Add(button2); - Controls.Add(button1); - Controls.Add(dataGridView1); - Controls.Add(label2); - Controls.Add(label1); - Controls.Add(textBox2); - Controls.Add(textBox1); - Name = "Form5"; - Text = "Form5"; - ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); - ResumeLayout(false); - PerformLayout(); - } - - #endregion - - private TextBox textBox1; - private TextBox textBox2; - private Label label1; - private Label label2; - private DataGridView dataGridView1; - private DataGridViewTextBoxColumn v; - private DataGridViewTextBoxColumn Column1; - private Button button1; - private Button button2; - private Button button3; - } -} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form5.cs b/IceCreamShop/temp/temp/Form5.cs deleted file mode 100644 index 35a60b5..0000000 --- a/IceCreamShop/temp/temp/Form5.cs +++ /dev/null @@ -1,20 +0,0 @@ -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 temp -{ - public partial class Form5 : Form - { - public Form5() - { - InitializeComponent(); - } - } -} diff --git a/IceCreamShop/temp/temp/Form5.resx b/IceCreamShop/temp/temp/Form5.resx deleted file mode 100644 index 8417479..0000000 --- a/IceCreamShop/temp/temp/Form5.resx +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - True - - - True - - \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form6.Designer.cs b/IceCreamShop/temp/temp/Form6.Designer.cs deleted file mode 100644 index 1fd2993..0000000 --- a/IceCreamShop/temp/temp/Form6.Designer.cs +++ /dev/null @@ -1,116 +0,0 @@ -namespace temp -{ - partial class Form6 - { - /// - /// 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() - { - comboBox1 = new ComboBox(); - textBox1 = new TextBox(); - label1 = new Label(); - label2 = new Label(); - сохранить = new Button(); - button2 = new Button(); - SuspendLayout(); - // - // comboBox1 - // - comboBox1.FormattingEnabled = true; - comboBox1.Location = new Point(36, 25); - comboBox1.Name = "comboBox1"; - comboBox1.Size = new Size(184, 23); - comboBox1.TabIndex = 0; - // - // textBox1 - // - textBox1.Location = new Point(36, 69); - textBox1.Name = "textBox1"; - textBox1.Size = new Size(184, 23); - textBox1.TabIndex = 1; - // - // label1 - // - label1.AutoSize = true; - label1.Location = new Point(36, 7); - label1.Name = "label1"; - label1.Size = new Size(74, 15); - label1.TabIndex = 2; - label1.Text = "медикамент"; - // - // label2 - // - label2.AutoSize = true; - label2.Location = new Point(36, 51); - label2.Name = "label2"; - label2.Size = new Size(71, 15); - label2.TabIndex = 3; - label2.Text = "количество"; - // - // сохранить - // - сохранить.Location = new Point(36, 98); - сохранить.Name = "сохранить"; - сохранить.Size = new Size(75, 23); - сохранить.TabIndex = 4; - сохранить.Text = "сохранить"; - сохранить.UseVisualStyleBackColor = true; - // - // button2 - // - button2.Location = new Point(145, 98); - button2.Name = "button2"; - button2.Size = new Size(75, 23); - button2.TabIndex = 5; - button2.Text = "отмена"; - button2.UseVisualStyleBackColor = true; - // - // Form6 - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(button2); - Controls.Add(сохранить); - Controls.Add(label2); - Controls.Add(label1); - Controls.Add(textBox1); - Controls.Add(comboBox1); - Name = "Form6"; - Text = "Form6"; - ResumeLayout(false); - PerformLayout(); - } - - #endregion - - private ComboBox comboBox1; - private TextBox textBox1; - private Label label1; - private Label label2; - private Button сохранить; - private Button button2; - } -} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form6.cs b/IceCreamShop/temp/temp/Form6.cs deleted file mode 100644 index e1c25d0..0000000 --- a/IceCreamShop/temp/temp/Form6.cs +++ /dev/null @@ -1,20 +0,0 @@ -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 temp -{ - public partial class Form6 : Form - { - public Form6() - { - InitializeComponent(); - } - } -} diff --git a/IceCreamShop/temp/temp/Form6.resx b/IceCreamShop/temp/temp/Form6.resx deleted file mode 100644 index af32865..0000000 --- a/IceCreamShop/temp/temp/Form6.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form7.Designer.cs b/IceCreamShop/temp/temp/Form7.Designer.cs deleted file mode 100644 index d7dccd1..0000000 --- a/IceCreamShop/temp/temp/Form7.Designer.cs +++ /dev/null @@ -1,139 +0,0 @@ -namespace temp -{ - partial class Form7 - { - /// - /// 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() - { - comboBox1 = new ComboBox(); - comboBox2 = new ComboBox(); - услуга = new Label(); - label1 = new Label(); - label2 = new Label(); - textBox1 = new TextBox(); - button1 = new Button(); - button2 = new Button(); - SuspendLayout(); - // - // comboBox1 - // - comboBox1.FormattingEnabled = true; - comboBox1.Location = new Point(70, 32); - comboBox1.Name = "comboBox1"; - comboBox1.Size = new Size(158, 23); - comboBox1.TabIndex = 0; - // - // comboBox2 - // - comboBox2.FormattingEnabled = true; - comboBox2.Location = new Point(70, 76); - comboBox2.Name = "comboBox2"; - comboBox2.Size = new Size(158, 23); - comboBox2.TabIndex = 1; - // - // услуга - // - услуга.AutoSize = true; - услуга.Location = new Point(70, 14); - услуга.Name = "услуга"; - услуга.Size = new Size(43, 15); - услуга.TabIndex = 2; - услуга.Text = "услуга"; - // - // label1 - // - label1.AutoSize = true; - label1.Location = new Point(70, 58); - label1.Name = "label1"; - label1.Size = new Size(46, 15); - label1.TabIndex = 3; - label1.Text = "оценка"; - // - // label2 - // - label2.AutoSize = true; - label2.Location = new Point(70, 102); - label2.Name = "label2"; - label2.Size = new Size(35, 15); - label2.TabIndex = 4; - label2.Text = "текст"; - // - // textBox1 - // - textBox1.Location = new Point(70, 120); - textBox1.Name = "textBox1"; - textBox1.Size = new Size(158, 23); - textBox1.TabIndex = 5; - // - // button1 - // - button1.Location = new Point(70, 149); - button1.Name = "button1"; - button1.Size = new Size(75, 23); - button1.TabIndex = 6; - button1.Text = "сохранить"; - button1.UseVisualStyleBackColor = true; - // - // button2 - // - button2.Location = new Point(153, 149); - button2.Name = "button2"; - button2.Size = new Size(75, 23); - button2.TabIndex = 7; - button2.Text = "отмена"; - button2.UseVisualStyleBackColor = true; - // - // Form7 - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(button2); - Controls.Add(button1); - Controls.Add(textBox1); - Controls.Add(label2); - Controls.Add(label1); - Controls.Add(услуга); - Controls.Add(comboBox2); - Controls.Add(comboBox1); - Name = "Form7"; - Text = "Form7"; - ResumeLayout(false); - PerformLayout(); - } - - #endregion - - private ComboBox comboBox1; - private ComboBox comboBox2; - private Label услуга; - private Label label1; - private Label label2; - private TextBox textBox1; - private Button button1; - private Button button2; - } -} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form7.cs b/IceCreamShop/temp/temp/Form7.cs deleted file mode 100644 index 087bf56..0000000 --- a/IceCreamShop/temp/temp/Form7.cs +++ /dev/null @@ -1,20 +0,0 @@ -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 temp -{ - public partial class Form7 : Form - { - public Form7() - { - InitializeComponent(); - } - } -} diff --git a/IceCreamShop/temp/temp/Form7.resx b/IceCreamShop/temp/temp/Form7.resx deleted file mode 100644 index af32865..0000000 --- a/IceCreamShop/temp/temp/Form7.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form8.Designer.cs b/IceCreamShop/temp/temp/Form8.Designer.cs deleted file mode 100644 index a27f3e5..0000000 --- a/IceCreamShop/temp/temp/Form8.Designer.cs +++ /dev/null @@ -1,137 +0,0 @@ -namespace temp -{ - partial class Form8 - { - /// - /// 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() - { - checkBox1 = new CheckBox(); - checkBox2 = new CheckBox(); - checkBox3 = new CheckBox(); - groupBox1 = new GroupBox(); - button1 = new Button(); - button2 = new Button(); - button3 = new Button(); - groupBox1.SuspendLayout(); - SuspendLayout(); - // - // checkBox1 - // - checkBox1.AutoSize = true; - checkBox1.Location = new Point(6, 22); - checkBox1.Name = "checkBox1"; - checkBox1.Size = new Size(71, 19); - checkBox1.TabIndex = 0; - checkBox1.Text = "услуга 1"; - checkBox1.UseVisualStyleBackColor = true; - // - // checkBox2 - // - checkBox2.AutoSize = true; - checkBox2.Location = new Point(6, 47); - checkBox2.Name = "checkBox2"; - checkBox2.Size = new Size(71, 19); - checkBox2.TabIndex = 1; - checkBox2.Text = "услуга 2"; - checkBox2.UseVisualStyleBackColor = true; - // - // checkBox3 - // - checkBox3.AutoSize = true; - checkBox3.Location = new Point(6, 72); - checkBox3.Name = "checkBox3"; - checkBox3.Size = new Size(71, 19); - checkBox3.TabIndex = 2; - checkBox3.Text = "услуга 3"; - checkBox3.UseVisualStyleBackColor = true; - // - // groupBox1 - // - groupBox1.Controls.Add(checkBox1); - groupBox1.Controls.Add(checkBox3); - groupBox1.Controls.Add(checkBox2); - groupBox1.Location = new Point(270, 106); - groupBox1.Name = "groupBox1"; - groupBox1.Size = new Size(237, 100); - groupBox1.TabIndex = 3; - groupBox1.TabStop = false; - groupBox1.Text = "услуги"; - // - // button1 - // - button1.Location = new Point(270, 212); - button1.Name = "button1"; - button1.RightToLeft = RightToLeft.No; - button1.Size = new Size(75, 23); - button1.TabIndex = 4; - button1.Text = "word"; - button1.UseVisualStyleBackColor = true; - // - // button2 - // - button2.Location = new Point(351, 212); - button2.Name = "button2"; - button2.Size = new Size(75, 23); - button2.TabIndex = 5; - button2.Text = "excel"; - button2.UseVisualStyleBackColor = true; - // - // button3 - // - button3.Location = new Point(432, 212); - button3.Name = "button3"; - button3.Size = new Size(75, 23); - button3.TabIndex = 6; - button3.Text = "отмена"; - button3.UseVisualStyleBackColor = true; - // - // Form8 - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(button3); - Controls.Add(button2); - Controls.Add(button1); - Controls.Add(groupBox1); - Name = "Form8"; - Text = "Form8"; - groupBox1.ResumeLayout(false); - groupBox1.PerformLayout(); - ResumeLayout(false); - } - - #endregion - - private CheckBox checkBox1; - private CheckBox checkBox2; - private CheckBox checkBox3; - private GroupBox groupBox1; - private Button button1; - private Button button2; - private Button button3; - } -} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Form8.cs b/IceCreamShop/temp/temp/Form8.cs deleted file mode 100644 index fa44bd7..0000000 --- a/IceCreamShop/temp/temp/Form8.cs +++ /dev/null @@ -1,20 +0,0 @@ -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 temp -{ - public partial class Form8 : Form - { - public Form8() - { - InitializeComponent(); - } - } -} diff --git a/IceCreamShop/temp/temp/Form8.resx b/IceCreamShop/temp/temp/Form8.resx deleted file mode 100644 index af32865..0000000 --- a/IceCreamShop/temp/temp/Form8.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - \ No newline at end of file diff --git a/IceCreamShop/temp/temp/Program.cs b/IceCreamShop/temp/temp/Program.cs deleted file mode 100644 index 9515381..0000000 --- a/IceCreamShop/temp/temp/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace temp -{ - internal static class Program - { - /// - /// 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(); - Application.Run(new Form1()); - } - } -} \ No newline at end of file diff --git a/IceCreamShop/temp/temp/temp.csproj b/IceCreamShop/temp/temp/temp.csproj deleted file mode 100644 index 663fdb8..0000000 --- a/IceCreamShop/temp/temp/temp.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - WinExe - net8.0-windows - enable - true - enable - - - \ No newline at end of file -- 2.25.1 From d510da711a3f6a8acc3a394ef7e2c64af9331b61 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Mon, 4 Mar 2024 15:28:55 +0400 Subject: [PATCH 08/23] Ready --- .../IceCreamShop/MainForm.Designer.cs | 60 +++++--- IceCreamShop/IceCreamShop/MainForm.cs | 9 ++ IceCreamShop/IceCreamShop/Program.cs | 3 +- .../IceCreamShop/SellForm.Designer.cs | 117 +++++++++++++++ IceCreamShop/IceCreamShop/SellForm.cs | 117 +++++++++++++++ IceCreamShop/IceCreamShop/SellForm.resx | 120 +++++++++++++++ .../IceCreamShop/ShopForm.Designer.cs | 72 +++++---- IceCreamShop/IceCreamShop/ShopForm.cs | 5 +- .../BusinessLogic/OrderLogic.cs | 88 ++++++++++- .../BusinessLogic/ShopLogic.cs | 39 +++-- .../BindingModels/ShopBindingModel.cs | 1 + .../BusinessLogicsContracts/IShopLogic.cs | 1 + .../StoragesContracts/IShopStorage.cs | 1 + .../ViewModels/ShopViewModel.cs | 2 + .../IceCreamShopDataModels/IShopModel.cs | 1 + .../DataFileSingleton.cs | 6 + .../Implements/IceCreamStorage.cs | 2 + .../Implements/OrderStorage.cs | 12 +- .../Implements/ShopStorage.cs | 140 ++++++++++++++++++ .../IceCreamShopFileImplement/Models/Shop.cs | 118 +++++++++++++++ .../Implements/ShopStorage.cs | 59 ++++++++ .../IceCreamShopListImplement/Models/Shop.cs | 1 + 22 files changed, 901 insertions(+), 73 deletions(-) create mode 100644 IceCreamShop/IceCreamShop/SellForm.Designer.cs create mode 100644 IceCreamShop/IceCreamShop/SellForm.cs create mode 100644 IceCreamShop/IceCreamShop/SellForm.resx create mode 100644 IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs create mode 100644 IceCreamShop/IceCreamShopFileImplement/Models/Shop.cs diff --git a/IceCreamShop/IceCreamShop/MainForm.Designer.cs b/IceCreamShop/IceCreamShop/MainForm.Designer.cs index c419e35..72d96f3 100644 --- a/IceCreamShop/IceCreamShop/MainForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/MainForm.Designer.cs @@ -40,6 +40,7 @@ ReadyButton = new Button(); IssuedButton = new Button(); RefreshButton = new Button(); + продажиToolStripMenuItem = new ToolStripMenuItem(); menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit(); SuspendLayout(); @@ -50,60 +51,62 @@ menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenu }); menuStrip1.Location = new Point(0, 0); menuStrip1.Name = "menuStrip1"; - menuStrip1.Padding = new Padding(6, 3, 0, 3); - menuStrip1.Size = new Size(1296, 30); + menuStrip1.Padding = new Padding(5, 2, 0, 2); + menuStrip1.Size = new Size(1134, 24); menuStrip1.TabIndex = 0; menuStrip1.Text = "menuStrip1"; // // ToolStripMenu // - ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыStripMenuItem, МороженноеStripMenuItem, магазиныToolStripMenuItem, поставкиToolStripMenuItem }); + ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыStripMenuItem, МороженноеStripMenuItem, магазиныToolStripMenuItem, поставкиToolStripMenuItem, продажиToolStripMenuItem }); ToolStripMenu.Name = "ToolStripMenu"; - ToolStripMenu.Size = new Size(117, 24); + ToolStripMenu.Size = new Size(94, 20); ToolStripMenu.Text = "Справочники"; // // КомпонентыStripMenuItem // КомпонентыStripMenuItem.Name = "КомпонентыStripMenuItem"; - КомпонентыStripMenuItem.Size = new Size(186, 26); + КомпонентыStripMenuItem.Size = new Size(180, 22); КомпонентыStripMenuItem.Text = "Компоненты"; КомпонентыStripMenuItem.Click += КомпонентыStripMenuItem_Click; // // МороженноеStripMenuItem // МороженноеStripMenuItem.Name = "МороженноеStripMenuItem"; - МороженноеStripMenuItem.Size = new Size(186, 26); + МороженноеStripMenuItem.Size = new Size(180, 22); МороженноеStripMenuItem.Text = "Мороженное"; МороженноеStripMenuItem.Click += МороженноеStripMenuItem_Click; // // магазиныToolStripMenuItem // магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem"; - магазиныToolStripMenuItem.Size = new Size(186, 26); + магазиныToolStripMenuItem.Size = new Size(180, 22); магазиныToolStripMenuItem.Text = "Магазины"; магазиныToolStripMenuItem.Click += магазиныToolStripMenuItem_Click; // // поставкиToolStripMenuItem // поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem"; - поставкиToolStripMenuItem.Size = new Size(186, 26); + поставкиToolStripMenuItem.Size = new Size(180, 22); поставкиToolStripMenuItem.Text = "Поставки"; поставкиToolStripMenuItem.Click += поставкиToolStripMenuItem_Click; // // DataGridView // DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - DataGridView.Location = new Point(11, 31); + DataGridView.Location = new Point(10, 23); + DataGridView.Margin = new Padding(3, 2, 3, 2); DataGridView.Name = "DataGridView"; DataGridView.RowHeadersWidth = 51; - DataGridView.Size = new Size(1007, 407); + DataGridView.Size = new Size(881, 305); DataGridView.TabIndex = 1; // // CreateOrderButton // - CreateOrderButton.Location = new Point(1025, 31); + CreateOrderButton.Location = new Point(897, 23); + CreateOrderButton.Margin = new Padding(3, 2, 3, 2); CreateOrderButton.Name = "CreateOrderButton"; - CreateOrderButton.Size = new Size(259, 29); + CreateOrderButton.Size = new Size(227, 22); CreateOrderButton.TabIndex = 2; CreateOrderButton.Text = "Создать заказ"; CreateOrderButton.UseVisualStyleBackColor = true; @@ -111,9 +114,10 @@ // // TakeInWorkButton // - TakeInWorkButton.Location = new Point(1025, 67); + TakeInWorkButton.Location = new Point(897, 50); + TakeInWorkButton.Margin = new Padding(3, 2, 3, 2); TakeInWorkButton.Name = "TakeInWorkButton"; - TakeInWorkButton.Size = new Size(259, 29); + TakeInWorkButton.Size = new Size(227, 22); TakeInWorkButton.TabIndex = 3; TakeInWorkButton.Text = "Отдать заказ в работу"; TakeInWorkButton.UseVisualStyleBackColor = true; @@ -121,9 +125,10 @@ // // ReadyButton // - ReadyButton.Location = new Point(1025, 101); + ReadyButton.Location = new Point(897, 76); + ReadyButton.Margin = new Padding(3, 2, 3, 2); ReadyButton.Name = "ReadyButton"; - ReadyButton.Size = new Size(259, 29); + ReadyButton.Size = new Size(227, 22); ReadyButton.TabIndex = 4; ReadyButton.Text = "Заказ готов"; ReadyButton.UseVisualStyleBackColor = true; @@ -131,9 +136,10 @@ // // IssuedButton // - IssuedButton.Location = new Point(1025, 136); + IssuedButton.Location = new Point(897, 102); + IssuedButton.Margin = new Padding(3, 2, 3, 2); IssuedButton.Name = "IssuedButton"; - IssuedButton.Size = new Size(259, 29); + IssuedButton.Size = new Size(227, 22); IssuedButton.TabIndex = 5; IssuedButton.Text = "Заказ выдан"; IssuedButton.UseVisualStyleBackColor = true; @@ -141,19 +147,27 @@ // // RefreshButton // - RefreshButton.Location = new Point(1025, 171); + RefreshButton.Location = new Point(897, 128); + RefreshButton.Margin = new Padding(3, 2, 3, 2); RefreshButton.Name = "RefreshButton"; - RefreshButton.Size = new Size(259, 29); + RefreshButton.Size = new Size(227, 22); RefreshButton.TabIndex = 6; RefreshButton.Text = "Обновить"; RefreshButton.UseVisualStyleBackColor = true; RefreshButton.Click += RefreshButton_Click; // + // продажиToolStripMenuItem + // + продажиToolStripMenuItem.Name = "продажиToolStripMenuItem"; + продажиToolStripMenuItem.Size = new Size(180, 22); + продажиToolStripMenuItem.Text = "Продажи"; + продажиToolStripMenuItem.Click += продажиToolStripMenuItem_Click; + // // MainForm // - AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1296, 451); + ClientSize = new Size(1134, 338); Controls.Add(RefreshButton); Controls.Add(IssuedButton); Controls.Add(ReadyButton); @@ -162,6 +176,7 @@ Controls.Add(DataGridView); Controls.Add(menuStrip1); MainMenuStrip = menuStrip1; + Margin = new Padding(3, 2, 3, 2); Name = "MainForm"; Text = "Форма главная"; Load += MainForm_Load; @@ -186,5 +201,6 @@ private Button RefreshButton; private ToolStripMenuItem магазиныToolStripMenuItem; private ToolStripMenuItem поставкиToolStripMenuItem; + private ToolStripMenuItem продажиToolStripMenuItem; } } \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/MainForm.cs b/IceCreamShop/IceCreamShop/MainForm.cs index e523217..cec910d 100644 --- a/IceCreamShop/IceCreamShop/MainForm.cs +++ b/IceCreamShop/IceCreamShop/MainForm.cs @@ -198,5 +198,14 @@ Program.ServiceProvider?.GetService(typeof(OrderForm)); form.ShowDialog(); } } + + private void продажиToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(SellForm)); + if (service is SellForm form) + { + form.ShowDialog(); + } + } } } diff --git a/IceCreamShop/IceCreamShop/Program.cs b/IceCreamShop/IceCreamShop/Program.cs index 0f67844..51f1264 100644 --- a/IceCreamShop/IceCreamShop/Program.cs +++ b/IceCreamShop/IceCreamShop/Program.cs @@ -34,8 +34,8 @@ namespace IceCreamShop option.AddNLog("nlog.config"); }); services.AddTransient(); - services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -51,6 +51,7 @@ namespace IceCreamShop services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); } } } diff --git a/IceCreamShop/IceCreamShop/SellForm.Designer.cs b/IceCreamShop/IceCreamShop/SellForm.Designer.cs new file mode 100644 index 0000000..95509c4 --- /dev/null +++ b/IceCreamShop/IceCreamShop/SellForm.Designer.cs @@ -0,0 +1,117 @@ +namespace IceCreamShop +{ + partial class SellForm + { + /// + /// 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() + { + IceCreamComboBox = new ComboBox(); + IceCreamLabel = new Label(); + CountLabel = new Label(); + CountTextBox = new TextBox(); + SaveButton = new Button(); + CancelButton = new Button(); + SuspendLayout(); + // + // IceCreamComboBox + // + IceCreamComboBox.FormattingEnabled = true; + IceCreamComboBox.Location = new Point(99, 12); + IceCreamComboBox.Name = "IceCreamComboBox"; + IceCreamComboBox.Size = new Size(121, 23); + IceCreamComboBox.TabIndex = 0; + // + // IceCreamLabel + // + IceCreamLabel.AutoSize = true; + IceCreamLabel.Location = new Point(12, 20); + IceCreamLabel.Name = "IceCreamLabel"; + IceCreamLabel.Size = new Size(81, 15); + IceCreamLabel.TabIndex = 1; + IceCreamLabel.Text = "Мороженное"; + // + // CountLabel + // + CountLabel.AutoSize = true; + CountLabel.Location = new Point(21, 49); + CountLabel.Name = "CountLabel"; + CountLabel.Size = new Size(72, 15); + CountLabel.TabIndex = 2; + CountLabel.Text = "Количество"; + // + // CountTextBox + // + CountTextBox.Location = new Point(99, 41); + CountTextBox.Name = "CountTextBox"; + CountTextBox.Size = new Size(121, 23); + CountTextBox.TabIndex = 3; + // + // SaveButton + // + SaveButton.Location = new Point(64, 73); + SaveButton.Name = "SaveButton"; + SaveButton.Size = new Size(75, 23); + SaveButton.TabIndex = 4; + SaveButton.Text = "Сохранить"; + SaveButton.UseVisualStyleBackColor = true; + SaveButton.Click += SaveButton_Click; + // + // CancelButton + // + CancelButton.Location = new Point(145, 73); + CancelButton.Name = "CancelButton"; + CancelButton.Size = new Size(75, 23); + CancelButton.TabIndex = 5; + CancelButton.Text = "Отмена"; + CancelButton.UseVisualStyleBackColor = true; + // + // SellForm + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(224, 108); + Controls.Add(CancelButton); + Controls.Add(SaveButton); + Controls.Add(CountTextBox); + Controls.Add(CountLabel); + Controls.Add(IceCreamLabel); + Controls.Add(IceCreamComboBox); + Name = "SellForm"; + Text = "Форма продажи"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox IceCreamComboBox; + private Label IceCreamLabel; + private Label CountLabel; + private TextBox CountTextBox; + private Button SaveButton; + private Button CancelButton; + } +} \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/SellForm.cs b/IceCreamShop/IceCreamShop/SellForm.cs new file mode 100644 index 0000000..96143c6 --- /dev/null +++ b/IceCreamShop/IceCreamShop/SellForm.cs @@ -0,0 +1,117 @@ +using IceCreamShopContracts.BusinessLogicsContracts; +using IceCreamShopContracts.SearchModels; +using IceCreamShopContracts.ViewModels; +using IceCreamShopDataModels.Models; +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 IceCreamShop +{ + public partial class SellForm : Form + { + private readonly List? _iceCreamList; + IShopLogic _shopLogic; + IIceCreamLogic _iceCreamLogic; + public SellForm(IIceCreamLogic iceCreamLogic, IShopLogic shopLogic) + { + InitializeComponent(); + _shopLogic = shopLogic; + _iceCreamLogic = iceCreamLogic; + _iceCreamList = iceCreamLogic.ReadList(null); + if (_iceCreamList != null) + { + IceCreamComboBox.DisplayMember = "IceCreamName"; + IceCreamComboBox.ValueMember = "Id"; + IceCreamComboBox.DataSource = _iceCreamList; + IceCreamComboBox.SelectedItem = null; + } + } + public int IceCreamId + { + get + { + return + Convert.ToInt32(IceCreamComboBox.SelectedValue); + } + set + { + IceCreamComboBox.SelectedValue = value; + } + } + + public IIceCreamModel? IceCreamModel + { + get + { + if (_iceCreamList == null) + { + return null; + } + foreach (var elem in _iceCreamList) + { + if (elem.Id == IceCreamId) + { + return elem; + } + } + return null; + } + } + + + public int Count + { + get { return Convert.ToInt32(CountTextBox.Text); } + set + { CountTextBox.Text = value.ToString(); } + } + + private void SaveButton_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(CountTextBox.Text)) + { + MessageBox.Show("Заполните поле Количество", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (IceCreamComboBox.SelectedValue == null) + { + MessageBox.Show("Выберите мороженное", "Ошибка", + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + try + { + int count = Convert.ToInt32(CountTextBox.Text); + + bool res = _shopLogic.MakeSell( + _iceCreamLogic.ReadElement(new() { Id = Convert.ToInt32(IceCreamComboBox.SelectedValue) }), + count + ); + + if (!res) + { + throw new Exception("Ошибка при продаже."); + } + + MessageBox.Show("Продажа прошла успешно"); + DialogResult = DialogResult.OK; + Close(); + + } + catch (Exception err) + { + MessageBox.Show("Ошибка продажи"); + return; + } + } + } +} diff --git a/IceCreamShop/IceCreamShop/SellForm.resx b/IceCreamShop/IceCreamShop/SellForm.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/IceCreamShop/IceCreamShop/SellForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/ShopForm.Designer.cs b/IceCreamShop/IceCreamShop/ShopForm.Designer.cs index e2dec45..a2c5b56 100644 --- a/IceCreamShop/IceCreamShop/ShopForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/ShopForm.Designer.cs @@ -41,66 +41,65 @@ Название = new DataGridViewTextBoxColumn(); Цена = new DataGridViewTextBoxColumn(); Количество = new DataGridViewTextBoxColumn(); + CapacityUpDown = new NumericUpDown(); + CapacityLabel = new Label(); ((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit(); + ((System.ComponentModel.ISupportInitialize)CapacityUpDown).BeginInit(); SuspendLayout(); // // DateTimePicker // - DateTimePicker.Location = new Point(97, 93); - DateTimePicker.Margin = new Padding(3, 4, 3, 4); + DateTimePicker.Location = new Point(85, 70); DateTimePicker.Name = "DateTimePicker"; - DateTimePicker.Size = new Size(363, 27); + DateTimePicker.Size = new Size(318, 23); DateTimePicker.TabIndex = 0; // // NameTextBox // - NameTextBox.Location = new Point(97, 16); - NameTextBox.Margin = new Padding(3, 4, 3, 4); + NameTextBox.Location = new Point(85, 12); NameTextBox.Name = "NameTextBox"; - NameTextBox.Size = new Size(363, 27); + NameTextBox.Size = new Size(318, 23); NameTextBox.TabIndex = 1; // // AddressTextBox // - AddressTextBox.Location = new Point(97, 55); - AddressTextBox.Margin = new Padding(3, 4, 3, 4); + AddressTextBox.Location = new Point(85, 41); AddressTextBox.Name = "AddressTextBox"; - AddressTextBox.Size = new Size(363, 27); + AddressTextBox.Size = new Size(318, 23); AddressTextBox.TabIndex = 2; // // NameLabel // NameLabel.AutoSize = true; - NameLabel.Location = new Point(14, 20); + NameLabel.Location = new Point(12, 15); NameLabel.Name = "NameLabel"; - NameLabel.Size = new Size(77, 20); + NameLabel.Size = new Size(59, 15); NameLabel.TabIndex = 3; NameLabel.Text = "Название"; // // AdressLabel // AdressLabel.AutoSize = true; - AdressLabel.Location = new Point(14, 59); + AdressLabel.Location = new Point(12, 44); AdressLabel.Name = "AdressLabel"; - AdressLabel.Size = new Size(51, 20); + AdressLabel.Size = new Size(40, 15); AdressLabel.TabIndex = 4; AdressLabel.Text = "Адрес"; // // DateLabel // DateLabel.AutoSize = true; - DateLabel.Location = new Point(14, 101); + DateLabel.Location = new Point(12, 76); DateLabel.Name = "DateLabel"; - DateLabel.Size = new Size(41, 20); + DateLabel.Size = new Size(32, 15); DateLabel.TabIndex = 5; DateLabel.Text = "Дата"; // // SaveButton // - SaveButton.Location = new Point(282, 340); - SaveButton.Margin = new Padding(3, 4, 3, 4); + SaveButton.Location = new Point(247, 284); SaveButton.Name = "SaveButton"; - SaveButton.Size = new Size(86, 31); + SaveButton.Size = new Size(75, 23); SaveButton.TabIndex = 6; SaveButton.Text = "Сохранить"; SaveButton.UseVisualStyleBackColor = true; @@ -108,10 +107,9 @@ // // CancelButton // - CancelButton.Location = new Point(375, 340); - CancelButton.Margin = new Padding(3, 4, 3, 4); + CancelButton.Location = new Point(328, 284); CancelButton.Name = "CancelButton"; - CancelButton.Size = new Size(86, 31); + CancelButton.Size = new Size(75, 23); CancelButton.TabIndex = 7; CancelButton.Text = "Отмена"; CancelButton.UseVisualStyleBackColor = true; @@ -121,11 +119,10 @@ // DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; DataGridView.Columns.AddRange(new DataGridViewColumn[] { Column1, Название, Цена, Количество }); - DataGridView.Location = new Point(14, 132); - DataGridView.Margin = new Padding(3, 4, 3, 4); + DataGridView.Location = new Point(12, 128); DataGridView.Name = "DataGridView"; DataGridView.RowHeadersWidth = 51; - DataGridView.Size = new Size(447, 200); + DataGridView.Size = new Size(391, 150); DataGridView.TabIndex = 8; // // Column1 @@ -160,11 +157,30 @@ Количество.ReadOnly = true; Количество.Width = 125; // + // CapacityUpDown + // + CapacityUpDown.Location = new Point(98, 99); + CapacityUpDown.Maximum = new decimal(new int[] { 10000, 0, 0, 0 }); + CapacityUpDown.Name = "CapacityUpDown"; + CapacityUpDown.Size = new Size(120, 23); + CapacityUpDown.TabIndex = 9; + // + // CapacityLabel + // + CapacityLabel.AutoSize = true; + CapacityLabel.Location = new Point(12, 107); + CapacityLabel.Name = "CapacityLabel"; + CapacityLabel.Size = new Size(80, 15); + CapacityLabel.TabIndex = 10; + CapacityLabel.Text = "Вместимость"; + // // ShopForm // - AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(470, 380); + ClientSize = new Size(411, 315); + Controls.Add(CapacityLabel); + Controls.Add(CapacityUpDown); Controls.Add(DataGridView); Controls.Add(CancelButton); Controls.Add(SaveButton); @@ -174,11 +190,11 @@ Controls.Add(AddressTextBox); Controls.Add(NameTextBox); Controls.Add(DateTimePicker); - Margin = new Padding(3, 4, 3, 4); Name = "ShopForm"; Text = "Форма магазина"; Load += ShopForm_Load; ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); + ((System.ComponentModel.ISupportInitialize)CapacityUpDown).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -198,5 +214,7 @@ private DataGridViewTextBoxColumn Название; private DataGridViewTextBoxColumn Цена; private DataGridViewTextBoxColumn Количество; + private NumericUpDown CapacityUpDown; + private Label CapacityLabel; } } \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/ShopForm.cs b/IceCreamShop/IceCreamShop/ShopForm.cs index 7af90da..9477799 100644 --- a/IceCreamShop/IceCreamShop/ShopForm.cs +++ b/IceCreamShop/IceCreamShop/ShopForm.cs @@ -42,7 +42,8 @@ namespace IceCreamShop NameTextBox.Text = shop.ShopName; AddressTextBox.Text = shop.Address; DateTimePicker.Text = shop.DateOpen.ToString(); - _iceCreams = shop.ShopIceCreams; + CapacityUpDown.Value = shop.MaxCapacity; + _iceCreams = shop.ShopIceCreams ?? new Dictionary(); } LoadData(); } @@ -103,7 +104,7 @@ namespace IceCreamShop ShopName = NameTextBox.Text, Address = AddressTextBox.Text, DateOpen = DateTimePicker.Value.Date, - ShopIceCreams = _iceCreams + MaxCapacity = Convert.ToInt32(CapacityUpDown.Value), }; var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); if (!operationResult) diff --git a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs index ef27b2a..78c7efc 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs @@ -5,6 +5,7 @@ using IceCreamShopContracts.StoragesContracts; using IceCreamShopContracts.ViewModels; using IceCreamShopDataModels; using IceCreamShopDataModels.Enums; +using IceCreamShopDataModels.Models; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -18,11 +19,17 @@ namespace IceCreamShopBusinessLogic.BusinessLogic { private readonly ILogger _logger; private readonly IOrderStorage _orderStorage; + private readonly IShopStorage _shopStorage; + private readonly IShopLogic _shopLogic; + private readonly IIceCreamStorage _iceCreamStorage; - public OrderLogic(ILogger logger, IOrderStorage orderStorage) + public OrderLogic(IOrderStorage orderStorage, IShopStorage shopStorage, IShopLogic shopLogic, IIceCreamStorage iceCreamStorage, ILogger logger) { - _logger = logger; _orderStorage = orderStorage; + _shopStorage = shopStorage; + _logger = logger; + _shopLogic = shopLogic; + _iceCreamStorage = iceCreamStorage; } public List? ReadList(OrderSearchModel? model) @@ -52,6 +59,69 @@ namespace IceCreamShopBusinessLogic.BusinessLogic return true; } + public bool CheckSupply(IIceCreamModel iceCream, int count) + { + if (count <= 0) + { + _logger.LogWarning("Check then supply operation error. IceCream count < 0."); + return false; + } + + int freeSpace = 0; + foreach (var shop in _shopStorage.GetFullList()) + { + freeSpace += shop.MaxCapacity; + foreach (var doc in shop.ShopIceCreams) + { + freeSpace -= doc.Value.Item2; + } + } + + if (freeSpace - count < 0) + { + _logger.LogWarning("Check then supply operation error. There's no place for new IceCream in shops."); + return false; + } + + foreach (var shop in _shopStorage.GetFullList()) + { + freeSpace = shop.MaxCapacity; + foreach (var doc in shop.ShopIceCreams) + { + freeSpace -= doc.Value.Item2; + } + if (freeSpace == 0) + { + continue; + } + if (freeSpace - count >= 0) + { + if (_shopLogic.MakeSupply(new() { Id = shop.Id }, iceCream, count)) + count = 0; + else + { + _logger.LogWarning("Supply error"); + return false; + } + } + if (freeSpace - count < 0) + { + if (_shopLogic.MakeSupply(new() { Id = shop.Id }, iceCream, freeSpace)) + count -= freeSpace; + else + { + _logger.LogWarning("Supply error"); + return false; + } + } + if (count <= 0) + { + return true; + } + } + return false; + } + public bool ChangeStatus(OrderBindingModel model, OrderStatus status) { CheckModel(model); @@ -66,6 +136,20 @@ namespace IceCreamShopBusinessLogic.BusinessLogic _logger.LogWarning("Status change operation failed"); throw new InvalidOperationException("Текущий статус заказа не может быть переведен в выбранный"); } + if(status == OrderStatus.Готов) + { + var icecream = _iceCreamStorage.GetElement(new IceCreamSearchModel() { Id = model.IceCreamId }); + if (icecream == null) + { + _logger.LogWarning("Status update to " + status.ToString() + " operation failed. Document not found."); + return false; + } + if (CheckSupply(icecream, model.Count) == false) + { + _logger.LogWarning("Status update to " + status.ToString() + " operation failed. Shop supply error."); + return false; + } + } model.Status = status; if (model.Status == OrderStatus.Выдан) model.DateImplement = DateTime.Now; _orderStorage.Update(model); diff --git a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs index e5e9410..ae4c719 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ShopLogic.cs @@ -52,25 +52,42 @@ _shopStorage.GetFilteredList(model); ShopViewModel curModel = _shopStorage.GetElement(model); if (curModel == null) throw new ArgumentNullException(nameof(curModel)); - if (curModel.ShopIceCreams.TryGetValue(iceCream.Id, out var pair)) + var countItems = curModel.ShopIceCreams.Select(x => x.Value.Item2).Sum(); + if (curModel.MaxCapacity - countItems >= count) { - curModel.ShopIceCreams[iceCream.Id] = (pair.Item1, pair.Item2 + count); + if (curModel.ShopIceCreams.TryGetValue(iceCream.Id, out var sameDocument)) + { + curModel.ShopIceCreams[iceCream.Id] = (iceCream, sameDocument.Item2 + count); + _logger.LogInformation("Same iceCream found by supply. Added {0} of {1} in {2} shop", count, iceCream.IceCreamName, curModel.ShopName); + } + else + { + curModel.ShopIceCreams[iceCream.Id] = (iceCream, count); + _logger.LogInformation("New iceCream added by supply. Added {0} of {1} in {2} shop", count, iceCream.IceCreamName, curModel.ShopName); + } + _shopStorage.Update(new() + { + Id = curModel.Id, + ShopName = curModel.ShopName, + Address = curModel.Address, + DateOpen = curModel.DateOpen, + ShopIceCreams = curModel.ShopIceCreams, + MaxCapacity = curModel.MaxCapacity + }); } else { - curModel.ShopIceCreams.Add(iceCream.Id, (iceCream, count)); + _logger.LogWarning("Required shop is overflowed"); + return false; } - Update(new() - { - Id = curModel.Id, - ShopName = curModel.ShopName, - DateOpen = curModel.DateOpen, - Address = curModel.Address, - ShopIceCreams = curModel.ShopIceCreams, - }); return true; } + public bool MakeSell(IIceCreamModel iceCream, int count) + { + return _shopStorage.SellIceCreams(iceCream, count); + } + public ShopViewModel ReadElement(ShopSearchModel model) { if (model == null) diff --git a/IceCreamShop/IceCreamShopContracts/BindingModels/ShopBindingModel.cs b/IceCreamShop/IceCreamShopContracts/BindingModels/ShopBindingModel.cs index 9b202bf..10e58da 100644 --- a/IceCreamShop/IceCreamShopContracts/BindingModels/ShopBindingModel.cs +++ b/IceCreamShop/IceCreamShopContracts/BindingModels/ShopBindingModel.cs @@ -13,6 +13,7 @@ namespace IceCreamShopContracts.BindingModels public string ShopName { get; set; } public string Address { get; set; } public DateTime DateOpen { get; set; } + public int MaxCapacity { get; set; } public Dictionary ShopIceCreams { get; set; } = new(); } } diff --git a/IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IShopLogic.cs b/IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IShopLogic.cs index c9ee0e2..e5e7e32 100644 --- a/IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IShopLogic.cs +++ b/IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IShopLogic.cs @@ -18,5 +18,6 @@ namespace IceCreamShopContracts.BusinessLogicsContracts bool Update(ShopBindingModel model); bool Delete(ShopBindingModel model); bool MakeSupply(ShopSearchModel model, IIceCreamModel iceCream, int count); + bool MakeSell(IIceCreamModel iceCream, int count); } } diff --git a/IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs b/IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs index 1a7eb3c..d0ae61e 100644 --- a/IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs +++ b/IceCreamShop/IceCreamShopContracts/StoragesContracts/IShopStorage.cs @@ -18,5 +18,6 @@ namespace IceCreamShopContracts.StoragesContracts ShopViewModel? Insert(ShopBindingModel model); ShopViewModel? Update(ShopBindingModel model); ShopViewModel? Delete(ShopBindingModel model); + public bool SellIceCreams(IIceCreamModel model, int count); } } diff --git a/IceCreamShop/IceCreamShopContracts/ViewModels/ShopViewModel.cs b/IceCreamShop/IceCreamShopContracts/ViewModels/ShopViewModel.cs index 0b93fb1..740053a 100644 --- a/IceCreamShop/IceCreamShopContracts/ViewModels/ShopViewModel.cs +++ b/IceCreamShop/IceCreamShopContracts/ViewModels/ShopViewModel.cs @@ -17,6 +17,8 @@ namespace IceCreamShopContracts.ViewModels public string Address { get; set; } [DisplayName("Дата открытия")] public DateTime DateOpen { get; set; } + [DisplayName("Вместимость")] + public int MaxCapacity { get; set; } public Dictionary ShopIceCreams { get; set; } = new(); } } diff --git a/IceCreamShop/IceCreamShopDataModels/IShopModel.cs b/IceCreamShop/IceCreamShopDataModels/IShopModel.cs index b852783..352bd82 100644 --- a/IceCreamShop/IceCreamShopDataModels/IShopModel.cs +++ b/IceCreamShop/IceCreamShopDataModels/IShopModel.cs @@ -12,5 +12,6 @@ namespace IceCreamShopDataModels.Models string Address { get; } DateTime DateOpen { get; } Dictionary ShopIceCreams { get; } + int MaxCapacity { get; } } } diff --git a/IceCreamShop/IceCreamShopFileImplement/DataFileSingleton.cs b/IceCreamShop/IceCreamShopFileImplement/DataFileSingleton.cs index 0bd54c8..fdcc3d8 100644 --- a/IceCreamShop/IceCreamShopFileImplement/DataFileSingleton.cs +++ b/IceCreamShop/IceCreamShopFileImplement/DataFileSingleton.cs @@ -14,9 +14,11 @@ namespace IceCreamShopFileImplement private readonly string ComponentFileName = "Component.xml"; private readonly string OrderFileName = "Order.xml"; private readonly string IceCreamFileName = "IceCream.xml"; + private readonly string ShopFileName = "Shops.xml"; public List Components { get; private set; } public List Orders { get; private set; } public List IceCreams { get; private set; } + public List Shops { get; private set; } public static DataFileSingleton GetInstance() { @@ -33,6 +35,8 @@ namespace IceCreamShopFileImplement "IceCreams", x => x.GetXElement); public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement); + public void SaveShops() => SaveData(Shops, ShopFileName, + "Shops", x => x.GetXElement); private DataFileSingleton() { Components = LoadData(ComponentFileName, "Component", x => @@ -41,6 +45,8 @@ namespace IceCreamShopFileImplement IceCream.Create(x)!)!; Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!; + Shops = LoadData(ShopFileName, "Shop", x => + Shop.Create(x)!)!; } private static List? LoadData(string filename, string xmlNodeName, Func selectFunction) diff --git a/IceCreamShop/IceCreamShopFileImplement/Implements/IceCreamStorage.cs b/IceCreamShop/IceCreamShopFileImplement/Implements/IceCreamStorage.cs index 234bd35..432809c 100644 --- a/IceCreamShop/IceCreamShopFileImplement/Implements/IceCreamStorage.cs +++ b/IceCreamShop/IceCreamShopFileImplement/Implements/IceCreamStorage.cs @@ -2,6 +2,7 @@ using IceCreamShopContracts.SearchModels; using IceCreamShopContracts.StoragesContracts; using IceCreamShopContracts.ViewModels; +using IceCreamShopDataModels.Models; using IceCreamShopFileImplement.Models; using System; using System.Collections.Generic; @@ -91,5 +92,6 @@ model) return null; } + } } diff --git a/IceCreamShop/IceCreamShopFileImplement/Implements/OrderStorage.cs b/IceCreamShop/IceCreamShopFileImplement/Implements/OrderStorage.cs index 983f9d1..8df2a2b 100644 --- a/IceCreamShop/IceCreamShopFileImplement/Implements/OrderStorage.cs +++ b/IceCreamShop/IceCreamShopFileImplement/Implements/OrderStorage.cs @@ -90,14 +90,10 @@ model) { if (model == null) return null; - foreach (var iceCream in source.IceCreams) - { - if (iceCream.Id == model.IceCreamId) - { - model.IceCreamName = iceCream.IceCreamName; - break; - } - } + var iceCream = source.IceCreams.FirstOrDefault(x => (x.Id == model.IceCreamId)); + if (iceCream == null) + return model; + model.IceCreamName = iceCream.IceCreamName; return model; } diff --git a/IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs b/IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs new file mode 100644 index 0000000..70c2277 --- /dev/null +++ b/IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs @@ -0,0 +1,140 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.SearchModels; +using IceCreamShopContracts.StoragesContracts; +using IceCreamShopContracts.ViewModels; +using IceCreamShopDataModels.Models; +using IceCreamShopFileImplement; +using IceCreamShopFileImplement.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopFileImplement.Implements +{ + public class ShopStorage : IShopStorage + { + private readonly DataFileSingleton _source; + public ShopStorage() + { + _source = DataFileSingleton.GetInstance(); + } + public List GetFullList() + { + return _source.Shops + .Select(x => x.GetViewModel) +.ToList(); + } + public List GetFilteredList(ShopSearchModel + model) + { + if (string.IsNullOrEmpty(model.Name)) + { + return new(); + } + return _source.Shops + .Where(x => x.ShopName.Contains(model.Name)) +.Select(x => x.GetViewModel) +.ToList(); ; + } + public ShopViewModel? GetElement(ShopSearchModel model) + { + if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue) + { + return null; + } + return _source.Shops + .FirstOrDefault(x => +(!string.IsNullOrEmpty(model.Name) && x.ShopName == +model.Name) || + (model.Id.HasValue && x.Id == model.Id)) + ?.GetViewModel; + } + public ShopViewModel? Insert(ShopBindingModel model) + { + model.Id = _source.Shops.Count > 0 ? _source.Shops.Max(x => +x.Id) + 1 : 1; + var newShop = Shop.Create(model); + if (newShop == null) + { + return null; + } + _source.Shops.Add(newShop); + _source.SaveShops(); + return newShop.GetViewModel; + } + public ShopViewModel? Update(ShopBindingModel model) + { + var component = _source.Shops.FirstOrDefault(x => x.Id == +model.Id); + if (component == null) + { + return null; + } + component.Update(model); + _source.SaveShops(); + return component.GetViewModel; + } + public ShopViewModel? Delete(ShopBindingModel model) + { + var element = _source.Shops.FirstOrDefault(x => x.Id == + model.Id); + if (element != null) + { + _source.Shops.Remove(element); + _source.SaveShops(); + return element.GetViewModel; + } + return null; + } + + public bool CheckAvailability(int iceCreamId, int count) + { + int minus = _source.Shops.Select(x => x.ShopIceCreams.Select(y => (y.Value.Item1.Id == iceCreamId ? y.Value.Item2 : 0)).Sum()).Sum(); + count -= minus; + return count <= 0; + } + + public bool SellIceCreams(IIceCreamModel model, int count) + { + var iceCream = _source.IceCreams.FirstOrDefault(x => x.Id == model.Id); + + if (iceCream == null || !CheckAvailability(iceCream.Id, count)) + { + return false; + } + + for (int i = 0; i < _source.Shops.Count; i++) + { + var shop = _source.Shops[i]; + var icecreams = shop.ShopIceCreams; + + foreach (var icecream in icecreams.Where(x => x.Value.Item1.Id == iceCream.Id)) + { + var min = Math.Min(icecream.Value.Item2, count); + icecreams[icecream.Value.Item1.Id] = (icecream.Value.Item1, icecream.Value.Item2 - min); + count -= min; + + if (count <= 0) + { + break; + } + } + + shop.Update(new ShopBindingModel + { + Id = shop.Id, + ShopName = shop.ShopName, + Address = shop.Address, + DateOpen = shop.DateOpen, + MaxCapacity = shop.MaxCapacity, + ShopIceCreams = icecreams + }); + } + _source.SaveShops(); + return true; + } + + } +} diff --git a/IceCreamShop/IceCreamShopFileImplement/Models/Shop.cs b/IceCreamShop/IceCreamShopFileImplement/Models/Shop.cs new file mode 100644 index 0000000..10d6f24 --- /dev/null +++ b/IceCreamShop/IceCreamShopFileImplement/Models/Shop.cs @@ -0,0 +1,118 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.ViewModels; +using IceCreamShopDataModels.Models; +using IceCreamShopFileImplement; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Threading.Tasks.Dataflow; +using System.Xml.Linq; + +namespace IceCreamShopFileImplement.Models +{ + public class Shop : IShopModel + { + public int Id { get; private set; } + public string ShopName { get; private set; } + public string Address { get; private set; } + public DateTime DateOpen { get; private set; } + public Dictionary IceCreams { get; private set; } = new(); + private Dictionary? _shopIceCreams = +null; + public Dictionary ShopIceCreams + { + get + { + if (_shopIceCreams == null) + { + var source = DataFileSingleton.GetInstance(); + _shopIceCreams = IceCreams.ToDictionary(x => x.Key, y => + ((source.IceCreams.FirstOrDefault(z => z.Id == y.Key) as IIceCreamModel)!, + y.Value)); + } + return _shopIceCreams; + } + } + + public int MaxCapacity { get; private set; } + + public static Shop? Create(ShopBindingModel model) + { + if (model == null) + return null; + return new Shop() + { + Id = model.Id, + ShopName = model.ShopName, + Address = model.Address, + DateOpen = model.DateOpen, + MaxCapacity = model.MaxCapacity, + IceCreams = model.ShopIceCreams.ToDictionary(x => x.Key, x => x.Value.Item2) + }; + } + + public static Shop? Create(XElement element) + { + if (element == null) + { + return null; + } + return new Shop() + { + Id = Convert.ToInt32(element.Attribute("Id")!.Value), + ShopName = element.Element("ShopName")!.Value, + Address = element.Element("Address")!.Value, + MaxCapacity = Convert.ToInt32(element.Element("MaxCapacity")!.Value), + DateOpen = Convert.ToDateTime(element.Element("DateOpen")!.Value), + IceCreams = + element.Element("ShopIceCreams")!.Elements("ShopIceCream") + .ToDictionary(x => + Convert.ToInt32(x.Element("Key")?.Value), x => + Convert.ToInt32(x.Element("Value")?.Value)) + }; + } + + + public void Update(ShopBindingModel model) + { + if (model == null) + { + return; + } + ShopName = model.ShopName; + Address = model.Address; + DateOpen = model.DateOpen; + MaxCapacity = model.MaxCapacity; + if (model.ShopIceCreams.Count > 0) + { + IceCreams = model.ShopIceCreams.ToDictionary(x => x.Key, x => x.Value.Item2); + _shopIceCreams = null; + } + } + + public ShopViewModel GetViewModel => new() + { + Id = Id, + ShopName = ShopName, + Address = Address, + DateOpen = DateOpen, + MaxCapacity = MaxCapacity, + ShopIceCreams = ShopIceCreams + }; + + public XElement GetXElement => new("Shop", + new XAttribute("Id", Id), + new XElement("ShopName", ShopName), + new XElement("Address", Address), + new XElement("DateOpen", DateOpen), + new XElement("MaxCapacity", MaxCapacity), + new XElement("ShopIceCreams", IceCreams + .Select(x => new XElement("ShopIceCream", + new XElement("Key", x.Key), + new XElement("Value", x.Value)) + ).ToArray())); + } +} diff --git a/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs b/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs index 0d6e6ea..06b9cc4 100644 --- a/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs +++ b/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs @@ -106,5 +106,64 @@ namespace IceCreamShopListImplement.Implements return null; } + public bool CheckAvailability(int iceCreamId, int count) + { + foreach (var shop in _source.Shops) + { + foreach (var icecream in shop.ShopIceCreams) + { + if (icecream.Value.Item1.Id == iceCreamId) + { + count -= icecream.Value.Item2; + } + if (count <= 0) + { + break; + } + } + } + + return count <= 0; + } + + public bool SellIceCreams(IIceCreamModel model, int count) + { + var iceCream = _source.IceCreams.FirstOrDefault(x => x.Id == model.Id); + + if (iceCream == null || !CheckAvailability(iceCream.Id, count)) + { + return false; + } + + for (int i = 0; i < _source.Shops.Count; i++) + { + var shop = _source.Shops[i]; + var icecreams = shop.ShopIceCreams; + + foreach (var icecream in icecreams.Where(x => x.Value.Item1.Id == iceCream.Id)) + { + var min = Math.Min(icecream.Value.Item2, count); + icecreams[icecream.Value.Item1.Id] = (icecream.Value.Item1, icecream.Value.Item2 - min); + count -= min; + + if (count <= 0) + { + break; + } + } + + shop.Update(new ShopBindingModel + { + Id = shop.Id, + ShopName = shop.ShopName, + Address = shop.Address, + DateOpen = shop.DateOpen, + MaxCapacity = shop.MaxCapacity, + ShopIceCreams = icecreams + }); + } + return true; + } + } } diff --git a/IceCreamShop/IceCreamShopListImplement/Models/Shop.cs b/IceCreamShop/IceCreamShopListImplement/Models/Shop.cs index 239004a..fd5f34c 100644 --- a/IceCreamShop/IceCreamShopListImplement/Models/Shop.cs +++ b/IceCreamShop/IceCreamShopListImplement/Models/Shop.cs @@ -16,6 +16,7 @@ namespace IceCreamShopListImplement.Models public string ShopName { get; private set; } public string Address { get; private set; } public DateTime DateOpen { get; private set; } + public int MaxCapacity { get; private set; } public Dictionary ShopIceCreams { get; private set; } = new(); public static Shop? Create (ShopBindingModel model) -- 2.25.1 From b9dfa72660cc00f5c47a594bb193bb3c4fb370ea Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Tue, 5 Mar 2024 11:56:13 +0400 Subject: [PATCH 09/23] =?UTF-8?q?=D0=A1=D0=B4=D0=B0=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs | 2 +- .../IceCreamShopFileImplement/Implements/ShopStorage.cs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs index 78c7efc..83cd6e2 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs @@ -136,7 +136,7 @@ namespace IceCreamShopBusinessLogic.BusinessLogic _logger.LogWarning("Status change operation failed"); throw new InvalidOperationException("Текущий статус заказа не может быть переведен в выбранный"); } - if(status == OrderStatus.Готов) + if(element.Status == OrderStatus.Готов) { var icecream = _iceCreamStorage.GetElement(new IceCreamSearchModel() { Id = model.IceCreamId }); if (icecream == null) diff --git a/IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs b/IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs index 70c2277..2f26478 100644 --- a/IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs +++ b/IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs @@ -114,6 +114,10 @@ model.Id); { var min = Math.Min(icecream.Value.Item2, count); icecreams[icecream.Value.Item1.Id] = (icecream.Value.Item1, icecream.Value.Item2 - min); + if(icecreams[icecream.Value.Item1.Id].Item2 == 0) + { + icecreams.Remove(icecream.Value.Item1.Id); + } count -= min; if (count <= 0) -- 2.25.1 From c94d96c6bcba0f752a6b92073ea040bd09c31d10 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Tue, 5 Mar 2024 11:58:55 +0400 Subject: [PATCH 10/23] =?UTF-8?q?=D0=B0=D0=BB=D0=B2=D0=B4=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IceCreamShopFileImplement/Implements/ShopStorage.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs b/IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs index 2f26478..70c2277 100644 --- a/IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs +++ b/IceCreamShop/IceCreamShopFileImplement/Implements/ShopStorage.cs @@ -114,10 +114,6 @@ model.Id); { var min = Math.Min(icecream.Value.Item2, count); icecreams[icecream.Value.Item1.Id] = (icecream.Value.Item1, icecream.Value.Item2 - min); - if(icecreams[icecream.Value.Item1.Id].Item2 == 0) - { - icecreams.Remove(icecream.Value.Item1.Id); - } count -= min; if (count <= 0) -- 2.25.1 From dc0f2d734699c39ba2a72112eecb772fca8addaa Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Tue, 5 Mar 2024 12:55:43 +0400 Subject: [PATCH 11/23] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/ShopStorage.cs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs b/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs index 06b9cc4..c43b674 100644 --- a/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs +++ b/IceCreamShop/IceCreamShopListImplement/Implements/ShopStorage.cs @@ -108,21 +108,8 @@ namespace IceCreamShopListImplement.Implements public bool CheckAvailability(int iceCreamId, int count) { - foreach (var shop in _source.Shops) - { - foreach (var icecream in shop.ShopIceCreams) - { - if (icecream.Value.Item1.Id == iceCreamId) - { - count -= icecream.Value.Item2; - } - if (count <= 0) - { - break; - } - } - } - + int minus = _source.Shops.Select(x => x.ShopIceCreams.Select(y => (y.Value.Item1.Id == iceCreamId ? y.Value.Item2 : 0)).Sum()).Sum(); + count -= minus; return count <= 0; } -- 2.25.1 From 749d98cd26a55088718b83bb94bc967b95ef021d Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Tue, 5 Mar 2024 13:09:33 +0400 Subject: [PATCH 12/23] =?UTF-8?q?=D0=9D=D0=A3=D0=96=D0=9D=D0=9E=20=D0=91?= =?UTF-8?q?=D0=9E=D0=9B=D0=AC=D0=A8=D0=95=20=D0=9B=D0=98=D0=9D=D0=9A=20?= =?UTF-8?q?=D0=97=D0=90=D0=9F=D0=A0=D0=9E=D0=A1=D0=9E=D0=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogic/OrderLogic.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs index 83cd6e2..b1de8d2 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/OrderLogic.cs @@ -67,15 +67,11 @@ namespace IceCreamShopBusinessLogic.BusinessLogic return false; } - int freeSpace = 0; - foreach (var shop in _shopStorage.GetFullList()) - { - freeSpace += shop.MaxCapacity; - foreach (var doc in shop.ShopIceCreams) - { - freeSpace -= doc.Value.Item2; - } - } + int sumCapacity = 0; + int sumCount = 0; + sumCapacity = _shopStorage.GetFullList().Select(x => x.MaxCapacity).Sum(); + sumCount = _shopStorage.GetFullList().Select(x => x.ShopIceCreams.Select(y => y.Value.Item2).Sum()).Sum(); + int freeSpace = sumCapacity - sumCount; if (freeSpace - count < 0) { -- 2.25.1 From 7949f9dbd6d34595291356eff4f6e48263eb3287 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Mon, 18 Mar 2024 19:22:56 +0400 Subject: [PATCH 13/23] Ready --- .../IceCreamShopDataBase.cs | 2 + .../Implements/OrderStorage.cs | 8 +- .../Implements/ShopStorage.cs | 153 ++++++++++++++++++ ... 20240318151414_InitialCreate.Designer.cs} | 81 +++++++++- ...ate.cs => 20240318151414_InitialCreate.cs} | 59 +++++++ .../IceCreamShopDataBaseModelSnapshot.cs | 79 +++++++++ .../Models/IceCream.cs | 4 +- .../Models/Shop.cs | 118 ++++++++++++++ .../Models/ShopIceCream.cs | 22 +++ 9 files changed, 520 insertions(+), 6 deletions(-) create mode 100644 IceCreamShop/IceCreamShopDatabaseImplement/Implements/ShopStorage.cs rename IceCreamShop/IceCreamShopDatabaseImplement/Migrations/{20240318125446_InitialCreate.Designer.cs => 20240318151414_InitialCreate.Designer.cs} (67%) rename IceCreamShop/IceCreamShopDatabaseImplement/Migrations/{20240318125446_InitialCreate.cs => 20240318151414_InitialCreate.cs} (66%) create mode 100644 IceCreamShop/IceCreamShopDatabaseImplement/Models/Shop.cs create mode 100644 IceCreamShop/IceCreamShopDatabaseImplement/Models/ShopIceCream.cs diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/IceCreamShopDataBase.cs b/IceCreamShop/IceCreamShopDatabaseImplement/IceCreamShopDataBase.cs index 6b30208..980fa74 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/IceCreamShopDataBase.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/IceCreamShopDataBase.cs @@ -24,6 +24,8 @@ optionsBuilder) public virtual DbSet IceCreams { set; get; } public virtual DbSet IceCreamComponents { set; get; } public virtual DbSet Orders { set; get; } + public virtual DbSet Shops { set; get; } + public virtual DbSet ShopIceCreams { set; get; } } } diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Implements/OrderStorage.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Implements/OrderStorage.cs index 450324f..5502922 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Implements/OrderStorage.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Implements/OrderStorage.cs @@ -28,7 +28,7 @@ namespace IceCreamShopDatabaseImplement.Implements return new(); } using var context = new IceCreamShopDataBase(); - return context.Orders + return context.Orders.Include(x => x.IceCream) .Where(x => x.Id == model.Id) .Select(x => x.GetViewModel) .ToList(); @@ -40,7 +40,7 @@ namespace IceCreamShopDatabaseImplement.Implements return null; } using var context = new IceCreamShopDataBase(); - return context.Orders.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; + return context.Orders.Include(x => x.IceCream).FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; } public OrderViewModel? Insert(OrderBindingModel model) { @@ -57,7 +57,7 @@ namespace IceCreamShopDatabaseImplement.Implements public OrderViewModel? Update(OrderBindingModel model) { using var context = new IceCreamShopDataBase(); - var order = context.Orders.FirstOrDefault(x => x.Id == + var order = context.Orders.Include(x => x.IceCream).FirstOrDefault(x => x.Id == model.Id); if (order == null) { @@ -70,7 +70,7 @@ namespace IceCreamShopDatabaseImplement.Implements public OrderViewModel? Delete(OrderBindingModel model) { using var context = new IceCreamShopDataBase(); - var element = context.Orders.FirstOrDefault(rec => rec.Id == + var element = context.Orders.Include(x => x.IceCream).FirstOrDefault(rec => rec.Id == model.Id); if (element != null) { diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Implements/ShopStorage.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Implements/ShopStorage.cs new file mode 100644 index 0000000..d9054e8 --- /dev/null +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Implements/ShopStorage.cs @@ -0,0 +1,153 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.SearchModels; +using IceCreamShopContracts.StoragesContracts; +using IceCreamShopContracts.ViewModels; +using IceCreamShopDatabaseImplement.Models; +using IceCreamShopDataModels.Models; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopDatabaseImplement.Implements +{ + public class ShopStorage : IShopStorage + { + public ShopViewModel? Delete(ShopBindingModel model) + { + using var context = new IceCreamShopDataBase(); + var element = context.Shops.FirstOrDefault(x => x.Id == model.Id); + if (element != null) + { + context.Shops.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + + public ShopViewModel? GetElement(ShopSearchModel model) + { + if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue) + { + return null; + } + using var context = new IceCreamShopDataBase(); + return context.Shops + .Include(x => x.IceCreams) + .ThenInclude(x => x.IceCream) + .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id) + ?.GetViewModel; + } + + public List GetFilteredList(ShopSearchModel model) + { + if (string.IsNullOrEmpty(model.Name)) + { + return new(); + } + using var context = new IceCreamShopDataBase(); + return context.Shops + .Include(x => x.IceCreams) + .ThenInclude(x => x.IceCream) + .Select(x => x.GetViewModel) + .Where(x => x.ShopName.Contains(model.Name ?? string.Empty)) + .ToList(); + } + + public List GetFullList() + { + using var context = new IceCreamShopDataBase(); + return context.Shops + .Include(x => x.IceCreams) + .ThenInclude(x => x.IceCream) + .Select(x => x.GetViewModel) + .ToList(); + } + + public ShopViewModel? Insert(ShopBindingModel model) + { + using var context = new IceCreamShopDataBase(); + try + { + var newShop = Shop.Create(context, model); + if (newShop == null) + { + return null; + } + if (context.Shops.Any(x => x.ShopName == newShop.ShopName)) + { + throw new Exception("Не должно быть два магазина с одним названием"); + } + context.Shops.Add(newShop); + context.SaveChanges(); + return newShop.GetViewModel; + } + catch + { + throw; + } + } + + public ShopViewModel? Update(ShopBindingModel model) + { + using var context = new IceCreamShopDataBase(); + var shop = context.Shops.FirstOrDefault(x => x.Id == model.Id); + if (shop == null) + { + return null; + } + try + { + if (context.Shops.Any(x => (x.ShopName == model.ShopName && x.Id != model.Id))) + { + throw new Exception("Не должно быть два магазина с одним названием"); + } + shop.Update(model); + shop.UpdateIceCreams(context, model); + context.SaveChanges(); + return shop.GetViewModel; + } + catch + { + throw; + } + } + public bool SellIceCreams(IIceCreamModel model, int count) + { + if (model == null) + return false; + using var context = new IceCreamShopDataBase(); + using var transaction = context.Database.BeginTransaction(); + List lst = new List(); + foreach(var el in context.ShopIceCreams.Where(x => x.IceCreamId == model.Id)) + { + int dif = count; + if (el.Count < dif) + dif = el.Count; + el.Count -= dif; + count -= dif; + if(el.Count == 0) + { + lst.Add(el); + } + if (count == 0) + break; + } + if (count > 0) + { + transaction.Rollback(); + return false; + } + foreach(var el in lst) + { + context.ShopIceCreams.Remove(el); + } + context.SaveChanges(); + transaction.Commit(); + return true; + } + } +} diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318125446_InitialCreate.Designer.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318151414_InitialCreate.Designer.cs similarity index 67% rename from IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318125446_InitialCreate.Designer.cs rename to IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318151414_InitialCreate.Designer.cs index 38becf5..b1e15d4 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318125446_InitialCreate.Designer.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318151414_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace IceCreamShopDatabaseImplement.Migrations { [DbContext(typeof(IceCreamShopDataBase))] - [Migration("20240318125446_InitialCreate")] + [Migration("20240318151414_InitialCreate")] partial class InitialCreate { /// @@ -124,6 +124,59 @@ namespace IceCreamShopDatabaseImplement.Migrations b.ToTable("Orders"); }); + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Shop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateOpen") + .HasColumnType("datetime2"); + + b.Property("MaxCapacity") + .HasColumnType("int"); + + b.Property("ShopName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Shops"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.ShopIceCream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("IceCreamId") + .HasColumnType("int"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IceCreamId"); + + b.HasIndex("ShopId"); + + b.ToTable("ShopIceCreams"); + }); + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCreamComponent", b => { b.HasOne("IceCreamShopDatabaseImplement.Models.Component", "Component") @@ -154,6 +207,25 @@ namespace IceCreamShopDatabaseImplement.Migrations b.Navigation("IceCream"); }); + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.ShopIceCream", b => + { + b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream") + .WithMany("ShopIceCreams") + .HasForeignKey("IceCreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IceCreamShopDatabaseImplement.Models.Shop", "Shop") + .WithMany("IceCreams") + .HasForeignKey("ShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IceCream"); + + b.Navigation("Shop"); + }); + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Component", b => { b.Navigation("IceCreamComponents"); @@ -164,6 +236,13 @@ namespace IceCreamShopDatabaseImplement.Migrations b.Navigation("Components"); b.Navigation("Orders"); + + b.Navigation("ShopIceCreams"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Shop", b => + { + b.Navigation("IceCreams"); }); #pragma warning restore 612, 618 } diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318125446_InitialCreate.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318151414_InitialCreate.cs similarity index 66% rename from IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318125446_InitialCreate.cs rename to IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318151414_InitialCreate.cs index ae61479..1110d17 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318125446_InitialCreate.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318151414_InitialCreate.cs @@ -39,6 +39,22 @@ namespace IceCreamShopDatabaseImplement.Migrations table.PrimaryKey("PK_IceCreams", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Shops", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ShopName = table.Column(type: "nvarchar(max)", nullable: false), + Address = table.Column(type: "nvarchar(max)", nullable: false), + DateOpen = table.Column(type: "datetime2", nullable: false), + MaxCapacity = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Shops", x => x.Id); + }); + migrationBuilder.CreateTable( name: "IceCreamComponents", columns: table => new @@ -90,6 +106,33 @@ namespace IceCreamShopDatabaseImplement.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "ShopIceCreams", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + IceCreamId = table.Column(type: "int", nullable: false), + ShopId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShopIceCreams", x => x.Id); + table.ForeignKey( + name: "FK_ShopIceCreams_IceCreams_IceCreamId", + column: x => x.IceCreamId, + principalTable: "IceCreams", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShopIceCreams_Shops_ShopId", + column: x => x.ShopId, + principalTable: "Shops", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateIndex( name: "IX_IceCreamComponents_ComponentId", table: "IceCreamComponents", @@ -104,6 +147,16 @@ namespace IceCreamShopDatabaseImplement.Migrations name: "IX_Orders_IceCreamId", table: "Orders", column: "IceCreamId"); + + migrationBuilder.CreateIndex( + name: "IX_ShopIceCreams_IceCreamId", + table: "ShopIceCreams", + column: "IceCreamId"); + + migrationBuilder.CreateIndex( + name: "IX_ShopIceCreams_ShopId", + table: "ShopIceCreams", + column: "ShopId"); } /// @@ -115,11 +168,17 @@ namespace IceCreamShopDatabaseImplement.Migrations migrationBuilder.DropTable( name: "Orders"); + migrationBuilder.DropTable( + name: "ShopIceCreams"); + migrationBuilder.DropTable( name: "Components"); migrationBuilder.DropTable( name: "IceCreams"); + + migrationBuilder.DropTable( + name: "Shops"); } } } diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/IceCreamShopDataBaseModelSnapshot.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/IceCreamShopDataBaseModelSnapshot.cs index 8400a67..01924ff 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/IceCreamShopDataBaseModelSnapshot.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/IceCreamShopDataBaseModelSnapshot.cs @@ -121,6 +121,59 @@ namespace IceCreamShopDatabaseImplement.Migrations b.ToTable("Orders"); }); + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Shop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateOpen") + .HasColumnType("datetime2"); + + b.Property("MaxCapacity") + .HasColumnType("int"); + + b.Property("ShopName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Shops"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.ShopIceCream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("IceCreamId") + .HasColumnType("int"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IceCreamId"); + + b.HasIndex("ShopId"); + + b.ToTable("ShopIceCreams"); + }); + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.IceCreamComponent", b => { b.HasOne("IceCreamShopDatabaseImplement.Models.Component", "Component") @@ -151,6 +204,25 @@ namespace IceCreamShopDatabaseImplement.Migrations b.Navigation("IceCream"); }); + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.ShopIceCream", b => + { + b.HasOne("IceCreamShopDatabaseImplement.Models.IceCream", "IceCream") + .WithMany("ShopIceCreams") + .HasForeignKey("IceCreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("IceCreamShopDatabaseImplement.Models.Shop", "Shop") + .WithMany("IceCreams") + .HasForeignKey("ShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IceCream"); + + b.Navigation("Shop"); + }); + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Component", b => { b.Navigation("IceCreamComponents"); @@ -161,6 +233,13 @@ namespace IceCreamShopDatabaseImplement.Migrations b.Navigation("Components"); b.Navigation("Orders"); + + b.Navigation("ShopIceCreams"); + }); + + modelBuilder.Entity("IceCreamShopDatabaseImplement.Models.Shop", b => + { + b.Navigation("IceCreams"); }); #pragma warning restore 612, 618 } diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Models/IceCream.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Models/IceCream.cs index f2f42c6..ccfe8fa 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Models/IceCream.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Models/IceCream.cs @@ -38,6 +38,8 @@ namespace IceCreamShopDatabaseImplement.Models public virtual List Components { get; set; } = new(); [ForeignKey("IceCreamId")] public virtual List Orders { get; set; } = new(); + [ForeignKey("IceCreamId")] + public virtual List ShopIceCreams { get; set; } = new(); public static IceCream Create(IceCreamShopDataBase context, IceCreamBindingModel model) { @@ -71,7 +73,7 @@ namespace IceCreamShopDatabaseImplement.Models { var iceCreamComponents = context.IceCreamComponents.Where(rec => rec.IceCreamId == model.Id).ToList(); - if (iceCreamComponents != null && IceCreamComponents.Count > 0) + if (iceCreamComponents != null && iceCreamComponents.Count > 0) { context.IceCreamComponents.RemoveRange(iceCreamComponents.Where(rec => !model.IceCreamComponents.ContainsKey(rec.ComponentId))); diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Models/Shop.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Models/Shop.cs new file mode 100644 index 0000000..ae308a7 --- /dev/null +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Models/Shop.cs @@ -0,0 +1,118 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.ViewModels; +using IceCreamShopDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopDatabaseImplement.Models +{ + public class Shop : IShopModel + { + public int Id { get; private set; } + [Required] + public string ShopName { get; private set; } + [Required] + public string Address { get; private set; } + [Required] + public DateTime DateOpen { get; private set; } + [Required] + public int MaxCapacity { get; private set; } + private Dictionary? _shopIceCreams = + null; + [NotMapped] + public Dictionary ShopIceCreams + { + get + { + if (_shopIceCreams == null) + { + _shopIceCreams = IceCreams + .ToDictionary(x => x.IceCreamId, x => + (x.IceCream as IIceCreamModel, x.Count)); + } + return _shopIceCreams; + } + } + [ForeignKey("ShopId")] + public virtual List IceCreams { get; set; } = new(); + public static Shop? Create(IceCreamShopDataBase context, ShopBindingModel model) + { + if (model == null) + return null; + return new Shop() + { + Id = model.Id, + ShopName = model.ShopName, + Address = model.Address, + DateOpen = model.DateOpen, + MaxCapacity = model.MaxCapacity, + IceCreams = model.ShopIceCreams.Select(x => new + ShopIceCream + { + IceCream = context.IceCreams.First(y => y.Id == x.Key), + Count = x.Value.Item2 + }).ToList() + }; + } + + public void Update(ShopBindingModel? model) + { + if (model == null) + { + return; + } + ShopName = model.ShopName; + Address = model.Address; + DateOpen = model.DateOpen; + MaxCapacity = model.MaxCapacity; + } + + public ShopViewModel GetViewModel => new() + { + Id = Id, + ShopName = ShopName, + Address = Address, + DateOpen = DateOpen, + ShopIceCreams = ShopIceCreams, + MaxCapacity = MaxCapacity + }; + + public void UpdateIceCreams(IceCreamShopDataBase context, + ShopBindingModel model) + { + var shopIceCreams = context.ShopIceCreams.Where(rec => + rec.ShopId == model.Id).ToList(); + if (shopIceCreams != null && shopIceCreams.Count > 0) + { + context.ShopIceCreams.RemoveRange(shopIceCreams.Where(rec +=> !model.ShopIceCreams.ContainsKey(rec.ShopId))); + + context.SaveChanges(); + foreach (var updateIceCream in shopIceCreams) + { + updateIceCream.Count = + model.ShopIceCreams[updateIceCream.IceCreamId].Item2; + model.ShopIceCreams.Remove(updateIceCream.IceCreamId); + } + context.SaveChanges(); + } + var shop = context.Shops.First(x => x.Id == Id); + foreach (var pc in model.ShopIceCreams) + { + context.ShopIceCreams.Add(new ShopIceCream + { + Shop = shop, + IceCream = context.IceCreams.First(x => x.Id == pc.Key), + Count = pc.Value.Item2 + }); + context.SaveChanges(); + } + _shopIceCreams = null; + } + } +} diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Models/ShopIceCream.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Models/ShopIceCream.cs new file mode 100644 index 0000000..42fbd6d --- /dev/null +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Models/ShopIceCream.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopDatabaseImplement.Models +{ + public class ShopIceCream + { + public int Id { get; set; } + [Required] + public int IceCreamId { get; set; } + [Required] + public int ShopId { get; set; } + [Required] + public int Count { get; set; } + public virtual Shop Shop { get; set; } = new(); + public virtual IceCream IceCream { get; set; } = new(); + } +} -- 2.25.1 From 7dbe4f7475b8ed26c90212e91f57d15fd69bebab Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Sun, 24 Mar 2024 11:51:50 +0400 Subject: [PATCH 14/23] =?UTF-8?q?=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IceCreamShopDatabaseImplement/IceCreamShopDataBase.cs | 2 +- ...ate.Designer.cs => 20240324074257_InitialCreate.Designer.cs} | 2 +- ...8151414_InitialCreate.cs => 20240324074257_InitialCreate.cs} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename IceCreamShop/IceCreamShopDatabaseImplement/Migrations/{20240318151414_InitialCreate.Designer.cs => 20240324074257_InitialCreate.Designer.cs} (99%) rename IceCreamShop/IceCreamShopDatabaseImplement/Migrations/{20240318151414_InitialCreate.cs => 20240324074257_InitialCreate.cs} (100%) diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/IceCreamShopDataBase.cs b/IceCreamShop/IceCreamShopDatabaseImplement/IceCreamShopDataBase.cs index 980fa74..afccb5a 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/IceCreamShopDataBase.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/IceCreamShopDataBase.cs @@ -16,7 +16,7 @@ optionsBuilder) { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=IceCreamShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=IceCreamShopHardDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318151414_InitialCreate.Designer.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240324074257_InitialCreate.Designer.cs similarity index 99% rename from IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318151414_InitialCreate.Designer.cs rename to IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240324074257_InitialCreate.Designer.cs index b1e15d4..4f4df90 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318151414_InitialCreate.Designer.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240324074257_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace IceCreamShopDatabaseImplement.Migrations { [DbContext(typeof(IceCreamShopDataBase))] - [Migration("20240318151414_InitialCreate")] + [Migration("20240324074257_InitialCreate")] partial class InitialCreate { /// diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318151414_InitialCreate.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240324074257_InitialCreate.cs similarity index 100% rename from IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240318151414_InitialCreate.cs rename to IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240324074257_InitialCreate.cs -- 2.25.1 From 71a50a0a2155771b8ac8b978a8a0133a7e80a687 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Sun, 24 Mar 2024 16:41:52 +0400 Subject: [PATCH 15/23] =?UTF-8?q?=D0=BD=D0=B0=D1=87=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IceCreamShop/MainForm.Designer.cs | 89 +++++++++---------- .../20240324074257_InitialCreate.Designer.cs | 5 +- 2 files changed, 44 insertions(+), 50 deletions(-) diff --git a/IceCreamShop/IceCreamShop/MainForm.Designer.cs b/IceCreamShop/IceCreamShop/MainForm.Designer.cs index 3227836..ec22665 100644 --- a/IceCreamShop/IceCreamShop/MainForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/MainForm.Designer.cs @@ -34,6 +34,7 @@ МороженноеStripMenuItem = new ToolStripMenuItem(); магазиныToolStripMenuItem = new ToolStripMenuItem(); поставкиToolStripMenuItem = new ToolStripMenuItem(); + продажиToolStripMenuItem = new ToolStripMenuItem(); отчетыToolStripMenuItem = new ToolStripMenuItem(); списокМороженногоToolStripMenuItem = new ToolStripMenuItem(); компонентыПоМороженнымToolStripMenuItem = new ToolStripMenuItem(); @@ -44,7 +45,6 @@ ReadyButton = new Button(); IssuedButton = new Button(); RefreshButton = new Button(); - продажиToolStripMenuItem = new ToolStripMenuItem(); menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit(); SuspendLayout(); @@ -55,8 +55,8 @@ menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenu, отчетыToolStripMenuItem }); menuStrip1.Location = new Point(0, 0); menuStrip1.Name = "menuStrip1"; - menuStrip1.Padding = new Padding(6, 3, 0, 3); - menuStrip1.Size = new Size(1296, 30); + menuStrip1.Padding = new Padding(7, 4, 0, 4); + menuStrip1.Size = new Size(1290, 32); menuStrip1.TabIndex = 0; menuStrip1.Text = "menuStrip1"; // @@ -64,23 +64,44 @@ // ToolStripMenu.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыStripMenuItem, МороженноеStripMenuItem, магазиныToolStripMenuItem, поставкиToolStripMenuItem, продажиToolStripMenuItem }); ToolStripMenu.Name = "ToolStripMenu"; - ToolStripMenu.Size = new Size(94, 20); + ToolStripMenu.Size = new Size(117, 24); ToolStripMenu.Text = "Справочники"; // // КомпонентыStripMenuItem // КомпонентыStripMenuItem.Name = "КомпонентыStripMenuItem"; - КомпонентыStripMenuItem.Size = new Size(180, 22); + КомпонентыStripMenuItem.Size = new Size(186, 26); КомпонентыStripMenuItem.Text = "Компоненты"; КомпонентыStripMenuItem.Click += КомпонентыStripMenuItem_Click; // // МороженноеStripMenuItem // МороженноеStripMenuItem.Name = "МороженноеStripMenuItem"; - МороженноеStripMenuItem.Size = new Size(180, 22); + МороженноеStripMenuItem.Size = new Size(186, 26); МороженноеStripMenuItem.Text = "Мороженное"; МороженноеStripMenuItem.Click += МороженноеStripMenuItem_Click; // + // магазиныToolStripMenuItem + // + магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem"; + магазиныToolStripMenuItem.Size = new Size(186, 26); + магазиныToolStripMenuItem.Text = "Магазины"; + магазиныToolStripMenuItem.Click += магазиныToolStripMenuItem_Click; + // + // поставкиToolStripMenuItem + // + поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem"; + поставкиToolStripMenuItem.Size = new Size(186, 26); + поставкиToolStripMenuItem.Text = "Поставки"; + поставкиToolStripMenuItem.Click += поставкиToolStripMenuItem_Click; + // + // продажиToolStripMenuItem + // + продажиToolStripMenuItem.Name = "продажиToolStripMenuItem"; + продажиToolStripMenuItem.Size = new Size(186, 26); + продажиToolStripMenuItem.Text = "Продажи"; + продажиToolStripMenuItem.Click += продажиToolStripMenuItem_Click; + // // отчетыToolStripMenuItem // отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокМороженногоToolStripMenuItem, компонентыПоМороженнымToolStripMenuItem, списокЗаказовToolStripMenuItem }); @@ -109,35 +130,21 @@ списокЗаказовToolStripMenuItem.Text = "Список заказов"; списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click; // - // магазиныToolStripMenuItem - // - магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem"; - магазиныToolStripMenuItem.Size = new Size(180, 22); - магазиныToolStripMenuItem.Text = "Магазины"; - магазиныToolStripMenuItem.Click += магазиныToolStripMenuItem_Click; - // - // поставкиToolStripMenuItem - // - поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem"; - поставкиToolStripMenuItem.Size = new Size(180, 22); - поставкиToolStripMenuItem.Text = "Поставки"; - поставкиToolStripMenuItem.Click += поставкиToolStripMenuItem_Click; - // // DataGridView // DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - DataGridView.Location = new Point(11, 31); + DataGridView.Location = new Point(13, 41); + DataGridView.Margin = new Padding(3, 4, 3, 4); DataGridView.Name = "DataGridView"; DataGridView.RowHeadersWidth = 51; - DataGridView.Size = new Size(881, 305); + DataGridView.Size = new Size(1007, 407); DataGridView.TabIndex = 1; // // CreateOrderButton // - CreateOrderButton.Location = new Point(897, 23); - CreateOrderButton.Margin = new Padding(3, 2, 3, 2); + CreateOrderButton.Location = new Point(1025, 31); CreateOrderButton.Name = "CreateOrderButton"; - CreateOrderButton.Size = new Size(227, 22); + CreateOrderButton.Size = new Size(259, 29); CreateOrderButton.TabIndex = 2; CreateOrderButton.Text = "Создать заказ"; CreateOrderButton.UseVisualStyleBackColor = true; @@ -145,9 +152,10 @@ // // TakeInWorkButton // - TakeInWorkButton.Location = new Point(1025, 67); + TakeInWorkButton.Location = new Point(1026, 65); + TakeInWorkButton.Margin = new Padding(3, 4, 3, 4); TakeInWorkButton.Name = "TakeInWorkButton"; - TakeInWorkButton.Size = new Size(227, 22); + TakeInWorkButton.Size = new Size(259, 29); TakeInWorkButton.TabIndex = 3; TakeInWorkButton.Text = "Отдать заказ в работу"; TakeInWorkButton.UseVisualStyleBackColor = true; @@ -155,10 +163,9 @@ // // ReadyButton // - ReadyButton.Location = new Point(897, 76); - ReadyButton.Margin = new Padding(3, 2, 3, 2); + ReadyButton.Location = new Point(1025, 101); ReadyButton.Name = "ReadyButton"; - ReadyButton.Size = new Size(227, 22); + ReadyButton.Size = new Size(259, 29); ReadyButton.TabIndex = 4; ReadyButton.Text = "Заказ готов"; ReadyButton.UseVisualStyleBackColor = true; @@ -166,10 +173,9 @@ // // IssuedButton // - IssuedButton.Location = new Point(897, 102); - IssuedButton.Margin = new Padding(3, 2, 3, 2); + IssuedButton.Location = new Point(1025, 136); IssuedButton.Name = "IssuedButton"; - IssuedButton.Size = new Size(227, 22); + IssuedButton.Size = new Size(259, 29); IssuedButton.TabIndex = 5; IssuedButton.Text = "Заказ выдан"; IssuedButton.UseVisualStyleBackColor = true; @@ -177,27 +183,19 @@ // // RefreshButton // - RefreshButton.Location = new Point(897, 128); - RefreshButton.Margin = new Padding(3, 2, 3, 2); + RefreshButton.Location = new Point(1025, 171); RefreshButton.Name = "RefreshButton"; - RefreshButton.Size = new Size(227, 22); + RefreshButton.Size = new Size(259, 29); RefreshButton.TabIndex = 6; RefreshButton.Text = "Обновить"; RefreshButton.UseVisualStyleBackColor = true; RefreshButton.Click += RefreshButton_Click; // - // продажиToolStripMenuItem - // - продажиToolStripMenuItem.Name = "продажиToolStripMenuItem"; - продажиToolStripMenuItem.Size = new Size(180, 22); - продажиToolStripMenuItem.Text = "Продажи"; - продажиToolStripMenuItem.Click += продажиToolStripMenuItem_Click; - // // MainForm // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1296, 451); + ClientSize = new Size(1290, 476); Controls.Add(RefreshButton); Controls.Add(IssuedButton); Controls.Add(ReadyButton); @@ -206,7 +204,6 @@ Controls.Add(DataGridView); Controls.Add(menuStrip1); MainMenuStrip = menuStrip1; - Margin = new Padding(3, 2, 3, 2); Name = "MainForm"; Text = "Форма главная"; Load += MainForm_Load; diff --git a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240324074257_InitialCreate.Designer.cs b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240324074257_InitialCreate.Designer.cs index 777e3bf..a298d4a 100644 --- a/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240324074257_InitialCreate.Designer.cs +++ b/IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240324074257_InitialCreate.Designer.cs @@ -12,11 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace IceCreamShopDatabaseImplement.Migrations { [DbContext(typeof(IceCreamShopDataBase))] -<<<<<<<< HEAD:IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240324075315_InitialCreate.Designer.cs - [Migration("20240324075315_InitialCreate")] -======== [Migration("20240324074257_InitialCreate")] ->>>>>>>> Lab3_Hard:IceCreamShop/IceCreamShopDatabaseImplement/Migrations/20240324074257_InitialCreate.Designer.cs + partial class InitialCreate { /// -- 2.25.1 From 801c2b0846c38bdf8d108d0bf689af4393e910f9 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Sun, 24 Mar 2024 18:46:06 +0400 Subject: [PATCH 16/23] =?UTF-8?q?=D0=B1=D0=B5=D0=B7=20=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D0=BE=D1=87=D0=BA=D0=B8=20=D0=BF=D0=B4=D1=84=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IceCreamShop/MainForm.Designer.cs | 28 +++- IceCreamShop/IceCreamShop/MainForm.cs | 24 ++++ IceCreamShop/IceCreamShop/Program.cs | 1 + .../ReportShopsIceCreamsForm.Designer.cs | 103 ++++++++++++++ .../IceCreamShop/ReportShopsIceCreamsForm.cs | 93 +++++++++++++ .../ReportShopsIceCreamsForm.resx | 129 ++++++++++++++++++ .../BusinessLogic/ReportLogic.cs | 65 ++++++++- .../OfficePackage/AbstractSaveToExcel.cs | 64 +++++++++ .../OfficePackage/AbstractSaveToPdf.cs | 33 +++++ .../OfficePackage/AbstractSaveToWord.cs | 31 ++++- .../OfficePackage/HelperModels/ExcelInfo.cs | 6 +- .../OfficePackage/HelperModels/PdfInfo.cs | 1 + .../OfficePackage/HelperModels/WordInfo.cs | 1 + .../OfficePackage/HelperModels/WordTable.cs | 16 +++ .../OfficePackage/Implements/SaveToWord.cs | 77 +++++++++++ .../BusinessLogicsContracts/IReportLogic.cs | 5 + .../ViewModels/ReportDateOrdersViewModel.cs | 15 ++ .../ViewModels/ReportShopIceCreamViewModel.cs | 15 ++ 18 files changed, 703 insertions(+), 4 deletions(-) create mode 100644 IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.Designer.cs create mode 100644 IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.cs create mode 100644 IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.resx create mode 100644 IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/WordTable.cs create mode 100644 IceCreamShop/IceCreamShopContracts/ViewModels/ReportDateOrdersViewModel.cs create mode 100644 IceCreamShop/IceCreamShopContracts/ViewModels/ReportShopIceCreamViewModel.cs diff --git a/IceCreamShop/IceCreamShop/MainForm.Designer.cs b/IceCreamShop/IceCreamShop/MainForm.Designer.cs index ec22665..42fbbd5 100644 --- a/IceCreamShop/IceCreamShop/MainForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/MainForm.Designer.cs @@ -39,6 +39,9 @@ списокМороженногоToolStripMenuItem = new ToolStripMenuItem(); компонентыПоМороженнымToolStripMenuItem = new ToolStripMenuItem(); списокЗаказовToolStripMenuItem = new ToolStripMenuItem(); + списокМагазиновToolStripMenuItem = new ToolStripMenuItem(); + мороженноеПоМагазинамToolStripMenuItem = new ToolStripMenuItem(); + заказыПоДатамToolStripMenuItem = new ToolStripMenuItem(); DataGridView = new DataGridView(); CreateOrderButton = new Button(); TakeInWorkButton = new Button(); @@ -104,7 +107,7 @@ // // отчетыToolStripMenuItem // - отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокМороженногоToolStripMenuItem, компонентыПоМороженнымToolStripMenuItem, списокЗаказовToolStripMenuItem }); + отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокМороженногоToolStripMenuItem, компонентыПоМороженнымToolStripMenuItem, списокЗаказовToolStripMenuItem, списокМагазиновToolStripMenuItem, мороженноеПоМагазинамToolStripMenuItem, заказыПоДатамToolStripMenuItem }); отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; отчетыToolStripMenuItem.Size = new Size(73, 24); отчетыToolStripMenuItem.Text = "Отчеты"; @@ -130,6 +133,26 @@ списокЗаказовToolStripMenuItem.Text = "Список заказов"; списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click; // + // списокМагазиновToolStripMenuItem + // + списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem"; + списокМагазиновToolStripMenuItem.Size = new Size(305, 26); + списокМагазиновToolStripMenuItem.Text = "Список магазинов"; + списокМагазиновToolStripMenuItem.Click += списокМагазиновToolStripMenuItem_Click; + // + // мороженноеПоМагазинамToolStripMenuItem + // + мороженноеПоМагазинамToolStripMenuItem.Name = "мороженноеПоМагазинамToolStripMenuItem"; + мороженноеПоМагазинамToolStripMenuItem.Size = new Size(305, 26); + мороженноеПоМагазинамToolStripMenuItem.Text = "Мороженное по магазинам"; + мороженноеПоМагазинамToolStripMenuItem.Click += мороженноеПоМагазинамToolStripMenuItem_Click; + // + // заказыПоДатамToolStripMenuItem + // + заказыПоДатамToolStripMenuItem.Name = "заказыПоДатамToolStripMenuItem"; + заказыПоДатамToolStripMenuItem.Size = new Size(305, 26); + заказыПоДатамToolStripMenuItem.Text = "Заказы по датам"; + // // DataGridView // DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; @@ -233,5 +256,8 @@ private ToolStripMenuItem магазиныToolStripMenuItem; private ToolStripMenuItem поставкиToolStripMenuItem; private ToolStripMenuItem продажиToolStripMenuItem; + private ToolStripMenuItem списокМагазиновToolStripMenuItem; + private ToolStripMenuItem мороженноеПоМагазинамToolStripMenuItem; + private ToolStripMenuItem заказыПоДатамToolStripMenuItem; } } \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/MainForm.cs b/IceCreamShop/IceCreamShop/MainForm.cs index fd7e8de..f3c5551 100644 --- a/IceCreamShop/IceCreamShop/MainForm.cs +++ b/IceCreamShop/IceCreamShop/MainForm.cs @@ -247,5 +247,29 @@ Program.ServiceProvider?.GetService(typeof(ReportOrdersForm)); } } + + private void списокМагазиновToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveShopsToWordFile(new ReportBindingModel + { + FileName = dialog.FileName + }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + } + + private void мороженноеПоМагазинамToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = +Program.ServiceProvider?.GetService(typeof(ReportShopsIceCreamsForm)); + if (service is ReportShopsIceCreamsForm form) + { + form.ShowDialog(); + } + } } } diff --git a/IceCreamShop/IceCreamShop/Program.cs b/IceCreamShop/IceCreamShop/Program.cs index 603ef77..06cea4e 100644 --- a/IceCreamShop/IceCreamShop/Program.cs +++ b/IceCreamShop/IceCreamShop/Program.cs @@ -55,6 +55,7 @@ namespace IceCreamShop services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.Designer.cs b/IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.Designer.cs new file mode 100644 index 0000000..b8d8fed --- /dev/null +++ b/IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.Designer.cs @@ -0,0 +1,103 @@ +namespace IceCreamShop +{ + partial class ReportShopsIceCreamsForm + { + /// + /// 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(); + ShopColumn = new DataGridViewTextBoxColumn(); + IceCreamColumn = new DataGridViewTextBoxColumn(); + CountColumn = new DataGridViewTextBoxColumn(); + SaveButton = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ShopColumn, IceCreamColumn, CountColumn }); + dataGridView.Location = new Point(12, 64); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(682, 374); + dataGridView.TabIndex = 0; + // + // ShopColumn + // + ShopColumn.HeaderText = "Магазин"; + ShopColumn.MinimumWidth = 6; + ShopColumn.Name = "ShopColumn"; + ShopColumn.Width = 250; + // + // IceCreamColumn + // + IceCreamColumn.HeaderText = "Мороженное"; + IceCreamColumn.MinimumWidth = 6; + IceCreamColumn.Name = "IceCreamColumn"; + IceCreamColumn.Width = 250; + // + // CountColumn + // + CountColumn.HeaderText = "Количество"; + CountColumn.MinimumWidth = 6; + CountColumn.Name = "CountColumn"; + CountColumn.Width = 125; + // + // SaveButton + // + SaveButton.Location = new Point(12, 29); + SaveButton.Name = "SaveButton"; + SaveButton.Size = new Size(108, 29); + SaveButton.TabIndex = 1; + SaveButton.Text = "Сохранить в"; + SaveButton.UseVisualStyleBackColor = true; + SaveButton.Click += SaveButton_Click_1; + // + // ReportShopsIceCreamsForm + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(702, 450); + Controls.Add(SaveButton); + Controls.Add(dataGridView); + Name = "ReportShopsIceCreamsForm"; + Text = "ReportShopsIceCreamsForm"; + Load += ReportShopsIceCreamsForm_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Button SaveButton; + private DataGridViewTextBoxColumn ShopColumn; + private DataGridViewTextBoxColumn IceCreamColumn; + private DataGridViewTextBoxColumn CountColumn; + } +} \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.cs b/IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.cs new file mode 100644 index 0000000..8eae605 --- /dev/null +++ b/IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.cs @@ -0,0 +1,93 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.BusinessLogicsContracts; +using Microsoft.Extensions.Logging; +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 IceCreamShop +{ + public partial class ReportShopsIceCreamsForm : Form + { + private readonly ILogger _logger; + private readonly IReportLogic _logic; + + public ReportShopsIceCreamsForm(ILogger +logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + + } + + private void ReportShopsIceCreamsForm_Load(object sender, EventArgs e) + { + try + { + var dict = _logic.GetShopsIceCreams(); + if (dict != null) + { + dataGridView.Rows.Clear(); + foreach (var elem in dict) + { + dataGridView.Rows.Add(new object[] { elem.ShopName, +"", "" }); + foreach (var listElem in elem.IceCreams) + { + dataGridView.Rows.Add(new object[] { "", +listElem.Item1, listElem.Item2 }); + } + dataGridView.Rows.Add(new object[] { "Итого", "", +elem.TotalCount }); + dataGridView.Rows.Add(Array.Empty()); + } + } + _logger.LogInformation("Загрузка списка мороженных по магазинам"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки списка мороженных по магазинам"); + + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + + } + private void SaveButton_Click_1(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog + { + Filter = "xlsx|*.xlsx" + }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + _logic.SaveShopsIceCreamsToExcelFile(new + ReportBindingModel + { + FileName = dialog.FileName + }); + _logger.LogInformation("Сохранение списка мороженных по магазинам"); + + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка сохранения списка мороженных по магазинам"); + + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } + } +} diff --git a/IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.resx b/IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.resx new file mode 100644 index 0000000..51eccb4 --- /dev/null +++ b/IceCreamShop/IceCreamShop/ReportShopsIceCreamsForm.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + \ No newline at end of file diff --git a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ReportLogic.cs b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ReportLogic.cs index 08903f4..d295693 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ReportLogic.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/BusinessLogic/ReportLogic.cs @@ -18,17 +18,19 @@ namespace IceCreamShopBusinessLogic.BusinessLogic private readonly IComponentStorage _componentStorage; private readonly IIceCreamStorage _iceCreamStorage; private readonly IOrderStorage _orderStorage; + private readonly IShopStorage _shopStorage; private readonly AbstractSaveToExcel _saveToExcel; private readonly AbstractSaveToWord _saveToWord; private readonly AbstractSaveToPdf _saveToPdf; public ReportLogic(IIceCreamStorage iceCreamStorage, IComponentStorage - componentStorage, IOrderStorage orderStorage, + componentStorage, IOrderStorage orderStorage, IShopStorage shopStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf) { _iceCreamStorage = iceCreamStorage; _componentStorage = componentStorage; _orderStorage = orderStorage; + _shopStorage = shopStorage; _saveToExcel = saveToExcel; _saveToWord = saveToWord; _saveToPdf = saveToPdf; @@ -56,6 +58,67 @@ namespace IceCreamShopBusinessLogic.BusinessLogic } return list; } + + public List GetShopsIceCreams() + { + var shops = _shopStorage.GetFullList(); + var list = new List(); + foreach (var shop in shops) + { + var record = new ReportShopIceCreamViewModel + { + ShopName = shop.ShopName, + IceCreams = new List>(), + TotalCount = 0 + }; + foreach (var iceCream in shop.ShopIceCreams) + { + record.IceCreams.Add(new Tuple(iceCream.Value.Item1.IceCreamName, iceCream.Value.Item2)); + record.TotalCount += + iceCream.Value.Item2; + } + list.Add(record); + } + return list; + } + public List GetDatesOrders() + { + return _orderStorage.GetFullList().GroupBy(x => x.DateCreate.Date).Select(x => new ReportDateOrdersViewModel + { + DateOfOrders = x.Key, + Count = x.Count(), + Sum = x.Sum(y => y.Sum) + }).ToList(); + } + public void SaveDatesOrdersToPdfFile(ReportBindingModel model) + { + _saveToPdf.CreateReportDateDoc(new PdfInfo + { + FileName = model.FileName, + Title = "Заказы по датам", + DateOrders = GetDatesOrders() + }); + } + public void SaveShopsToWordFile(ReportBindingModel model) + { + var tmp = _shopStorage.GetFullList(); + _saveToWord.CreateTableDoc(new WordInfo + { + FileName = model.FileName, + Title = "Список магазинов", + Shops = _shopStorage.GetFullList() + }); + } + public void SaveShopsIceCreamsToExcelFile(ReportBindingModel model) + { + _saveToExcel.CreateShopReport(new ExcelInfo + { + FileName = model.FileName, + Title = "Загруженность магазинов", + ShopIceCreams = GetShopsIceCreams() + }); + } public List GetOrders(ReportBindingModel model) { return _orderStorage.GetFilteredList(new OrderSearchModel diff --git a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs index 43f6ab6..3a8100c 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -74,6 +74,70 @@ namespace IceCreamShopBusinessLogic.OfficePackage } SaveExcel(info); } + public void CreateShopReport(ExcelInfo info) + { + CreateExcel(info); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = 1, + Text = info.Title, + StyleInfo = ExcelStyleInfoType.Title + }); + MergeCells(new ExcelMergeParameters + { + CellFromName = "A1", + CellToName = "C1" + }); + uint rowIndex = 2; + foreach (var pc in info.ShopIceCreams) + { + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = rowIndex, + Text = pc.ShopName, + StyleInfo = ExcelStyleInfoType.Text + }); + rowIndex++; + foreach (var iceCream in pc.IceCreams) + { + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "B", + RowIndex = rowIndex, + Text = iceCream.Item1, + StyleInfo = + ExcelStyleInfoType.TextWithBroder + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "C", + RowIndex = rowIndex, + Text = iceCream.Item2.ToString(), + StyleInfo = + ExcelStyleInfoType.TextWithBroder + }); + rowIndex++; + } + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = rowIndex, + Text = "Итого", + StyleInfo = ExcelStyleInfoType.Text + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "C", + RowIndex = rowIndex, + Text = pc.TotalCount.ToString(), + StyleInfo = ExcelStyleInfoType.Text + }); + rowIndex++; + } + SaveExcel(info); + } protected abstract void CreateExcel(ExcelInfo info); protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams); diff --git a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs index fd21c8c..c296017 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -53,6 +53,39 @@ order.DateCreate.ToShortDateString(), order.IceCreamName, order.Sum.ToString(), }); SavePdf(info); } + public void CreateReportDateDoc(PdfInfo info) + { + CreatePdf(info); + CreateParagraph(new PdfParagraph + { + Text = info.Title, + Style = "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + CreateTable(new List { "3cm", "3cm", "7cm" }); + CreateRow(new PdfRowParameters + { + Texts = new List { "Дата", "Количество", "Сумма" }, + Style = "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + foreach (var order in info.DateOrders) + { + CreateRow(new PdfRowParameters + { + Texts = new List { order.DateOfOrders.ToShortDateString(), order.Count.ToString(), order.Sum.ToString() }, + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Left + }); + } + CreateParagraph(new PdfParagraph + { + Text = $"Итого: {info.DateOrders.Sum(x => x.Sum)}\t", + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + SavePdf(info); + } protected abstract void CreatePdf(PdfInfo info); protected abstract void CreateParagraph(PdfParagraph paragraph); protected abstract void CreateTable(List columns); diff --git a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs index 1498d75..cd2f636 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -1,4 +1,5 @@ -using IceCreamShopBusinessLogic.OfficePackage.HelperEnums; +using DocumentFormat.OpenXml.Office2010.ExcelAc; +using IceCreamShopBusinessLogic.OfficePackage.HelperEnums; using IceCreamShopBusinessLogic.OfficePackage.HelperModels; using System; using System.Collections.Generic; @@ -40,8 +41,36 @@ WordTextProperties { Bold = true, Size = "24", }) }, } SaveWord(info); } + + public void CreateTableDoc(WordInfo info) + { + CreateWord(info); + List> list = new List>(); + foreach (var shop in info.Shops) + { + var ls = new List + { + shop.ShopName, + shop.Address, + shop.DateOpen.ToShortDateString() + }; + list.Add(ls); + } + var wordTable = new WordTable + { + Headers = new List { + "Название", + "Адрес", + "Дата открытия"}, + Columns = 3, + RowText = list + }; + CreateTable(wordTable); + SaveWord(info); + } protected abstract void CreateWord(WordInfo info); protected abstract void CreateParagraph(WordParagraph paragraph); + protected abstract void CreateTable(WordTable table); protected abstract void SaveWord(WordInfo info); } diff --git a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs index f863cff..4648738 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs @@ -16,6 +16,10 @@ namespace IceCreamShopBusinessLogic.OfficePackage.HelperModels get; set; } = new(); - + public List ShopIceCreams + { + get; + set; + } = new(); } } diff --git a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs index 2986518..2df3f5b 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs @@ -14,5 +14,6 @@ namespace IceCreamShopBusinessLogic.OfficePackage.HelperModels public DateTime DateFrom { get; set; } public DateTime DateTo { get; set; } public List Orders { get; set; } = new(); + public List DateOrders { get; set; } = new(); } } diff --git a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs index f00edda..208a045 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs @@ -12,5 +12,6 @@ namespace IceCreamShopBusinessLogic.OfficePackage.HelperModels public string FileName { get; set; } = string.Empty; public string Title { get; set; } = string.Empty; public List IceCreams { get; set; } = new(); + public List Shops { get; set; } = new(); } } diff --git a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/WordTable.cs b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/WordTable.cs new file mode 100644 index 0000000..2abf431 --- /dev/null +++ b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/HelperModels/WordTable.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopBusinessLogic.OfficePackage.HelperModels +{ + public class WordTable + { + public List Headers { get; set; } = new(); + public List> RowText { get; set; } = new(); + public int Columns { get; set; } + } +} diff --git a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/Implements/SaveToWord.cs b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/Implements/SaveToWord.cs index 82d730e..2092e18 100644 --- a/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/Implements/SaveToWord.cs +++ b/IceCreamShop/IceCreamShopBusinessLogic/OfficePackage/Implements/SaveToWord.cs @@ -117,5 +117,82 @@ namespace IceCreamShopBusinessLogic.OfficePackage.Implements _wordDocument.Dispose(); } + + protected override void CreateTable(WordTable table) + { + if (_docBody == null || table == null) + { + return; + } + Table docTable = new Table(); + TableProperties tableProps = new TableProperties( + new TopBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + }, + new BottomBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + }, + new LeftBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + }, + new RightBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + }, + new InsideHorizontalBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + }, + new InsideVerticalBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + }); + docTable.AppendChild(tableProps); + TableGrid tableGrid = new TableGrid(); + for (int i = 0; i < table.Columns; i++) + { + tableGrid.AppendChild(new GridColumn()); + } + docTable.AppendChild(tableGrid); + TableRow tableRow = new TableRow(); + foreach (var text in table.Headers) + { + tableRow.AppendChild(CreateTableCell(text)); + } + int height = table.RowText.Count; + int width = table.Columns; + for (int i = 0; i < height; i++) + { + tableRow = new TableRow(); + for (int j = 0; j < width; j++) + { + var element = table.RowText[i][j]; + tableRow.AppendChild(CreateTableCell(element)); + } + docTable.AppendChild(tableRow); + } + + _docBody.AppendChild(docTable); + } + + private TableCell CreateTableCell(string element) + { + var tableParagraph = new Paragraph(); + var run = new Run(); + run.AppendChild(new Text { Text = element }); + tableParagraph.AppendChild(run); + var tableCell = new TableCell(); + tableCell.AppendChild(tableParagraph); + return tableCell; + } } } diff --git a/IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IReportLogic.cs b/IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IReportLogic.cs index 4657c15..e81041f 100644 --- a/IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IReportLogic.cs +++ b/IceCreamShop/IceCreamShopContracts/BusinessLogicsContracts/IReportLogic.cs @@ -12,8 +12,13 @@ namespace IceCreamShopContracts.BusinessLogicsContracts { List GetIceCreamComponent(); List GetOrders(ReportBindingModel model); + List GetDatesOrders(); + List GetShopsIceCreams(); void SaveIceCreamToWordFile(ReportBindingModel model); void SaveIceCreamComponentToExcelFile(ReportBindingModel model); void SaveOrdersToPdfFile(ReportBindingModel model); + void SaveShopsToWordFile(ReportBindingModel model); + void SaveShopsIceCreamsToExcelFile(ReportBindingModel model); + void SaveDatesOrdersToPdfFile(ReportBindingModel model); } } diff --git a/IceCreamShop/IceCreamShopContracts/ViewModels/ReportDateOrdersViewModel.cs b/IceCreamShop/IceCreamShopContracts/ViewModels/ReportDateOrdersViewModel.cs new file mode 100644 index 0000000..834c977 --- /dev/null +++ b/IceCreamShop/IceCreamShopContracts/ViewModels/ReportDateOrdersViewModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopContracts.ViewModels +{ + public class ReportDateOrdersViewModel + { + public DateTime DateOfOrders { get; set; } + public int Count { get; set; } + public double Sum { get; set; } + } +} diff --git a/IceCreamShop/IceCreamShopContracts/ViewModels/ReportShopIceCreamViewModel.cs b/IceCreamShop/IceCreamShopContracts/ViewModels/ReportShopIceCreamViewModel.cs new file mode 100644 index 0000000..a33f11d --- /dev/null +++ b/IceCreamShop/IceCreamShopContracts/ViewModels/ReportShopIceCreamViewModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IceCreamShopContracts.ViewModels +{ + public class ReportShopIceCreamViewModel + { + public string ShopName { get; set; } = string.Empty; + public int TotalCount { get; set; } + public List> IceCreams { get; set; } = new(); + } +} -- 2.25.1 From e9f66a28a1c1f93352711857493670913b1e0542 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Sun, 24 Mar 2024 19:08:25 +0400 Subject: [PATCH 17/23] ready --- .../IceCreamShop/MainForm.Designer.cs | 1 + IceCreamShop/IceCreamShop/MainForm.cs | 10 + IceCreamShop/IceCreamShop/Program.cs | 1 + .../ReportDateOrdersForm.Designer.cs | 82 ++++ .../IceCreamShop/ReportDateOrdersForm.cs | 77 ++++ .../IceCreamShop/ReportDateOrdersForm.resx | 120 ++++++ .../IceCreamShop/ReportOrdersByDate.rdlc | 400 ++++++++++++++++++ .../ReportShopsIceCreamsForm.Designer.cs | 2 +- 8 files changed, 692 insertions(+), 1 deletion(-) create mode 100644 IceCreamShop/IceCreamShop/ReportDateOrdersForm.Designer.cs create mode 100644 IceCreamShop/IceCreamShop/ReportDateOrdersForm.cs create mode 100644 IceCreamShop/IceCreamShop/ReportDateOrdersForm.resx create mode 100644 IceCreamShop/IceCreamShop/ReportOrdersByDate.rdlc diff --git a/IceCreamShop/IceCreamShop/MainForm.Designer.cs b/IceCreamShop/IceCreamShop/MainForm.Designer.cs index 42fbbd5..784fd19 100644 --- a/IceCreamShop/IceCreamShop/MainForm.Designer.cs +++ b/IceCreamShop/IceCreamShop/MainForm.Designer.cs @@ -152,6 +152,7 @@ заказыПоДатамToolStripMenuItem.Name = "заказыПоДатамToolStripMenuItem"; заказыПоДатамToolStripMenuItem.Size = new Size(305, 26); заказыПоДатамToolStripMenuItem.Text = "Заказы по датам"; + заказыПоДатамToolStripMenuItem.Click += заказыПоДатамToolStripMenuItem_Click; // // DataGridView // diff --git a/IceCreamShop/IceCreamShop/MainForm.cs b/IceCreamShop/IceCreamShop/MainForm.cs index f3c5551..993218b 100644 --- a/IceCreamShop/IceCreamShop/MainForm.cs +++ b/IceCreamShop/IceCreamShop/MainForm.cs @@ -271,5 +271,15 @@ Program.ServiceProvider?.GetService(typeof(ReportShopsIceCreamsForm)); form.ShowDialog(); } } + + private void заказыПоДатамToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = +Program.ServiceProvider?.GetService(typeof(ReportDateOrdersForm)); + if (service is ReportDateOrdersForm form) + { + form.ShowDialog(); + } + } } } diff --git a/IceCreamShop/IceCreamShop/Program.cs b/IceCreamShop/IceCreamShop/Program.cs index 06cea4e..4859f6d 100644 --- a/IceCreamShop/IceCreamShop/Program.cs +++ b/IceCreamShop/IceCreamShop/Program.cs @@ -56,6 +56,7 @@ namespace IceCreamShop services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/IceCreamShop/IceCreamShop/ReportDateOrdersForm.Designer.cs b/IceCreamShop/IceCreamShop/ReportDateOrdersForm.Designer.cs new file mode 100644 index 0000000..25c1a26 --- /dev/null +++ b/IceCreamShop/IceCreamShop/ReportDateOrdersForm.Designer.cs @@ -0,0 +1,82 @@ +namespace IceCreamShop +{ + partial class ReportDateOrdersForm + { + /// + /// 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() + { + panel = new Panel(); + MakeButton = new Button(); + ToPdfButton = new Button(); + SuspendLayout(); + // + // panel + // + panel.Location = new Point(12, 71); + panel.Name = "panel"; + panel.Size = new Size(776, 367); + panel.TabIndex = 0; + // + // MakeButton + // + MakeButton.Location = new Point(12, 36); + MakeButton.Name = "MakeButton"; + MakeButton.Size = new Size(131, 29); + MakeButton.TabIndex = 1; + MakeButton.Text = "Сформировать"; + MakeButton.UseVisualStyleBackColor = true; + MakeButton.Click += MakeButton_Click; + // + // ToPdfButton + // + ToPdfButton.Location = new Point(149, 36); + ToPdfButton.Name = "ToPdfButton"; + ToPdfButton.Size = new Size(94, 29); + ToPdfButton.TabIndex = 2; + ToPdfButton.Text = "В PDF"; + ToPdfButton.UseVisualStyleBackColor = true; + ToPdfButton.Click += ToPdfButton_Click; + // + // ReportDateOrdersForm + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(ToPdfButton); + Controls.Add(MakeButton); + Controls.Add(panel); + Name = "ReportDateOrdersForm"; + Text = "Заказы по датам"; + ResumeLayout(false); + } + + #endregion + + private Panel panel; + private Button MakeButton; + private Button ToPdfButton; + } +} \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/ReportDateOrdersForm.cs b/IceCreamShop/IceCreamShop/ReportDateOrdersForm.cs new file mode 100644 index 0000000..5c82422 --- /dev/null +++ b/IceCreamShop/IceCreamShop/ReportDateOrdersForm.cs @@ -0,0 +1,77 @@ +using IceCreamShopContracts.BindingModels; +using IceCreamShopContracts.BusinessLogicsContracts; +using Microsoft.Extensions.Logging; +using Microsoft.Reporting.WinForms; +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 IceCreamShop +{ + public partial class ReportDateOrdersForm : Form + { + private readonly ReportViewer reportViewer; + + private readonly ILogger _logger; + + private readonly IReportLogic _logic; + public ReportDateOrdersForm(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + reportViewer = new ReportViewer + { + Dock = DockStyle.Fill + }; + reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrdersByDate.rdlc", FileMode.Open)); + panel.Controls.Add(reportViewer); + } + + private void MakeButton_Click(object sender, EventArgs e) + { + try + { + var dataSource = _logic.GetDatesOrders(); + var source = new ReportDataSource("DataSetOrders", dataSource); + reportViewer.LocalReport.DataSources.Clear(); + reportViewer.LocalReport.DataSources.Add(source); + reportViewer.RefreshReport(); + _logger.LogInformation("Загрузка списка заказов на весь период по датам"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки списка заказов на период"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ToPdfButton_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + _logic.SaveDatesOrdersToPdfFile(new ReportBindingModel + { + FileName = dialog.FileName + }); + _logger.LogInformation("Сохранение списка заказов на весь период по датам"); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка сохранения списка заказов на период"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + } +} diff --git a/IceCreamShop/IceCreamShop/ReportDateOrdersForm.resx b/IceCreamShop/IceCreamShop/ReportDateOrdersForm.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/IceCreamShop/IceCreamShop/ReportDateOrdersForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/IceCreamShop/IceCreamShop/ReportOrdersByDate.rdlc b/IceCreamShop/IceCreamShop/ReportOrdersByDate.rdlc new file mode 100644 index 0000000..f7156f4 --- /dev/null +++ b/IceCreamShop/IceCreamShop/ReportOrdersByDate.rdlc @@ -0,0 +1,400 @@ + + + + + + true + true + + + + + Заказы + + + + + + + 0.24cm + 1cm + 21cm + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + 3cm + + + 3cm + + + 7cm + + + + + 0.6cm + + + + + true + true + + + + + Дата + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Количество + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Сумма + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + =Fields!DateOfOrders.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Count.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Sum.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSetOrders + 2.72391cm + 0.55245cm + 1.2cm + 13cm + 1 + + + + + + true + true + + + + + Всего: + + + + + + + 4.24cm + 8.55245cm + 0.6cm + 2.5cm + 2 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Sum(Fields!Sum.Value, "DataSetOrders") + + + + + + + 4.24cm + 11.05245cm + 0.6cm + 2.5cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + 2in +