From 4e9423b82c5e6f8ae4a55a531530999ae321ae42 Mon Sep 17 00:00:00 2001 From: malimova Date: Thu, 14 Mar 2024 23:26:40 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConfectioneryView/FormShop.Designer.cs | 36 ++++++++++++++++++- Confectionery/ConfectioneryView/FormShop.cs | 2 +- Confectionery/ConfectioneryView/FormShop.resx | 9 +++++ Confectionery/ConfectioneryView/nlog.config | 15 ++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 Confectionery/ConfectioneryView/nlog.config diff --git a/Confectionery/ConfectioneryView/FormShop.Designer.cs b/Confectionery/ConfectioneryView/FormShop.Designer.cs index 57f5e82..35e4ece 100644 --- a/Confectionery/ConfectioneryView/FormShop.Designer.cs +++ b/Confectionery/ConfectioneryView/FormShop.Designer.cs @@ -29,6 +29,9 @@ private void InitializeComponent() { dataGridView = new DataGridView(); + id = new DataGridViewTextBoxColumn(); + PastryName = new DataGridViewTextBoxColumn(); + Count = new DataGridViewTextBoxColumn(); labelName = new Label(); labelAddress = new Label(); labelOpen = new Label(); @@ -42,15 +45,43 @@ // // dataGridView // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView.BackgroundColor = Color.AliceBlue; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { id, PastryName, Count }); dataGridView.Location = new Point(12, 225); dataGridView.Name = "dataGridView"; - dataGridView.RowHeadersWidth = 62; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.None; + dataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders; dataGridView.RowTemplate.Height = 33; dataGridView.Size = new Size(765, 393); dataGridView.TabIndex = 0; // + // id + // + id.HeaderText = "id"; + id.MinimumWidth = 8; + id.Name = "id"; + id.ReadOnly = true; + id.Visible = false; + // + // PastryName + // + PastryName.HeaderText = "Кондитерское изделие"; + PastryName.MinimumWidth = 8; + PastryName.Name = "PastryName"; + PastryName.ReadOnly = true; + // + // Count + // + Count.HeaderText = "Количество"; + Count.MinimumWidth = 8; + Count.Name = "Count"; + Count.ReadOnly = true; + // // labelName // labelName.AutoSize = true; @@ -152,5 +183,8 @@ private DateTimePicker dateTimePickerOpen; private Button buttonSave; private Button buttonCancel; + private DataGridViewTextBoxColumn id; + private DataGridViewTextBoxColumn PastryName; + private DataGridViewTextBoxColumn Count; } } \ No newline at end of file diff --git a/Confectionery/ConfectioneryView/FormShop.cs b/Confectionery/ConfectioneryView/FormShop.cs index 09be130..4f53f29 100644 --- a/Confectionery/ConfectioneryView/FormShop.cs +++ b/Confectionery/ConfectioneryView/FormShop.cs @@ -104,7 +104,7 @@ namespace ConfectioneryView var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); if (!operationResult) { - throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + throw new Exception("Ошибка при сохранении"); } MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; diff --git a/Confectionery/ConfectioneryView/FormShop.resx b/Confectionery/ConfectioneryView/FormShop.resx index f298a7b..d3dc922 100644 --- a/Confectionery/ConfectioneryView/FormShop.resx +++ b/Confectionery/ConfectioneryView/FormShop.resx @@ -57,4 +57,13 @@ 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/Confectionery/ConfectioneryView/nlog.config b/Confectionery/ConfectioneryView/nlog.config new file mode 100644 index 0000000..85797a7 --- /dev/null +++ b/Confectionery/ConfectioneryView/nlog.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file