diff --git a/BeautySalon/BeautySalon.csproj b/BeautySalon/BeautySalon.csproj
index 2440d79..2a84d15 100644
--- a/BeautySalon/BeautySalon.csproj
+++ b/BeautySalon/BeautySalon.csproj
@@ -13,6 +13,8 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
diff --git a/BeautySalon/Form1.cs b/BeautySalon/Form1.cs
deleted file mode 100644
index 1a4d5cf..0000000
--- a/BeautySalon/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace BeautySalon
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/BeautySalon/FormClient.Designer.cs b/BeautySalon/FormClient.Designer.cs
new file mode 100644
index 0000000..4f1d508
--- /dev/null
+++ b/BeautySalon/FormClient.Designer.cs
@@ -0,0 +1,119 @@
+namespace BeautySalon
+{
+ partial class FormClient
+ {
+ ///
+ /// 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.buttonSave = new System.Windows.Forms.Button();
+ this.labelName = new System.Windows.Forms.Label();
+ this.textBoxName = new System.Windows.Forms.TextBox();
+ this.labelPhoneNumber = new System.Windows.Forms.Label();
+ this.textBoxPhoneNumber = new System.Windows.Forms.TextBox();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // buttonSave
+ //
+ this.buttonSave.Location = new System.Drawing.Point(213, 76);
+ this.buttonSave.Name = "buttonSave";
+ this.buttonSave.Size = new System.Drawing.Size(75, 23);
+ this.buttonSave.TabIndex = 0;
+ this.buttonSave.Text = "Сохранить";
+ this.buttonSave.UseVisualStyleBackColor = true;
+ this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
+ //
+ // labelName
+ //
+ this.labelName.AutoSize = true;
+ this.labelName.Location = new System.Drawing.Point(12, 22);
+ this.labelName.Name = "labelName";
+ this.labelName.Size = new System.Drawing.Size(37, 15);
+ this.labelName.TabIndex = 1;
+ this.labelName.Text = "ФИО:";
+ //
+ // textBoxName
+ //
+ this.textBoxName.Location = new System.Drawing.Point(122, 19);
+ this.textBoxName.Name = "textBoxName";
+ this.textBoxName.Size = new System.Drawing.Size(247, 23);
+ this.textBoxName.TabIndex = 2;
+ //
+ // labelPhoneNumber
+ //
+ this.labelPhoneNumber.AutoSize = true;
+ this.labelPhoneNumber.Location = new System.Drawing.Point(12, 50);
+ this.labelPhoneNumber.Name = "labelPhoneNumber";
+ this.labelPhoneNumber.Size = new System.Drawing.Size(104, 15);
+ this.labelPhoneNumber.TabIndex = 3;
+ this.labelPhoneNumber.Text = "Номер телефона:";
+ //
+ // textBoxPhoneNumber
+ //
+ this.textBoxPhoneNumber.Location = new System.Drawing.Point(122, 47);
+ this.textBoxPhoneNumber.Name = "textBoxPhoneNumber";
+ this.textBoxPhoneNumber.Size = new System.Drawing.Size(128, 23);
+ this.textBoxPhoneNumber.TabIndex = 4;
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Location = new System.Drawing.Point(294, 76);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(75, 23);
+ this.buttonCancel.TabIndex = 5;
+ this.buttonCancel.Text = "Отмена";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
+ //
+ // FormClient
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(381, 107);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.textBoxPhoneNumber);
+ this.Controls.Add(this.labelPhoneNumber);
+ this.Controls.Add(this.textBoxName);
+ this.Controls.Add(this.labelName);
+ this.Controls.Add(this.buttonSave);
+ this.Name = "FormClient";
+ this.Text = "Клиент";
+ this.Load += new System.EventHandler(this.FormClient_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private Button buttonSave;
+ private Label labelName;
+ private TextBox textBoxName;
+ private Label labelPhoneNumber;
+ private TextBox textBoxPhoneNumber;
+ private Button buttonCancel;
+ }
+}
\ No newline at end of file
diff --git a/BeautySalon/FormClient.cs b/BeautySalon/FormClient.cs
new file mode 100644
index 0000000..65eb3ad
--- /dev/null
+++ b/BeautySalon/FormClient.cs
@@ -0,0 +1,82 @@
+using BeautySalonContracts.BindingModels;
+using BeautySalonContracts.BusinessLogicsContracts;
+using BeautySalonContracts.SearchModels;
+using Microsoft.Extensions.Logging;
+
+namespace BeautySalon
+{
+ public partial class FormClient : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IClientLogic _logic;
+ private int? _id;
+ public int Id { set { _id = value; } }
+ public FormClient(ILogger logger, IClientLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxName.Text))
+ {
+ MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ _logger.LogInformation("Сохранение клиента");
+ try
+ {
+ var model = new ClientBindingModel
+ {
+ Id = _id ?? 0,
+ ClientFIO = textBoxName.Text,
+ PhoneNumber = textBoxPhoneNumber.Text
+ };
+ var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+ MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения клиента");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ private void FormClient_Load(object sender, EventArgs e)
+ {
+ if (_id.HasValue)
+ {
+ try
+ {
+ _logger.LogInformation("Получение клиента");
+ var view = _logic.ReadElement(new ClientSearchModel { Id = _id.Value });
+ if (view != null)
+ {
+ textBoxName.Text = view.ClientFIO;
+ textBoxPhoneNumber.Text = view.PhoneNumber.ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка получения клиента");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+}
diff --git a/BeautySalon/FormClient.resx b/BeautySalon/FormClient.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/BeautySalon/FormClient.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/FormClients.Designer.cs b/BeautySalon/FormClients.Designer.cs
new file mode 100644
index 0000000..aaf6b83
--- /dev/null
+++ b/BeautySalon/FormClients.Designer.cs
@@ -0,0 +1,113 @@
+namespace BeautySalon
+{
+ partial class FormClients
+ {
+ ///
+ /// 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.dataGridView = new System.Windows.Forms.DataGridView();
+ this.buttonAdd = new System.Windows.Forms.Button();
+ this.buttonUpd = new System.Windows.Forms.Button();
+ this.buttonDel = new System.Windows.Forms.Button();
+ this.buttonRef = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Control;
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(12, 12);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.Size = new System.Drawing.Size(357, 426);
+ this.dataGridView.TabIndex = 0;
+ //
+ // buttonAdd
+ //
+ this.buttonAdd.Location = new System.Drawing.Point(411, 31);
+ this.buttonAdd.Name = "buttonAdd";
+ this.buttonAdd.Size = new System.Drawing.Size(75, 23);
+ this.buttonAdd.TabIndex = 1;
+ this.buttonAdd.Text = "Добавить";
+ this.buttonAdd.UseVisualStyleBackColor = true;
+ this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
+ //
+ // buttonUpd
+ //
+ this.buttonUpd.Location = new System.Drawing.Point(411, 79);
+ this.buttonUpd.Name = "buttonUpd";
+ this.buttonUpd.Size = new System.Drawing.Size(75, 23);
+ this.buttonUpd.TabIndex = 2;
+ this.buttonUpd.Text = "Изменить";
+ this.buttonUpd.UseVisualStyleBackColor = true;
+ this.buttonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
+ //
+ // buttonDel
+ //
+ this.buttonDel.Location = new System.Drawing.Point(411, 131);
+ this.buttonDel.Name = "buttonDel";
+ this.buttonDel.Size = new System.Drawing.Size(75, 23);
+ this.buttonDel.TabIndex = 3;
+ this.buttonDel.Text = "Удалить";
+ this.buttonDel.UseVisualStyleBackColor = true;
+ this.buttonDel.Click += new System.EventHandler(this.ButtonDel_Click);
+ //
+ // buttonRef
+ //
+ this.buttonRef.Location = new System.Drawing.Point(411, 187);
+ this.buttonRef.Name = "buttonRef";
+ this.buttonRef.Size = new System.Drawing.Size(75, 23);
+ this.buttonRef.TabIndex = 4;
+ this.buttonRef.Text = "Обновить";
+ this.buttonRef.UseVisualStyleBackColor = true;
+ //
+ // FormClients
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(520, 450);
+ this.Controls.Add(this.buttonRef);
+ this.Controls.Add(this.buttonDel);
+ this.Controls.Add(this.buttonUpd);
+ this.Controls.Add(this.buttonAdd);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormClients";
+ this.Text = "Клиенты";
+ this.Load += new System.EventHandler(this.FormClients_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button buttonAdd;
+ private Button buttonUpd;
+ private Button buttonDel;
+ private Button buttonRef;
+ }
+}
\ No newline at end of file
diff --git a/BeautySalon/FormClients.cs b/BeautySalon/FormClients.cs
new file mode 100644
index 0000000..233ef4b
--- /dev/null
+++ b/BeautySalon/FormClients.cs
@@ -0,0 +1,96 @@
+using BeautySalonContracts.BindingModels;
+using BeautySalonContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+
+namespace BeautySalon
+{
+ public partial class FormClients : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IClientLogic _logic;
+ public FormClients(ILogger logger, IClientLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void LoadData()
+ {
+ try
+ {
+ var list = _logic.ReadList(null);
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["Id"].Visible = false;
+ dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ }
+ _logger.LogInformation("Загрузка клиентов");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки клиентов");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormClient));
+ if (service is FormClient form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+
+ private void ButtonUpd_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormClient));
+ if (service is FormClient form)
+ {
+ form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+ }
+
+ private void ButtonDel_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Удаление клиента");
+ try
+ {
+ if (!_logic.Delete(new ClientBindingModel { Id = id }))
+ {
+ throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка удаления клиента");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+
+ private void FormClients_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ }
+}
diff --git a/BeautySalon/FormClients.resx b/BeautySalon/FormClients.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/BeautySalon/FormClients.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/FormCreateVisit.Designer.cs b/BeautySalon/FormCreateVisit.Designer.cs
new file mode 100644
index 0000000..c7d23af
--- /dev/null
+++ b/BeautySalon/FormCreateVisit.Designer.cs
@@ -0,0 +1,198 @@
+namespace BeautySalon
+{
+ partial class FormCreateVisit
+ {
+ ///
+ /// 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.labelMaster = new System.Windows.Forms.Label();
+ this.labelSum = new System.Windows.Forms.Label();
+ this.comboBoxMaster = new System.Windows.Forms.ComboBox();
+ this.textBoxSum = new System.Windows.Forms.TextBox();
+ this.buttonSave = new System.Windows.Forms.Button();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.labelClient = new System.Windows.Forms.Label();
+ this.comboBoxClient = new System.Windows.Forms.ComboBox();
+ this.comboBoxService = new System.Windows.Forms.ComboBox();
+ this.labelService = new System.Windows.Forms.Label();
+ this.labelDate = new System.Windows.Forms.Label();
+ this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
+ this.SuspendLayout();
+ //
+ // labelMaster
+ //
+ this.labelMaster.AutoSize = true;
+ this.labelMaster.Location = new System.Drawing.Point(12, 44);
+ this.labelMaster.Name = "labelMaster";
+ this.labelMaster.Size = new System.Drawing.Size(51, 15);
+ this.labelMaster.TabIndex = 0;
+ this.labelMaster.Text = "Мастер:";
+ //
+ // labelSum
+ //
+ this.labelSum.AutoSize = true;
+ this.labelSum.Location = new System.Drawing.Point(11, 102);
+ this.labelSum.Name = "labelSum";
+ this.labelSum.Size = new System.Drawing.Size(48, 15);
+ this.labelSum.TabIndex = 2;
+ this.labelSum.Text = "Сумма:";
+ //
+ // comboBoxMaster
+ //
+ this.comboBoxMaster.BackColor = System.Drawing.SystemColors.Window;
+ this.comboBoxMaster.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboBoxMaster.FormattingEnabled = true;
+ this.comboBoxMaster.Location = new System.Drawing.Point(93, 41);
+ this.comboBoxMaster.Name = "comboBoxMaster";
+ this.comboBoxMaster.Size = new System.Drawing.Size(238, 23);
+ this.comboBoxMaster.TabIndex = 3;
+ this.comboBoxMaster.SelectedIndexChanged += new System.EventHandler(this.ComboBoxMaster_SelectedIndexChanged);
+ //
+ // textBoxSum
+ //
+ this.textBoxSum.Location = new System.Drawing.Point(93, 99);
+ this.textBoxSum.Name = "textBoxSum";
+ this.textBoxSum.ReadOnly = true;
+ this.textBoxSum.Size = new System.Drawing.Size(238, 23);
+ this.textBoxSum.TabIndex = 5;
+ //
+ // buttonSave
+ //
+ this.buttonSave.Location = new System.Drawing.Point(175, 170);
+ this.buttonSave.Name = "buttonSave";
+ this.buttonSave.Size = new System.Drawing.Size(75, 23);
+ this.buttonSave.TabIndex = 6;
+ this.buttonSave.Text = "Сохранить";
+ this.buttonSave.UseVisualStyleBackColor = true;
+ this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Location = new System.Drawing.Point(256, 170);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(75, 23);
+ this.buttonCancel.TabIndex = 7;
+ this.buttonCancel.Text = "Отмена";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
+ //
+ // labelClient
+ //
+ this.labelClient.AutoSize = true;
+ this.labelClient.Location = new System.Drawing.Point(12, 15);
+ this.labelClient.Name = "labelClient";
+ this.labelClient.Size = new System.Drawing.Size(49, 15);
+ this.labelClient.TabIndex = 8;
+ this.labelClient.Text = "Клиент:";
+ //
+ // comboBoxClient
+ //
+ this.comboBoxClient.BackColor = System.Drawing.SystemColors.Window;
+ this.comboBoxClient.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboBoxClient.FormattingEnabled = true;
+ this.comboBoxClient.Location = new System.Drawing.Point(93, 12);
+ this.comboBoxClient.Name = "comboBoxClient";
+ this.comboBoxClient.Size = new System.Drawing.Size(238, 23);
+ this.comboBoxClient.TabIndex = 9;
+ this.comboBoxClient.SelectedIndexChanged += new System.EventHandler(this.ComboBoxClient_SelectedIndexChanged);
+ //
+ // comboBoxService
+ //
+ this.comboBoxService.BackColor = System.Drawing.SystemColors.Window;
+ this.comboBoxService.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboBoxService.FormattingEnabled = true;
+ this.comboBoxService.Location = new System.Drawing.Point(93, 70);
+ this.comboBoxService.Name = "comboBoxService";
+ this.comboBoxService.Size = new System.Drawing.Size(238, 23);
+ this.comboBoxService.TabIndex = 11;
+ this.comboBoxService.SelectedIndexChanged += new System.EventHandler(this.ComboBoxService_SelectedIndexChanged);
+ //
+ // labelService
+ //
+ this.labelService.AutoSize = true;
+ this.labelService.Location = new System.Drawing.Point(11, 73);
+ this.labelService.Name = "labelService";
+ this.labelService.Size = new System.Drawing.Size(47, 15);
+ this.labelService.TabIndex = 10;
+ this.labelService.Text = "Услуга:";
+ //
+ // labelDate
+ //
+ this.labelDate.AutoSize = true;
+ this.labelDate.Location = new System.Drawing.Point(12, 134);
+ this.labelDate.Name = "labelDate";
+ this.labelDate.Size = new System.Drawing.Size(35, 15);
+ this.labelDate.TabIndex = 12;
+ this.labelDate.Text = "Дата:";
+ //
+ // dateTimePicker
+ //
+ this.dateTimePicker.Location = new System.Drawing.Point(93, 128);
+ this.dateTimePicker.Name = "dateTimePicker";
+ this.dateTimePicker.Size = new System.Drawing.Size(238, 23);
+ this.dateTimePicker.TabIndex = 13;
+ //
+ // FormCreateVisit
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(346, 206);
+ this.Controls.Add(this.dateTimePicker);
+ this.Controls.Add(this.labelDate);
+ this.Controls.Add(this.comboBoxService);
+ this.Controls.Add(this.labelService);
+ this.Controls.Add(this.comboBoxClient);
+ this.Controls.Add(this.labelClient);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.buttonSave);
+ this.Controls.Add(this.textBoxSum);
+ this.Controls.Add(this.comboBoxMaster);
+ this.Controls.Add(this.labelSum);
+ this.Controls.Add(this.labelMaster);
+ this.Name = "FormCreateVisit";
+ this.Text = "Посещение";
+ this.Load += new System.EventHandler(this.FormCreateVisit_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private Label labelMaster;
+ private Label labelSum;
+ private ComboBox comboBoxMaster;
+ private TextBox textBoxSum;
+ private Button buttonSave;
+ private Button buttonCancel;
+ private Label labelClient;
+ private ComboBox comboBoxClient;
+ private ComboBox comboBoxService;
+ private Label labelService;
+ private Label labelDate;
+ private DateTimePicker dateTimePicker;
+ }
+}
\ No newline at end of file
diff --git a/BeautySalon/FormCreateVisit.cs b/BeautySalon/FormCreateVisit.cs
new file mode 100644
index 0000000..eef55a9
--- /dev/null
+++ b/BeautySalon/FormCreateVisit.cs
@@ -0,0 +1,138 @@
+using BeautySalonContracts.BindingModels;
+using BeautySalonContracts.BusinessLogicsContracts;
+using BeautySalonContracts.SearchModels;
+using Microsoft.Extensions.Logging;
+
+namespace BeautySalon
+{
+ public partial class FormCreateVisit : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IServiceLogic _logicS;
+ private readonly IVisitLogic _logicV;
+ public FormCreateVisit(ILogger logger, IVisitLogic logicV, IServiceLogic logicS)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logicS = logicS;
+ _logicV = logicV;
+ LoadData();
+ }
+
+ private void LoadData()
+ {
+ _logger.LogInformation("Загрузка услуг для посещения");
+ try
+ {
+ var list = _logicS.ReadList(null);
+ if (list != null)
+ {
+ comboBoxMaster.DisplayMember = "ServiceName";
+ comboBoxMaster.ValueMember = "Id";
+ comboBoxMaster.DataSource = list;
+ comboBoxMaster.SelectedItem = null;
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки списка услуг");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void FormCreateVisit_Load(object sender, EventArgs e)
+ {
+ _logger.LogInformation("Загрузка мастеров для посещения");
+ LoadData();
+ }
+
+ private void CalcSum()
+ {
+ if (comboBoxService.SelectedValue != null)
+ {
+ try
+ {
+ int id = Convert.ToInt32(comboBoxService.SelectedValue);
+ var service = _logicS.ReadElement(new ServiceSearchModel
+ {
+ Id = id
+ });
+ textBoxSum.Text = Math.Round((service?.Cost ?? 0), 2).ToString();
+ _logger.LogInformation("Расчет суммы посещения");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка расчета суммы посещения");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void ComboBoxClient_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ CalcSum();
+ }
+
+ private void ComboBoxMaster_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ CalcSum();
+ }
+
+ private void ComboBoxService_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ CalcSum();
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (comboBoxClient.SelectedValue == null)
+ {
+ MessageBox.Show("Выберите клиента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (comboBoxService.SelectedValue == null)
+ {
+ MessageBox.Show("Выберите услугу", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (comboBoxMaster.SelectedValue == null)
+ {
+ MessageBox.Show("Выберите мастера", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ _logger.LogInformation("Создание посещения");
+ try
+ {
+ var operationResult = _logicV.Create(new VisitBindingModel
+ {
+ MasterId = Convert.ToInt32(comboBoxMaster.SelectedValue),
+ MasterFIO = comboBoxMaster.Text,
+ ClientId = Convert.ToInt32(comboBoxClient.SelectedValue),
+ ClientFIO = comboBoxClient.Text,
+ ServiceId = Convert.ToInt32(comboBoxService.SelectedValue),
+ ServiceName = comboBoxService.Text,
+ DateOfVisit = dateTimePicker.Value,
+ Sum = Convert.ToDouble(textBoxSum.Text)
+ });
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при создании посещения. Дополнительная информация в логах.");
+ }
+ MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка создания посещения");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}
diff --git a/BeautySalon/FormCreateVisit.resx b/BeautySalon/FormCreateVisit.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/BeautySalon/FormCreateVisit.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/FormMain.Designer.cs b/BeautySalon/FormMain.Designer.cs
new file mode 100644
index 0000000..ad6bc7e
--- /dev/null
+++ b/BeautySalon/FormMain.Designer.cs
@@ -0,0 +1,145 @@
+namespace BeautySalon
+{
+ partial class FormMain
+ {
+ ///
+ /// 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.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.услугиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.мастераToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.dataGridView = new System.Windows.Forms.DataGridView();
+ this.buttonCreateVisit = new System.Windows.Forms.Button();
+ this.buttonRef = new System.Windows.Forms.Button();
+ this.menuStrip1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.справочникиToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(1078, 24);
+ this.menuStrip1.TabIndex = 0;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // справочникиToolStripMenuItem
+ //
+ this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.услугиToolStripMenuItem,
+ this.мастераToolStripMenuItem,
+ this.клиентыToolStripMenuItem});
+ this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
+ this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
+ this.справочникиToolStripMenuItem.Text = "Справочники";
+ //
+ // услугиToolStripMenuItem
+ //
+ this.услугиToolStripMenuItem.Name = "услугиToolStripMenuItem";
+ this.услугиToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.услугиToolStripMenuItem.Text = "Услуги";
+ this.услугиToolStripMenuItem.Click += new System.EventHandler(this.УслугиToolStripMenuItem_Click);
+ //
+ // мастераToolStripMenuItem
+ //
+ this.мастераToolStripMenuItem.Name = "мастераToolStripMenuItem";
+ this.мастераToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.мастераToolStripMenuItem.Text = "Мастера";
+ this.мастераToolStripMenuItem.Click += new System.EventHandler(this.МастераToolStripMenuItem_Click);
+ //
+ // клиентыToolStripMenuItem
+ //
+ this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
+ this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.клиентыToolStripMenuItem.Text = "Клиенты";
+ this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.КлиентыToolStripMenuItem_Click);
+ //
+ // dataGridView
+ //
+ this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Control;
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(0, 27);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.Size = new System.Drawing.Size(889, 397);
+ this.dataGridView.TabIndex = 1;
+ //
+ // buttonCreateVisit
+ //
+ this.buttonCreateVisit.Location = new System.Drawing.Point(912, 60);
+ this.buttonCreateVisit.Name = "buttonCreateVisit";
+ this.buttonCreateVisit.Size = new System.Drawing.Size(145, 23);
+ this.buttonCreateVisit.TabIndex = 2;
+ this.buttonCreateVisit.Text = "Создать посещение";
+ this.buttonCreateVisit.UseVisualStyleBackColor = true;
+ this.buttonCreateVisit.Click += new System.EventHandler(this.ButtonCreateVisit_Click);
+ //
+ // buttonRef
+ //
+ this.buttonRef.Location = new System.Drawing.Point(912, 98);
+ this.buttonRef.Name = "buttonRef";
+ this.buttonRef.Size = new System.Drawing.Size(145, 23);
+ this.buttonRef.TabIndex = 3;
+ this.buttonRef.Text = "Обновить список";
+ this.buttonRef.UseVisualStyleBackColor = true;
+ this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
+ //
+ // FormMain
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1078, 425);
+ this.Controls.Add(this.buttonRef);
+ this.Controls.Add(this.buttonCreateVisit);
+ this.Controls.Add(this.dataGridView);
+ this.Controls.Add(this.menuStrip1);
+ this.MainMenuStrip = this.menuStrip1;
+ this.Name = "FormMain";
+ this.Text = "Салон красоты";
+ this.Load += new System.EventHandler(this.FormMain_Load);
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private MenuStrip menuStrip1;
+ private ToolStripMenuItem справочникиToolStripMenuItem;
+ private ToolStripMenuItem услугиToolStripMenuItem;
+ private ToolStripMenuItem мастераToolStripMenuItem;
+ private ToolStripMenuItem клиентыToolStripMenuItem;
+ private DataGridView dataGridView;
+ private Button buttonCreateVisit;
+ private Button buttonRef;
+ }
+}
\ No newline at end of file
diff --git a/BeautySalon/FormMain.cs b/BeautySalon/FormMain.cs
new file mode 100644
index 0000000..8cf9beb
--- /dev/null
+++ b/BeautySalon/FormMain.cs
@@ -0,0 +1,91 @@
+using BeautySalonContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+
+namespace BeautySalon
+{
+ public partial class FormMain : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IVisitLogic _visitLogic;
+ public FormMain(ILogger logger, IVisitLogic visitLogic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _visitLogic = visitLogic;
+ }
+
+ private void FormMain_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void ButtonCreateVisit_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormCreateVisit));
+ if (service is FormCreateVisit form)
+ {
+ form.ShowDialog();
+ LoadData();
+ }
+ }
+
+ private void ButtonRef_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void УслугиToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormServices));
+ if (service is FormServices form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void МастераToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormMasters));
+ if (service is FormMasters form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void КлиентыToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormClients));
+ if (service is FormClients form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void LoadData()
+ {
+ _logger.LogInformation("Загрузка посещений");
+ try
+ {
+ var list = _visitLogic.ReadList(null);
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["ClientId"].Visible = false;
+ dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ dataGridView.Columns["MasterId"].Visible = false;
+ dataGridView.Columns["MasterFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ dataGridView.Columns["ServiceId"].Visible = false;
+ dataGridView.Columns["ServiceName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ dataGridView.Columns["DateOfVisit"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ dataGridView.Columns["Sum"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ }
+ _logger.LogInformation("Загрузка посещений");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки посещений");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+}
diff --git a/BeautySalon/FormMain.resx b/BeautySalon/FormMain.resx
new file mode 100644
index 0000000..938108a
--- /dev/null
+++ b/BeautySalon/FormMain.resx
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/BeautySalon/FormMaster.Designer.cs b/BeautySalon/FormMaster.Designer.cs
new file mode 100644
index 0000000..2325e28
--- /dev/null
+++ b/BeautySalon/FormMaster.Designer.cs
@@ -0,0 +1,229 @@
+namespace BeautySalon
+{
+ partial class FormMaster
+ {
+ ///
+ /// 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.labelName = new System.Windows.Forms.Label();
+ this.textBoxName = new System.Windows.Forms.TextBox();
+ this.groupBox = new System.Windows.Forms.GroupBox();
+ this.buttonRef = new System.Windows.Forms.Button();
+ this.buttonDel = new System.Windows.Forms.Button();
+ this.buttonUpd = new System.Windows.Forms.Button();
+ this.dataGridView = new System.Windows.Forms.DataGridView();
+ this.buttonAdd = new System.Windows.Forms.Button();
+ this.labelWorkingHours = new System.Windows.Forms.Label();
+ this.buttonSave = new System.Windows.Forms.Button();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.textBoxWorkingHours = new System.Windows.Forms.TextBox();
+ this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.NameService = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.groupBox.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // labelName
+ //
+ this.labelName.AutoSize = true;
+ this.labelName.Location = new System.Drawing.Point(24, 27);
+ this.labelName.Name = "labelName";
+ this.labelName.Size = new System.Drawing.Size(37, 15);
+ this.labelName.TabIndex = 0;
+ this.labelName.Text = "ФИО:";
+ //
+ // textBoxName
+ //
+ this.textBoxName.Location = new System.Drawing.Point(123, 24);
+ this.textBoxName.Name = "textBoxName";
+ this.textBoxName.Size = new System.Drawing.Size(301, 23);
+ this.textBoxName.TabIndex = 1;
+ //
+ // groupBox
+ //
+ this.groupBox.Controls.Add(this.buttonRef);
+ this.groupBox.Controls.Add(this.buttonDel);
+ this.groupBox.Controls.Add(this.buttonUpd);
+ this.groupBox.Controls.Add(this.dataGridView);
+ this.groupBox.Controls.Add(this.buttonAdd);
+ this.groupBox.Location = new System.Drawing.Point(12, 112);
+ this.groupBox.Name = "groupBox";
+ this.groupBox.Size = new System.Drawing.Size(551, 292);
+ this.groupBox.TabIndex = 2;
+ this.groupBox.TabStop = false;
+ this.groupBox.Text = "Услуги";
+ //
+ // buttonRef
+ //
+ this.buttonRef.Location = new System.Drawing.Point(438, 164);
+ this.buttonRef.Name = "buttonRef";
+ this.buttonRef.Size = new System.Drawing.Size(75, 23);
+ this.buttonRef.TabIndex = 4;
+ this.buttonRef.Text = "Обновить";
+ this.buttonRef.UseVisualStyleBackColor = true;
+ this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
+ //
+ // buttonDel
+ //
+ this.buttonDel.Location = new System.Drawing.Point(438, 121);
+ this.buttonDel.Name = "buttonDel";
+ this.buttonDel.Size = new System.Drawing.Size(75, 23);
+ this.buttonDel.TabIndex = 3;
+ this.buttonDel.Text = "Удалить";
+ this.buttonDel.UseVisualStyleBackColor = true;
+ this.buttonDel.Click += new System.EventHandler(this.ButtonDel_Click);
+ //
+ // buttonUpd
+ //
+ this.buttonUpd.Location = new System.Drawing.Point(438, 78);
+ this.buttonUpd.Name = "buttonUpd";
+ this.buttonUpd.Size = new System.Drawing.Size(75, 23);
+ this.buttonUpd.TabIndex = 2;
+ this.buttonUpd.Text = "Изменить";
+ this.buttonUpd.UseVisualStyleBackColor = true;
+ this.buttonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
+ //
+ // dataGridView
+ //
+ this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Control;
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.ID,
+ this.NameService,
+ this.Time});
+ this.dataGridView.GridColor = System.Drawing.SystemColors.Control;
+ this.dataGridView.Location = new System.Drawing.Point(6, 16);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(398, 270);
+ this.dataGridView.TabIndex = 1;
+ //
+ // buttonAdd
+ //
+ this.buttonAdd.Location = new System.Drawing.Point(438, 36);
+ this.buttonAdd.Name = "buttonAdd";
+ this.buttonAdd.Size = new System.Drawing.Size(75, 23);
+ this.buttonAdd.TabIndex = 0;
+ this.buttonAdd.Text = "Добавить";
+ this.buttonAdd.UseVisualStyleBackColor = true;
+ this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
+ //
+ // labelWorkingHours
+ //
+ this.labelWorkingHours.AutoSize = true;
+ this.labelWorkingHours.Location = new System.Drawing.Point(24, 59);
+ this.labelWorkingHours.Name = "labelWorkingHours";
+ this.labelWorkingHours.Size = new System.Drawing.Size(93, 15);
+ this.labelWorkingHours.TabIndex = 3;
+ this.labelWorkingHours.Text = "Рабочее время:";
+ //
+ // buttonSave
+ //
+ this.buttonSave.Location = new System.Drawing.Point(369, 410);
+ this.buttonSave.Name = "buttonSave";
+ this.buttonSave.Size = new System.Drawing.Size(75, 23);
+ this.buttonSave.TabIndex = 5;
+ this.buttonSave.Text = "Сохранить";
+ this.buttonSave.UseVisualStyleBackColor = true;
+ this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Location = new System.Drawing.Point(450, 410);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(75, 23);
+ this.buttonCancel.TabIndex = 6;
+ this.buttonCancel.Text = "Отмена";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
+ //
+ // textBoxWorkingHours
+ //
+ this.textBoxWorkingHours.Location = new System.Drawing.Point(123, 53);
+ this.textBoxWorkingHours.Name = "textBoxWorkingHours";
+ this.textBoxWorkingHours.ReadOnly = true;
+ this.textBoxWorkingHours.Size = new System.Drawing.Size(152, 23);
+ this.textBoxWorkingHours.TabIndex = 7;
+ //
+ // ID
+ //
+ this.ID.HeaderText = "ID";
+ this.ID.Name = "ID";
+ this.ID.Visible = false;
+ //
+ // NameService
+ //
+ this.NameService.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.NameService.HeaderText = "Услуга";
+ this.NameService.Name = "NameService";
+ //
+ // Time
+ //
+ this.Time.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.Time.HeaderText = "Время на услугу, час(ов)";
+ this.Time.Name = "Time";
+ //
+ // FormMaster
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(575, 444);
+ this.Controls.Add(this.textBoxWorkingHours);
+ this.Controls.Add(this.buttonSave);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.labelWorkingHours);
+ this.Controls.Add(this.groupBox);
+ this.Controls.Add(this.textBoxName);
+ this.Controls.Add(this.labelName);
+ this.Name = "FormMaster";
+ this.Text = "Мастер";
+ this.groupBox.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private Label labelName;
+ private TextBox textBoxName;
+ private GroupBox groupBox;
+ private Button buttonRef;
+ private Button buttonDel;
+ private Button buttonUpd;
+ private DataGridView dataGridView;
+ private Button buttonAdd;
+ private Label labelWorkingHours;
+ private Button buttonSave;
+ private Button buttonCancel;
+ private DataGridViewTextBoxColumn ID;
+ private DataGridViewTextBoxColumn NameService;
+ private DataGridViewTextBoxColumn Time;
+ private TextBox textBoxWorkingHours;
+ }
+}
\ No newline at end of file
diff --git a/BeautySalon/FormMaster.cs b/BeautySalon/FormMaster.cs
new file mode 100644
index 0000000..5b20cef
--- /dev/null
+++ b/BeautySalon/FormMaster.cs
@@ -0,0 +1,202 @@
+using BeautySalonContracts.BindingModels;
+using BeautySalonContracts.BusinessLogicsContracts;
+using BeautySalonContracts.SearchModels;
+using BeautySalonDataModels.Models;
+using Microsoft.Extensions.Logging;
+
+namespace BeautySalon
+{
+ public partial class FormMaster : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IMasterLogic _logic;
+ private int? _id;
+ private Dictionary _masterServices;
+ public int Id { set { _id = value; } }
+ public FormMaster(ILogger logger, IMasterLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ _masterServices = new Dictionary();
+ }
+
+ private void LoadData()
+ {
+ _logger.LogInformation("Загрузка услуг мастера");
+ try
+ {
+ if (_masterServices != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var ec in _masterServices)
+ {
+ dataGridView.Rows.Add(new object[] { ec.Key, ec.Value.Item1.ServiceName, ec.Value.Item2 });
+ }
+ textBoxWorkingHours.Text = CalcWorkingHours().ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки услуг мастера");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormMasterService));
+ if (service is FormMasterService form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ if (form.ServiceModel == null)
+ {
+ return;
+ }
+ _logger.LogInformation("Добавление новой услуги: {ServiceName} - {Time}", form.ServiceModel.ServiceName, form.Time);
+ if (_masterServices.ContainsKey(form.Id))
+ {
+ _masterServices[form.Id] = (form.ServiceModel, form.Time);
+ }
+ else
+ {
+ _masterServices.Add(form.Id, (form.ServiceModel, form.Time));
+ }
+ LoadData();
+ }
+ }
+ }
+
+ private void ButtonUpd_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormMasterService));
+ if (service is FormMasterService form)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
+ form.Id = id;
+ form.Time = _masterServices[id].Item2;
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ if (form.ServiceModel == null)
+ {
+ return;
+ }
+ _logger.LogInformation("Изменение услуги: { ServiceName} - { Time}", form.ServiceModel.ServiceName, form.Time);
+ _masterServices[form.Id] = (form.ServiceModel, form.Time);
+ LoadData();
+ }
+ }
+ }
+ }
+
+ private void ButtonDel_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ try
+ {
+ _logger.LogInformation("Удаление услуги: { ServiceName} - { Time}", dataGridView.SelectedRows[0].Cells[1].Value);
+ _masterServices?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ LoadData();
+ }
+ }
+ }
+
+ private void ButtonRef_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxName.Text))
+ {
+ MessageBox.Show("Заполните ФИО", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (_masterServices == null || _masterServices.Count == 0)
+ {
+ MessageBox.Show("Заполните услуги", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (string.IsNullOrEmpty(textBoxWorkingHours.Text))
+ {
+ MessageBox.Show("Заполните рабочее время", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ _logger.LogInformation("Сохранение мастера");
+ try
+ {
+ var model = new MasterBindingModel
+ {
+ Id = _id ?? 0,
+ MasterFIO = textBoxName.Text,
+ WorkingHours = Convert.ToDouble(textBoxWorkingHours.Text),
+ MasterServices = _masterServices
+ };
+ var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+ MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения мастера");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ private void FormMaster_Load(object sender, EventArgs e)
+ {
+ if (_id.HasValue)
+ {
+ _logger.LogInformation("Загрузка мастера");
+ try
+ {
+ var view = _logic.ReadElement(new MasterSearchModel { Id = _id.Value });
+ if (view != null)
+ {
+ textBoxName.Text = view.MasterFIO;
+ textBoxWorkingHours.Text = view.WorkingHours.ToString();
+ _masterServices = view.MasterServices ?? new Dictionary();
+ LoadData();
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки мастера");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ private double CalcWorkingHours()
+ {
+ double workingHours = 0;
+ foreach (var elem in _masterServices)
+ {
+ workingHours += elem.Value.Item1?.Cost ?? 0;
+ }
+ return Math.Round(workingHours, 2);
+ }
+ }
+}
diff --git a/BeautySalon/FormMaster.resx b/BeautySalon/FormMaster.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/BeautySalon/FormMaster.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/FormMasterService.Designer.cs b/BeautySalon/FormMasterService.Designer.cs
new file mode 100644
index 0000000..5664950
--- /dev/null
+++ b/BeautySalon/FormMasterService.Designer.cs
@@ -0,0 +1,120 @@
+namespace BeautySalon
+{
+ partial class FormMasterService
+ {
+ ///
+ /// 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.labelService = new System.Windows.Forms.Label();
+ this.labelTime = new System.Windows.Forms.Label();
+ this.comboBoxService = new System.Windows.Forms.ComboBox();
+ this.textBoxTime = new System.Windows.Forms.TextBox();
+ this.buttonSave = new System.Windows.Forms.Button();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // labelService
+ //
+ this.labelService.AutoSize = true;
+ this.labelService.Location = new System.Drawing.Point(23, 22);
+ this.labelService.Name = "labelService";
+ this.labelService.Size = new System.Drawing.Size(47, 15);
+ this.labelService.TabIndex = 0;
+ this.labelService.Text = "Услуга:";
+ //
+ // labelTime
+ //
+ this.labelTime.AutoSize = true;
+ this.labelTime.Location = new System.Drawing.Point(23, 60);
+ this.labelTime.Name = "labelTime";
+ this.labelTime.Size = new System.Drawing.Size(45, 15);
+ this.labelTime.TabIndex = 1;
+ this.labelTime.Text = "Время:";
+ //
+ // comboBoxService
+ //
+ this.comboBoxService.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboBoxService.FormattingEnabled = true;
+ this.comboBoxService.Location = new System.Drawing.Point(119, 19);
+ this.comboBoxService.Name = "comboBoxService";
+ this.comboBoxService.Size = new System.Drawing.Size(248, 23);
+ this.comboBoxService.TabIndex = 2;
+ //
+ // textBoxTime
+ //
+ this.textBoxTime.Location = new System.Drawing.Point(119, 57);
+ this.textBoxTime.Name = "textBoxTime";
+ this.textBoxTime.Size = new System.Drawing.Size(248, 23);
+ this.textBoxTime.TabIndex = 3;
+ //
+ // buttonSave
+ //
+ this.buttonSave.Location = new System.Drawing.Point(198, 97);
+ this.buttonSave.Name = "buttonSave";
+ this.buttonSave.Size = new System.Drawing.Size(75, 23);
+ this.buttonSave.TabIndex = 4;
+ this.buttonSave.Text = "Сохранить";
+ this.buttonSave.UseVisualStyleBackColor = true;
+ this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Location = new System.Drawing.Point(279, 97);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(75, 23);
+ this.buttonCancel.TabIndex = 5;
+ this.buttonCancel.Text = "Отмена";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
+ //
+ // FormMasterService
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(379, 132);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.buttonSave);
+ this.Controls.Add(this.textBoxTime);
+ this.Controls.Add(this.comboBoxService);
+ this.Controls.Add(this.labelTime);
+ this.Controls.Add(this.labelService);
+ this.Name = "FormMasterService";
+ this.Text = "Услуга мастера";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private Label labelService;
+ private Label labelTime;
+ private ComboBox comboBoxService;
+ private TextBox textBoxTime;
+ private Button buttonSave;
+ private Button buttonCancel;
+ }
+}
\ No newline at end of file
diff --git a/BeautySalon/FormMasterService.cs b/BeautySalon/FormMasterService.cs
new file mode 100644
index 0000000..3b43ad1
--- /dev/null
+++ b/BeautySalon/FormMasterService.cs
@@ -0,0 +1,80 @@
+using BeautySalonContracts.BusinessLogicsContracts;
+using BeautySalonContracts.ViewModels;
+using BeautySalonDataModels.Models;
+
+namespace BeautySalon
+{
+ public partial class FormMasterService : Form
+ {
+ private readonly List? _list;
+ public int Id
+ {
+ get
+ {
+ return Convert.ToInt32(comboBoxService.SelectedValue);
+ }
+ set
+ {
+ comboBoxService.SelectedValue = value;
+ }
+ }
+ public IServiceModel? ServiceModel
+ {
+ get
+ {
+ if (_list == null)
+ {
+ return null;
+ }
+ foreach (var elem in _list)
+ {
+ if (elem.Id == Id)
+ {
+ return elem;
+ }
+ }
+ return null;
+ }
+ }
+ public int Time
+ {
+ get { return Convert.ToInt32(textBoxTime.Text); }
+ set
+ { textBoxTime.Text = value.ToString(); }
+ }
+ public FormMasterService(IServiceLogic logic)
+ {
+ InitializeComponent();
+ _list = logic.ReadList(null);
+ if (_list != null)
+ {
+ comboBoxService.DisplayMember = "ServiceName";
+ comboBoxService.ValueMember = "Id";
+ comboBoxService.DataSource = _list;
+ comboBoxService.SelectedItem = null;
+ }
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxTime.Text))
+ {
+ MessageBox.Show("Заполните поле время", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (comboBoxService.SelectedValue == null)
+ {
+ MessageBox.Show("Выберите услугу", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}
diff --git a/BeautySalon/FormMasterService.resx b/BeautySalon/FormMasterService.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/BeautySalon/FormMasterService.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/FormMasters.Designer.cs b/BeautySalon/FormMasters.Designer.cs
new file mode 100644
index 0000000..9003f86
--- /dev/null
+++ b/BeautySalon/FormMasters.Designer.cs
@@ -0,0 +1,116 @@
+namespace BeautySalon
+{
+ partial class FormMasters
+ {
+ ///
+ /// 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.dataGridView = new System.Windows.Forms.DataGridView();
+ this.buttonAdd = new System.Windows.Forms.Button();
+ this.buttonUpd = new System.Windows.Forms.Button();
+ this.buttonDel = new System.Windows.Forms.Button();
+ this.buttonRef = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Control;
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.GridColor = System.Drawing.SystemColors.Control;
+ this.dataGridView.Location = new System.Drawing.Point(3, 3);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(382, 407);
+ this.dataGridView.TabIndex = 0;
+ //
+ // buttonAdd
+ //
+ this.buttonAdd.Location = new System.Drawing.Point(437, 61);
+ this.buttonAdd.Name = "buttonAdd";
+ this.buttonAdd.Size = new System.Drawing.Size(75, 23);
+ this.buttonAdd.TabIndex = 1;
+ this.buttonAdd.Text = "Добавить";
+ this.buttonAdd.UseVisualStyleBackColor = true;
+ this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
+ //
+ // buttonUpd
+ //
+ this.buttonUpd.Location = new System.Drawing.Point(437, 113);
+ this.buttonUpd.Name = "buttonUpd";
+ this.buttonUpd.Size = new System.Drawing.Size(75, 23);
+ this.buttonUpd.TabIndex = 2;
+ this.buttonUpd.Text = "Изменить";
+ this.buttonUpd.UseVisualStyleBackColor = true;
+ this.buttonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
+ //
+ // buttonDel
+ //
+ this.buttonDel.Location = new System.Drawing.Point(437, 162);
+ this.buttonDel.Name = "buttonDel";
+ this.buttonDel.Size = new System.Drawing.Size(75, 23);
+ this.buttonDel.TabIndex = 3;
+ this.buttonDel.Text = "Удалить";
+ this.buttonDel.UseVisualStyleBackColor = true;
+ this.buttonDel.Click += new System.EventHandler(this.ButtonDel_Click);
+ //
+ // buttonRef
+ //
+ this.buttonRef.Location = new System.Drawing.Point(437, 213);
+ this.buttonRef.Name = "buttonRef";
+ this.buttonRef.Size = new System.Drawing.Size(75, 23);
+ this.buttonRef.TabIndex = 4;
+ this.buttonRef.Text = "Обновить";
+ this.buttonRef.UseVisualStyleBackColor = true;
+ this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
+ //
+ // FormMasters
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(558, 413);
+ this.Controls.Add(this.buttonRef);
+ this.Controls.Add(this.buttonDel);
+ this.Controls.Add(this.buttonUpd);
+ this.Controls.Add(this.buttonAdd);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormMasters";
+ this.Text = "Мастера";
+ this.Load += new System.EventHandler(this.FormMasters_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button buttonAdd;
+ private Button buttonUpd;
+ private Button buttonDel;
+ private Button buttonRef;
+ }
+}
\ No newline at end of file
diff --git a/BeautySalon/FormMasters.cs b/BeautySalon/FormMasters.cs
new file mode 100644
index 0000000..f0c559a
--- /dev/null
+++ b/BeautySalon/FormMasters.cs
@@ -0,0 +1,106 @@
+using BeautySalonContracts.BindingModels;
+using BeautySalonContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+
+namespace BeautySalon
+{
+ public partial class FormMasters : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IMasterLogic _logic;
+ public FormMasters(ILogger logger, IMasterLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void LoadData()
+ {
+ try
+ {
+ var list = _logic.ReadList(null);
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["Id"].Visible = false;
+ dataGridView.Columns["MasterFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ dataGridView.Columns["MasterServices"].Visible = false;
+ }
+ _logger.LogInformation("Загрузка мастеров");
+
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки мастеров");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void FormMasters_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormMaster));
+ if (service is FormMaster form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+
+ private void ButtonUpd_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormMaster));
+ if (service is FormMaster form)
+ {
+ form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+ }
+
+ private void ButtonDel_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Удаление мастера");
+ try
+ {
+ if (!_logic.Delete(new MasterBindingModel
+ {
+ Id = id
+ }))
+ {
+ throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка удаления мастера");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+
+ private void ButtonRef_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ }
+}
diff --git a/BeautySalon/FormMasters.resx b/BeautySalon/FormMasters.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/BeautySalon/FormMasters.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/FormService.Designer.cs b/BeautySalon/FormService.Designer.cs
new file mode 100644
index 0000000..e052208
--- /dev/null
+++ b/BeautySalon/FormService.Designer.cs
@@ -0,0 +1,119 @@
+namespace BeautySalon
+{
+ partial class FormService
+ {
+ ///
+ /// 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.buttonSave = new System.Windows.Forms.Button();
+ this.labelName = new System.Windows.Forms.Label();
+ this.textBoxName = new System.Windows.Forms.TextBox();
+ this.labelCost = new System.Windows.Forms.Label();
+ this.textBoxCost = new System.Windows.Forms.TextBox();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // buttonSave
+ //
+ this.buttonSave.Location = new System.Drawing.Point(170, 76);
+ this.buttonSave.Name = "buttonSave";
+ this.buttonSave.Size = new System.Drawing.Size(75, 23);
+ this.buttonSave.TabIndex = 0;
+ this.buttonSave.Text = "Сохранить";
+ this.buttonSave.UseVisualStyleBackColor = true;
+ this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
+ //
+ // labelName
+ //
+ this.labelName.AutoSize = true;
+ this.labelName.Location = new System.Drawing.Point(12, 22);
+ this.labelName.Name = "labelName";
+ this.labelName.Size = new System.Drawing.Size(62, 15);
+ this.labelName.TabIndex = 1;
+ this.labelName.Text = "Название:";
+ //
+ // textBoxName
+ //
+ this.textBoxName.Location = new System.Drawing.Point(82, 19);
+ this.textBoxName.Name = "textBoxName";
+ this.textBoxName.Size = new System.Drawing.Size(247, 23);
+ this.textBoxName.TabIndex = 2;
+ //
+ // labelCost
+ //
+ this.labelCost.AutoSize = true;
+ this.labelCost.Location = new System.Drawing.Point(12, 50);
+ this.labelCost.Name = "labelCost";
+ this.labelCost.Size = new System.Drawing.Size(38, 15);
+ this.labelCost.TabIndex = 3;
+ this.labelCost.Text = "Цена:";
+ //
+ // textBoxCost
+ //
+ this.textBoxCost.Location = new System.Drawing.Point(82, 47);
+ this.textBoxCost.Name = "textBoxCost";
+ this.textBoxCost.Size = new System.Drawing.Size(128, 23);
+ this.textBoxCost.TabIndex = 4;
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Location = new System.Drawing.Point(254, 76);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(75, 23);
+ this.buttonCancel.TabIndex = 5;
+ this.buttonCancel.Text = "Отмена";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
+ //
+ // FormService
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(341, 107);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.textBoxCost);
+ this.Controls.Add(this.labelCost);
+ this.Controls.Add(this.textBoxName);
+ this.Controls.Add(this.labelName);
+ this.Controls.Add(this.buttonSave);
+ this.Name = "FormService";
+ this.Text = "Услуга";
+ this.Load += new System.EventHandler(this.FormService_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private Button buttonSave;
+ private Label labelName;
+ private TextBox textBoxName;
+ private Label labelCost;
+ private TextBox textBoxCost;
+ private Button buttonCancel;
+ }
+}
\ No newline at end of file
diff --git a/BeautySalon/FormService.cs b/BeautySalon/FormService.cs
new file mode 100644
index 0000000..35ee2b8
--- /dev/null
+++ b/BeautySalon/FormService.cs
@@ -0,0 +1,82 @@
+using BeautySalonContracts.BindingModels;
+using BeautySalonContracts.BusinessLogicsContracts;
+using BeautySalonContracts.SearchModels;
+using Microsoft.Extensions.Logging;
+
+namespace BeautySalon
+{
+ public partial class FormService : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IServiceLogic _logic;
+ private int? _id;
+ public int Id { set { _id = value; } }
+ public FormService(ILogger logger, IServiceLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxName.Text))
+ {
+ MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ _logger.LogInformation("Сохранение услуги");
+ try
+ {
+ var model = new ServiceBindingModel
+ {
+ Id = _id ?? 0,
+ ServiceName = textBoxName.Text,
+ Cost = Convert.ToDouble(textBoxCost.Text)
+ };
+ var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+ MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения услуги");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ private void FormService_Load(object sender, EventArgs e)
+ {
+ if (_id.HasValue)
+ {
+ try
+ {
+ _logger.LogInformation("Получение услуги");
+ var view = _logic.ReadElement(new ServiceSearchModel { Id = _id.Value });
+ if (view != null)
+ {
+ textBoxName.Text = view.ServiceName;
+ textBoxCost.Text = view.Cost.ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка получения услуги");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+}
diff --git a/BeautySalon/FormService.resx b/BeautySalon/FormService.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/BeautySalon/FormService.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/FormServices.Designer.cs b/BeautySalon/FormServices.Designer.cs
new file mode 100644
index 0000000..5dad493
--- /dev/null
+++ b/BeautySalon/FormServices.Designer.cs
@@ -0,0 +1,114 @@
+namespace BeautySalon
+{
+ partial class FormServices
+ {
+ ///
+ /// 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.dataGridView = new System.Windows.Forms.DataGridView();
+ this.buttonAdd = new System.Windows.Forms.Button();
+ this.buttonUpd = new System.Windows.Forms.Button();
+ this.buttonDel = new System.Windows.Forms.Button();
+ this.buttonRef = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Control;
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(12, 12);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.Size = new System.Drawing.Size(357, 426);
+ this.dataGridView.TabIndex = 0;
+ //
+ // buttonAdd
+ //
+ this.buttonAdd.Location = new System.Drawing.Point(411, 31);
+ this.buttonAdd.Name = "buttonAdd";
+ this.buttonAdd.Size = new System.Drawing.Size(75, 23);
+ this.buttonAdd.TabIndex = 1;
+ this.buttonAdd.Text = "Добавить";
+ this.buttonAdd.UseVisualStyleBackColor = true;
+ this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
+ //
+ // buttonUpd
+ //
+ this.buttonUpd.Location = new System.Drawing.Point(411, 79);
+ this.buttonUpd.Name = "buttonUpd";
+ this.buttonUpd.Size = new System.Drawing.Size(75, 23);
+ this.buttonUpd.TabIndex = 2;
+ this.buttonUpd.Text = "Изменить";
+ this.buttonUpd.UseVisualStyleBackColor = true;
+ this.buttonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
+ //
+ // buttonDel
+ //
+ this.buttonDel.Location = new System.Drawing.Point(411, 131);
+ this.buttonDel.Name = "buttonDel";
+ this.buttonDel.Size = new System.Drawing.Size(75, 23);
+ this.buttonDel.TabIndex = 3;
+ this.buttonDel.Text = "Удалить";
+ this.buttonDel.UseVisualStyleBackColor = true;
+ this.buttonDel.Click += new System.EventHandler(this.ButtonDel_Click);
+ //
+ // buttonRef
+ //
+ this.buttonRef.Location = new System.Drawing.Point(411, 187);
+ this.buttonRef.Name = "buttonRef";
+ this.buttonRef.Size = new System.Drawing.Size(75, 23);
+ this.buttonRef.TabIndex = 4;
+ this.buttonRef.Text = "Обновить";
+ this.buttonRef.UseVisualStyleBackColor = true;
+ this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
+ //
+ // FormServices
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(520, 450);
+ this.Controls.Add(this.buttonRef);
+ this.Controls.Add(this.buttonDel);
+ this.Controls.Add(this.buttonUpd);
+ this.Controls.Add(this.buttonAdd);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormServices";
+ this.Text = "Услуги";
+ this.Load += new System.EventHandler(this.FormServices_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button buttonAdd;
+ private Button buttonUpd;
+ private Button buttonDel;
+ private Button buttonRef;
+ }
+}
\ No newline at end of file
diff --git a/BeautySalon/FormServices.cs b/BeautySalon/FormServices.cs
new file mode 100644
index 0000000..3712c8e
--- /dev/null
+++ b/BeautySalon/FormServices.cs
@@ -0,0 +1,101 @@
+using BeautySalonContracts.BindingModels;
+using BeautySalonContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+
+namespace BeautySalon
+{
+ public partial class FormServices : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IServiceLogic _logic;
+ public FormServices(ILogger logger, IServiceLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormServices_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void LoadData()
+ {
+ try
+ {
+ var list = _logic.ReadList(null);
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["Id"].Visible = false;
+ dataGridView.Columns["ServiceName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ }
+ _logger.LogInformation("Загрузка услуг");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки услуг");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormService));
+ if (service is FormService form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+
+ private void ButtonUpd_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormService));
+ if (service is FormService form)
+ {
+ form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+ }
+
+ private void ButtonDel_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Удаление услуги");
+ try
+ {
+ if (!_logic.Delete(new ServiceBindingModel { Id = id }))
+ {
+ throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка удаления услуги");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+
+ private void ButtonRef_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ }
+}
diff --git a/BeautySalon/FormServices.resx b/BeautySalon/FormServices.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/BeautySalon/FormServices.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/Form1.Designer.cs b/BeautySalon/FormTests.Designer.cs
similarity index 76%
rename from BeautySalon/Form1.Designer.cs
rename to BeautySalon/FormTests.Designer.cs
index 6c2325f..4755b4d 100644
--- a/BeautySalon/Form1.Designer.cs
+++ b/BeautySalon/FormTests.Designer.cs
@@ -1,14 +1,14 @@
namespace BeautySalon
{
- partial class Form1
+ partial class FormTests
{
///
- /// Required designer variable.
+ /// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
- /// Clean up any resources being used.
+ /// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
@@ -23,15 +23,15 @@
#region Windows Form Designer generated code
///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
+ /// 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 = "Form1";
+ this.Text = "FormTests";
}
#endregion
diff --git a/BeautySalon/FormTests.cs b/BeautySalon/FormTests.cs
new file mode 100644
index 0000000..5365914
--- /dev/null
+++ b/BeautySalon/FormTests.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 FormTests : Form
+ {
+ public FormTests()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BeautySalon/Form1.resx b/BeautySalon/FormTests.resx
similarity index 100%
rename from BeautySalon/Form1.resx
rename to BeautySalon/FormTests.resx
diff --git a/BeautySalon/Program.cs b/BeautySalon/Program.cs
index d8ac575..7e31b65 100644
--- a/BeautySalon/Program.cs
+++ b/BeautySalon/Program.cs
@@ -1,17 +1,53 @@
+using BeautySalonBusinessLogic.BusinessLogics;
+using BeautySalonContracts.BusinessLogicsContracts;
+using BeautySalonContracts.StoragesContracts;
+using BeautySalonDatabaseImplement.Implements;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using NLog.Extensions.Logging;
+
namespace BeautySalon
{
internal static class Program
{
- ///
- /// The main entry point for the application.
- ///
+ private static ServiceProvider? _serviceProvider;
+ public static ServiceProvider? ServiceProvider => _serviceProvider;
[STAThread]
static void Main()
{
- // To customize application configuration such as set high DPI settings or default font,
- // see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ var services = new ServiceCollection();
+ ConfigureServices(services);
+ _serviceProvider = services.BuildServiceProvider();
+ Application.Run(_serviceProvider.GetRequiredService());
+ }
+
+ private static void ConfigureServices(ServiceCollection services)
+ {
+ services.AddLogging(option =>
+ {
+ option.SetMinimumLevel(LogLevel.Information);
+ option.AddNLog("nlog.config");
+ });
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file
diff --git a/BeautySalonBusinessLogic/BusinessLogics/VisitLogic.cs b/BeautySalonBusinessLogic/BusinessLogics/VisitLogic.cs
index 0f89116..7e52ac2 100644
--- a/BeautySalonBusinessLogic/BusinessLogics/VisitLogic.cs
+++ b/BeautySalonBusinessLogic/BusinessLogics/VisitLogic.cs
@@ -80,11 +80,7 @@ namespace BeautySalonBusinessLogic.BusinessLogics
if (model == null)
{
throw new ArgumentNullException(nameof(model));
- }
- if (model.Count <= 0)
- {
- throw new ArgumentNullException("Количество услуг должно быть больше 0", nameof(model.Count));
- }
+ }
if (model.Sum <= 0)
{
throw new ArgumentNullException("Суммарная стоимость должна быть больше 0", nameof(model.Sum));
diff --git a/BeautySalonDataModels/Models/IMasterModel.cs b/BeautySalonDataModels/Models/IMasterModel.cs
index 412af99..a586d45 100644
--- a/BeautySalonDataModels/Models/IMasterModel.cs
+++ b/BeautySalonDataModels/Models/IMasterModel.cs
@@ -3,7 +3,7 @@
public interface IMasterModel : IId
{
string MasterFIO { get; }
- string Specialization { get; }
+ double WorkingHours { get; }
public Dictionary MasterServices { get; }
}
}
diff --git a/BeautySalonDataModels/Models/IVisitModel.cs b/BeautySalonDataModels/Models/IVisitModel.cs
index 4a3e2db..e3c01b6 100644
--- a/BeautySalonDataModels/Models/IVisitModel.cs
+++ b/BeautySalonDataModels/Models/IVisitModel.cs
@@ -7,6 +7,5 @@
int MasterId { get; }
int ServiceId { get; }
double Sum { get; }
- int Count { get; }
}
}
diff --git a/BeautySalonDatabaseImplement/Migrations/20230513120245_InitialCreate.Designer.cs b/BeautySalonDatabaseImplement/Migrations/20230513120245_InitialCreate.Designer.cs
deleted file mode 100644
index f343eb6..0000000
--- a/BeautySalonDatabaseImplement/Migrations/20230513120245_InitialCreate.Designer.cs
+++ /dev/null
@@ -1,225 +0,0 @@
-//
-using System;
-using BeautySalonDatabaseImplement;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-#nullable disable
-
-namespace BeautySalonDatabaseImplement.Migrations
-{
- [DbContext(typeof(BeautySalonDatabase))]
- [Migration("20230513120245_InitialCreate")]
- partial class InitialCreate
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "7.0.5")
- .HasAnnotation("Relational:MaxIdentifierLength", 128);
-
- SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Client", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("ClientFIO")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("PhoneNumber")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.HasKey("Id");
-
- b.ToTable("Clients");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Master", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("MasterFIO")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Specialization")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.HasKey("Id");
-
- b.ToTable("Masters");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.MasterService", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("Count")
- .HasColumnType("int");
-
- b.Property("MasterId")
- .HasColumnType("int");
-
- b.Property("ServiceId")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.HasIndex("MasterId");
-
- b.HasIndex("ServiceId");
-
- b.ToTable("MasterServices");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("Cost")
- .HasColumnType("float");
-
- b.Property("ServiceName")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.HasKey("Id");
-
- b.ToTable("Services");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Visit", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("ClientFIO")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("ClientId")
- .HasColumnType("int");
-
- b.Property("Count")
- .HasColumnType("int");
-
- b.Property("DateOfVisit")
- .HasColumnType("datetime2");
-
- b.Property("MasterFIO")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("MasterId")
- .HasColumnType("int");
-
- b.Property("ServiceId")
- .HasColumnType("int");
-
- b.Property("ServiceName")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Sum")
- .HasColumnType("float");
-
- b.HasKey("Id");
-
- b.HasIndex("ClientId");
-
- b.HasIndex("MasterId");
-
- b.HasIndex("ServiceId");
-
- b.ToTable("Visits");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.MasterService", b =>
- {
- b.HasOne("BeautySalonDatabaseImplement.Models.Master", "Master")
- .WithMany("Services")
- .HasForeignKey("MasterId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("BeautySalonDatabaseImplement.Models.Service", "Service")
- .WithMany("MasterServices")
- .HasForeignKey("ServiceId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Master");
-
- b.Navigation("Service");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Visit", b =>
- {
- b.HasOne("BeautySalonDatabaseImplement.Models.Client", "Client")
- .WithMany()
- .HasForeignKey("ClientId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("BeautySalonDatabaseImplement.Models.Master", "Master")
- .WithMany("Visits")
- .HasForeignKey("MasterId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("BeautySalonDatabaseImplement.Models.Service", "Service")
- .WithMany()
- .HasForeignKey("ServiceId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Client");
-
- b.Navigation("Master");
-
- b.Navigation("Service");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Master", b =>
- {
- b.Navigation("Services");
-
- b.Navigation("Visits");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b =>
- {
- b.Navigation("MasterServices");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/BeautySalonDatabaseImplement/Migrations/20230513120245_InitialCreate.cs b/BeautySalonDatabaseImplement/Migrations/20230513120245_InitialCreate.cs
deleted file mode 100644
index bb58afe..0000000
--- a/BeautySalonDatabaseImplement/Migrations/20230513120245_InitialCreate.cs
+++ /dev/null
@@ -1,167 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace BeautySalonDatabaseImplement.Migrations
-{
- ///
- public partial class InitialCreate : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Clients",
- columns: table => new
- {
- Id = table.Column(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- ClientFIO = table.Column(type: "nvarchar(max)", nullable: false),
- PhoneNumber = table.Column(type: "nvarchar(max)", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Clients", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Masters",
- columns: table => new
- {
- Id = table.Column(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- MasterFIO = table.Column(type: "nvarchar(max)", nullable: false),
- Specialization = table.Column(type: "nvarchar(max)", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Masters", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Services",
- columns: table => new
- {
- Id = table.Column(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- ServiceName = table.Column(type: "nvarchar(max)", nullable: false),
- Cost = table.Column(type: "float", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Services", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "MasterServices",
- columns: table => new
- {
- Id = table.Column(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- MasterId = table.Column(type: "int", nullable: false),
- ServiceId = table.Column(type: "int", nullable: false),
- Count = table.Column(type: "int", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_MasterServices", x => x.Id);
- table.ForeignKey(
- name: "FK_MasterServices_Masters_MasterId",
- column: x => x.MasterId,
- principalTable: "Masters",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_MasterServices_Services_ServiceId",
- column: x => x.ServiceId,
- principalTable: "Services",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "Visits",
- columns: table => new
- {
- Id = table.Column(type: "int", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- DateOfVisit = table.Column(type: "datetime2", nullable: false),
- ClientId = table.Column(type: "int", nullable: false),
- MasterId = table.Column(type: "int", nullable: false),
- ServiceId = table.Column(type: "int", nullable: false),
- ClientFIO = table.Column(type: "nvarchar(max)", nullable: false),
- MasterFIO = table.Column(type: "nvarchar(max)", nullable: false),
- ServiceName = table.Column(type: "nvarchar(max)", nullable: false),
- Sum = table.Column(type: "float", nullable: false),
- Count = table.Column(type: "int", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Visits", x => x.Id);
- table.ForeignKey(
- name: "FK_Visits_Clients_ClientId",
- column: x => x.ClientId,
- principalTable: "Clients",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_Visits_Masters_MasterId",
- column: x => x.MasterId,
- principalTable: "Masters",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_Visits_Services_ServiceId",
- column: x => x.ServiceId,
- principalTable: "Services",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_MasterServices_MasterId",
- table: "MasterServices",
- column: "MasterId");
-
- migrationBuilder.CreateIndex(
- name: "IX_MasterServices_ServiceId",
- table: "MasterServices",
- column: "ServiceId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Visits_ClientId",
- table: "Visits",
- column: "ClientId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Visits_MasterId",
- table: "Visits",
- column: "MasterId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Visits_ServiceId",
- table: "Visits",
- column: "ServiceId");
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "MasterServices");
-
- migrationBuilder.DropTable(
- name: "Visits");
-
- migrationBuilder.DropTable(
- name: "Clients");
-
- migrationBuilder.DropTable(
- name: "Masters");
-
- migrationBuilder.DropTable(
- name: "Services");
- }
- }
-}
diff --git a/BeautySalonDatabaseImplement/Migrations/BeautySalonDatabaseModelSnapshot.cs b/BeautySalonDatabaseImplement/Migrations/BeautySalonDatabaseModelSnapshot.cs
deleted file mode 100644
index 7b07540..0000000
--- a/BeautySalonDatabaseImplement/Migrations/BeautySalonDatabaseModelSnapshot.cs
+++ /dev/null
@@ -1,222 +0,0 @@
-//
-using System;
-using BeautySalonDatabaseImplement;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-
-#nullable disable
-
-namespace BeautySalonDatabaseImplement.Migrations
-{
- [DbContext(typeof(BeautySalonDatabase))]
- partial class BeautySalonDatabaseModelSnapshot : ModelSnapshot
- {
- protected override void BuildModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "7.0.5")
- .HasAnnotation("Relational:MaxIdentifierLength", 128);
-
- SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Client", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("ClientFIO")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("PhoneNumber")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.HasKey("Id");
-
- b.ToTable("Clients");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Master", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("MasterFIO")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Specialization")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.HasKey("Id");
-
- b.ToTable("Masters");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.MasterService", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("Count")
- .HasColumnType("int");
-
- b.Property("MasterId")
- .HasColumnType("int");
-
- b.Property("ServiceId")
- .HasColumnType("int");
-
- b.HasKey("Id");
-
- b.HasIndex("MasterId");
-
- b.HasIndex("ServiceId");
-
- b.ToTable("MasterServices");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("Cost")
- .HasColumnType("float");
-
- b.Property("ServiceName")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.HasKey("Id");
-
- b.ToTable("Services");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Visit", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
-
- b.Property("ClientFIO")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("ClientId")
- .HasColumnType("int");
-
- b.Property("Count")
- .HasColumnType("int");
-
- b.Property("DateOfVisit")
- .HasColumnType("datetime2");
-
- b.Property("MasterFIO")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("MasterId")
- .HasColumnType("int");
-
- b.Property("ServiceId")
- .HasColumnType("int");
-
- b.Property("ServiceName")
- .IsRequired()
- .HasColumnType("nvarchar(max)");
-
- b.Property("Sum")
- .HasColumnType("float");
-
- b.HasKey("Id");
-
- b.HasIndex("ClientId");
-
- b.HasIndex("MasterId");
-
- b.HasIndex("ServiceId");
-
- b.ToTable("Visits");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.MasterService", b =>
- {
- b.HasOne("BeautySalonDatabaseImplement.Models.Master", "Master")
- .WithMany("Services")
- .HasForeignKey("MasterId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("BeautySalonDatabaseImplement.Models.Service", "Service")
- .WithMany("MasterServices")
- .HasForeignKey("ServiceId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Master");
-
- b.Navigation("Service");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Visit", b =>
- {
- b.HasOne("BeautySalonDatabaseImplement.Models.Client", "Client")
- .WithMany()
- .HasForeignKey("ClientId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("BeautySalonDatabaseImplement.Models.Master", "Master")
- .WithMany("Visits")
- .HasForeignKey("MasterId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("BeautySalonDatabaseImplement.Models.Service", "Service")
- .WithMany()
- .HasForeignKey("ServiceId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Client");
-
- b.Navigation("Master");
-
- b.Navigation("Service");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Master", b =>
- {
- b.Navigation("Services");
-
- b.Navigation("Visits");
- });
-
- modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b =>
- {
- b.Navigation("MasterServices");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/BeautySalonDatabaseImplement/Models/Master.cs b/BeautySalonDatabaseImplement/Models/Master.cs
index e221bf2..97e986d 100644
--- a/BeautySalonDatabaseImplement/Models/Master.cs
+++ b/BeautySalonDatabaseImplement/Models/Master.cs
@@ -12,7 +12,7 @@ namespace BeautySalonDatabaseImplement.Models
[Required]
public string MasterFIO { get; set; } = string.Empty;
[Required]
- public string Specialization { get; set; } = string.Empty;
+ public double WorkingHours { get; set; }
private Dictionary? _masterServices = null;
[NotMapped]
public Dictionary MasterServices
@@ -38,7 +38,7 @@ namespace BeautySalonDatabaseImplement.Models
{
Id = model.Id,
MasterFIO = model.MasterFIO,
- Specialization = model.Specialization,
+ WorkingHours = model.WorkingHours,
Services = model.MasterServices.Select(x => new MasterService
{
Service = context.Services.First(y => y.Id == x.Key),
@@ -49,13 +49,13 @@ namespace BeautySalonDatabaseImplement.Models
public void Update(MasterBindingModel model)
{
MasterFIO = model.MasterFIO;
- Specialization = model.Specialization;
+ WorkingHours = model.WorkingHours;
}
public MasterViewModel GetViewModel => new()
{
Id = Id,
MasterFIO = MasterFIO,
- Specialization = Specialization,
+ WorkingHours = WorkingHours,
MasterServices = MasterServices
};
public void UpdateServices(BeautySalonDatabase context, MasterBindingModel model)
diff --git a/BeautySalonDatabaseImplement/Models/Visit.cs b/BeautySalonDatabaseImplement/Models/Visit.cs
index 7d22df3..ea6c452 100644
--- a/BeautySalonDatabaseImplement/Models/Visit.cs
+++ b/BeautySalonDatabaseImplement/Models/Visit.cs
@@ -18,9 +18,7 @@ namespace BeautySalonDatabaseImplement.Models
public string MasterFIO { get; set; } = string.Empty;
public string ServiceName { get; set; } = string.Empty;
[Required]
- public double Sum { get; private set; }
- [Required]
- public int Count { get; private set; }
+ public double Sum { get; private set; }
public virtual Client Client { get; set; }
public virtual Master Master { get; set; }
public virtual Service Service { get; set; }
@@ -41,7 +39,6 @@ namespace BeautySalonDatabaseImplement.Models
MasterFIO = model.MasterFIO,
ServiceId = model.ServiceId,
ServiceName = model.ServiceName,
- Count = model.Count,
Sum = model.Sum,
DateOfVisit = model.DateOfVisit
};
@@ -60,7 +57,6 @@ namespace BeautySalonDatabaseImplement.Models
MasterFIO = model.MasterFIO;
ServiceId = model.ServiceId;
ServiceName = model.ServiceName;
- Count = model.Count;
Sum = model.Sum;
DateOfVisit = model.DateOfVisit;
}
@@ -74,7 +70,6 @@ namespace BeautySalonDatabaseImplement.Models
MasterFIO = MasterFIO,
ServiceId = ServiceId,
ServiceName = ServiceName,
- Count = Count,
Sum = Sum,
DateOfVisit = DateOfVisit
};
diff --git a/BeauySalonContracts/BindingModels/MasterBindingModel.cs b/BeauySalonContracts/BindingModels/MasterBindingModel.cs
index 61a855e..d48839a 100644
--- a/BeauySalonContracts/BindingModels/MasterBindingModel.cs
+++ b/BeauySalonContracts/BindingModels/MasterBindingModel.cs
@@ -6,7 +6,7 @@ namespace BeautySalonContracts.BindingModels
{
public int Id { get; set; }
public string MasterFIO { get; set; } = string.Empty;
- public string Specialization { get; set; } = string.Empty;
+ public double WorkingHours { get; set; }
public Dictionary MasterServices { get; set; } = new();
}
}
diff --git a/BeauySalonContracts/BindingModels/VisitBindingModel.cs b/BeauySalonContracts/BindingModels/VisitBindingModel.cs
index 951b21e..10e26a2 100644
--- a/BeauySalonContracts/BindingModels/VisitBindingModel.cs
+++ b/BeauySalonContracts/BindingModels/VisitBindingModel.cs
@@ -13,6 +13,5 @@ namespace BeautySalonContracts.BindingModels
public string MasterFIO { get; set; } = string.Empty;
public string ServiceName { get; set; } = string.Empty;
public double Sum { get; set; }
- public int Count { get; set; }
}
}
diff --git a/BeauySalonContracts/SearchModels/MasterSearchModel.cs b/BeauySalonContracts/SearchModels/MasterSearchModel.cs
index dcfd561..28f24fd 100644
--- a/BeauySalonContracts/SearchModels/MasterSearchModel.cs
+++ b/BeauySalonContracts/SearchModels/MasterSearchModel.cs
@@ -4,6 +4,5 @@
{
public int? Id { get; set; }
public string? MasterFIO { get; set; }
- public string? Specilization { get; set; }
}
}
diff --git a/BeauySalonContracts/ViewModels/MasterViewModel.cs b/BeauySalonContracts/ViewModels/MasterViewModel.cs
index d579515..27610ac 100644
--- a/BeauySalonContracts/ViewModels/MasterViewModel.cs
+++ b/BeauySalonContracts/ViewModels/MasterViewModel.cs
@@ -8,8 +8,8 @@ namespace BeautySalonContracts.ViewModels
public int Id { get; set; }
[DisplayName("ФИО мастера")]
public string MasterFIO { get; set; } = string.Empty;
- [DisplayName("Специализация")]
- public string Specialization { get; set; } = string.Empty;
+ [DisplayName("Рабочее время")]
+ public double WorkingHours { get; set; }
public Dictionary MasterServices { get; set; } = new();
}
}
diff --git a/BeauySalonContracts/ViewModels/VisitViewModel.cs b/BeauySalonContracts/ViewModels/VisitViewModel.cs
index bfeef3a..6b886af 100644
--- a/BeauySalonContracts/ViewModels/VisitViewModel.cs
+++ b/BeauySalonContracts/ViewModels/VisitViewModel.cs
@@ -19,7 +19,5 @@ namespace BeautySalonContracts.ViewModels
public string ServiceName { get; set; } = string.Empty;
[DisplayName("Сумма")]
public double Sum { get; set; }
- [DisplayName("Количество")]
- public int Count { get; set; }
}
}