This commit is contained in:
Павел Путилин 2023-04-11 21:44:57 +04:00
parent f326ecfea1
commit 77ee2c8e4b
3 changed files with 22 additions and 26 deletions

View File

@ -30,7 +30,6 @@
{
this.buttonSave = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.textBoxDateOpening = new System.Windows.Forms.TextBox();
this.textBoxAddress = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
@ -38,8 +37,9 @@
this.ReinforcedName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Price = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.comboBoxShop = new System.Windows.Forms.ComboBox();
this.comboBoxShop = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.dateTimePickerOpening = new System.Windows.Forms.DateTimePicker();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
//
@ -65,13 +65,6 @@
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// textBoxDateOpening
//
this.textBoxDateOpening.Location = new System.Drawing.Point(386, 26);
this.textBoxDateOpening.Name = "textBoxDateOpening";
this.textBoxDateOpening.Size = new System.Drawing.Size(209, 23);
this.textBoxDateOpening.TabIndex = 15;
//
// textBoxAddress
//
this.textBoxAddress.Location = new System.Drawing.Point(159, 26);
@ -131,12 +124,10 @@
//
// comboBoxShop
//
this.comboBoxShop.FormattingEnabled = true;
this.comboBoxShop.Location = new System.Drawing.Point(12, 26);
this.comboBoxShop.Name = "comboBoxShop";
this.comboBoxShop.Size = new System.Drawing.Size(141, 23);
this.comboBoxShop.TabIndex = 1;
this.comboBoxShop.SelectedIndexChanged += new System.EventHandler(this.ComboBoxShop_SelectedIndexChanged);
//
// label1
//
@ -147,14 +138,21 @@
this.label1.TabIndex = 9;
this.label1.Text = "Название магазина:";
//
// dateTimePickerOpening
//
this.dateTimePickerOpening.Location = new System.Drawing.Point(386, 26);
this.dateTimePickerOpening.Name = "dateTimePickerOpening";
this.dateTimePickerOpening.Size = new System.Drawing.Size(200, 23);
this.dateTimePickerOpening.TabIndex = 18;
//
// FormShop
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(737, 319);
this.Controls.Add(this.dateTimePickerOpening);
this.Controls.Add(this.buttonSave);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.textBoxDateOpening);
this.Controls.Add(this.textBoxAddress);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
@ -174,7 +172,6 @@
private Button buttonSave;
private Button buttonCancel;
private TextBox textBoxDateOpening;
private TextBox textBoxAddress;
private Label label3;
private Label label2;
@ -182,7 +179,8 @@
private DataGridViewTextBoxColumn ReinforcedName;
private DataGridViewTextBoxColumn Price;
private DataGridViewTextBoxColumn Count;
private ComboBox comboBoxShop;
private TextBox comboBoxShop;
private Label label1;
private DateTimePicker dateTimePickerOpening;
}
}

View File

@ -39,25 +39,18 @@ namespace PrecastConcretePlantView
_logger = logger;
_listShops = logic.ReadList(null);
_logic = logic;
if (_listShops != null)
{
comboBoxShop.DisplayMember = "Name";
comboBoxShop.ValueMember = "Id";
comboBoxShop.DataSource = _listShops;
comboBoxShop.SelectedItem = null;
}
}
private void LoadData(bool extendDate = true)
{
try
{
var model = GetShop(extendDate ? Id : Convert.ToInt32(comboBoxShop.SelectedValue));
var model = GetShop(extendDate ? Id : Convert.ToInt32(comboBoxShop.Text));
if (model != null)
{
comboBoxShop.Text = model.Name;
textBoxAddress.Text = model.Address;
textBoxDateOpening.Text = Convert.ToString(model.DateOpening);
dateTimePickerOpening.Value = model.DateOpening;
dataGridView.Rows.Clear();
foreach (var el in model.Reinforceds.Values)
{
@ -96,13 +89,12 @@ namespace PrecastConcretePlantView
_logger.LogInformation("Сохранение изделия");
try
{
DateTime.TryParse(textBoxDateOpening.Text, out var dateTime);
ShopBindingModel model = new()
{
Name = comboBoxShop.Text,
Address = textBoxAddress.Text,
DateOpening = dateTime
};
DateOpening = dateTimePickerOpening.Value,
};
var vmodel = GetShop(Id);
bool operationResult = false;

View File

@ -63,4 +63,10 @@
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Price.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>