diff --git a/Confectionery/Confectionery/ConfectioneryView.csproj b/Confectionery/Confectionery/ConfectioneryView.csproj index 8c9a910..96b207b 100644 --- a/Confectionery/Confectionery/ConfectioneryView.csproj +++ b/Confectionery/Confectionery/ConfectioneryView.csproj @@ -15,8 +15,6 @@ - - diff --git a/Confectionery/Confectionery/FormComponent.Designer.cs b/Confectionery/Confectionery/FormComponent.Designer.cs index 0ed973b..9694a57 100644 --- a/Confectionery/Confectionery/FormComponent.Designer.cs +++ b/Confectionery/Confectionery/FormComponent.Designer.cs @@ -39,7 +39,7 @@ // labelName // labelName.AutoSize = true; - labelName.Location = new Point(15, 19); + labelName.Location = new Point(16, 21); labelName.Name = "labelName"; labelName.Size = new Size(94, 25); labelName.TabIndex = 0; @@ -48,7 +48,7 @@ // labelCost // labelCost.AutoSize = true; - labelCost.Location = new Point(15, 71); + labelCost.Location = new Point(16, 66); labelCost.Name = "labelCost"; labelCost.Size = new Size(57, 25); labelCost.TabIndex = 1; @@ -56,7 +56,8 @@ // // buttonSave // - buttonSave.Location = new Point(339, 152); + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonSave.Location = new Point(336, 148); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(112, 34); buttonSave.TabIndex = 2; @@ -66,7 +67,8 @@ // // buttonCancel // - buttonCancel.Location = new Point(457, 152); + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.Location = new Point(454, 148); buttonCancel.Name = "buttonCancel"; buttonCancel.Size = new Size(112, 34); buttonCancel.TabIndex = 3; @@ -76,16 +78,18 @@ // // textBoxName // - textBoxName.Location = new Point(148, 17); + textBoxName.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + textBoxName.Location = new Point(170, 21); textBoxName.Name = "textBoxName"; - textBoxName.Size = new Size(421, 31); + textBoxName.Size = new Size(396, 31); textBoxName.TabIndex = 4; // // textBoxCost // - textBoxCost.Location = new Point(148, 69); + textBoxCost.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + textBoxCost.Location = new Point(170, 66); textBoxCost.Name = "textBoxCost"; - textBoxCost.Size = new Size(150, 31); + textBoxCost.Size = new Size(160, 31); textBoxCost.TabIndex = 5; // // FormComponent diff --git a/Confectionery/Confectionery/FormComponents.Designer.cs b/Confectionery/Confectionery/FormComponents.Designer.cs index d35152c..52508c7 100644 --- a/Confectionery/Confectionery/FormComponents.Designer.cs +++ b/Confectionery/Confectionery/FormComponents.Designer.cs @@ -38,9 +38,10 @@ // // buttonAdd // - buttonAdd.Location = new Point(676, 12); + buttonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonAdd.Location = new Point(754, 12); buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(112, 34); + buttonAdd.Size = new Size(112, 56); buttonAdd.TabIndex = 0; buttonAdd.Text = "Добавить"; buttonAdd.UseVisualStyleBackColor = true; @@ -48,9 +49,10 @@ // // buttonUpd // - buttonUpd.Location = new Point(676, 52); + buttonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonUpd.Location = new Point(754, 74); buttonUpd.Name = "buttonUpd"; - buttonUpd.Size = new Size(112, 34); + buttonUpd.Size = new Size(112, 56); buttonUpd.TabIndex = 1; buttonUpd.Text = "Изменить"; buttonUpd.UseVisualStyleBackColor = true; @@ -58,9 +60,10 @@ // // buttonDel // - buttonDel.Location = new Point(676, 92); + buttonDel.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonDel.Location = new Point(754, 198); buttonDel.Name = "buttonDel"; - buttonDel.Size = new Size(112, 34); + buttonDel.Size = new Size(112, 56); buttonDel.TabIndex = 2; buttonDel.Text = "Удалить"; buttonDel.UseVisualStyleBackColor = true; @@ -68,9 +71,10 @@ // // buttonRef // - buttonRef.Location = new Point(676, 132); + buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonRef.Location = new Point(754, 136); buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(112, 34); + buttonRef.Size = new Size(112, 56); buttonRef.TabIndex = 3; buttonRef.Text = "Обновить"; buttonRef.UseVisualStyleBackColor = true; @@ -78,23 +82,25 @@ // // dataGridView // + dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + dataGridView.BackgroundColor = SystemColors.Window; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(-1, -1); + dataGridView.Location = new Point(0, 0); dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 62; - dataGridView.Size = new Size(659, 451); + dataGridView.Size = new Size(742, 444); dataGridView.TabIndex = 4; // // FormComponents // AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(dataGridView); + ClientSize = new Size(878, 444); Controls.Add(buttonRef); Controls.Add(buttonDel); Controls.Add(buttonUpd); Controls.Add(buttonAdd); + Controls.Add(dataGridView); Name = "FormComponents"; Text = "Компоненты"; Load += FormComponents_Load; diff --git a/Confectionery/Confectionery/FormCreateOrder.Designer.cs b/Confectionery/Confectionery/FormCreateOrder.Designer.cs index 0902ec1..377b38d 100644 --- a/Confectionery/Confectionery/FormCreateOrder.Designer.cs +++ b/Confectionery/Confectionery/FormCreateOrder.Designer.cs @@ -67,6 +67,8 @@ // // comboBoxPastry // + comboBoxPastry.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + comboBoxPastry.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxPastry.FormattingEnabled = true; comboBoxPastry.Location = new Point(170, 21); comboBoxPastry.Name = "comboBoxPastry"; @@ -76,6 +78,7 @@ // // textBoxCount // + textBoxCount.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; textBoxCount.Location = new Point(170, 66); textBoxCount.Name = "textBoxCount"; textBoxCount.Size = new Size(396, 31); @@ -84,6 +87,7 @@ // // textBoxSum // + textBoxSum.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; textBoxSum.Location = new Point(170, 112); textBoxSum.Name = "textBoxSum"; textBoxSum.ReadOnly = true; @@ -92,7 +96,8 @@ // // buttonSave // - buttonSave.Location = new Point(336, 149); + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonSave.Location = new Point(336, 148); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(112, 34); buttonSave.TabIndex = 6; @@ -102,7 +107,8 @@ // // buttonCancel // - buttonCancel.Location = new Point(454, 149); + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.Location = new Point(454, 148); buttonCancel.Name = "buttonCancel"; buttonCancel.Size = new Size(112, 34); buttonCancel.TabIndex = 7; diff --git a/Confectionery/Confectionery/FormMain.Designer.cs b/Confectionery/Confectionery/FormMain.Designer.cs index 39f4a1a..f9b4147 100644 --- a/Confectionery/Confectionery/FormMain.Designer.cs +++ b/Confectionery/Confectionery/FormMain.Designer.cs @@ -36,26 +36,29 @@ buttonRef = new Button(); menuStrip = new MenuStrip(); referencesToolStripMenuItem = new ToolStripMenuItem(); - pastriesToolStripMenuItem = new ToolStripMenuItem(); componentsToolStripMenuItem = new ToolStripMenuItem(); + pastriesToolStripMenuItem = new ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); menuStrip.SuspendLayout(); SuspendLayout(); // // dataGridView // + dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + dataGridView.BackgroundColor = SystemColors.Window; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.Location = new Point(0, 36); dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 62; - dataGridView.Size = new Size(913, 414); + dataGridView.Size = new Size(1001, 406); dataGridView.TabIndex = 1; // // buttonCreateOrder // - buttonCreateOrder.Location = new Point(919, 47); + buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonCreateOrder.Location = new Point(1016, 36); buttonCreateOrder.Name = "buttonCreateOrder"; - buttonCreateOrder.Size = new Size(223, 34); + buttonCreateOrder.Size = new Size(126, 74); buttonCreateOrder.TabIndex = 3; buttonCreateOrder.Text = "Создать заказ"; buttonCreateOrder.UseVisualStyleBackColor = true; @@ -63,9 +66,10 @@ // // buttonTakeOrderInWork // - buttonTakeOrderInWork.Location = new Point(919, 87); + buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonTakeOrderInWork.Location = new Point(1016, 116); buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; - buttonTakeOrderInWork.Size = new Size(223, 34); + buttonTakeOrderInWork.Size = new Size(126, 74); buttonTakeOrderInWork.TabIndex = 4; buttonTakeOrderInWork.Text = "Отдать на выполнение"; buttonTakeOrderInWork.UseVisualStyleBackColor = true; @@ -73,9 +77,10 @@ // // buttonOrderReady // - buttonOrderReady.Location = new Point(919, 127); + buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonOrderReady.Location = new Point(1016, 196); buttonOrderReady.Name = "buttonOrderReady"; - buttonOrderReady.Size = new Size(223, 34); + buttonOrderReady.Size = new Size(126, 74); buttonOrderReady.TabIndex = 5; buttonOrderReady.Text = "Заказ готов"; buttonOrderReady.UseVisualStyleBackColor = true; @@ -83,9 +88,10 @@ // // buttonIssuedOrder // - buttonIssuedOrder.Location = new Point(919, 167); + buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonIssuedOrder.Location = new Point(1016, 276); buttonIssuedOrder.Name = "buttonIssuedOrder"; - buttonIssuedOrder.Size = new Size(223, 34); + buttonIssuedOrder.Size = new Size(126, 74); buttonIssuedOrder.TabIndex = 6; buttonIssuedOrder.Text = "Заказ выдан"; buttonIssuedOrder.UseVisualStyleBackColor = true; @@ -93,9 +99,10 @@ // // buttonRef // - buttonRef.Location = new Point(919, 207); + buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonRef.Location = new Point(1016, 356); buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(223, 34); + buttonRef.Size = new Size(126, 74); buttonRef.TabIndex = 7; buttonRef.Text = "Обновить список"; buttonRef.UseVisualStyleBackColor = true; @@ -103,11 +110,12 @@ // // menuStrip // + menuStrip.Dock = DockStyle.None; menuStrip.ImageScalingSize = new Size(24, 24); menuStrip.Items.AddRange(new ToolStripItem[] { referencesToolStripMenuItem }); menuStrip.Location = new Point(0, 0); menuStrip.Name = "menuStrip"; - menuStrip.Size = new Size(1154, 33); + menuStrip.Size = new Size(147, 33); menuStrip.TabIndex = 8; menuStrip.Text = "menuStrip1"; // @@ -118,13 +126,6 @@ referencesToolStripMenuItem.Size = new Size(139, 29); referencesToolStripMenuItem.Text = "Справочники"; // - // pastriesToolStripMenuItem - // - pastriesToolStripMenuItem.Name = "pastriesToolStripMenuItem"; - pastriesToolStripMenuItem.Size = new Size(298, 34); - pastriesToolStripMenuItem.Text = "Кондитерские изделия"; - pastriesToolStripMenuItem.Click += PastriesToolStripMenuItem_Click; - // // componentsToolStripMenuItem // componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; @@ -132,11 +133,18 @@ componentsToolStripMenuItem.Text = "Компоненты"; componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click; // + // pastriesToolStripMenuItem + // + pastriesToolStripMenuItem.Name = "pastriesToolStripMenuItem"; + pastriesToolStripMenuItem.Size = new Size(298, 34); + pastriesToolStripMenuItem.Text = "Кондитерские изделия"; + pastriesToolStripMenuItem.Click += PastriesToolStripMenuItem_Click; + // // FormMain // AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1154, 450); + ClientSize = new Size(1154, 442); Controls.Add(menuStrip); Controls.Add(buttonRef); Controls.Add(buttonIssuedOrder); diff --git a/Confectionery/Confectionery/FormPastries.Designer.cs b/Confectionery/Confectionery/FormPastries.Designer.cs index f631b79..bffc820 100644 --- a/Confectionery/Confectionery/FormPastries.Designer.cs +++ b/Confectionery/Confectionery/FormPastries.Designer.cs @@ -38,21 +38,24 @@ // // dataGridView // + dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + dataGridView.BackgroundColor = SystemColors.Window; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(2, 0); + dataGridView.Location = new Point(0, 0); dataGridView.Margin = new Padding(4); dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 51; dataGridView.RowTemplate.Height = 29; - dataGridView.Size = new Size(764, 565); + dataGridView.Size = new Size(742, 444); dataGridView.TabIndex = 0; // // buttonAdd // - buttonAdd.Location = new Point(774, 13); + buttonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonAdd.Location = new Point(754, 12); buttonAdd.Margin = new Padding(4); buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(123, 42); + buttonAdd.Size = new Size(112, 56); buttonAdd.TabIndex = 1; buttonAdd.Text = "Добавить"; buttonAdd.UseVisualStyleBackColor = true; @@ -60,10 +63,11 @@ // // buttonUpd // - buttonUpd.Location = new Point(774, 63); + buttonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonUpd.Location = new Point(754, 74); buttonUpd.Margin = new Padding(4); buttonUpd.Name = "buttonUpd"; - buttonUpd.Size = new Size(123, 45); + buttonUpd.Size = new Size(112, 56); buttonUpd.TabIndex = 2; buttonUpd.Text = "Изменить"; buttonUpd.UseVisualStyleBackColor = true; @@ -71,10 +75,11 @@ // // buttonDel // - buttonDel.Location = new Point(774, 116); + buttonDel.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonDel.Location = new Point(754, 198); buttonDel.Margin = new Padding(4); buttonDel.Name = "buttonDel"; - buttonDel.Size = new Size(123, 42); + buttonDel.Size = new Size(112, 56); buttonDel.TabIndex = 3; buttonDel.Text = "Удалить"; buttonDel.UseVisualStyleBackColor = true; @@ -82,10 +87,11 @@ // // buttonRef // - buttonRef.Location = new Point(774, 166); + buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonRef.Location = new Point(754, 136); buttonRef.Margin = new Padding(4); buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(123, 44); + buttonRef.Size = new Size(112, 56); buttonRef.TabIndex = 4; buttonRef.Text = "Обновить"; buttonRef.UseVisualStyleBackColor = true; @@ -95,7 +101,7 @@ // AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(905, 562); + ClientSize = new Size(878, 444); Controls.Add(buttonRef); Controls.Add(buttonDel); Controls.Add(buttonUpd); diff --git a/Confectionery/Confectionery/FormPastry.Designer.cs b/Confectionery/Confectionery/FormPastry.Designer.cs index e2d40a9..b6b2990 100644 --- a/Confectionery/Confectionery/FormPastry.Designer.cs +++ b/Confectionery/Confectionery/FormPastry.Designer.cs @@ -38,11 +38,11 @@ buttonUpd = new Button(); buttonAdd = new Button(); dataGridView = new DataGridView(); - buttonCancel = new Button(); - buttonSave = new Button(); id = new DataGridViewTextBoxColumn(); Component = new DataGridViewTextBoxColumn(); Count = new DataGridViewTextBoxColumn(); + buttonCancel = new Button(); + buttonSave = new Button(); groupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); @@ -50,7 +50,7 @@ // labelName // labelName.AutoSize = true; - labelName.Location = new Point(25, 24); + labelName.Location = new Point(16, 21); labelName.Name = "labelName"; labelName.Size = new Size(94, 25); labelName.TabIndex = 0; @@ -59,7 +59,7 @@ // labelPrice // labelPrice.AutoSize = true; - labelPrice.Location = new Point(25, 69); + labelPrice.Location = new Point(16, 66); labelPrice.Name = "labelPrice"; labelPrice.Size = new Size(103, 25); labelPrice.TabIndex = 1; @@ -67,37 +67,41 @@ // // textBoxName // - textBoxName.Location = new Point(189, 21); + textBoxName.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + textBoxName.Location = new Point(170, 21); textBoxName.Name = "textBoxName"; - textBoxName.Size = new Size(329, 31); + textBoxName.Size = new Size(396, 31); textBoxName.TabIndex = 2; // // textBoxPrice // - textBoxPrice.Location = new Point(189, 66); + textBoxPrice.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + textBoxPrice.Location = new Point(170, 66); textBoxPrice.Name = "textBoxPrice"; - textBoxPrice.Size = new Size(150, 31); + textBoxPrice.Size = new Size(160, 31); textBoxPrice.TabIndex = 3; // // groupBox // + groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; groupBox.Controls.Add(buttonRef); groupBox.Controls.Add(buttonDel); groupBox.Controls.Add(buttonUpd); groupBox.Controls.Add(buttonAdd); groupBox.Controls.Add(dataGridView); - groupBox.Location = new Point(25, 115); + groupBox.Location = new Point(16, 112); groupBox.Name = "groupBox"; - groupBox.Size = new Size(751, 262); + groupBox.Size = new Size(850, 286); groupBox.TabIndex = 4; groupBox.TabStop = false; groupBox.Text = "Компоненты"; // // buttonRef // - buttonRef.Location = new Point(624, 150); + buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonRef.Location = new Point(732, 215); buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(112, 34); + buttonRef.Size = new Size(112, 56); buttonRef.TabIndex = 4; buttonRef.Text = "Обновить"; buttonRef.UseVisualStyleBackColor = true; @@ -105,9 +109,10 @@ // // buttonDel // - buttonDel.Location = new Point(624, 110); + buttonDel.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonDel.Location = new Point(732, 153); buttonDel.Name = "buttonDel"; - buttonDel.Size = new Size(112, 34); + buttonDel.Size = new Size(112, 56); buttonDel.TabIndex = 3; buttonDel.Text = "Удалить"; buttonDel.UseVisualStyleBackColor = true; @@ -115,9 +120,10 @@ // // buttonUpd // - buttonUpd.Location = new Point(624, 70); + buttonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonUpd.Location = new Point(732, 91); buttonUpd.Name = "buttonUpd"; - buttonUpd.Size = new Size(112, 34); + buttonUpd.Size = new Size(112, 56); buttonUpd.TabIndex = 2; buttonUpd.Text = "Изменить"; buttonUpd.UseVisualStyleBackColor = true; @@ -125,9 +131,10 @@ // // buttonAdd // - buttonAdd.Location = new Point(624, 30); + buttonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonAdd.Location = new Point(732, 29); buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(112, 34); + buttonAdd.Size = new Size(112, 56); buttonAdd.TabIndex = 1; buttonAdd.Text = "Добавить"; buttonAdd.UseVisualStyleBackColor = true; @@ -135,36 +142,18 @@ // // dataGridView // + dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.BackgroundColor = SystemColors.Window; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.Columns.AddRange(new DataGridViewColumn[] { id, Component, Count }); - dataGridView.Location = new Point(10, 23); + dataGridView.Location = new Point(6, 29); dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 51; dataGridView.RowTemplate.Height = 29; - dataGridView.Size = new Size(581, 381); + dataGridView.Size = new Size(720, 251); dataGridView.TabIndex = 0; // - // buttonCancel - // - buttonCancel.Location = new Point(676, 404); - buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(112, 34); - buttonCancel.TabIndex = 5; - buttonCancel.Text = "Отмена"; - buttonCancel.UseVisualStyleBackColor = true; - buttonCancel.Click += ButtonCancel_Click; - // - // buttonSave - // - buttonSave.Location = new Point(558, 404); - buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(112, 34); - buttonSave.TabIndex = 6; - buttonSave.Text = "Сохранить"; - buttonSave.UseVisualStyleBackColor = true; - buttonSave.Click += ButtonSave_Click; - // // id // id.HeaderText = "id"; @@ -185,11 +174,33 @@ Count.MinimumWidth = 6; Count.Name = "Count"; // + // buttonCancel + // + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.Location = new Point(754, 404); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(112, 34); + buttonCancel.TabIndex = 5; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // buttonSave + // + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonSave.Location = new Point(636, 404); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(112, 34); + buttonSave.TabIndex = 6; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // // FormPastry // AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(878, 444); Controls.Add(buttonSave); Controls.Add(buttonCancel); Controls.Add(groupBox); @@ -199,6 +210,7 @@ Controls.Add(labelName); Name = "FormPastry"; Text = "Кондитерское изделие"; + Load += FormPastry_Load; Click += FormPastry_Load; groupBox.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); diff --git a/Confectionery/Confectionery/FormPastryComponent.Designer.cs b/Confectionery/Confectionery/FormPastryComponent.Designer.cs index 7801e2f..03b23ed 100644 --- a/Confectionery/Confectionery/FormPastryComponent.Designer.cs +++ b/Confectionery/Confectionery/FormPastryComponent.Designer.cs @@ -39,7 +39,7 @@ // labelComponent // labelComponent.AutoSize = true; - labelComponent.Location = new Point(21, 20); + labelComponent.Location = new Point(16, 21); labelComponent.Name = "labelComponent"; labelComponent.Size = new Size(107, 25); labelComponent.TabIndex = 0; @@ -48,7 +48,7 @@ // labelCount // labelCount.AutoSize = true; - labelCount.Location = new Point(21, 71); + labelCount.Location = new Point(16, 66); labelCount.Name = "labelCount"; labelCount.Size = new Size(111, 25); labelCount.TabIndex = 1; @@ -56,21 +56,25 @@ // // comboBoxComponent // + comboBoxComponent.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + comboBoxComponent.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxComponent.FormattingEnabled = true; - comboBoxComponent.Location = new Point(174, 17); + comboBoxComponent.Location = new Point(170, 21); comboBoxComponent.Name = "comboBoxComponent"; - comboBoxComponent.Size = new Size(392, 33); + comboBoxComponent.Size = new Size(396, 33); comboBoxComponent.TabIndex = 2; // // textBoxCount // - textBoxCount.Location = new Point(174, 67); + textBoxCount.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + textBoxCount.Location = new Point(170, 66); textBoxCount.Name = "textBoxCount"; - textBoxCount.Size = new Size(392, 31); + textBoxCount.Size = new Size(396, 31); textBoxCount.TabIndex = 3; // // buttonCancel // + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.Location = new Point(454, 148); buttonCancel.Name = "buttonCancel"; buttonCancel.Size = new Size(112, 34); @@ -81,6 +85,7 @@ // // buttonSave // + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonSave.Location = new Point(336, 148); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(112, 34); diff --git a/Confectionery/ConfectioneryBusinessLogic/ComponentLogic.cs b/Confectionery/ConfectioneryBusinessLogic/BusinessLogics/ComponentLogic.cs similarity index 100% rename from Confectionery/ConfectioneryBusinessLogic/ComponentLogic.cs rename to Confectionery/ConfectioneryBusinessLogic/BusinessLogics/ComponentLogic.cs diff --git a/Confectionery/ConfectioneryBusinessLogic/OrderLogic.cs b/Confectionery/ConfectioneryBusinessLogic/BusinessLogics/OrderLogic.cs similarity index 100% rename from Confectionery/ConfectioneryBusinessLogic/OrderLogic.cs rename to Confectionery/ConfectioneryBusinessLogic/BusinessLogics/OrderLogic.cs diff --git a/Confectionery/ConfectioneryBusinessLogic/PastryLogic.cs b/Confectionery/ConfectioneryBusinessLogic/BusinessLogics/PastryLogic.cs similarity index 100% rename from Confectionery/ConfectioneryBusinessLogic/PastryLogic.cs rename to Confectionery/ConfectioneryBusinessLogic/BusinessLogics/PastryLogic.cs diff --git a/Confectionery/ConfectioneryDataModels/OrderStatus.cs b/Confectionery/ConfectioneryDataModels/Enums/OrderStatus.cs similarity index 100% rename from Confectionery/ConfectioneryDataModels/OrderStatus.cs rename to Confectionery/ConfectioneryDataModels/Enums/OrderStatus.cs diff --git a/Confectionery/ConfectioneryDataModels/IComponentModel.cs b/Confectionery/ConfectioneryDataModels/Models/IComponentModel.cs similarity index 100% rename from Confectionery/ConfectioneryDataModels/IComponentModel.cs rename to Confectionery/ConfectioneryDataModels/Models/IComponentModel.cs diff --git a/Confectionery/ConfectioneryDataModels/IOrderModel.cs b/Confectionery/ConfectioneryDataModels/Models/IOrderModel.cs similarity index 100% rename from Confectionery/ConfectioneryDataModels/IOrderModel.cs rename to Confectionery/ConfectioneryDataModels/Models/IOrderModel.cs diff --git a/Confectionery/ConfectioneryDataModels/IPastryModel.cs b/Confectionery/ConfectioneryDataModels/Models/IPastryModel.cs similarity index 100% rename from Confectionery/ConfectioneryDataModels/IPastryModel.cs rename to Confectionery/ConfectioneryDataModels/Models/IPastryModel.cs diff --git a/Confectionery/ConfectioneryFileImplement/ConfectioneryFileImplement.csproj b/Confectionery/ConfectioneryFileImplement/ConfectioneryFileImplement.csproj new file mode 100644 index 0000000..f0eca47 --- /dev/null +++ b/Confectionery/ConfectioneryFileImplement/ConfectioneryFileImplement.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/Confectionery/ConfectioneryFileImplement/DataFileSingleton.cs b/Confectionery/ConfectioneryFileImplement/DataFileSingleton.cs new file mode 100644 index 0000000..38b16f6 --- /dev/null +++ b/Confectionery/ConfectioneryFileImplement/DataFileSingleton.cs @@ -0,0 +1,57 @@ +using ConfectioneryFileImplement.Models; +using System.Xml.Linq; +namespace ConfectioneryFileImplement +{ + internal class DataFileSingleton + { + private static DataFileSingleton? instance; + private readonly string ComponentFileName = "Component.xml"; + private readonly string OrderFileName = "Order.xml"; + private readonly string PastryFileName = "Pastry.xml"; + public List Components { get; private set; } + public List Orders { get; private set; } + public List Pastries { get; private set; } + public static DataFileSingleton GetInstance() + { + if (instance == null) + { + instance = new DataFileSingleton(); + } + return instance; + } + public void SaveComponents() => SaveData(Components, ComponentFileName, + "Components", x => x.GetXElement); + public void SavePastries() => SaveData(Pastries, PastryFileName, + "Pastries", x => x.GetXElement); + public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", + x => x.GetXElement); + private DataFileSingleton() + { + Components = LoadData(ComponentFileName, "Component", + x => Component.Create(x)!)!; + Pastries = LoadData(PastryFileName, "Pastry", + x => Pastry.Create(x)!)!; + Orders = LoadData(OrderFileName, "Order", + x => Order.Create(x)!)!; + } + private static List? LoadData(string filename, + string xmlNodeName, Func selectFunction) + { + if (File.Exists(filename)) + { + return XDocument.Load(filename)?.Root?.Elements(xmlNodeName)? + .Select(selectFunction)?.ToList(); + } + return new List(); + } + private static void SaveData(List data, string filename, + string xmlNodeName, Func selectFunction) + { + if (data != null) + { + new XDocument(new XElement(xmlNodeName, + data.Select(selectFunction).ToArray())).Save(filename); + } + } + } +} \ No newline at end of file diff --git a/Confectionery/ConfectioneryFileImplement/Implements/ComponentStorage.cs b/Confectionery/ConfectioneryFileImplement/Implements/ComponentStorage.cs new file mode 100644 index 0000000..a0b0639 --- /dev/null +++ b/Confectionery/ConfectioneryFileImplement/Implements/ComponentStorage.cs @@ -0,0 +1,83 @@ +using ConfectioneryContracts.BindingModels; +using ConfectioneryContracts.SearchModels; +using ConfectioneryContracts.StoragesContracts; +using ConfectioneryContracts.ViewModels; +using ConfectioneryFileImplement.Models; +namespace ConfectioneryFileImplement.Implements +{ + public class ComponentStorage : IComponentStorage + { + private readonly DataFileSingleton source; + public ComponentStorage() + { + source = DataFileSingleton.GetInstance(); + } + public List GetFullList() + { + return source.Components + .Select(x => x.GetViewModel) + .ToList(); + } + public List GetFilteredList(ComponentSearchModel + model) + { + if (string.IsNullOrEmpty(model.ComponentName)) + { + return new(); + } + return source.Components + .Where(x => x.ComponentName.Contains(model.ComponentName)) + .Select(x => x.GetViewModel) + .ToList(); + } + public ComponentViewModel? GetElement(ComponentSearchModel model) + { + if (string.IsNullOrEmpty(model.ComponentName) && + !model.Id.HasValue) + { + return null; + } + return source.Components + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.ComponentName) + && x.ComponentName == model.ComponentName) || + (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; + } + public ComponentViewModel? Insert(ComponentBindingModel model) + { + model.Id = source.Components.Count > 0 ? + source.Components.Max(x => x.Id) + 1 : 1; + var newComponent = Component.Create(model); + if (newComponent == null) + { + return null; + } + source.Components.Add(newComponent); + source.SaveComponents(); + return newComponent.GetViewModel; + } + public ComponentViewModel? Update(ComponentBindingModel model) + { + var component = source.Components.FirstOrDefault(x => x.Id == + model.Id); + if (component == null) + { + return null; + } + component.Update(model); + source.SaveComponents(); + return component.GetViewModel; + } + public ComponentViewModel? Delete(ComponentBindingModel model) + { + var element = source.Components.FirstOrDefault(x => x.Id == + model.Id); + if (element != null) + { + source.Components.Remove(element); + source.SaveComponents(); + return element.GetViewModel; + } + return null; + } + } +} diff --git a/Confectionery/ConfectioneryFileImplement/Implements/OrderStorage.cs b/Confectionery/ConfectioneryFileImplement/Implements/OrderStorage.cs new file mode 100644 index 0000000..801bbdd --- /dev/null +++ b/Confectionery/ConfectioneryFileImplement/Implements/OrderStorage.cs @@ -0,0 +1,99 @@ +using ConfectioneryContracts.BindingModels; +using ConfectioneryContracts.SearchModels; +using ConfectioneryContracts.StoragesContracts; +using ConfectioneryContracts.ViewModels; +using ConfectioneryFileImplement.Models; + +namespace ConfectioneryFileImplement.Implements +{ + public class OrderStorage : IOrderStorage + { + private readonly DataFileSingleton source; + public OrderStorage() + { + source = DataFileSingleton.GetInstance(); + } + + public List GetFullList() + { + return source.Orders + .Select(x => AccessPastryStorage(x.GetViewModel)) + .ToList(); + } + + public List GetFilteredList(OrderSearchModel model) + { + if (!model.Id.HasValue) + { + return new(); + } + return source.Orders + .Where(x => x.Id == model.Id) + .Select(x => AccessPastryStorage(x.GetViewModel)) + .ToList(); + } + + public OrderViewModel? GetElement(OrderSearchModel model) + { + if (!model.Id.HasValue) + { + return null; + } + return AccessPastryStorage(source.Orders.FirstOrDefault( + x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel); + } + + public OrderViewModel? Insert(OrderBindingModel model) + { + model.Id = source.Orders.Count > 0 ? + source.Orders.Max(x => x.Id) + 1 : 1; + var newOrder = Order.Create(model); + if (newOrder == null) + { + return null; + } + source.Orders.Add(newOrder); + source.SaveOrders(); + return AccessPastryStorage(newOrder.GetViewModel); + } + + public OrderViewModel? Update(OrderBindingModel model) + { + var order = source.Orders.FirstOrDefault(x => x.Id == model.Id); + if (order == null) + { + return null; + } + order.Update(model); + source.SaveOrders(); + return AccessPastryStorage(order.GetViewModel); + } + public OrderViewModel? Delete(OrderBindingModel model) + { + var element = source.Orders.FirstOrDefault(x => x.Id == + model.Id); + if (element != null) + { + source.Orders.Remove(element); + source.SaveOrders(); + return AccessPastryStorage(element.GetViewModel); + } + return null; + } + + public OrderViewModel AccessPastryStorage(OrderViewModel model) + { + if (model == null) + return null; + foreach (var Pastry in source.Pastries) + { + if (Pastry.Id == model.PastryId) + { + model.PastryName = Pastry.PastryName; + break; + } + } + return model; + } + } +} \ No newline at end of file diff --git a/Confectionery/ConfectioneryFileImplement/Implements/PastryStorage.cs b/Confectionery/ConfectioneryFileImplement/Implements/PastryStorage.cs new file mode 100644 index 0000000..fff167d --- /dev/null +++ b/Confectionery/ConfectioneryFileImplement/Implements/PastryStorage.cs @@ -0,0 +1,83 @@ +using ConfectioneryContracts.BindingModels; +using ConfectioneryContracts.SearchModels; +using ConfectioneryContracts.StoragesContracts; +using ConfectioneryContracts.ViewModels; +using ConfectioneryFileImplement.Models; + +namespace ConfectioneryFileImplement.Implements +{ + public class PastryStorage : IPastryStorage + { + private readonly DataFileSingleton source; + public PastryStorage() + { + source = DataFileSingleton.GetInstance(); + } + public List GetFullList() + { + return source.Pastries + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFilteredList(PastrySearchModel model) + { + if (string.IsNullOrEmpty(model.PastryName)) + { + return new(); + } + return source.Pastries + .Where(x => x.PastryName.Contains(model.PastryName)) + .Select(x => x.GetViewModel) + .ToList(); + } + + public PastryViewModel? GetElement(PastrySearchModel model) + { + if (string.IsNullOrEmpty(model.PastryName) && !model.Id.HasValue) + { + return null; + } + return source.Pastries.FirstOrDefault(x => (!string.IsNullOrEmpty( + model.PastryName) && x.PastryName == model.PastryName) || + (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; + } + + public PastryViewModel? Insert(PastryBindingModel model) + { + model.Id = source.Pastries.Count > 0 ? + source.Pastries.Max(x => x.Id) + 1 : 1; + var newPastry = Pastry.Create(model); + if (newPastry == null) + { + return null; + } + source.Pastries.Add(newPastry); + source.SavePastries(); + return newPastry.GetViewModel; + } + + public PastryViewModel? Update(PastryBindingModel model) + { + var Pastry = source.Pastries.FirstOrDefault(x => x.Id == model.Id); + if (Pastry == null) + { + return null; + } + Pastry.Update(model); + source.SavePastries(); + return Pastry.GetViewModel; + } + public PastryViewModel? Delete(PastryBindingModel model) + { + var Pastry = source.Pastries.FirstOrDefault(x => x.Id == model.Id); + if (Pastry != null) + { + source.Pastries.Remove(Pastry); + source.SavePastries(); + return Pastry.GetViewModel; + } + return null; + } + } +} \ No newline at end of file diff --git a/Confectionery/ConfectioneryFileImplement/Models/Component.cs b/Confectionery/ConfectioneryFileImplement/Models/Component.cs new file mode 100644 index 0000000..bd01ea4 --- /dev/null +++ b/Confectionery/ConfectioneryFileImplement/Models/Component.cs @@ -0,0 +1,58 @@ +using ConfectioneryContracts.BindingModels; +using ConfectioneryContracts.ViewModels; +using ConfectioneryDataModels.Models; +using System.Xml.Linq; +namespace ConfectioneryFileImplement.Models +{ + public class Component : IComponentModel + { + public int Id { get; private set; } + public string ComponentName { get; private set; } = string.Empty; + public double Cost { get; set; } + public static Component? Create(ComponentBindingModel model) + { + if (model == null) + { + return null; + } + return new Component() + { + Id = model.Id, + ComponentName = model.ComponentName, + Cost = model.Cost + }; + } + public static Component? Create(XElement element) + { + if (element == null) + { + return null; + } + return new Component() + { + Id = Convert.ToInt32(element.Attribute("Id")!.Value), + ComponentName = element.Element("ComponentName")!.Value, + Cost = Convert.ToDouble(element.Element("Cost")!.Value) + }; + } + public void Update(ComponentBindingModel model) + { + if (model == null) + { + return; + } + ComponentName = model.ComponentName; + Cost = model.Cost; + } + public ComponentViewModel GetViewModel => new() + { + Id = Id, + ComponentName = ComponentName, + Cost = Cost + }; + public XElement GetXElement => new("Component", + new XAttribute("Id", Id), + new XElement("ComponentName", ComponentName), + new XElement("Cost", Cost.ToString())); + } +} diff --git a/Confectionery/ConfectioneryFileImplement/Models/Order.cs b/Confectionery/ConfectioneryFileImplement/Models/Order.cs new file mode 100644 index 0000000..1dd7492 --- /dev/null +++ b/Confectionery/ConfectioneryFileImplement/Models/Order.cs @@ -0,0 +1,86 @@ +using ConfectioneryContracts.BindingModels; +using ConfectioneryContracts.ViewModels; +using ConfectioneryDataModels.Enums; +using ConfectioneryDataModels.Models; +using System.Xml.Linq; + +namespace ConfectioneryFileImplement.Models +{ + public class Order : IOrderModel + { + public int Id { get; private set; } + public int PastryId { get; private set; } + public int Count { get; private set; } + public double Sum { get; private set; } + public OrderStatus Status { get; private set; } + public DateTime DateCreate { get; private set; } + public DateTime? DateImplement { get; private set; } + + public static Order? Create(OrderBindingModel model) + { + if (model == null) + { + return null; + } + return new Order() + { + Id = model.Id, + PastryId = model.PastryId, + Count = model.Count, + Sum = model.Sum, + Status = model.Status, + DateCreate = model.DateCreate, + DateImplement = model.DateImplement, + }; + } + public static Order? Create(XElement element) + { + if (element == null) + { + return null; + } + return new Order() + { + Id = Convert.ToInt32(element.Attribute("Id")!.Value), + PastryId = Convert.ToInt32(element.Element("PastryId")!.Value), + Count = Convert.ToInt32(element.Element("Count")!.Value), + Sum = Convert.ToDouble(element.Element("Sum")!.Value), + Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), + element.Element("Status")!.Value.ToString()), + DateCreate = Convert.ToDateTime( + element.Element("DateCreate")!.Value), + DateImplement = string.IsNullOrEmpty( + element.Element("DateImplement")!.Value) ? null : + Convert.ToDateTime(element.Element("DateImplement")!.Value) + }; + } + public void Update(OrderBindingModel model) + { + if (model == null) + { + return; + } + Status = model.Status; + DateImplement = model.DateImplement; + } + public OrderViewModel GetViewModel => new() + { + Id = Id, + PastryId = PastryId, + Count = Count, + Sum = Sum, + Status = Status, + DateCreate = DateCreate, + DateImplement = DateImplement, + }; + public XElement GetXElement => new("Order", + new XAttribute("Id", Id), + new XElement("PastryId", PastryId), + new XElement("Sum", Sum.ToString()), + new XElement("Count", Count), + new XElement("Status", Status.ToString()), + new XElement("DateCreate", DateCreate.ToString()), + new XElement("DateImplement", DateImplement.ToString()) + ); + } +} \ No newline at end of file diff --git a/Confectionery/ConfectioneryFileImplement/Models/Pastry.cs b/Confectionery/ConfectioneryFileImplement/Models/Pastry.cs new file mode 100644 index 0000000..7740b0a --- /dev/null +++ b/Confectionery/ConfectioneryFileImplement/Models/Pastry.cs @@ -0,0 +1,91 @@ +using ConfectioneryContracts.BindingModels; +using ConfectioneryContracts.ViewModels; +using ConfectioneryDataModels.Models; +using System.Xml.Linq; +namespace ConfectioneryFileImplement.Models +{ + public class Pastry : IPastryModel + { + public int Id { get; private set; } + public string PastryName { get; private set; } = string.Empty; + public double Price { get; private set; } + public Dictionary Components { get; private set; } = new(); + private Dictionary? + _pastryComponents = null; + public Dictionary PastryComponents + { + get + { + if (_pastryComponents == null) + { + var source = DataFileSingleton.GetInstance(); + _pastryComponents = Components.ToDictionary( + x => x.Key, y => ((source.Components.FirstOrDefault( + z => z.Id == y.Key) as + IComponentModel)!, y.Value)); + } + return _pastryComponents; + } + } + public static Pastry? Create(PastryBindingModel model) + { + if (model == null) + { + return null; + } + return new Pastry() + { + Id = model.Id, + PastryName = model.PastryName, + Price = model.Price, + Components = model.PastryComponents.ToDictionary( + x => x.Key, x => x.Value.Item2) + }; + } + public static Pastry? Create(XElement element) + { + if (element == null) + { + return null; + } + return new Pastry() + { + Id = Convert.ToInt32(element.Attribute("Id")!.Value), + PastryName = element.Element("PastryName")!.Value, + Price = Convert.ToDouble(element.Element("Price")!.Value), + Components = element.Element( + "PastryComponents")!.Elements("PastryComponent") + .ToDictionary(x => Convert.ToInt32(x.Element("Key") + ?.Value), x => Convert.ToInt32(x.Element("Value")?.Value)) + }; + } + public void Update(PastryBindingModel model) + { + if (model == null) + { + return; + } + PastryName = model.PastryName; + Price = model.Price; + Components = model.PastryComponents.ToDictionary( + x => x.Key, x => x.Value.Item2); + _pastryComponents = null; + } + public PastryViewModel GetViewModel => new() + { + Id = Id, + PastryName = PastryName, + Price = Price, + PastryComponents = PastryComponents + }; + public XElement GetXElement => new("Pastry", + new XAttribute("Id", Id), + new XElement("PastryName", PastryName), + new XElement("Price", Price.ToString()), + new XElement("PastryComponents", Components.Select(x => + new XElement("PastryComponent", + new XElement("Key", x.Key), + new XElement("Value", x.Value))) + .ToArray())); + } +}