diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Entities/CustomerContractReview.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/CustomerExecutorReview.cs similarity index 59% rename from PIbd-23_Gutorov_I.A._IT-Company/Entities/CustomerContractReview.cs rename to PIbd-23_Gutorov_I.A._IT-Company/Entities/CustomerExecutorReview.cs index 48cc244..1a7f114 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Entities/CustomerContractReview.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/CustomerExecutorReview.cs @@ -1,24 +1,24 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Entities; -public class CustomerContractReview +public class CustomerExecutorReview { public int Id { get; private set; } public int CustomerId { get; private set; } - public int ContractId { get; private set; } + public int ExecutorId { get; private set; } public string Review { get; private set; } = string.Empty; public int Grade { get; private set; } - public static CustomerContractReview CreateElement(int id, int customerId, int contractId, string review, int grade) + public static CustomerExecutorReview CreateElement(int id, int customerId, int executorId, string review, int grade) { - return new CustomerContractReview + return new CustomerExecutorReview { Id = id, CustomerId = customerId, - ContractId = contractId, + ExecutorId = executorId, Review = review ?? String.Empty, Grade = grade }; diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Entities/Enums/ExecutorPost.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Enums/ExecutorPost.cs index 8a25ac7..bc23622 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Entities/Enums/ExecutorPost.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Enums/ExecutorPost.cs @@ -7,7 +7,7 @@ public enum ExecutorPost Junior = 1, Middle = 2, - + Senior = 3, TeamLead = 4 diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Entities/ServiceExecution.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/ServiceExecution.cs deleted file mode 100644 index 3196d18..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Entities/ServiceExecution.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace PIbd_23_Gutorov_I.A._IT_Company.Entities; - -public class ServiceExecution -{ - public int Id { get; private set; } - - public int ContractId { get; private set; } - - public int ServiceId { get; private set; } - - public int ExecutorId { get; private set; } - - public int Completion { get; private set; } - - public DateTime Deadline { get; private set; } - - public static ServiceExecution CreateOperation(int id, int contractId, int serviceId, int executorId, int completion, DateTime deadline) - { - return new ServiceExecution - { - Id = id, - ContractId = contractId, - ServiceId = serviceId, - ExecutorId = executorId, - Completion = completion, - Deadline = deadline - }; - } -} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.Designer.cs index b5a55e6..3e5371a 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.Designer.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.Designer.cs @@ -37,7 +37,6 @@ CustomerContractReviewsToolStripMenuItem = new ToolStripMenuItem(); контрактыToolStripMenuItem = new ToolStripMenuItem(); отчетыToolStripMenuItem = new ToolStripMenuItem(); - выполнениеУслугToolStripMenuItem = new ToolStripMenuItem(); menuStrip.SuspendLayout(); SuspendLayout(); // @@ -60,27 +59,27 @@ // CustomersToolStripMenuItem // CustomersToolStripMenuItem.Name = "CustomersToolStripMenuItem"; - CustomersToolStripMenuItem.Size = new Size(149, 22); + CustomersToolStripMenuItem.Size = new Size(180, 22); CustomersToolStripMenuItem.Text = "Заказчики"; CustomersToolStripMenuItem.Click += CustomersToolStripMenuItem_Click; // // ExecutorsToolStripMenuItem // ExecutorsToolStripMenuItem.Name = "ExecutorsToolStripMenuItem"; - ExecutorsToolStripMenuItem.Size = new Size(149, 22); + ExecutorsToolStripMenuItem.Size = new Size(180, 22); ExecutorsToolStripMenuItem.Text = "Исполнители"; ExecutorsToolStripMenuItem.Click += ExecutorsToolStripMenuItem_Click; // // ServicesToolStripMenuItem // ServicesToolStripMenuItem.Name = "ServicesToolStripMenuItem"; - ServicesToolStripMenuItem.Size = new Size(149, 22); + ServicesToolStripMenuItem.Size = new Size(180, 22); ServicesToolStripMenuItem.Text = "Услуги"; ServicesToolStripMenuItem.Click += ServicesToolStripMenuItem_Click; // // операцииToolStripMenuItem // - операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CustomerContractReviewsToolStripMenuItem, контрактыToolStripMenuItem, выполнениеУслугToolStripMenuItem }); + операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CustomerContractReviewsToolStripMenuItem, контрактыToolStripMenuItem }); операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; операцииToolStripMenuItem.Size = new Size(75, 20); операцииToolStripMenuItem.Text = "Операции"; @@ -105,13 +104,6 @@ отчетыToolStripMenuItem.Size = new Size(60, 20); отчетыToolStripMenuItem.Text = "Отчеты"; // - // выполнениеУслугToolStripMenuItem - // - выполнениеУслугToolStripMenuItem.Name = "выполнениеУслугToolStripMenuItem"; - выполнениеУслугToolStripMenuItem.Size = new Size(181, 22); - выполнениеУслугToolStripMenuItem.Text = "Выполнение услуг"; - выполнениеУслугToolStripMenuItem.Click += ServiceExecutionsToolStripMenuItem_Click; - // // FormItCompany // AutoScaleDimensions = new SizeF(7F, 15F); @@ -141,6 +133,5 @@ private ToolStripMenuItem отчетыToolStripMenuItem; private ToolStripMenuItem CustomerContractReviewsToolStripMenuItem; private ToolStripMenuItem контрактыToolStripMenuItem; - private ToolStripMenuItem выполнениеУслугToolStripMenuItem; } } diff --git a/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.cs b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.cs index e53911b..710d8e2 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.cs @@ -1,5 +1,4 @@ using PIbd_23_Gutorov_I.A._IT_Company.Forms; -using System.Runtime.Serialization; using Unity; namespace PIbd_23_Gutorov_I.A._IT_Company @@ -66,19 +65,7 @@ namespace PIbd_23_Gutorov_I.A._IT_Company { try { - _container.Resolve().ShowDialog(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void ServiceExecutionsToolStripMenuItem_Click(object sender, EventArgs e) - { - try - { - _container.Resolve().ShowDialog(); + _container.Resolve().ShowDialog(); } catch (Exception ex) { diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.Designer.cs index 148c1b8..2eed9bf 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.Designer.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.Designer.cs @@ -42,6 +42,7 @@ labelContractPaymentAmount = new Label(); dataGridViewServices = new DataGridView(); groupBox = new GroupBox(); + ColumnServiceDescription = new DataGridViewComboBoxColumn(); ((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridViewServices).BeginInit(); groupBox.SuspendLayout(); @@ -73,6 +74,7 @@ // // buttonCancel // + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; buttonCancel.Location = new Point(12, 469); buttonCancel.Name = "buttonCancel"; buttonCancel.Size = new Size(358, 23); @@ -83,6 +85,7 @@ // // buttonSave // + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; buttonSave.Location = new Point(12, 440); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(358, 23); @@ -156,16 +159,22 @@ // // dataGridViewServices // - dataGridViewServices.AllowUserToDeleteRows = false; + dataGridViewServices.AllowUserToResizeColumns = false; + dataGridViewServices.AllowUserToResizeRows = false; dataGridViewServices.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewServices.Columns.AddRange(new DataGridViewColumn[] { ColumnServiceDescription }); dataGridViewServices.Dock = DockStyle.Fill; dataGridViewServices.Location = new Point(3, 19); + dataGridViewServices.MultiSelect = false; dataGridViewServices.Name = "dataGridViewServices"; + dataGridViewServices.RowHeadersVisible = false; + dataGridViewServices.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridViewServices.Size = new Size(352, 244); dataGridViewServices.TabIndex = 17; // // groupBox // + groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; groupBox.Controls.Add(dataGridViewServices); groupBox.Location = new Point(12, 168); groupBox.Name = "groupBox"; @@ -174,6 +183,13 @@ groupBox.TabStop = false; groupBox.Text = "Услуги:"; // + // ColumnServiceDescription + // + ColumnServiceDescription.HeaderText = "Услуга"; + ColumnServiceDescription.Name = "ColumnServiceDescription"; + ColumnServiceDescription.Resizable = DataGridViewTriState.True; + ColumnServiceDescription.SortMode = DataGridViewColumnSortMode.Automatic; + // // FormContract // AutoScaleDimensions = new SizeF(7F, 15F); @@ -218,5 +234,6 @@ private Label labelContractPaymentAmount; private DataGridView dataGridViewServices; private GroupBox groupBox; + private DataGridViewComboBoxColumn ColumnServiceDescription; } } \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.cs index 769d8b3..7be33b9 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.cs @@ -8,51 +8,24 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms { private readonly IContractRepository _contractRepository; - private int? _contractId; - - public int Id - { - set - { - try - { - var contract = _contractRepository.ReadContractById(value); - if (contract == null) throw new InvalidDataException(nameof(contract)); - - foreach (ContractCategory elem in Enum.GetValues(typeof(ContractCategory))) - { - if ((elem & contract.Category) != 0) - { - checkedListBoxContractCategory.SetItemChecked(checkedListBoxContractCategory.Items.IndexOf(elem), true); - } - } - - dateTimePickerContractDeadline.Value = contract.Deadline; - numericUpDownContractPaymentAmount.Value = contract.PaymentAmount; - _contractId = value; - - - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - } - } - - public FormContract(IContractRepository contractRepository, ICustomerRepository customerRepository, IExecutorRepository executorRepository) + public FormContract(IContractRepository contractRepository, ICustomerRepository customerRepository, + IExecutorRepository executorRepository, IServiceRepository serviceRepository) { InitializeComponent(); _contractRepository = contractRepository ?? throw new ArgumentNullException(nameof(contractRepository)); comboBoxContractCustomerId.DataSource = customerRepository.ReadCustomers(); + comboBoxContractCustomerId.DisplayMember = "Name"; comboBoxContractCustomerId.DisplayMember = "Id"; comboBoxContractExecutorId.DataSource = executorRepository.ReadExecutors(); comboBoxContractExecutorId.DisplayMember = "Name"; comboBoxContractExecutorId.DisplayMember = "Id"; + ColumnServiceDescription.DataSource = serviceRepository.ReadServices(); + ColumnServiceDescription.DisplayMember = "Description"; + comboBoxContractExecutorId.DisplayMember = "Id"; + foreach (var elem in Enum.GetValues(typeof(ContractCategory))) { checkedListBoxContractCategory.Items.Add(elem); diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.resx index 8b2ff64..9958efa 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.resx +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.cs index b763e2f..84309c8 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.cs @@ -17,7 +17,7 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms { var customer = _customerRepository.ReadCustomerById(value); if (customer == null) throw new InvalidDataException(nameof(customer)); - + textBoxCustomerName.Text = customer.Name; textBoxCustomerContact.Text = customer.Contact; textBoxCustomerAddress.Text = customer.Address; @@ -62,7 +62,7 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms private void ButtonCancel_Click(object sender, EventArgs e) => Close(); private Customer CreateCustomer(int id) => Customer.CreateEntity( - id, textBoxCustomerName.Text, textBoxCustomerContact.Text, + id, textBoxCustomerName.Text, textBoxCustomerContact.Text, textBoxCustomerAddress.Text); } } \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReview.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReview.Designer.cs deleted file mode 100644 index 58acf10..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReview.Designer.cs +++ /dev/null @@ -1,180 +0,0 @@ -namespace PIbd_23_Gutorov_I.A._IT_Company.Forms -{ - partial class FormCustomerContractReview - { - /// - /// 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() - { - labelCustomerContractReviewCustomerId = new Label(); - buttonCancel = new Button(); - buttonSave = new Button(); - richTextBoxCustomerContractReviewReview = new RichTextBox(); - labelCustomerContractReviewReview = new Label(); - numericUpDownCustomerContractReviewGrade = new NumericUpDown(); - comboBoxCustomerContractReviewCustomerId = new ComboBox(); - comboBoxCustomerContractReviewContractId = new ComboBox(); - labelCustomerContractReviewContractId = new Label(); - labelCustomerContractReviewGrade = new Label(); - ((System.ComponentModel.ISupportInitialize)numericUpDownCustomerContractReviewGrade).BeginInit(); - SuspendLayout(); - // - // labelCustomerContractReviewCustomerId - // - labelCustomerContractReviewCustomerId.AutoSize = true; - labelCustomerContractReviewCustomerId.Location = new Point(12, 9); - labelCustomerContractReviewCustomerId.Name = "labelCustomerContractReviewCustomerId"; - labelCustomerContractReviewCustomerId.Size = new Size(60, 15); - labelCustomerContractReviewCustomerId.TabIndex = 22; - labelCustomerContractReviewCustomerId.Text = "Заказчик:"; - // - // buttonCancel - // - buttonCancel.Location = new Point(12, 224); - buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(358, 23); - buttonCancel.TabIndex = 21; - buttonCancel.Text = "Отмена"; - buttonCancel.UseVisualStyleBackColor = true; - buttonCancel.Click += ButtonCancel_Click; - // - // buttonSave - // - buttonSave.Location = new Point(12, 195); - buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(358, 23); - buttonSave.TabIndex = 20; - buttonSave.Text = "Сохранить"; - buttonSave.UseVisualStyleBackColor = true; - buttonSave.Click += ButtonSave_Click; - // - // richTextBoxCustomerContractReviewReview - // - richTextBoxCustomerContractReviewReview.Location = new Point(169, 64); - richTextBoxCustomerContractReviewReview.Name = "richTextBoxCustomerContractReviewReview"; - richTextBoxCustomerContractReviewReview.Size = new Size(202, 96); - richTextBoxCustomerContractReviewReview.TabIndex = 27; - richTextBoxCustomerContractReviewReview.Text = ""; - // - // labelCustomerContractReviewReview - // - labelCustomerContractReviewReview.AutoSize = true; - labelCustomerContractReviewReview.Location = new Point(12, 67); - labelCustomerContractReviewReview.Name = "labelCustomerContractReviewReview"; - labelCustomerContractReviewReview.Size = new Size(44, 15); - labelCustomerContractReviewReview.TabIndex = 28; - labelCustomerContractReviewReview.Text = "Отзыв:"; - // - // numericUpDownCustomerContractReviewGrade - // - numericUpDownCustomerContractReviewGrade.Location = new Point(169, 166); - numericUpDownCustomerContractReviewGrade.Maximum = new decimal(new int[] { 5, 0, 0, 0 }); - numericUpDownCustomerContractReviewGrade.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); - numericUpDownCustomerContractReviewGrade.Name = "numericUpDownCustomerContractReviewGrade"; - numericUpDownCustomerContractReviewGrade.Size = new Size(201, 23); - numericUpDownCustomerContractReviewGrade.TabIndex = 29; - numericUpDownCustomerContractReviewGrade.Value = new decimal(new int[] { 1, 0, 0, 0 }); - // - // comboBoxCustomerContractReviewCustomerId - // - comboBoxCustomerContractReviewCustomerId.DropDownStyle = ComboBoxStyle.DropDownList; - comboBoxCustomerContractReviewCustomerId.FormattingEnabled = true; - comboBoxCustomerContractReviewCustomerId.Location = new Point(169, 6); - comboBoxCustomerContractReviewCustomerId.Name = "comboBoxCustomerContractReviewCustomerId"; - comboBoxCustomerContractReviewCustomerId.Size = new Size(202, 23); - comboBoxCustomerContractReviewCustomerId.TabIndex = 30; - // - // comboBoxCustomerContractReviewContractId - // - comboBoxCustomerContractReviewContractId.DropDownStyle = ComboBoxStyle.DropDownList; - comboBoxCustomerContractReviewContractId.FormattingEnabled = true; - comboBoxCustomerContractReviewContractId.Location = new Point(169, 35); - comboBoxCustomerContractReviewContractId.Name = "comboBoxCustomerContractReviewContractId"; - comboBoxCustomerContractReviewContractId.Size = new Size(202, 23); - comboBoxCustomerContractReviewContractId.TabIndex = 31; - // - // labelCustomerContractReviewContractId - // - labelCustomerContractReviewContractId.AutoSize = true; - labelCustomerContractReviewContractId.Location = new Point(12, 38); - labelCustomerContractReviewContractId.Name = "labelCustomerContractReviewContractId"; - labelCustomerContractReviewContractId.Size = new Size(60, 15); - labelCustomerContractReviewContractId.TabIndex = 32; - labelCustomerContractReviewContractId.Text = "Контракт:"; - // - // labelCustomerContractReviewGrade - // - labelCustomerContractReviewGrade.AutoSize = true; - labelCustomerContractReviewGrade.Location = new Point(12, 168); - labelCustomerContractReviewGrade.Name = "labelCustomerContractReviewGrade"; - labelCustomerContractReviewGrade.Size = new Size(51, 15); - labelCustomerContractReviewGrade.TabIndex = 33; - labelCustomerContractReviewGrade.Text = "Оценка:"; - // - // FormCustomerContractReview - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(381, 260); - Controls.Add(labelCustomerContractReviewGrade); - Controls.Add(labelCustomerContractReviewContractId); - Controls.Add(comboBoxCustomerContractReviewContractId); - Controls.Add(comboBoxCustomerContractReviewCustomerId); - Controls.Add(numericUpDownCustomerContractReviewGrade); - Controls.Add(labelCustomerContractReviewReview); - Controls.Add(richTextBoxCustomerContractReviewReview); - Controls.Add(labelCustomerContractReviewCustomerId); - Controls.Add(buttonCancel); - Controls.Add(buttonSave); - Name = "FormCustomerContractReview"; - StartPosition = FormStartPosition.CenterParent; - Text = "Отзыв заказчика"; - ((System.ComponentModel.ISupportInitialize)numericUpDownCustomerContractReviewGrade).EndInit(); - ResumeLayout(false); - PerformLayout(); - } - - #endregion - - private Label labelContractPaymentAmount; - private Label labelContractDeadline; - private ComboBox comboBoxCustomerContractReviewCustomerId; - private ComboBox comboBoxContractCustomerId; - private Label labelContractCategory; - private Label labelContractExecutorId; - private Label labelCustomerContractReviewCustomerId; - private Button buttonCancel; - private Button buttonSave; - private RichTextBox richTextBoxCustomerContractReviewReview; - private Label labelCustomerContractReviewReview; - private NumericUpDown numericUpDownCustomerContractReviewGrade; - private NumericUpDown numericUpDownContractPaymentAmount; - private DateTimePicker dateTimePickerContractDeadline; - private CheckedListBox checkedListBoxContractCategory; - private ComboBox comboBoxCustomerContractReviewContractId; - private Label labelCustomerContractReviewContractId; - private Label labelCustomerContractReviewGrade; - } -} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReview.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReview.cs deleted file mode 100644 index cceece4..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReview.cs +++ /dev/null @@ -1,49 +0,0 @@ -using PIbd_23_Gutorov_I.A._IT_Company.Repositories; -using PIbd_23_Gutorov_I.A._IT_Company.Entities; - -namespace PIbd_23_Gutorov_I.A._IT_Company.Forms -{ - public partial class FormCustomerContractReview : Form - { - private readonly ICustomerContractReviewRepository _customerContractReviewRepository; - - public FormCustomerContractReview(ICustomerContractReviewRepository customerContractReviewRepository, - ICustomerRepository customerRepository, IContractRepository contractRepository) - { - InitializeComponent(); - _customerContractReviewRepository = customerContractReviewRepository ?? throw new ArgumentNullException(nameof(customerContractReviewRepository)); - - comboBoxCustomerContractReviewCustomerId.DataSource = customerRepository.ReadCustomers(); - comboBoxCustomerContractReviewCustomerId.DisplayMember = "Name"; - comboBoxCustomerContractReviewCustomerId.DisplayMember = "Id"; - - comboBoxCustomerContractReviewContractId.DataSource = contractRepository.ReadContracts(); - comboBoxCustomerContractReviewCustomerId.DisplayMember = "Id"; - } - - private void ButtonSave_Click(object sender, EventArgs e) - { - try - { - if (comboBoxCustomerContractReviewContractId.SelectedIndex < 0 || - comboBoxCustomerContractReviewCustomerId.SelectedIndex < 0 || - string.IsNullOrEmpty(richTextBoxCustomerContractReviewReview.Text)) - { - throw new Exception("Имеются незаполненные поля"); - } - - _customerContractReviewRepository.CreateCustomerContractReview(CustomerContractReview.CreateElement( - 0, (int)comboBoxCustomerContractReviewCustomerId.SelectedValue!, (int)comboBoxCustomerContractReviewContractId.SelectedValue!, - richTextBoxCustomerContractReviewReview.Text, Convert.ToInt32(numericUpDownContractPaymentAmount.Value))); - - Close(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void ButtonCancel_Click(object sender, EventArgs e) => Close(); - } -} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.Designer.cs new file mode 100644 index 0000000..c4a8d2d --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.Designer.cs @@ -0,0 +1,172 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + partial class FormCustomerExecutorReview + { + /// + /// 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() + { + labelCustomerExecutorReviewCustomerId = new Label(); + buttonCancel = new Button(); + buttonSave = new Button(); + richTextBoxCustomerExecutorReviewReview = new RichTextBox(); + labelCustomerExecutorReviewReview = new Label(); + numericUpDownCustomerExecutorReviewGrade = new NumericUpDown(); + comboBoxCustomerExecutorReviewCustomerId = new ComboBox(); + comboBoxCustomerExecutorReviewExecutorId = new ComboBox(); + labelCustomerExecutorReviewExecutorId = new Label(); + labelCustomerExecutorReviewGrade = new Label(); + ((System.ComponentModel.ISupportInitialize)numericUpDownCustomerExecutorReviewGrade).BeginInit(); + SuspendLayout(); + // + // labelCustomerExecutorReviewCustomerId + // + labelCustomerExecutorReviewCustomerId.AutoSize = true; + labelCustomerExecutorReviewCustomerId.Location = new Point(12, 9); + labelCustomerExecutorReviewCustomerId.Name = "labelCustomerExecutorReviewCustomerId"; + labelCustomerExecutorReviewCustomerId.Size = new Size(60, 15); + labelCustomerExecutorReviewCustomerId.TabIndex = 22; + labelCustomerExecutorReviewCustomerId.Text = "Заказчик:"; + // + // buttonCancel + // + buttonCancel.Location = new Point(12, 224); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(358, 23); + buttonCancel.TabIndex = 21; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // buttonSave + // + buttonSave.Location = new Point(12, 195); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(358, 23); + buttonSave.TabIndex = 20; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // richTextBoxCustomerExecutorReviewReview + // + richTextBoxCustomerExecutorReviewReview.Location = new Point(169, 64); + richTextBoxCustomerExecutorReviewReview.Name = "richTextBoxCustomerExecutorReviewReview"; + richTextBoxCustomerExecutorReviewReview.Size = new Size(202, 96); + richTextBoxCustomerExecutorReviewReview.TabIndex = 27; + richTextBoxCustomerExecutorReviewReview.Text = ""; + // + // labelCustomerExecutorReviewReview + // + labelCustomerExecutorReviewReview.AutoSize = true; + labelCustomerExecutorReviewReview.Location = new Point(12, 67); + labelCustomerExecutorReviewReview.Name = "labelCustomerExecutorReviewReview"; + labelCustomerExecutorReviewReview.Size = new Size(44, 15); + labelCustomerExecutorReviewReview.TabIndex = 28; + labelCustomerExecutorReviewReview.Text = "Отзыв:"; + // + // numericUpDownCustomerExecutorReviewGrade + // + numericUpDownCustomerExecutorReviewGrade.Location = new Point(169, 166); + numericUpDownCustomerExecutorReviewGrade.Maximum = new decimal(new int[] { 5, 0, 0, 0 }); + numericUpDownCustomerExecutorReviewGrade.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + numericUpDownCustomerExecutorReviewGrade.Name = "numericUpDownCustomerExecutorReviewGrade"; + numericUpDownCustomerExecutorReviewGrade.Size = new Size(201, 23); + numericUpDownCustomerExecutorReviewGrade.TabIndex = 29; + numericUpDownCustomerExecutorReviewGrade.Value = new decimal(new int[] { 1, 0, 0, 0 }); + // + // comboBoxCustomerExecutorReviewCustomerId + // + comboBoxCustomerExecutorReviewCustomerId.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxCustomerExecutorReviewCustomerId.FormattingEnabled = true; + comboBoxCustomerExecutorReviewCustomerId.Location = new Point(169, 6); + comboBoxCustomerExecutorReviewCustomerId.Name = "comboBoxCustomerExecutorReviewCustomerId"; + comboBoxCustomerExecutorReviewCustomerId.Size = new Size(202, 23); + comboBoxCustomerExecutorReviewCustomerId.TabIndex = 30; + // + // comboBoxCustomerExecutorReviewExecutorId + // + comboBoxCustomerExecutorReviewExecutorId.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxCustomerExecutorReviewExecutorId.FormattingEnabled = true; + comboBoxCustomerExecutorReviewExecutorId.Location = new Point(169, 35); + comboBoxCustomerExecutorReviewExecutorId.Name = "comboBoxCustomerExecutorReviewExecutorId"; + comboBoxCustomerExecutorReviewExecutorId.Size = new Size(202, 23); + comboBoxCustomerExecutorReviewExecutorId.TabIndex = 31; + // + // labelCustomerExecutorReviewExecutorId + // + labelCustomerExecutorReviewExecutorId.AutoSize = true; + labelCustomerExecutorReviewExecutorId.Location = new Point(12, 38); + labelCustomerExecutorReviewExecutorId.Name = "labelCustomerExecutorReviewExecutorId"; + labelCustomerExecutorReviewExecutorId.Size = new Size(84, 15); + labelCustomerExecutorReviewExecutorId.TabIndex = 32; + labelCustomerExecutorReviewExecutorId.Text = "Исполнитель:"; + // + // labelCustomerExecutorReviewGrade + // + labelCustomerExecutorReviewGrade.AutoSize = true; + labelCustomerExecutorReviewGrade.Location = new Point(12, 168); + labelCustomerExecutorReviewGrade.Name = "labelCustomerExecutorReviewGrade"; + labelCustomerExecutorReviewGrade.Size = new Size(51, 15); + labelCustomerExecutorReviewGrade.TabIndex = 33; + labelCustomerExecutorReviewGrade.Text = "Оценка:"; + // + // FormCustomerExecutorReview + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(381, 260); + Controls.Add(labelCustomerExecutorReviewGrade); + Controls.Add(labelCustomerExecutorReviewExecutorId); + Controls.Add(comboBoxCustomerExecutorReviewExecutorId); + Controls.Add(comboBoxCustomerExecutorReviewCustomerId); + Controls.Add(numericUpDownCustomerExecutorReviewGrade); + Controls.Add(labelCustomerExecutorReviewReview); + Controls.Add(richTextBoxCustomerExecutorReviewReview); + Controls.Add(labelCustomerExecutorReviewCustomerId); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Name = "FormCustomerExecutorReview"; + StartPosition = FormStartPosition.CenterParent; + Text = "Отзыв заказчика"; + ((System.ComponentModel.ISupportInitialize)numericUpDownCustomerExecutorReviewGrade).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox comboBoxCustomerExecutorReviewCustomerId; + private Label labelCustomerExecutorReviewCustomerId; + private Button buttonCancel; + private Button buttonSave; + private RichTextBox richTextBoxCustomerExecutorReviewReview; + private Label labelCustomerExecutorReviewReview; + private NumericUpDown numericUpDownCustomerExecutorReviewGrade; + private ComboBox comboBoxCustomerExecutorReviewExecutorId; + private Label labelCustomerExecutorReviewExecutorId; + private Label labelCustomerExecutorReviewGrade; + } +} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.cs new file mode 100644 index 0000000..dcf0cef --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.cs @@ -0,0 +1,50 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities; +using PIbd_23_Gutorov_I.A._IT_Company.Repositories; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + public partial class FormCustomerExecutorReview : Form + { + private readonly ICustomerExecutorReviewRepository _customerExecutorReviewRepository; + + public FormCustomerExecutorReview(ICustomerExecutorReviewRepository customerExecutorReviewRepository, + ICustomerRepository customerRepository, IExecutorRepository executorRepository) + { + InitializeComponent(); + _customerExecutorReviewRepository = customerExecutorReviewRepository ?? throw new ArgumentNullException(nameof(customerExecutorReviewRepository)); + + comboBoxCustomerExecutorReviewCustomerId.DataSource = customerRepository.ReadCustomers(); + comboBoxCustomerExecutorReviewCustomerId.DisplayMember = "Name"; + comboBoxCustomerExecutorReviewCustomerId.DisplayMember = "Id"; + + comboBoxCustomerExecutorReviewExecutorId.DataSource = executorRepository.ReadExecutors(); + comboBoxCustomerExecutorReviewExecutorId.DisplayMember = "Name"; + comboBoxCustomerExecutorReviewCustomerId.DisplayMember = "Id"; + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (comboBoxCustomerExecutorReviewExecutorId.SelectedIndex < 0 || + comboBoxCustomerExecutorReviewCustomerId.SelectedIndex < 0 || + string.IsNullOrEmpty(richTextBoxCustomerExecutorReviewReview.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + + _customerExecutorReviewRepository.CreateCustomerExecutorReview(CustomerExecutorReview.CreateElement( + 0, (int)comboBoxCustomerExecutorReviewCustomerId.SelectedValue!, (int)comboBoxCustomerExecutorReviewExecutorId.SelectedValue!, + richTextBoxCustomerExecutorReviewReview.Text, Convert.ToInt32(numericUpDownCustomerExecutorReviewGrade.Value))); + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReview.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.resx similarity index 100% rename from PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReview.resx rename to PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.resx diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReviews.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.Designer.cs similarity index 97% rename from PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReviews.Designer.cs rename to PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.Designer.cs index 756dbe0..6c5f3e4 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReviews.Designer.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.Designer.cs @@ -1,6 +1,6 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms { - partial class FormCustomerContractReviews + partial class FormCustomerExecutorReviews { /// /// Required designer variable. @@ -83,7 +83,7 @@ Name = "FormCustomerContractReviews"; StartPosition = FormStartPosition.CenterParent; Text = "Отзывы заказчиков"; - Load += FormCustomerContractReviews_Load; + Load += FormCustomerExecutorReviews_Load; ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); panel.ResumeLayout(false); ResumeLayout(false); diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReviews.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.cs similarity index 60% rename from PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReviews.cs rename to PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.cs index e6453df..27d60c1 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReviews.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.cs @@ -1,23 +1,22 @@ using PIbd_23_Gutorov_I.A._IT_Company.Repositories; -using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations; using Unity; namespace PIbd_23_Gutorov_I.A._IT_Company.Forms { - public partial class FormCustomerContractReviews : Form + public partial class FormCustomerExecutorReviews : Form { private readonly IUnityContainer _container; - private readonly ICustomerContractReviewRepository _customerContractReviewRepository; + private readonly ICustomerExecutorReviewRepository _customerExecutorReviewRepository; - public FormCustomerContractReviews(IUnityContainer container, ICustomerContractReviewRepository customerContractReviewRepository) + public FormCustomerExecutorReviews(IUnityContainer container, ICustomerExecutorReviewRepository customerExecutorReviewRepository) { InitializeComponent(); _container = container ?? throw new ArgumentException(nameof(container)); - _customerContractReviewRepository = customerContractReviewRepository ?? throw new ArgumentException(nameof(customerContractReviewRepository)); + _customerExecutorReviewRepository = customerExecutorReviewRepository ?? throw new ArgumentException(nameof(customerExecutorReviewRepository)); } - private void FormCustomerContractReviews_Load(object sender, EventArgs e) + private void FormCustomerExecutorReviews_Load(object sender, EventArgs e) { try { @@ -33,7 +32,7 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms { try { - _container.Resolve().ShowDialog(); + _container.Resolve().ShowDialog(); LoadList(); } catch (Exception ex) @@ -42,6 +41,6 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms } } - private void LoadList() => dataGridViewData.DataSource = _customerContractReviewRepository.ReadCustomerContractReviews(); + private void LoadList() => dataGridViewData.DataSource = _customerExecutorReviewRepository.ReadCustomerExecutorReviews(); } } diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReviews.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.resx similarity index 100% rename from PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReviews.resx rename to PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.resx diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.cs index b5429c0..f94d5b7 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.cs @@ -1,16 +1,5 @@ using PIbd_23_Gutorov_I.A._IT_Company.Entities; -using PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums; using PIbd_23_Gutorov_I.A._IT_Company.Repositories; -using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations; -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 PIbd_23_Gutorov_I.A._IT_Company.Forms { @@ -59,7 +48,7 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms throw new Exception("Имеются незаполненные поля"); } - _serviceRepository.CreateService(Service.CreateEntity(0, + _serviceRepository.CreateService(Service.CreateEntity(0, richTextBoxServiceDescription.Text, (int)comboBoxServiceContractId.SelectedValue!)); Close(); diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.Designer.cs deleted file mode 100644 index f8332dd..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.Designer.cs +++ /dev/null @@ -1,194 +0,0 @@ -namespace PIbd_23_Gutorov_I.A._IT_Company.Forms -{ - partial class FormServiceExecution - { - /// - /// 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() - { - labelContractDeadline = new Label(); - comboBoxServiceExecutionExecutorId = new ComboBox(); - labelServiceExecutionExecutorId = new Label(); - dateTimePickerContractDeadline = new DateTimePicker(); - comboBoxServiceExecutionContractId = new ComboBox(); - labelServiceExecutionContractId = new Label(); - comboBoxServiceExecutionServiceId = new ComboBox(); - labelServiceExecutionServiceId = new Label(); - labelServiceExecutionCompleteion = new Label(); - numericUpDownContractPaymentAmount = new NumericUpDown(); - buttonCancel = new Button(); - buttonSave = new Button(); - ((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).BeginInit(); - SuspendLayout(); - // - // labelContractDeadline - // - labelContractDeadline.AutoSize = true; - labelContractDeadline.Location = new Point(12, 128); - labelContractDeadline.Name = "labelContractDeadline"; - labelContractDeadline.Size = new Size(110, 15); - labelContractDeadline.TabIndex = 21; - labelContractDeadline.Text = "Срок выполнения:"; - // - // comboBoxServiceExecutionExecutorId - // - comboBoxServiceExecutionExecutorId.DropDownStyle = ComboBoxStyle.DropDownList; - comboBoxServiceExecutionExecutorId.FormattingEnabled = true; - comboBoxServiceExecutionExecutorId.Location = new Point(169, 64); - comboBoxServiceExecutionExecutorId.Name = "comboBoxServiceExecutionExecutorId"; - comboBoxServiceExecutionExecutorId.Size = new Size(202, 23); - comboBoxServiceExecutionExecutorId.TabIndex = 20; - // - // labelServiceExecutionExecutorId - // - labelServiceExecutionExecutorId.AutoSize = true; - labelServiceExecutionExecutorId.Location = new Point(12, 67); - labelServiceExecutionExecutorId.Name = "labelServiceExecutionExecutorId"; - labelServiceExecutionExecutorId.Size = new Size(84, 15); - labelServiceExecutionExecutorId.TabIndex = 18; - labelServiceExecutionExecutorId.Text = "Исполнитель:"; - // - // dateTimePickerContractDeadline - // - dateTimePickerContractDeadline.Location = new Point(169, 122); - dateTimePickerContractDeadline.Name = "dateTimePickerContractDeadline"; - dateTimePickerContractDeadline.Size = new Size(202, 23); - dateTimePickerContractDeadline.TabIndex = 16; - // - // comboBoxServiceExecutionContractId - // - comboBoxServiceExecutionContractId.DropDownStyle = ComboBoxStyle.DropDownList; - comboBoxServiceExecutionContractId.FormattingEnabled = true; - comboBoxServiceExecutionContractId.Location = new Point(169, 6); - comboBoxServiceExecutionContractId.Name = "comboBoxServiceExecutionContractId"; - comboBoxServiceExecutionContractId.Size = new Size(202, 23); - comboBoxServiceExecutionContractId.TabIndex = 23; - // - // labelServiceExecutionContractId - // - labelServiceExecutionContractId.AutoSize = true; - labelServiceExecutionContractId.Location = new Point(12, 9); - labelServiceExecutionContractId.Name = "labelServiceExecutionContractId"; - labelServiceExecutionContractId.Size = new Size(60, 15); - labelServiceExecutionContractId.TabIndex = 22; - labelServiceExecutionContractId.Text = "Контракт:"; - // - // comboBoxServiceExecutionServiceId - // - comboBoxServiceExecutionServiceId.DropDownStyle = ComboBoxStyle.DropDownList; - comboBoxServiceExecutionServiceId.FormattingEnabled = true; - comboBoxServiceExecutionServiceId.Location = new Point(169, 35); - comboBoxServiceExecutionServiceId.Name = "comboBoxServiceExecutionServiceId"; - comboBoxServiceExecutionServiceId.Size = new Size(202, 23); - comboBoxServiceExecutionServiceId.TabIndex = 25; - // - // labelServiceExecutionServiceId - // - labelServiceExecutionServiceId.AutoSize = true; - labelServiceExecutionServiceId.Location = new Point(12, 38); - labelServiceExecutionServiceId.Name = "labelServiceExecutionServiceId"; - labelServiceExecutionServiceId.Size = new Size(47, 15); - labelServiceExecutionServiceId.TabIndex = 24; - labelServiceExecutionServiceId.Text = "Услуга:"; - // - // labelServiceExecutionCompleteion - // - labelServiceExecutionCompleteion.AutoSize = true; - labelServiceExecutionCompleteion.Location = new Point(12, 95); - labelServiceExecutionCompleteion.Name = "labelServiceExecutionCompleteion"; - labelServiceExecutionCompleteion.Size = new Size(94, 15); - labelServiceExecutionCompleteion.TabIndex = 27; - labelServiceExecutionCompleteion.Text = "Готовность в %:"; - // - // numericUpDownContractPaymentAmount - // - numericUpDownContractPaymentAmount.Increment = new decimal(new int[] { 100000, 0, 0, 0 }); - numericUpDownContractPaymentAmount.Location = new Point(169, 93); - numericUpDownContractPaymentAmount.Maximum = new decimal(new int[] { 1000000000, 0, 0, 0 }); - numericUpDownContractPaymentAmount.Name = "numericUpDownContractPaymentAmount"; - numericUpDownContractPaymentAmount.Size = new Size(202, 23); - numericUpDownContractPaymentAmount.TabIndex = 26; - // - // buttonCancel - // - buttonCancel.Location = new Point(12, 180); - buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(359, 23); - buttonCancel.TabIndex = 29; - buttonCancel.Text = "Отмена"; - buttonCancel.UseVisualStyleBackColor = true; - buttonCancel.Click += ButtonCancel_Click; - // - // buttonSave - // - buttonSave.Location = new Point(12, 151); - buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(359, 23); - buttonSave.TabIndex = 28; - buttonSave.Text = "Сохранить"; - buttonSave.UseVisualStyleBackColor = true; - buttonSave.Click += ButtonSave_Click; - // - // FormServiceExecution - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(387, 214); - Controls.Add(buttonCancel); - Controls.Add(buttonSave); - Controls.Add(labelServiceExecutionCompleteion); - Controls.Add(numericUpDownContractPaymentAmount); - Controls.Add(comboBoxServiceExecutionServiceId); - Controls.Add(labelServiceExecutionServiceId); - Controls.Add(comboBoxServiceExecutionContractId); - Controls.Add(labelServiceExecutionContractId); - Controls.Add(labelContractDeadline); - Controls.Add(comboBoxServiceExecutionExecutorId); - Controls.Add(labelServiceExecutionExecutorId); - Controls.Add(dateTimePickerContractDeadline); - Name = "FormServiceExecution"; - StartPosition = FormStartPosition.CenterParent; - Text = "Выполнение услуги"; - ((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).EndInit(); - ResumeLayout(false); - PerformLayout(); - } - - #endregion - - private Label labelContractDeadline; - private ComboBox comboBoxServiceExecutionExecutorId; - private Label labelServiceExecutionExecutorId; - private DateTimePicker dateTimePickerContractDeadline; - private ComboBox comboBoxServiceExecutionContractId; - private Label labelServiceExecutionContractId; - private ComboBox comboBoxServiceExecutionServiceId; - private Label labelServiceExecutionServiceId; - private Label labelServiceExecutionCompleteion; - private NumericUpDown numericUpDownContractPaymentAmount; - private Button buttonCancel; - private Button buttonSave; - } -} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.cs deleted file mode 100644 index 07498f3..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.cs +++ /dev/null @@ -1,63 +0,0 @@ -using PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums; -using PIbd_23_Gutorov_I.A._IT_Company.Repositories; -using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations; -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 PIbd_23_Gutorov_I.A._IT_Company.Forms -{ - public partial class FormServiceExecution : Form - { - private readonly IServiceExecutionRepository _serviceExecutionRepository; - - private int? _serviceExecutionId; - - public int Id - { - set - { - try - { - var executor = _serviceExecutionRepository.ReadServiceExecutionById(value); - if (executor == null) throw new InvalidDataException(nameof(executor)); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - } - } - - public FormServiceExecution(IServiceExecutionRepository serviceExecutionRepository, IContractRepository contractRepository, - IServiceRepository serviceRepository, IExecutorRepository executorRepository) - { - InitializeComponent(); - _serviceExecutionRepository = serviceExecutionRepository ?? throw new ArgumentNullException(nameof(serviceExecutionRepository)); - - comboBoxServiceExecutionContractId.DataSource = contractRepository.ReadContracts(); - comboBoxServiceExecutionContractId.DisplayMember = "Id"; - - comboBoxServiceExecutionServiceId.DataSource = serviceRepository.ReadServices(); - comboBoxServiceExecutionServiceId.DisplayMember = "Id"; - - comboBoxServiceExecutionExecutorId.DataSource = executorRepository.ReadExecutors(); - comboBoxServiceExecutionExecutorId.DisplayMember = "Name"; - comboBoxServiceExecutionExecutorId.DisplayMember = "Id"; - } - - private void ButtonSave_Click(object sender, EventArgs e) - { - Close(); - } - - private void ButtonCancel_Click(object sender, EventArgs e) => Close(); - } -} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.resx deleted file mode 100644 index 8b2ff64..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.Designer.cs deleted file mode 100644 index 13ead64..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.Designer.cs +++ /dev/null @@ -1,112 +0,0 @@ -namespace PIbd_23_Gutorov_I.A._IT_Company.Forms -{ - partial class FormServiceExecutions - { - /// - /// 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() - { - dataGridViewData = new DataGridView(); - panel = new Panel(); - buttonUpd = new Button(); - buttonAdd = new Button(); - ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit(); - panel.SuspendLayout(); - SuspendLayout(); - // - // dataGridViewData - // - dataGridViewData.AllowUserToAddRows = false; - dataGridViewData.AllowUserToDeleteRows = false; - dataGridViewData.AllowUserToResizeColumns = false; - dataGridViewData.AllowUserToResizeRows = false; - dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; - dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridViewData.Dock = DockStyle.Fill; - dataGridViewData.Location = new Point(0, 0); - dataGridViewData.MultiSelect = false; - dataGridViewData.Name = "dataGridViewData"; - dataGridViewData.ReadOnly = true; - dataGridViewData.RowHeadersVisible = false; - dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridViewData.Size = new Size(677, 450); - dataGridViewData.TabIndex = 5; - // - // panel - // - panel.Controls.Add(buttonUpd); - panel.Controls.Add(buttonAdd); - panel.Dock = DockStyle.Right; - panel.Location = new Point(677, 0); - panel.Name = "panel"; - panel.Size = new Size(123, 450); - panel.TabIndex = 4; - // - // buttonUpd - // - buttonUpd.BackgroundImage = Properties.Resources.icon_edit_button; - buttonUpd.BackgroundImageLayout = ImageLayout.Stretch; - buttonUpd.Location = new Point(16, 108); - buttonUpd.Name = "buttonUpd"; - buttonUpd.Size = new Size(90, 90); - buttonUpd.TabIndex = 1; - buttonUpd.UseVisualStyleBackColor = true; - buttonUpd.Click += ButtonUpd_Click; - // - // buttonAdd - // - buttonAdd.BackgroundImage = Properties.Resources.icon_add_button; - buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; - buttonAdd.Location = new Point(16, 12); - buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(90, 90); - buttonAdd.TabIndex = 0; - buttonAdd.UseVisualStyleBackColor = true; - buttonAdd.Click += ButtonAdd_Click; - // - // FormServiceExecutions - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(dataGridViewData); - Controls.Add(panel); - Name = "FormServiceExecutions"; - StartPosition = FormStartPosition.CenterParent; - Text = "Выполнение услуг"; - Load += FormServiceExecutions_Load; - ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); - panel.ResumeLayout(false); - ResumeLayout(false); - } - - #endregion - - private DataGridView dataGridViewData; - private Panel panel; - private Button buttonUpd; - private Button buttonAdd; - } -} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.cs deleted file mode 100644 index cd3fdaf..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.cs +++ /dev/null @@ -1,77 +0,0 @@ -using PIbd_23_Gutorov_I.A._IT_Company.Repositories; -using Unity; - -namespace PIbd_23_Gutorov_I.A._IT_Company.Forms -{ - public partial class FormServiceExecutions : Form - { - private readonly IUnityContainer _container; - - private readonly IServiceExecutionRepository _serviceExecutionRepository; - - public FormServiceExecutions(IUnityContainer container, IServiceExecutionRepository serviceExecutionRepository) - { - InitializeComponent(); - _container = container ?? throw new ArgumentException(nameof(container)); - _serviceExecutionRepository = serviceExecutionRepository ?? throw new ArgumentException(nameof(serviceExecutionRepository)); - } - - private void FormServiceExecutions_Load(object sender, EventArgs e) - { - try - { - LoadList(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void ButtonAdd_Click(object sender, EventArgs e) - { - try - { - _container.Resolve().ShowDialog(); - LoadList(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void ButtonUpd_Click(object sender, EventArgs e) - { - if (!TryGetIdentifierFromSelectedRow(out var findId)) - return; - - try - { - var form = _container.Resolve(); - form.Id = findId; - form.ShowDialog(); - LoadList(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void LoadList() => dataGridViewData.DataSource = _serviceExecutionRepository.ReadServiceExecutions(); - - private bool TryGetIdentifierFromSelectedRow(out int id) - { - id = 0; - if (dataGridViewData.SelectedRows.Count < 1) - { - MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - return false; - } - - id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value); - return true; - } - } -} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.resx deleted file mode 100644 index 8b2ff64..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.cs index 50d6fd4..5b0cea9 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.cs @@ -1,5 +1,4 @@ using PIbd_23_Gutorov_I.A._IT_Company.Repositories; -using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations; using Unity; namespace PIbd_23_Gutorov_I.A._IT_Company.Forms diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Program.cs b/PIbd-23_Gutorov_I.A._IT-Company/Program.cs index 32ea60d..3c5e10d 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Program.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Program.cs @@ -23,10 +23,9 @@ namespace PIbd_23_Gutorov_I.A._IT_Company var container = new UnityContainer(); container.RegisterType(); - container.RegisterType(); + container.RegisterType(); container.RegisterType(); container.RegisterType(); - container.RegisterType(); container.RegisterType(); return container; diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IContractRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IContractRepository.cs index 5dbfb59..baabd43 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IContractRepository.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IContractRepository.cs @@ -6,8 +6,6 @@ public interface IContractRepository { IEnumerable ReadContracts(DateTime? dateFrom = null, DateTime? dateTo = null, int? customerId = null, int? executorId = null); - Contract ReadContractById(int id); - void CreateContract(Contract Contract); void DeleteContract(int id); diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/ICustomerContractReviewRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/ICustomerContractReviewRepository.cs deleted file mode 100644 index 7bdd77c..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/ICustomerContractReviewRepository.cs +++ /dev/null @@ -1,12 +0,0 @@ -using PIbd_23_Gutorov_I.A._IT_Company.Entities; - -namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories; - -public interface ICustomerContractReviewRepository -{ - IEnumerable ReadCustomerContractReviews(int? customerId = null); - - CustomerContractReview ReadCustomerContractReviewById(int id); - - void CreateCustomerContractReview(CustomerContractReview CustomerContractReview); -} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/ICustomerExecutorReviewRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/ICustomerExecutorReviewRepository.cs new file mode 100644 index 0000000..714d757 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/ICustomerExecutorReviewRepository.cs @@ -0,0 +1,12 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories; + +public interface ICustomerExecutorReviewRepository +{ + IEnumerable ReadCustomerExecutorReviews(int? customerId = null, int? executorId = null); + + CustomerExecutorReview ReadCustomerExecutorReviewById(int id); + + void CreateCustomerExecutorReview(CustomerExecutorReview CustomerContractReview); +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IServiceExecutionRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IServiceExecutionRepository.cs deleted file mode 100644 index 11bf5a8..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IServiceExecutionRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using PIbd_23_Gutorov_I.A._IT_Company.Entities; - -namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories; - -public interface IServiceExecutionRepository -{ - IEnumerable ReadServiceExecutions(); - - ServiceExecution ReadServiceExecutionById(int id); - - void CreateServiceExecution(ServiceExecution ServiceExecution); - - void UpdateServiceExecution(ServiceExecution ServiceExecution); -} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ContractRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ContractRepository.cs index 3afd64f..9e99cd9 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ContractRepository.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ContractRepository.cs @@ -12,11 +12,6 @@ public class ContractRepository : IContractRepository { } - public Contract ReadContractById(int id) - { - return Contract.CreateEntity(0, 0, 0, Entities.Enums.ContractCategory.None, DateTime.Now, 0); - } - public IEnumerable ReadContracts(DateTime? dateFrom = null, DateTime? dateTo = null, int? customerId = null, int? executorId = null) { return []; diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/CustomerContractReviewRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/CustomerContractReviewRepository.cs deleted file mode 100644 index 2d0208b..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/CustomerContractReviewRepository.cs +++ /dev/null @@ -1,20 +0,0 @@ -using PIbd_23_Gutorov_I.A._IT_Company.Entities; - -namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations; - -public class CustomerContractReviewRepository : ICustomerContractReviewRepository -{ - public void CreateCustomerContractReview(CustomerContractReview CustomerContractReview) - { - } - - public CustomerContractReview ReadCustomerContractReviewById(int id) - { - return CustomerContractReview.CreateElement(0, 0, 0, string.Empty, 0); - } - - public IEnumerable ReadCustomerContractReviews(int? customerId = null) - { - return []; - } -} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/CustomerExecutorReviewRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/CustomerExecutorReviewRepository.cs new file mode 100644 index 0000000..60fc9ff --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/CustomerExecutorReviewRepository.cs @@ -0,0 +1,20 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations; + +public class CustomerExecutorReviewRepository : ICustomerExecutorReviewRepository +{ + public void CreateCustomerExecutorReview(CustomerExecutorReview CustomerContractReview) + { + } + + public CustomerExecutorReview ReadCustomerExecutorReviewById(int id) + { + return CustomerExecutorReview.CreateElement(0, 0, 0, string.Empty, 0); + } + + public IEnumerable ReadCustomerExecutorReviews(int? customerId = null, int? executorId = null) + { + return []; + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ServiceExecutionRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ServiceExecutionRepository.cs deleted file mode 100644 index fe8db08..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ServiceExecutionRepository.cs +++ /dev/null @@ -1,24 +0,0 @@ -using PIbd_23_Gutorov_I.A._IT_Company.Entities; - -namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations; - -public class ServiceExecutionRepository : IServiceExecutionRepository -{ - public void CreateServiceExecution(ServiceExecution ServiceExecution) - { - } - - public ServiceExecution ReadServiceExecutionById(int id) - { - return ServiceExecution.CreateOperation(0, 0, 0, 0, 0, DateTime.Now); - } - - public IEnumerable ReadServiceExecutions() - { - return []; - } - - public void UpdateServiceExecution(ServiceExecution ServiceExecution) - { - } -}