Доделано

This commit is contained in:
malimova 2024-03-14 23:26:40 +04:00
parent 8da5dc0943
commit 4e9423b82c
4 changed files with 60 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -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;

View File

@ -57,4 +57,13 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PastryName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true" internalLogLevel="Info">
<targets>
<target xsi:type="File" name="tofile" fileName="log-${shortdate}.log" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="tofile" />
</rules>
</nlog>
</configuration>