diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Entities/Contract.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Contract.cs new file mode 100644 index 0000000..cb943c3 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Contract.cs @@ -0,0 +1,34 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Entities; + +public class Contract +{ + public int Id { get; private set; } + + public int CustomerID { get; private set; } + + public int ExecutorID { get; private set; } + + public ContractCategory Category { get; private set; } + + public DateTime ConclusionDate { get; private set; } + + public DateTime Deadline { get; private set; } + + public int PaymentAmount { get; private set; } + + public static Contract CreateEntity(int id, int customerID, int executorID, ContractCategory category, DateTime deadline, int paymentAmount) + { + return new Contract + { + Id = id, + CustomerID = customerID, + ExecutorID = executorID, + Category = category, + ConclusionDate = DateTime.Now, + Deadline = deadline, + PaymentAmount = paymentAmount + }; + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Entities/Customer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Customer.cs new file mode 100644 index 0000000..c3f26db --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Customer.cs @@ -0,0 +1,23 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Entities; + +public class Customer +{ + public int Id { get; private set; } + + public string Name { get; private set; } = string.Empty; + + public string Contact { get; private set; } = string.Empty; + + public string Address { get; private set; } = string.Empty; + + public static Customer CreateEntity(int id, string name, string contact, string address) + { + return new Customer + { + Id = id, + Name = name ?? String.Empty, + Contact = contact ?? String.Empty, + Address = address ?? String.Empty + }; + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Entities/CustomerContractReview.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/CustomerContractReview.cs new file mode 100644 index 0000000..48cc244 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/CustomerContractReview.cs @@ -0,0 +1,26 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Entities; + +public class CustomerContractReview +{ + public int Id { get; private set; } + + public int CustomerId { get; private set; } + + public int ContractId { 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) + { + return new CustomerContractReview + { + Id = id, + CustomerId = customerId, + ContractId = contractId, + Review = review ?? String.Empty, + Grade = grade + }; + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Entities/Enums/ContractCategory.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Enums/ContractCategory.cs new file mode 100644 index 0000000..ccfad07 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Enums/ContractCategory.cs @@ -0,0 +1,11 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums; + +[Flags] +public enum ContractCategory +{ + None = 0, + + Support = 1, + + Development = 2 +} 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 new file mode 100644 index 0000000..8a25ac7 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Enums/ExecutorPost.cs @@ -0,0 +1,14 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums; + +public enum ExecutorPost +{ + None = 0, + + Junior = 1, + + Middle = 2, + + Senior = 3, + + TeamLead = 4 +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Entities/Executor.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Executor.cs new file mode 100644 index 0000000..b80579e --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Executor.cs @@ -0,0 +1,22 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Entities; + +public class Executor +{ + public int Id { get; private set; } + + public string Name { get; private set; } = string.Empty; + + public ExecutorPost Post { get; private set; } + + public static Executor CreateEntity(int id, string name, ExecutorPost post) + { + return new Executor + { + Id = id, + Name = name ?? String.Empty, + Post = post + }; + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Entities/Service.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Service.cs new file mode 100644 index 0000000..3b670c6 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Service.cs @@ -0,0 +1,20 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Entities; + +public class Service +{ + public int Id { get; private set; } + + public string Description { get; private set; } = string.Empty; + + public int ContractId { get; private set; } + + public static Service CreateEntity(int id, string description, int contractId) + { + return new Service + { + Id = id, + Description = description, + ContractId = contractId + }; + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Entities/ServiceExecution.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/ServiceExecution.cs new file mode 100644 index 0000000..3196d18 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/ServiceExecution.cs @@ -0,0 +1,29 @@ +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/Form1.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Form1.Designer.cs deleted file mode 100644 index c6fff68..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace PIbd_23_Gutorov_I.A._IT_Company -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.Designer.cs new file mode 100644 index 0000000..a63cf5c --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.Designer.cs @@ -0,0 +1,140 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company +{ + partial class FormItCompany + { + /// + /// 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() + { + menuStrip = new MenuStrip(); + справочникиToolStripMenuItem = new ToolStripMenuItem(); + заказчикиToolStripMenuItem = new ToolStripMenuItem(); + исполнителиToolStripMenuItem = new ToolStripMenuItem(); + услугиToolStripMenuItem = new ToolStripMenuItem(); + контрактыToolStripMenuItem = new ToolStripMenuItem(); + операцииToolStripMenuItem = new ToolStripMenuItem(); + выполнениеУслугиToolStripMenuItem = new ToolStripMenuItem(); + отзывыКлиентовToolStripMenuItem = new ToolStripMenuItem(); + отчетыToolStripMenuItem = new ToolStripMenuItem(); + menuStrip.SuspendLayout(); + SuspendLayout(); + // + // menuStrip + // + menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Size = new Size(734, 24); + menuStrip.TabIndex = 0; + menuStrip.Text = "menuStrip1"; + // + // справочникиToolStripMenuItem + // + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { заказчикиToolStripMenuItem, исполнителиToolStripMenuItem, услугиToolStripMenuItem, контрактыToolStripMenuItem }); + справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + справочникиToolStripMenuItem.Size = new Size(94, 20); + справочникиToolStripMenuItem.Text = "Справочники"; + // + // заказчикиToolStripMenuItem + // + заказчикиToolStripMenuItem.Name = "заказчикиToolStripMenuItem"; + заказчикиToolStripMenuItem.Size = new Size(149, 22); + заказчикиToolStripMenuItem.Text = "Заказчики"; + // + // исполнителиToolStripMenuItem + // + исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem"; + исполнителиToolStripMenuItem.Size = new Size(149, 22); + исполнителиToolStripMenuItem.Text = "Исполнители"; + // + // услугиToolStripMenuItem + // + услугиToolStripMenuItem.Name = "услугиToolStripMenuItem"; + услугиToolStripMenuItem.Size = new Size(149, 22); + услугиToolStripMenuItem.Text = "Услуги"; + // + // контрактыToolStripMenuItem + // + контрактыToolStripMenuItem.Name = "контрактыToolStripMenuItem"; + контрактыToolStripMenuItem.Size = new Size(149, 22); + контрактыToolStripMenuItem.Text = "Контракты"; + // + // операцииToolStripMenuItem + // + операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { выполнениеУслугиToolStripMenuItem, отзывыКлиентовToolStripMenuItem }); + операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; + операцииToolStripMenuItem.Size = new Size(75, 20); + операцииToolStripMenuItem.Text = "Операции"; + // + // выполнениеУслугиToolStripMenuItem + // + выполнениеУслугиToolStripMenuItem.Name = "выполнениеУслугиToolStripMenuItem"; + выполнениеУслугиToolStripMenuItem.Size = new Size(184, 22); + выполнениеУслугиToolStripMenuItem.Text = "Выполнение услуги"; + // + // отзывыКлиентовToolStripMenuItem + // + отзывыКлиентовToolStripMenuItem.Name = "отзывыКлиентовToolStripMenuItem"; + отзывыКлиентовToolStripMenuItem.Size = new Size(184, 22); + отзывыКлиентовToolStripMenuItem.Text = "Отзывы заказчиков"; + // + // отчетыToolStripMenuItem + // + отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; + отчетыToolStripMenuItem.Size = new Size(60, 20); + отчетыToolStripMenuItem.Text = "Отчеты"; + // + // FormItCompany + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + BackgroundImage = Properties.Resources.modern_equipped_computer_lab; + BackgroundImageLayout = ImageLayout.Stretch; + ClientSize = new Size(734, 461); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; + Name = "FormItCompany"; + StartPosition = FormStartPosition.CenterScreen; + Text = "IT-компания"; + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private MenuStrip menuStrip; + private ToolStripMenuItem справочникиToolStripMenuItem; + private ToolStripMenuItem заказчикиToolStripMenuItem; + private ToolStripMenuItem исполнителиToolStripMenuItem; + private ToolStripMenuItem услугиToolStripMenuItem; + private ToolStripMenuItem контрактыToolStripMenuItem; + private ToolStripMenuItem операцииToolStripMenuItem; + private ToolStripMenuItem отчетыToolStripMenuItem; + private ToolStripMenuItem выполнениеУслугиToolStripMenuItem; + private ToolStripMenuItem отзывыКлиентовToolStripMenuItem; + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Form1.cs b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.cs similarity index 59% rename from PIbd-23_Gutorov_I.A._IT-Company/Form1.cs rename to PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.cs index b362d48..9b2720f 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Form1.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.cs @@ -1,8 +1,8 @@ namespace PIbd_23_Gutorov_I.A._IT_Company { - public partial class Form1 : Form + public partial class FormItCompany : Form { - public Form1() + public FormItCompany() { InitializeComponent(); } diff --git a/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.resx b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.resx new file mode 100644 index 0000000..31084d5 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.Designer.cs new file mode 100644 index 0000000..64591d2 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.Designer.cs @@ -0,0 +1,190 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + partial class FormContract + { + /// + /// 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() + { + checkedListBoxContractCategory = new CheckedListBox(); + dateTimePickerContractDeadline = new DateTimePicker(); + numericUpDownContractPaymentAmount = new NumericUpDown(); + buttonCancel = new Button(); + buttonSave = new Button(); + labelContractCustomerId = new Label(); + labelContractExecutorId = new Label(); + labelContractCategory = new Label(); + comboBoxContractCustomerId = new ComboBox(); + comboBoxContractExecutorId = new ComboBox(); + labelContractDeadline = new Label(); + labelContractPaymentAmount = new Label(); + ((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).BeginInit(); + SuspendLayout(); + // + // checkedListBoxContractCategory + // + checkedListBoxContractCategory.FormattingEnabled = true; + checkedListBoxContractCategory.Location = new Point(169, 64); + checkedListBoxContractCategory.Name = "checkedListBoxContractCategory"; + checkedListBoxContractCategory.Size = new Size(202, 40); + checkedListBoxContractCategory.TabIndex = 0; + // + // dateTimePickerContractDeadline + // + dateTimePickerContractDeadline.Location = new Point(169, 110); + dateTimePickerContractDeadline.Name = "dateTimePickerContractDeadline"; + dateTimePickerContractDeadline.Size = new Size(202, 23); + dateTimePickerContractDeadline.TabIndex = 1; + // + // numericUpDownContractPaymentAmount + // + numericUpDownContractPaymentAmount.Location = new Point(169, 139); + numericUpDownContractPaymentAmount.Name = "numericUpDownContractPaymentAmount"; + numericUpDownContractPaymentAmount.Size = new Size(202, 23); + numericUpDownContractPaymentAmount.TabIndex = 2; + // + // buttonCancel + // + buttonCancel.Location = new Point(12, 197); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(358, 23); + buttonCancel.TabIndex = 9; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // buttonSave + // + buttonSave.Location = new Point(12, 168); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(358, 23); + buttonSave.TabIndex = 8; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // labelContractCustomerId + // + labelContractCustomerId.AutoSize = true; + labelContractCustomerId.Location = new Point(12, 9); + labelContractCustomerId.Name = "labelContractCustomerId"; + labelContractCustomerId.Size = new Size(60, 15); + labelContractCustomerId.TabIndex = 10; + labelContractCustomerId.Text = "Заказчик:"; + // + // labelContractExecutorId + // + labelContractExecutorId.AutoSize = true; + labelContractExecutorId.Location = new Point(12, 38); + labelContractExecutorId.Name = "labelContractExecutorId"; + labelContractExecutorId.Size = new Size(84, 15); + labelContractExecutorId.TabIndex = 11; + labelContractExecutorId.Text = "Исполнитель:"; + // + // labelContractCategory + // + labelContractCategory.AutoSize = true; + labelContractCategory.Location = new Point(12, 64); + labelContractCategory.Name = "labelContractCategory"; + labelContractCategory.Size = new Size(66, 15); + labelContractCategory.TabIndex = 12; + labelContractCategory.Text = "Категория:"; + // + // comboBoxContractCustomerId + // + comboBoxContractCustomerId.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxContractCustomerId.FormattingEnabled = true; + comboBoxContractCustomerId.Location = new Point(169, 6); + comboBoxContractCustomerId.Name = "comboBoxContractCustomerId"; + comboBoxContractCustomerId.Size = new Size(202, 23); + comboBoxContractCustomerId.TabIndex = 13; + // + // comboBoxContractExecutorId + // + comboBoxContractExecutorId.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxContractExecutorId.FormattingEnabled = true; + comboBoxContractExecutorId.Location = new Point(169, 35); + comboBoxContractExecutorId.Name = "comboBoxContractExecutorId"; + comboBoxContractExecutorId.Size = new Size(202, 23); + comboBoxContractExecutorId.TabIndex = 14; + // + // labelContractDeadline + // + labelContractDeadline.AutoSize = true; + labelContractDeadline.Location = new Point(12, 116); + labelContractDeadline.Name = "labelContractDeadline"; + labelContractDeadline.Size = new Size(110, 15); + labelContractDeadline.TabIndex = 15; + labelContractDeadline.Text = "Срок выполнения:"; + // + // labelContractPaymentAmount + // + labelContractPaymentAmount.AutoSize = true; + labelContractPaymentAmount.Location = new Point(12, 141); + labelContractPaymentAmount.Name = "labelContractPaymentAmount"; + labelContractPaymentAmount.Size = new Size(97, 15); + labelContractPaymentAmount.TabIndex = 16; + labelContractPaymentAmount.Text = "Сумма платежа:"; + // + // FormContract + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(382, 231); + Controls.Add(labelContractPaymentAmount); + Controls.Add(labelContractDeadline); + Controls.Add(comboBoxContractExecutorId); + Controls.Add(comboBoxContractCustomerId); + Controls.Add(labelContractCategory); + Controls.Add(labelContractExecutorId); + Controls.Add(labelContractCustomerId); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(numericUpDownContractPaymentAmount); + Controls.Add(dateTimePickerContractDeadline); + Controls.Add(checkedListBoxContractCategory); + Name = "FormContract"; + Text = "Контракт"; + ((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private CheckedListBox checkedListBoxContractCategory; + private DateTimePicker dateTimePickerContractDeadline; + private NumericUpDown numericUpDownContractPaymentAmount; + private Button buttonCancel; + private Button buttonSave; + private Label labelContractCustomerId; + private Label labelContractExecutorId; + private Label labelContractCategory; + private ComboBox comboBoxContractCustomerId; + private ComboBox comboBoxContractExecutorId; + private Label labelContractDeadline; + private Label labelContractPaymentAmount; + } +} \ 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 new file mode 100644 index 0000000..f853138 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.cs @@ -0,0 +1,87 @@ +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; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + public partial class FormContract : Form + { + 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) + { + InitializeComponent(); + _contractRepository = contractRepository ?? throw new ArgumentNullException(nameof(contractRepository)); + + foreach (var elem in Enum.GetValues(typeof(ContractCategory))) + { + checkedListBoxContractCategory.Items.Add(elem); + } + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrEmpty(textBoxCustomerName.Text) || + string.IsNullOrEmpty(textBoxCustomerContact.Text) || + string.IsNullOrEmpty(textBoxCustomerAddress.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + + if (_contractId.HasValue) _contractRepository.UpdateContract(CreateContract(_contractId.Value)); + else _contractRepository.UpdateContract(CreateContract(0)); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private Contract CreateContract(int id) + { + ContractCategory contractCategory = ContractCategory.None; + foreach (var elem in checkedListBoxContractCategory.CheckedItems) + { + contractCategory |= (ContractCategory)elem; + } + + return Contract.CreateEntity(id) + } + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Form1.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.resx similarity index 92% rename from PIbd-23_Gutorov_I.A._IT-Company/Form1.resx rename to PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.resx index 1af7de1..8b2ff64 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Form1.resx +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.resx @@ -1,17 +1,17 @@  - diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.Designer.cs new file mode 100644 index 0000000..d5547b4 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.Designer.cs @@ -0,0 +1,140 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + partial class FormCustomer + { + /// + /// 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() + { + labelCustomerName = new Label(); + labelCustomerContact = new Label(); + labelCustomerAddress = new Label(); + textBoxCustomerName = new TextBox(); + textBoxCustomerContact = new TextBox(); + textBoxCustomerAddress = new TextBox(); + buttonSave = new Button(); + buttonCancel = new Button(); + SuspendLayout(); + // + // labelCustomerName + // + labelCustomerName.AutoSize = true; + labelCustomerName.Location = new Point(12, 9); + labelCustomerName.Name = "labelCustomerName"; + labelCustomerName.Size = new Size(34, 15); + labelCustomerName.TabIndex = 0; + labelCustomerName.Text = "Имя:"; + // + // labelCustomerContact + // + labelCustomerContact.AutoSize = true; + labelCustomerContact.Location = new Point(12, 38); + labelCustomerContact.Name = "labelCustomerContact"; + labelCustomerContact.Size = new Size(107, 15); + labelCustomerContact.TabIndex = 1; + labelCustomerContact.Text = "Контактная почта:"; + // + // labelCustomerAddress + // + labelCustomerAddress.AutoSize = true; + labelCustomerAddress.Location = new Point(12, 67); + labelCustomerAddress.Name = "labelCustomerAddress"; + labelCustomerAddress.Size = new Size(43, 15); + labelCustomerAddress.TabIndex = 2; + labelCustomerAddress.Text = "Адрес:"; + // + // textBoxCustomerName + // + textBoxCustomerName.Location = new Point(125, 6); + textBoxCustomerName.Name = "textBoxCustomerName"; + textBoxCustomerName.Size = new Size(168, 23); + textBoxCustomerName.TabIndex = 3; + // + // textBoxCustomerContact + // + textBoxCustomerContact.Location = new Point(125, 35); + textBoxCustomerContact.Name = "textBoxCustomerContact"; + textBoxCustomerContact.Size = new Size(168, 23); + textBoxCustomerContact.TabIndex = 4; + // + // textBoxCustomerAddress + // + textBoxCustomerAddress.Location = new Point(125, 64); + textBoxCustomerAddress.Name = "textBoxCustomerAddress"; + textBoxCustomerAddress.Size = new Size(168, 23); + textBoxCustomerAddress.TabIndex = 5; + // + // buttonSave + // + buttonSave.Location = new Point(12, 93); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(281, 23); + buttonSave.TabIndex = 6; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(12, 122); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(281, 23); + buttonCancel.TabIndex = 7; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // FormCustomer + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(309, 159); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxCustomerAddress); + Controls.Add(textBoxCustomerContact); + Controls.Add(textBoxCustomerName); + Controls.Add(labelCustomerAddress); + Controls.Add(labelCustomerContact); + Controls.Add(labelCustomerName); + Name = "FormCustomer"; + StartPosition = FormStartPosition.CenterParent; + Text = "Заказчик"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelCustomerName; + private Label labelCustomerContact; + private Label labelCustomerAddress; + private TextBox textBoxCustomerName; + private TextBox textBoxCustomerContact; + private TextBox textBoxCustomerAddress; + private Button buttonSave; + private Button buttonCancel; + } +} \ 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 new file mode 100644 index 0000000..d61b4c6 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.cs @@ -0,0 +1,66 @@ +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 FormCustomer : Form + { + private readonly ICustomerRepository _customerRepository; + + private int? _customerId; + + public int Id + { + set + { + try + { + 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; + _customerId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormCustomer(ICustomerRepository customerRepository) + { + InitializeComponent(); + _customerRepository = customerRepository ?? throw new ArgumentNullException(nameof(customerRepository)); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrEmpty(textBoxCustomerName.Text) || + string.IsNullOrEmpty(textBoxCustomerContact.Text) || + string.IsNullOrEmpty(textBoxCustomerAddress.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + + if (_customerId.HasValue) _customerRepository.UpdateCustomer(CreateCustomer(_customerId.Value)); + else _customerRepository.UpdateCustomer(CreateCustomer(0)); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private Customer CreateCustomer(int id) => Customer.CreateEntity( + id, textBoxCustomerName.Text, textBoxCustomerContact.Text, + textBoxCustomerAddress.Text); + } +} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomers.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomers.Designer.cs new file mode 100644 index 0000000..b8279ec --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomers.Designer.cs @@ -0,0 +1,126 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + partial class FormCustomers + { + /// + /// 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() + { + panel = new Panel(); + buttonDel = new Button(); + buttonUpd = new Button(); + buttonAdd = new Button(); + dataGridViewData = new DataGridView(); + panel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit(); + SuspendLayout(); + // + // panel + // + panel.Controls.Add(buttonDel); + 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 = 0; + // + // buttonDel + // + buttonDel.BackgroundImage = Properties.Resources.icon_remove_button; + buttonDel.BackgroundImageLayout = ImageLayout.Stretch; + buttonDel.Location = new Point(16, 204); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(90, 90); + buttonDel.TabIndex = 2; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // + // 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; + // + // 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 = 1; + // + // FormCustomers + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridViewData); + Controls.Add(panel); + Name = "FormCustomers"; + StartPosition = FormStartPosition.CenterParent; + Text = "Заказчики"; + Load += FormCustomers_Load; + panel.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel; + private Button buttonAdd; + private Button buttonDel; + private Button buttonUpd; + private DataGridView dataGridViewData; + } +} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomers.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomers.cs new file mode 100644 index 0000000..ebceb67 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomers.cs @@ -0,0 +1,96 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Repositories; +using Unity; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + public partial class FormCustomers : Form + { + private readonly IUnityContainer _container; + + private readonly ICustomerRepository _customerRepository; + + public FormCustomers(IUnityContainer container, ICustomerRepository customerRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentException(nameof(container)); + _customerRepository = customerRepository ?? throw new ArgumentException(nameof(customerRepository)); + } + + private void FormCustomers_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 ButtonDel_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + return; + + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + return; + + try + { + _customerRepository.DeleteCustomer(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => dataGridViewData.DataSource = _customerRepository.ReadCustomers(); + + 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/FormCustomers.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomers.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomers.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutor.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutor.Designer.cs new file mode 100644 index 0000000..d165291 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutor.Designer.cs @@ -0,0 +1,119 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + partial class FormExecutor + { + /// + /// 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() + { + comboBoxExecutorPost = new ComboBox(); + LabelExecutorName = new Label(); + labelExecutorPost = new Label(); + textBoxExecutorName = new TextBox(); + buttonSave = new Button(); + buttonCancel = new Button(); + SuspendLayout(); + // + // comboBoxExecutorPost + // + comboBoxExecutorPost.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxExecutorPost.FormattingEnabled = true; + comboBoxExecutorPost.Location = new Point(101, 41); + comboBoxExecutorPost.Name = "comboBoxExecutorPost"; + comboBoxExecutorPost.Size = new Size(168, 23); + comboBoxExecutorPost.TabIndex = 0; + // + // LabelExecutorName + // + LabelExecutorName.AutoSize = true; + LabelExecutorName.Location = new Point(12, 15); + LabelExecutorName.Name = "LabelExecutorName"; + LabelExecutorName.Size = new Size(34, 15); + LabelExecutorName.TabIndex = 1; + LabelExecutorName.Text = "Имя:"; + // + // labelExecutorPost + // + labelExecutorPost.AutoSize = true; + labelExecutorPost.Location = new Point(12, 44); + labelExecutorPost.Name = "labelExecutorPost"; + labelExecutorPost.Size = new Size(72, 15); + labelExecutorPost.TabIndex = 2; + labelExecutorPost.Text = "Должность:"; + // + // textBoxExecutorName + // + textBoxExecutorName.Location = new Point(101, 12); + textBoxExecutorName.Name = "textBoxExecutorName"; + textBoxExecutorName.Size = new Size(168, 23); + textBoxExecutorName.TabIndex = 4; + // + // buttonSave + // + buttonSave.Location = new Point(12, 70); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(257, 23); + buttonSave.TabIndex = 7; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(12, 99); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(257, 23); + buttonCancel.TabIndex = 8; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // FormExecutor + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(281, 133); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxExecutorName); + Controls.Add(labelExecutorPost); + Controls.Add(LabelExecutorName); + Controls.Add(comboBoxExecutorPost); + Name = "FormExecutor"; + Text = "FormExecutor"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox comboBoxExecutorPost; + private Label LabelExecutorName; + private Label labelExecutorPost; + private TextBox textBoxExecutorName; + private Button buttonSave; + private Button buttonCancel; + } +} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutor.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutor.cs new file mode 100644 index 0000000..f5c9666 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutor.cs @@ -0,0 +1,66 @@ +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; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + public partial class FormExecutor : Form + { + private readonly IExecutorRepository _executorRepository; + + private int? _executorId; + + public int Id + { + set + { + try + { + var executor = _executorRepository.ReadExecutorById(value); + if (executor == null) throw new InvalidDataException(nameof(executor)); + + textBoxExecutorName.Text = executor.Name; + comboBoxExecutorPost.SelectedItem = executor.Post; + _executorId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormExecutor(IExecutorRepository executorRepository) + { + InitializeComponent(); + _executorRepository = executorRepository ?? throw new ArgumentNullException(nameof(executorRepository)); + + comboBoxExecutorPost.DataSource = Enum.GetValues(typeof(ExecutorPost)); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrEmpty(textBoxExecutorName.Text) || + comboBoxExecutorPost.SelectedIndex < 1) + { + throw new Exception("Имеются незаполненные поля"); + } + + if (_executorId.HasValue) _executorRepository.UpdateExecutor(CreateExecutor(_executorId.Value)); + else _executorRepository.UpdateExecutor(CreateExecutor(0)); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private Executor CreateExecutor(int id) => + Executor.CreateEntity(id, textBoxExecutorName.Text, (ExecutorPost)comboBoxExecutorPost.SelectedItem!); + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutor.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutor.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutors.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutors.Designer.cs new file mode 100644 index 0000000..b67755c --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutors.Designer.cs @@ -0,0 +1,125 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + partial class FormExecutors + { + /// + /// 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(); + buttonDel = new Button(); + 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 = 3; + // + // panel + // + panel.Controls.Add(buttonDel); + 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 = 2; + // + // buttonDel + // + buttonDel.BackgroundImage = Properties.Resources.icon_remove_button; + buttonDel.BackgroundImageLayout = ImageLayout.Stretch; + buttonDel.Location = new Point(16, 204); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(90, 90); + buttonDel.TabIndex = 2; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // + // 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; + // + // FormExecutors + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridViewData); + Controls.Add(panel); + Name = "FormExecutors"; + Text = "FormExecutors"; + Load += FormExecutors_Load; + ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); + panel.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridViewData; + private Panel panel; + private Button buttonDel; + private Button buttonUpd; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutors.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutors.cs new file mode 100644 index 0000000..8c99e4b --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutors.cs @@ -0,0 +1,107 @@ +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; +using System.Xml.Linq; +using Unity; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + public partial class FormExecutors : Form + { + private readonly IUnityContainer _container; + + private readonly IExecutorRepository _executorRepository; + + public FormExecutors(IUnityContainer container, IExecutorRepository executorRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentException(nameof(container)); + _executorRepository = executorRepository ?? throw new ArgumentException(nameof(executorRepository)); + } + + private void FormExecutors_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 ButtonDel_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + return; + + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + return; + + try + { + _executorRepository.DeleteExecutor(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => dataGridViewData.DataSource = _executorRepository.ReadExecutors(); + + 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/FormExecutors.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutors.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutors.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/PIbd-23_Gutorov_I.A._IT-Company.csproj b/PIbd-23_Gutorov_I.A._IT-Company/PIbd-23_Gutorov_I.A._IT-Company.csproj index 417f5c7..5159f6f 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/PIbd-23_Gutorov_I.A._IT-Company.csproj +++ b/PIbd-23_Gutorov_I.A._IT-Company/PIbd-23_Gutorov_I.A._IT-Company.csproj @@ -9,4 +9,23 @@ enable + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Program.cs b/PIbd-23_Gutorov_I.A._IT-Company/Program.cs index 5c6c767..32ea60d 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Program.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Program.cs @@ -1,3 +1,7 @@ +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 { internal static class Program @@ -11,7 +15,21 @@ namespace PIbd_23_Gutorov_I.A._IT_Company // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + Application.Run(CreateContainer().Resolve()); + } + + private static IUnityContainer CreateContainer() + { + var container = new UnityContainer(); + + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + + return container; } } } \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Properties/Resources.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Properties/Resources.Designer.cs new file mode 100644 index 0000000..35a1116 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace PIbd_23_Gutorov_I.A._IT_Company.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PIbd_23_Gutorov_I.A._IT_Company.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon_add_button { + get { + object obj = ResourceManager.GetObject("icon-add-button", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon_edit_button { + get { + object obj = ResourceManager.GetObject("icon-edit-button", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon_remove_button { + get { + object obj = ResourceManager.GetObject("icon-remove-button", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap modern_equipped_computer_lab { + get { + object obj = ResourceManager.GetObject("modern-equipped-computer-lab", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Properties/Resources.resx b/PIbd-23_Gutorov_I.A._IT-Company/Properties/Resources.resx new file mode 100644 index 0000000..8bb8269 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Properties/Resources.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + ..\Resources\modern-equipped-computer-lab.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icon-add-button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icon-edit-button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icon-remove-button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IContractRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IContractRepository.cs new file mode 100644 index 0000000..d22894e --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IContractRepository.cs @@ -0,0 +1,16 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories; + +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 UpdateContract(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 new file mode 100644 index 0000000..7bdd77c --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/ICustomerContractReviewRepository.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 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/ICustomerRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/ICustomerRepository.cs new file mode 100644 index 0000000..ac1d8fc --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/ICustomerRepository.cs @@ -0,0 +1,16 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories; + +public interface ICustomerRepository +{ + IEnumerable ReadCustomers(); + + Customer ReadCustomerById(int id); + + void CreateCustomer(Customer customer); + + void UpdateCustomer(Customer customer); + + void DeleteCustomer(int id); +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IExecutorRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IExecutorRepository.cs new file mode 100644 index 0000000..e240684 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IExecutorRepository.cs @@ -0,0 +1,16 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories; + +public interface IExecutorRepository +{ + IEnumerable ReadExecutors(); + + Executor ReadExecutorById(int id); + + void CreateExecutor(Executor Executor); + + void UpdateExecutor(Executor Executor); + + void DeleteExecutor(int id); +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IServiceExecutionRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IServiceExecutionRepository.cs new file mode 100644 index 0000000..11bf5a8 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IServiceExecutionRepository.cs @@ -0,0 +1,14 @@ +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/IServiceRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IServiceRepository.cs new file mode 100644 index 0000000..ae28c36 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IServiceRepository.cs @@ -0,0 +1,16 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories; + +public interface IServiceRepository +{ + IEnumerable ReadServices(int? contractId = null); + + Service ReadServiceById(int id); + + void CreateService(Service Service); + + void UpdateService(Service Service); + + void DeleteService(int id); +} 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 new file mode 100644 index 0000000..255904a --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ContractRepository.cs @@ -0,0 +1,28 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations; + +public class ContractRepository : IContractRepository +{ + public void CreateContract(Contract Contract) + { + } + + public void DeleteContract(int id) + { + } + + 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 []; + } + + public void UpdateContract(Contract Contract) + { + } +} 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 new file mode 100644 index 0000000..2d0208b --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/CustomerContractReviewRepository.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 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/CustomerRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/CustomerRepository.cs new file mode 100644 index 0000000..618d76a --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/CustomerRepository.cs @@ -0,0 +1,28 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations; + +public class CustomerRepository : ICustomerRepository +{ + public void CreateCustomer(Customer customer) + { + } + + public void DeleteCustomer(int id) + { + } + + public Customer ReadCustomerById(int id) + { + return Customer.CreateEntity(0, string.Empty, string.Empty, string.Empty); + } + + public IEnumerable ReadCustomers() + { + return []; + } + + public void UpdateCustomer(Customer customer) + { + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ExecutorRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ExecutorRepository.cs new file mode 100644 index 0000000..3448c73 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ExecutorRepository.cs @@ -0,0 +1,28 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations; + +public class ExecutorRepository : IExecutorRepository +{ + public void CreateExecutor(Executor Executor) + { + } + + public void DeleteExecutor(int id) + { + } + + public Executor ReadExecutorById(int id) + { + return Executor.CreateEntity(0, string.Empty, Entities.Enums.ExecutorPost.None); + } + + public IEnumerable ReadExecutors() + { + return []; + } + + public void UpdateExecutor(Executor Executor) + { + } +} 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 new file mode 100644 index 0000000..fe8db08 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ServiceExecutionRepository.cs @@ -0,0 +1,24 @@ +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) + { + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ServiceRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ServiceRepository.cs new file mode 100644 index 0000000..0b16421 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ServiceRepository.cs @@ -0,0 +1,28 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Entities; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations; + +internal class ServiceRepository : IServiceRepository +{ + public void CreateService(Service Service) + { + } + + public void DeleteService(int id) + { + } + + public Service ReadServiceById(int id) + { + return Service.CreateEntity(0, string.Empty, 0); + } + + public IEnumerable ReadServices(int? contractId = null) + { + return []; + } + + public void UpdateService(Service Service) + { + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Resources/icon-add-button.png b/PIbd-23_Gutorov_I.A._IT-Company/Resources/icon-add-button.png new file mode 100644 index 0000000..87306ed Binary files /dev/null and b/PIbd-23_Gutorov_I.A._IT-Company/Resources/icon-add-button.png differ diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Resources/icon-edit-button.png b/PIbd-23_Gutorov_I.A._IT-Company/Resources/icon-edit-button.png new file mode 100644 index 0000000..01a08d0 Binary files /dev/null and b/PIbd-23_Gutorov_I.A._IT-Company/Resources/icon-edit-button.png differ diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Resources/icon-remove-button.png b/PIbd-23_Gutorov_I.A._IT-Company/Resources/icon-remove-button.png new file mode 100644 index 0000000..3887666 Binary files /dev/null and b/PIbd-23_Gutorov_I.A._IT-Company/Resources/icon-remove-button.png differ diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Resources/modern-equipped-computer-lab.jpg b/PIbd-23_Gutorov_I.A._IT-Company/Resources/modern-equipped-computer-lab.jpg new file mode 100644 index 0000000..974acd9 Binary files /dev/null and b/PIbd-23_Gutorov_I.A._IT-Company/Resources/modern-equipped-computer-lab.jpg differ