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(); dropDownList = new WinForm.DropDownList();
labelType = new Label(); labelType = new Label();
panelDate = new Panel(); panelDate = new Panel();
controlInputNullableDate = new ControlsLibraryNet60.Input.ControlInputNullableDate(); customTextBox1 = new WinFormsLibrary.CustomTextBox();
labelDate = new Label(); labelDate = new Label();
buttonSave = new Button(); buttonSave = new Button();
panelButtons = new Panel(); panelButtons = new Panel();
@ -131,8 +131,8 @@
// //
// buttonType // buttonType
// //
buttonType.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; buttonType.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonType.Location = new Point(115, 64); buttonType.Location = new Point(220, 64);
buttonType.Name = "buttonType"; buttonType.Name = "buttonType";
buttonType.Size = new Size(127, 23); buttonType.Size = new Size(127, 23);
buttonType.TabIndex = 2; buttonType.TabIndex = 2;
@ -162,25 +162,23 @@
// panelDate // panelDate
// //
panelDate.AutoSize = true; panelDate.AutoSize = true;
panelDate.Controls.Add(controlInputNullableDate); panelDate.Controls.Add(customTextBox1);
panelDate.Controls.Add(labelDate); panelDate.Controls.Add(labelDate);
panelDate.Dock = DockStyle.Top; panelDate.Dock = DockStyle.Top;
panelDate.Location = new Point(0, 216); panelDate.Location = new Point(0, 216);
panelDate.Margin = new Padding(0); panelDate.Margin = new Padding(0);
panelDate.Name = "panelDate"; panelDate.Name = "panelDate";
panelDate.Padding = new Padding(10); panelDate.Padding = new Padding(10);
panelDate.Size = new Size(360, 58); panelDate.Size = new Size(360, 57);
panelDate.TabIndex = 6; panelDate.TabIndex = 6;
// //
// controlInputNullableDate // customTextBox1
// //
controlInputNullableDate.Dock = DockStyle.Top; customTextBox1.DateValue = null;
controlInputNullableDate.Location = new Point(10, 25); customTextBox1.Location = new Point(112, 13);
controlInputNullableDate.Margin = new Padding(4, 3, 4, 3); customTextBox1.Name = "customTextBox1";
controlInputNullableDate.Name = "controlInputNullableDate"; customTextBox1.Size = new Size(235, 31);
controlInputNullableDate.Size = new Size(340, 23); customTextBox1.TabIndex = 1;
controlInputNullableDate.TabIndex = 1;
controlInputNullableDate.Value = null;
// //
// labelDate // labelDate
// //
@ -194,8 +192,8 @@
// //
// buttonSave // buttonSave
// //
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonSave.Location = new Point(10, 7); buttonSave.Location = new Point(194, 7);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(75, 23); buttonSave.Size = new Size(75, 23);
buttonSave.TabIndex = 7; buttonSave.TabIndex = 7;
@ -209,7 +207,7 @@
panelButtons.Controls.Add(buttonCancel); panelButtons.Controls.Add(buttonCancel);
panelButtons.Controls.Add(buttonSave); panelButtons.Controls.Add(buttonSave);
panelButtons.Dock = DockStyle.Top; panelButtons.Dock = DockStyle.Top;
panelButtons.Location = new Point(0, 274); panelButtons.Location = new Point(0, 273);
panelButtons.Margin = new Padding(0); panelButtons.Margin = new Padding(0);
panelButtons.Name = "panelButtons"; panelButtons.Name = "panelButtons";
panelButtons.Padding = new Padding(10); panelButtons.Padding = new Padding(10);
@ -231,13 +229,13 @@
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(360, 311); ClientSize = new Size(360, 358);
Controls.Add(panelButtons); Controls.Add(panelButtons);
Controls.Add(panelDate); Controls.Add(panelDate);
Controls.Add(panelType); Controls.Add(panelType);
Controls.Add(panelFurniture); Controls.Add(panelFurniture);
Controls.Add(panelName); Controls.Add(panelName);
MaximumSize = new Size(900, 350); MaximumSize = new Size(900, 500);
MinimumSize = new Size(200, 350); MinimumSize = new Size(200, 350);
Name = "FormProvider"; Name = "FormProvider";
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
@ -268,12 +266,13 @@
private Panel panelType; private Panel panelType;
private Label labelType; private Label labelType;
private Panel panelDate; private Panel panelDate;
private ControlsLibraryNet60.Input.ControlInputNullableDate controlInputNullableDate;
private Label labelDate; private Label labelDate;
private Button buttonSave; private Button buttonSave;
private Panel panelButtons; private Panel panelButtons;
private Button buttonCancel; private Button buttonCancel;
private Button buttonType; private Button buttonType;
private WinForm.DropDownList dropDownList; 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) private void FormProvider_Load(object sender, EventArgs e)
{ {
controlInputNullableDate.ElementChanged += OnInputChange; customTextBox1.ValueChanged += OnInputChange;
dropDownList.ExplicitEvent += OnInputChange; dropDownList.ExplicitEvent += OnInputChange;
LoadData(); LoadData();
if (_id.HasValue) if (_id.HasValue)
@ -41,7 +41,7 @@ namespace AppView
textBoxName.Text = element.Name; textBoxName.Text = element.Name;
textBoxFurniture.Text = element.Furniture; textBoxFurniture.Text = element.Furniture;
dropDownList.Selected = element.Type; dropDownList.Selected = element.Type;
controlInputNullableDate.Value = element.SupplyDate; customTextBox1.DateValue = element.SupplyDate;
} }
} }
catch (Exception ex) catch (Exception ex)
@ -111,9 +111,9 @@ namespace AppView
Name = textBoxName.Text, Name = textBoxName.Text,
Furniture = textBoxFurniture.Text, Furniture = textBoxFurniture.Text,
Type = dropDownList.Selected, Type = dropDownList.Selected,
SupplyDate = (controlInputNullableDate.Value != null) ? SupplyDate = (customTextBox1.DateValue != null) ?
DateTime.SpecifyKind((DateTime)controlInputNullableDate.Value, DateTimeKind.Utc) DateTime.SpecifyKind((DateTime)customTextBox1.DateValue, DateTimeKind.Utc)
: controlInputNullableDate.Value, : customTextBox1.DateValue,
}; };
var action = _id.HasValue ? _providerStorage.Update(model) : _providerStorage.Insert(model); var action = _id.HasValue ? _providerStorage.Update(model) : _providerStorage.Insert(model);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

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