diff --git a/BeautySalon/BeautySalon/FormSpecialisation.Designer.cs b/BeautySalon/BeautySalon/FormSpecialisation.Designer.cs new file mode 100644 index 0000000..7df883b --- /dev/null +++ b/BeautySalon/BeautySalon/FormSpecialisation.Designer.cs @@ -0,0 +1,39 @@ +namespace BeautySalon +{ + partial class FormSpecialisation + { + /// + /// 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 = "FormSpecialisation"; + } + + #endregion + } +} \ No newline at end of file diff --git a/BeautySalon/BeautySalon/FormSpecialisation.cs b/BeautySalon/BeautySalon/FormSpecialisation.cs new file mode 100644 index 0000000..c83ea6c --- /dev/null +++ b/BeautySalon/BeautySalon/FormSpecialisation.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 BeautySalon +{ + public partial class FormSpecialisation : Form + { + public FormSpecialisation() + { + InitializeComponent(); + } + } +} diff --git a/BeautySalon/BeautySalon/FormSpecialisation.resx b/BeautySalon/BeautySalon/FormSpecialisation.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/BeautySalon/BeautySalon/FormSpecialisation.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 diff --git a/BeautySalon/BeautySalon/FormSpecialisations.Designer.cs b/BeautySalon/BeautySalon/FormSpecialisations.Designer.cs index 97ddf69..f435fee 100644 --- a/BeautySalon/BeautySalon/FormSpecialisations.Designer.cs +++ b/BeautySalon/BeautySalon/FormSpecialisations.Designer.cs @@ -29,25 +29,63 @@ private void InitializeComponent() { dataGridView = new DataGridView(); + buttonCreate = new Button(); + buttonDelete = new Button(); + buttonUpdate = new Button(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); // // dataGridView // + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView.BackgroundColor = SystemColors.ActiveCaption; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.Dock = DockStyle.Left; dataGridView.Location = new Point(0, 0); dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersVisible = false; dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView.Size = new Size(417, 450); dataGridView.TabIndex = 0; // + // buttonCreate + // + buttonCreate.Location = new Point(476, 31); + buttonCreate.Name = "buttonCreate"; + buttonCreate.Size = new Size(147, 56); + buttonCreate.TabIndex = 1; + buttonCreate.Text = "Добавить"; + buttonCreate.UseVisualStyleBackColor = true; + buttonCreate.Click += buttonCreate_Click; + // + // buttonDelete + // + buttonDelete.Location = new Point(476, 362); + buttonDelete.Name = "buttonDelete"; + buttonDelete.Size = new Size(147, 56); + buttonDelete.TabIndex = 3; + buttonDelete.Text = "Уничтожить..."; + buttonDelete.UseVisualStyleBackColor = true; + // + // buttonUpdate + // + buttonUpdate.Location = new Point(476, 192); + buttonUpdate.Name = "buttonUpdate"; + buttonUpdate.Size = new Size(147, 56); + buttonUpdate.TabIndex = 2; + buttonUpdate.Text = "Корректровать"; + buttonUpdate.UseVisualStyleBackColor = true; + buttonUpdate.Click += buttonUpdate_Click; + // // FormSpecialisations // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(678, 450); + Controls.Add(buttonDelete); + Controls.Add(buttonUpdate); + Controls.Add(buttonCreate); Controls.Add(dataGridView); Name = "FormSpecialisations"; Text = "Специализации"; @@ -59,5 +97,8 @@ #endregion private DataGridView dataGridView; + private Button buttonCreate; + private Button buttonDelete; + private Button buttonUpdate; } } \ No newline at end of file diff --git a/BeautySalon/BeautySalon/FormSpecialisations.cs b/BeautySalon/BeautySalon/FormSpecialisations.cs index 12d3ba2..9cb7214 100644 --- a/BeautySalon/BeautySalon/FormSpecialisations.cs +++ b/BeautySalon/BeautySalon/FormSpecialisations.cs @@ -35,5 +35,31 @@ namespace BeautySalon { LoadData(); } + + private void buttonCreate_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormSpecialisation)); + if (service is FormSpecialisation form) + { + form.ShowDialog(); + } + } + + private void buttonUpdate_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + var service = Program.ServiceProvider?.GetService(typeof(FormSpecialisation)); + if (service is FormSpecialisation form) + { + int rowIndex = dataGridView.CurrentCell.RowIndex; + int specialisationId = (int)dataGridView.Rows[rowIndex].Cells["SpecialisationId"].Value; + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } + } + } } } diff --git a/BeautySalon/BeautySalon/Program.cs b/BeautySalon/BeautySalon/Program.cs index 67b3dce..c5a4373 100644 --- a/BeautySalon/BeautySalon/Program.cs +++ b/BeautySalon/BeautySalon/Program.cs @@ -42,6 +42,7 @@ namespace BeautySalon services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file