This commit is contained in:
maxnes3 2023-11-02 11:34:21 +04:00
parent d7fdaccf6d
commit 088dedd6db
3 changed files with 24 additions and 24 deletions

View File

@ -39,7 +39,7 @@
dropDownList = new WinForm.DropDownList();
labelType = new Label();
panelDate = new Panel();
controlInputNullableDate = new ControlsLibraryNet60.Input.ControlInputNullableDate();
customTextBox1 = new WinFormsLibrary.CustomTextBox();
labelDate = new Label();
buttonSave = new Button();
panelButtons = new Panel();
@ -131,8 +131,8 @@
//
// buttonType
//
buttonType.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
buttonType.Location = new Point(115, 64);
buttonType.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonType.Location = new Point(220, 64);
buttonType.Name = "buttonType";
buttonType.Size = new Size(127, 23);
buttonType.TabIndex = 2;
@ -162,25 +162,23 @@
// panelDate
//
panelDate.AutoSize = true;
panelDate.Controls.Add(controlInputNullableDate);
panelDate.Controls.Add(customTextBox1);
panelDate.Controls.Add(labelDate);
panelDate.Dock = DockStyle.Top;
panelDate.Location = new Point(0, 216);
panelDate.Margin = new Padding(0);
panelDate.Name = "panelDate";
panelDate.Padding = new Padding(10);
panelDate.Size = new Size(360, 58);
panelDate.Size = new Size(360, 57);
panelDate.TabIndex = 6;
//
// controlInputNullableDate
// customTextBox1
//
controlInputNullableDate.Dock = DockStyle.Top;
controlInputNullableDate.Location = new Point(10, 25);
controlInputNullableDate.Margin = new Padding(4, 3, 4, 3);
controlInputNullableDate.Name = "controlInputNullableDate";
controlInputNullableDate.Size = new Size(340, 23);
controlInputNullableDate.TabIndex = 1;
controlInputNullableDate.Value = null;
customTextBox1.DateValue = null;
customTextBox1.Location = new Point(112, 13);
customTextBox1.Name = "customTextBox1";
customTextBox1.Size = new Size(235, 31);
customTextBox1.TabIndex = 1;
//
// labelDate
//
@ -194,8 +192,8 @@
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(10, 7);
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonSave.Location = new Point(194, 7);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(75, 23);
buttonSave.TabIndex = 7;
@ -209,7 +207,7 @@
panelButtons.Controls.Add(buttonCancel);
panelButtons.Controls.Add(buttonSave);
panelButtons.Dock = DockStyle.Top;
panelButtons.Location = new Point(0, 274);
panelButtons.Location = new Point(0, 273);
panelButtons.Margin = new Padding(0);
panelButtons.Name = "panelButtons";
panelButtons.Padding = new Padding(10);
@ -231,13 +229,13 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(360, 311);
ClientSize = new Size(360, 358);
Controls.Add(panelButtons);
Controls.Add(panelDate);
Controls.Add(panelType);
Controls.Add(panelFurniture);
Controls.Add(panelName);
MaximumSize = new Size(900, 350);
MaximumSize = new Size(900, 500);
MinimumSize = new Size(200, 350);
Name = "FormProvider";
StartPosition = FormStartPosition.CenterScreen;
@ -268,12 +266,13 @@
private Panel panelType;
private Label labelType;
private Panel panelDate;
private ControlsLibraryNet60.Input.ControlInputNullableDate controlInputNullableDate;
private Label labelDate;
private Button buttonSave;
private Panel panelButtons;
private Button buttonCancel;
private Button buttonType;
private WinForm.DropDownList dropDownList;
private WinFormsLibrary.CustomTextBox customTextBox;
private WinFormsLibrary.CustomTextBox customTextBox1;
}
}

View File

@ -25,7 +25,7 @@ namespace AppView
private void FormProvider_Load(object sender, EventArgs e)
{
controlInputNullableDate.ElementChanged += OnInputChange;
customTextBox1.ValueChanged += OnInputChange;
dropDownList.ExplicitEvent += OnInputChange;
LoadData();
if (_id.HasValue)
@ -41,7 +41,7 @@ namespace AppView
textBoxName.Text = element.Name;
textBoxFurniture.Text = element.Furniture;
dropDownList.Selected = element.Type;
controlInputNullableDate.Value = element.SupplyDate;
customTextBox1.DateValue = element.SupplyDate;
}
}
catch (Exception ex)
@ -111,9 +111,9 @@ namespace AppView
Name = textBoxName.Text,
Furniture = textBoxFurniture.Text,
Type = dropDownList.Selected,
SupplyDate = (controlInputNullableDate.Value != null) ?
DateTime.SpecifyKind((DateTime)controlInputNullableDate.Value, DateTimeKind.Utc)
: controlInputNullableDate.Value,
SupplyDate = (customTextBox1.DateValue != null) ?
DateTime.SpecifyKind((DateTime)customTextBox1.DateValue, DateTimeKind.Utc)
: customTextBox1.DateValue,
};
var action = _id.HasValue ? _providerStorage.Update(model) : _providerStorage.Insert(model);
DialogResult = DialogResult.OK;

View File

@ -52,6 +52,7 @@
ClientSize = new Size(355, 306);
Controls.Add(dataGridView);
Name = "FormType";
StartPosition = FormStartPosition.CenterScreen;
Text = "Редактирование типов организаций";
Load += FormType_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();