From 2043b7962e890fcb70566be9c745e5aa688281c6 Mon Sep 17 00:00:00 2001 From: Tonb73 Date: Fri, 8 Nov 2024 23:41:15 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=20=D1=81=D0=BA?= =?UTF-8?q?=D0=B8=D0=B4=D0=BA=D0=B8=20=D0=B2=20Client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Forms/FormClient.Designer.cs | 25 ++-- project/ProjectTourAgency/Forms/FormClient.cs | 7 +- .../Forms/FormTour.Designer.cs | 39 ++++++ project/ProjectTourAgency/Forms/FormTour.cs | 20 +++ project/ProjectTourAgency/Forms/FormTour.resx | 120 ++++++++++++++++++ 5 files changed, 195 insertions(+), 16 deletions(-) create mode 100644 project/ProjectTourAgency/Forms/FormTour.Designer.cs create mode 100644 project/ProjectTourAgency/Forms/FormTour.cs create mode 100644 project/ProjectTourAgency/Forms/FormTour.resx diff --git a/project/ProjectTourAgency/Forms/FormClient.Designer.cs b/project/ProjectTourAgency/Forms/FormClient.Designer.cs index 627f561..39c5a91 100644 --- a/project/ProjectTourAgency/Forms/FormClient.Designer.cs +++ b/project/ProjectTourAgency/Forms/FormClient.Designer.cs @@ -37,8 +37,7 @@ labelSocialStatus = new Label(); buttonSave = new Button(); buttonCancel = new Button(); - numericUpDownSocialStatus = new NumericUpDown(); - ((System.ComponentModel.ISupportInitialize)numericUpDownSocialStatus).BeginInit(); + comboBoxSocialStatus = new ComboBox(); SuspendLayout(); // // labelName @@ -119,20 +118,21 @@ buttonCancel.UseVisualStyleBackColor = true; buttonCancel.Click += buttonCancel_Click; // - // numericUpDownSocialStatus + // comboBoxSocialStatus // - numericUpDownSocialStatus.Location = new Point(156, 187); - numericUpDownSocialStatus.Maximum = new decimal(new int[] { 3, 0, 0, 0 }); - numericUpDownSocialStatus.Name = "numericUpDownSocialStatus"; - numericUpDownSocialStatus.Size = new Size(120, 23); - numericUpDownSocialStatus.TabIndex = 11; + comboBoxSocialStatus.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxSocialStatus.FormattingEnabled = true; + comboBoxSocialStatus.Location = new Point(156, 179); + comboBoxSocialStatus.Name = "comboBoxSocialStatus"; + comboBoxSocialStatus.Size = new Size(121, 23); + comboBoxSocialStatus.TabIndex = 11; // - // FormClients + // FormClient // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(369, 314); - Controls.Add(numericUpDownSocialStatus); + Controls.Add(comboBoxSocialStatus); Controls.Add(buttonCancel); Controls.Add(buttonSave); Controls.Add(labelSocialStatus); @@ -142,10 +142,9 @@ Controls.Add(labelBirthDate); Controls.Add(textBoxName); Controls.Add(labelName); - Name = "FormClients"; + Name = "FormClient"; StartPosition = FormStartPosition.CenterScreen; Text = "Клиенты"; - ((System.ComponentModel.ISupportInitialize)numericUpDownSocialStatus).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -161,6 +160,6 @@ private Label labelSocialStatus; private Button buttonSave; private Button buttonCancel; - private NumericUpDown numericUpDownSocialStatus; + private ComboBox comboBoxSocialStatus; } } \ No newline at end of file diff --git a/project/ProjectTourAgency/Forms/FormClient.cs b/project/ProjectTourAgency/Forms/FormClient.cs index e64657d..225fce4 100644 --- a/project/ProjectTourAgency/Forms/FormClient.cs +++ b/project/ProjectTourAgency/Forms/FormClient.cs @@ -1,4 +1,5 @@ using ProjectTourAgency.Enities; +using ProjectTourAgency.Enities.Enums; using ProjectTourAgency.Repositories; using System; using System.Collections.Generic; @@ -31,7 +32,7 @@ public partial class FormClient : Form } textBoxName.Text = client.FullName; textBoxNumber.Text = client.PhoneNumber; - numericUpDownSocialStatus.Value = (decimal)client.ClientSocialStatus; + comboBoxSocialStatus.SelectedItem = client.ClientSocialStatus; dateTimePickerBirth.Value = client.BirthDate; } @@ -48,6 +49,7 @@ public partial class FormClient : Form InitializeComponent(); _clientRepository = clientRepository ?? throw new ArgumentNullException(nameof(clientRepository)); + comboBoxSocialStatus.DataSource = Enum.GetValues(typeof(ClientSocialStatus)); } private void buttonSave_Click(object sender, EventArgs e) @@ -79,6 +81,5 @@ public partial class FormClient : Form private void buttonCancel_Click(object sender, EventArgs e) => Close(); private Client CreateClient(int id) => Client.CreateEntity(id, textBoxName.Text, - dateTimePickerBirth.Value, textBoxNumber.Text, - (Enities.Enums.ClientSocialStatus)numericUpDownSocialStatus.Value); + dateTimePickerBirth.Value, textBoxNumber.Text, (ClientSocialStatus)comboBoxSocialStatus.SelectedItem!); } diff --git a/project/ProjectTourAgency/Forms/FormTour.Designer.cs b/project/ProjectTourAgency/Forms/FormTour.Designer.cs new file mode 100644 index 0000000..a21485e --- /dev/null +++ b/project/ProjectTourAgency/Forms/FormTour.Designer.cs @@ -0,0 +1,39 @@ +namespace ProjectTourAgency.Forms +{ + partial class FormTour + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "FormTour"; + } + + #endregion + } +} \ No newline at end of file diff --git a/project/ProjectTourAgency/Forms/FormTour.cs b/project/ProjectTourAgency/Forms/FormTour.cs new file mode 100644 index 0000000..7d1fbc9 --- /dev/null +++ b/project/ProjectTourAgency/Forms/FormTour.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectTourAgency.Forms +{ + public partial class FormTour : Form + { + public FormTour() + { + InitializeComponent(); + } + } +} diff --git a/project/ProjectTourAgency/Forms/FormTour.resx b/project/ProjectTourAgency/Forms/FormTour.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/project/ProjectTourAgency/Forms/FormTour.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file