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..66ec15b --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Contract.cs @@ -0,0 +1,39 @@ +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 IEnumerable Services { get; private set; } = []; + + public static Contract CreateEntity(int id, int customerID, int executorID, + ContractCategory category, DateTime deadline, + int paymentAmount, IEnumerable services) + { + return new Contract + { + Id = id, + CustomerID = customerID, + ExecutorID = executorID, + Category = category, + ConclusionDate = DateTime.Now, + Deadline = deadline, + PaymentAmount = paymentAmount, + Services = services + }; + } +} 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/CustomerExecutorReview.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/CustomerExecutorReview.cs new file mode 100644 index 0000000..1a7f114 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/CustomerExecutorReview.cs @@ -0,0 +1,26 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Entities; + +public class CustomerExecutorReview +{ + public int Id { get; private set; } + + public int CustomerId { 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 CustomerExecutorReview CreateElement(int id, int customerId, int executorId, string review, int grade) + { + return new CustomerExecutorReview + { + Id = id, + CustomerId = customerId, + ExecutorId = executorId, + 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..bc23622 --- /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..76ee123 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/Service.cs @@ -0,0 +1,17 @@ +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 static Service CreateEntity(int id, string description) + { + return new Service + { + Id = id, + Description = description + }; + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Entities/ServiceContract.cs b/PIbd-23_Gutorov_I.A._IT-Company/Entities/ServiceContract.cs new file mode 100644 index 0000000..7edd1bd --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Entities/ServiceContract.cs @@ -0,0 +1,20 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Entities; + +public class ServiceContract +{ + public int Id { get; private set; } + + public int ServiceId { get; private set; } + + public int ContractId { get; private set; } + + public static ServiceContract CreateElement(int id, int serviceId, int contractId) + { + return new ServiceContract + { + Id = id, + ContractId = contractId, + ServiceId = serviceId + }; + } +} 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/Form1.cs b/PIbd-23_Gutorov_I.A._IT-Company/Form1.cs deleted file mode 100644 index b362d48..0000000 --- a/PIbd-23_Gutorov_I.A._IT-Company/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace PIbd_23_Gutorov_I.A._IT_Company -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} 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..b70d236 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.Designer.cs @@ -0,0 +1,137 @@ +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(); + EntitiesToolStripMenuItem = new ToolStripMenuItem(); + CustomersToolStripMenuItem = new ToolStripMenuItem(); + ExecutorsToolStripMenuItem = new ToolStripMenuItem(); + ServicesToolStripMenuItem = new ToolStripMenuItem(); + OperationsToolStripMenuItem = new ToolStripMenuItem(); + CustomerContractReviewsToolStripMenuItem = new ToolStripMenuItem(); + ContractsToolStripMenuItem = new ToolStripMenuItem(); + ReportsToolStripMenuItem = new ToolStripMenuItem(); + menuStrip.SuspendLayout(); + SuspendLayout(); + // + // menuStrip + // + menuStrip.Items.AddRange(new ToolStripItem[] { EntitiesToolStripMenuItem, OperationsToolStripMenuItem, ReportsToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Size = new Size(734, 24); + menuStrip.TabIndex = 0; + menuStrip.Text = "menuStrip1"; + // + // EntitiesToolStripMenuItem + // + EntitiesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CustomersToolStripMenuItem, ExecutorsToolStripMenuItem, ServicesToolStripMenuItem }); + EntitiesToolStripMenuItem.Name = "EntitiesToolStripMenuItem"; + EntitiesToolStripMenuItem.Size = new Size(94, 20); + EntitiesToolStripMenuItem.Text = "Справочники"; + // + // CustomersToolStripMenuItem + // + CustomersToolStripMenuItem.Name = "CustomersToolStripMenuItem"; + CustomersToolStripMenuItem.Size = new Size(180, 22); + CustomersToolStripMenuItem.Text = "Заказчики"; + CustomersToolStripMenuItem.Click += CustomersToolStripMenuItem_Click; + // + // ExecutorsToolStripMenuItem + // + ExecutorsToolStripMenuItem.Name = "ExecutorsToolStripMenuItem"; + ExecutorsToolStripMenuItem.Size = new Size(180, 22); + ExecutorsToolStripMenuItem.Text = "Исполнители"; + ExecutorsToolStripMenuItem.Click += ExecutorsToolStripMenuItem_Click; + // + // ServicesToolStripMenuItem + // + ServicesToolStripMenuItem.Name = "ServicesToolStripMenuItem"; + ServicesToolStripMenuItem.Size = new Size(180, 22); + ServicesToolStripMenuItem.Text = "Услуги"; + ServicesToolStripMenuItem.Click += ServicesToolStripMenuItem_Click; + // + // OperationsToolStripMenuItem + // + OperationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CustomerContractReviewsToolStripMenuItem, ContractsToolStripMenuItem }); + OperationsToolStripMenuItem.Name = "OperationsToolStripMenuItem"; + OperationsToolStripMenuItem.Size = new Size(75, 20); + OperationsToolStripMenuItem.Text = "Операции"; + // + // CustomerContractReviewsToolStripMenuItem + // + CustomerContractReviewsToolStripMenuItem.Name = "CustomerContractReviewsToolStripMenuItem"; + CustomerContractReviewsToolStripMenuItem.Size = new Size(181, 22); + CustomerContractReviewsToolStripMenuItem.Text = "Отзывы заказчиков"; + CustomerContractReviewsToolStripMenuItem.Click += CustomerContractReviewsToolStripMenuItem_Click; + // + // ContractsToolStripMenuItem + // + ContractsToolStripMenuItem.Name = "ContractsToolStripMenuItem"; + ContractsToolStripMenuItem.Size = new Size(181, 22); + ContractsToolStripMenuItem.Text = "Контракты"; + ContractsToolStripMenuItem.Click += ContractsToolStripMenuItem_Click; + // + // ReportsToolStripMenuItem + // + ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem"; + ReportsToolStripMenuItem.Size = new Size(60, 20); + ReportsToolStripMenuItem.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 EntitiesToolStripMenuItem; + private ToolStripMenuItem CustomersToolStripMenuItem; + private ToolStripMenuItem ExecutorsToolStripMenuItem; + private ToolStripMenuItem OperationsToolStripMenuItem; + private ToolStripMenuItem ReportsToolStripMenuItem; + private ToolStripMenuItem CustomerContractReviewsToolStripMenuItem; + private ToolStripMenuItem ContractsToolStripMenuItem; + private ToolStripMenuItem ServicesToolStripMenuItem; + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.cs b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.cs new file mode 100644 index 0000000..795a495 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/FormItCompany.cs @@ -0,0 +1,76 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Forms; +using Unity; + +namespace PIbd_23_Gutorov_I.A._IT_Company +{ + public partial class FormItCompany : Form + { + private readonly IUnityContainer _container; + + public FormItCompany(IUnityContainer container) + { + InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + } + + private void CustomersToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ExecutorsToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ContractsToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void CustomerContractReviewsToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ServicesToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} 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..e694e67 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.Designer.cs @@ -0,0 +1,240 @@ +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(); + dataGridViewServices = new DataGridView(); + ColumnServiceDescription = new DataGridViewComboBoxColumn(); + groupBox = new GroupBox(); + ((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).BeginInit(); + ((System.ComponentModel.ISupportInitialize)dataGridViewServices).BeginInit(); + groupBox.SuspendLayout(); + 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.Increment = new decimal(new int[] { 100000, 0, 0, 0 }); + numericUpDownContractPaymentAmount.Location = new Point(169, 139); + numericUpDownContractPaymentAmount.Maximum = new decimal(new int[] { 1000000000, 0, 0, 0 }); + numericUpDownContractPaymentAmount.Name = "numericUpDownContractPaymentAmount"; + numericUpDownContractPaymentAmount.Size = new Size(202, 23); + numericUpDownContractPaymentAmount.TabIndex = 2; + // + // buttonCancel + // + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + buttonCancel.Location = new Point(12, 469); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(358, 23); + buttonCancel.TabIndex = 9; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // buttonSave + // + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + buttonSave.Location = new Point(12, 440); + 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 = "Сумма платежа:"; + // + // dataGridViewServices + // + 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; + // + // ColumnServiceDescription + // + ColumnServiceDescription.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + ColumnServiceDescription.HeaderText = "Услуга"; + ColumnServiceDescription.Name = "ColumnServiceDescription"; + ColumnServiceDescription.Resizable = DataGridViewTriState.True; + ColumnServiceDescription.SortMode = DataGridViewColumnSortMode.Automatic; + // + // groupBox + // + groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + groupBox.Controls.Add(dataGridViewServices); + groupBox.Location = new Point(12, 168); + groupBox.Name = "groupBox"; + groupBox.Size = new Size(358, 266); + groupBox.TabIndex = 18; + groupBox.TabStop = false; + groupBox.Text = "Услуги:"; + // + // FormContract + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(382, 502); + Controls.Add(groupBox); + 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"; + StartPosition = FormStartPosition.CenterParent; + Text = "Контракт"; + ((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).EndInit(); + ((System.ComponentModel.ISupportInitialize)dataGridViewServices).EndInit(); + groupBox.ResumeLayout(false); + 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; + 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 new file mode 100644 index 0000000..4275593 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.cs @@ -0,0 +1,83 @@ +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; + + 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.ValueMember = "Id"; + + comboBoxContractExecutorId.DataSource = executorRepository.ReadExecutors(); + comboBoxContractExecutorId.DisplayMember = "Name"; + comboBoxContractExecutorId.ValueMember = "Id"; + + ColumnServiceDescription.DataSource = serviceRepository.ReadServices(); + ColumnServiceDescription.DisplayMember = "Description"; + ColumnServiceDescription.ValueMember = "Id"; + + foreach (var elem in Enum.GetValues(typeof(ContractCategory))) + { + checkedListBoxContractCategory.Items.Add(elem); + } + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (checkedListBoxContractCategory.CheckedItems.Count == 0 || + comboBoxContractCustomerId.SelectedIndex < 0 || + comboBoxContractExecutorId.SelectedIndex < 0) + { + throw new Exception("Имеются незаполненные поля"); + } + + _contractRepository.CreateContract(CreateContract(0)); + + Close(); + } + 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, (int)comboBoxContractCustomerId.SelectedValue!, + (int)comboBoxContractExecutorId.SelectedValue!, contractCategory, + dateTimePickerContractDeadline.Value, Convert.ToInt32(numericUpDownContractPaymentAmount.Value), + CreateListServicesFromDataGrid()); + } + + private List CreateListServicesFromDataGrid() + { + var list = new List(); + + foreach (DataGridViewRow row in dataGridViewServices.Rows) + if (row.Cells["ColumnServiceDescription"].Value != null) + list.Add(Service.CreateEntity(0, Convert.ToString(row.Cells["ColumnServiceDescription"].Value)!)); + + return list; + } + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.resx new file mode 100644 index 0000000..9958efa --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContract.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 + + + True + + \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.Designer.cs new file mode 100644 index 0000000..71e53a8 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.Designer.cs @@ -0,0 +1,112 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + partial class FormContracts + { + /// + /// 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(); + 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(buttonDel); + 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; + // + // buttonDel + // + buttonDel.BackgroundImage = Properties.Resources.icon_remove_button; + buttonDel.BackgroundImageLayout = ImageLayout.Stretch; + buttonDel.Location = new Point(16, 108); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(90, 90); + buttonDel.TabIndex = 2; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_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; + // + // FormContracts + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridViewData); + Controls.Add(panel); + Name = "FormContracts"; + StartPosition = FormStartPosition.CenterParent; + Text = "Контракты"; + Load += FormContracts_Load; + ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); + panel.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridViewData; + private Panel panel; + private Button buttonDel; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.cs new file mode 100644 index 0000000..abce63a --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.cs @@ -0,0 +1,78 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Repositories; +using Unity; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + public partial class FormContracts : Form + { + private readonly IUnityContainer _container; + + private readonly IContractRepository _contractRepository; + + public FormContracts(IUnityContainer container, IContractRepository contractRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentException(nameof(container)); + _contractRepository = contractRepository ?? throw new ArgumentException(nameof(contractRepository)); + } + + private void FormContracts_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 ButtonDel_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + return; + + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + return; + + try + { + _contractRepository.DeleteContract(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => dataGridViewData.DataSource = _contractRepository.ReadContracts(); + + 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/FormContracts.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.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/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..cbb6c0d --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomer.cs @@ -0,0 +1,68 @@ +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.CreateCustomer(CreateCustomer(0)); + + Close(); + } + 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/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..a12334a --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.cs @@ -0,0 +1,58 @@ +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.ValueMember = "Id"; + + comboBoxCustomerExecutorReviewExecutorId.DataSource = executorRepository.ReadExecutors(); + comboBoxCustomerExecutorReviewExecutorId.DisplayMember = "Name"; + comboBoxCustomerExecutorReviewExecutorId.ValueMember = "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(CreateCustomerExecutorReview(0)); + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private CustomerExecutorReview CreateCustomerExecutorReview(int id) + { + return CustomerExecutorReview.CreateElement( + id, (int)comboBoxCustomerExecutorReviewCustomerId.SelectedValue!, + (int)comboBoxCustomerExecutorReviewExecutorId.SelectedValue!, + richTextBoxCustomerExecutorReviewReview.Text, + Convert.ToInt32(numericUpDownCustomerExecutorReviewGrade.Value)); + } + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReview.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/FormCustomerExecutorReviews.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.Designer.cs new file mode 100644 index 0000000..6c5f3e4 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.Designer.cs @@ -0,0 +1,98 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + partial class FormCustomerExecutorReviews + { + /// + /// 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(); + 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(buttonAdd); + panel.Dock = DockStyle.Right; + panel.Location = new Point(677, 0); + panel.Name = "panel"; + panel.Size = new Size(123, 450); + panel.TabIndex = 4; + // + // 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; + // + // FormCustomerContractReviews + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridViewData); + Controls.Add(panel); + Name = "FormCustomerContractReviews"; + StartPosition = FormStartPosition.CenterParent; + Text = "Отзывы заказчиков"; + Load += FormCustomerExecutorReviews_Load; + ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); + panel.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridViewData; + private Panel panel; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.cs new file mode 100644 index 0000000..27d60c1 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.cs @@ -0,0 +1,46 @@ +using PIbd_23_Gutorov_I.A._IT_Company.Repositories; +using Unity; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + public partial class FormCustomerExecutorReviews : Form + { + private readonly IUnityContainer _container; + + private readonly ICustomerExecutorReviewRepository _customerExecutorReviewRepository; + + public FormCustomerExecutorReviews(IUnityContainer container, ICustomerExecutorReviewRepository customerExecutorReviewRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentException(nameof(container)); + _customerExecutorReviewRepository = customerExecutorReviewRepository ?? throw new ArgumentException(nameof(customerExecutorReviewRepository)); + } + + private void FormCustomerExecutorReviews_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 LoadList() => dataGridViewData.DataSource = _customerExecutorReviewRepository.ReadCustomerExecutorReviews(); + } +} diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerExecutorReviews.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..648db50 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutor.Designer.cs @@ -0,0 +1,120 @@ +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"; + StartPosition = FormStartPosition.CenterParent; + Text = "Исполнитель"; + 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..d847278 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutor.cs @@ -0,0 +1,68 @@ +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.CreateExecutor(CreateExecutor(0)); + + Close(); + } + 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..5a6fca5 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutors.Designer.cs @@ -0,0 +1,126 @@ +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"; + StartPosition = FormStartPosition.CenterParent; + Text = "Исполнители"; + 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..f4b93ba --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormExecutors.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 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/Forms/FormService.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.Designer.cs new file mode 100644 index 0000000..4112755 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.Designer.cs @@ -0,0 +1,96 @@ +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + partial class FormService + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + labelServiceDescription = new Label(); + richTextBoxServiceDescription = new RichTextBox(); + buttonCancel = new Button(); + buttonSave = new Button(); + SuspendLayout(); + // + // labelServiceDescription + // + labelServiceDescription.AutoSize = true; + labelServiceDescription.Location = new Point(16, 15); + labelServiceDescription.Name = "labelServiceDescription"; + labelServiceDescription.Size = new Size(65, 15); + labelServiceDescription.TabIndex = 30; + labelServiceDescription.Text = "Описание:"; + // + // richTextBoxServiceDescription + // + richTextBoxServiceDescription.Location = new Point(173, 12); + richTextBoxServiceDescription.Name = "richTextBoxServiceDescription"; + richTextBoxServiceDescription.Size = new Size(202, 96); + richTextBoxServiceDescription.TabIndex = 29; + richTextBoxServiceDescription.Text = ""; + // + // buttonCancel + // + buttonCancel.Location = new Point(16, 143); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(359, 23); + buttonCancel.TabIndex = 32; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // buttonSave + // + buttonSave.Location = new Point(16, 114); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(359, 23); + buttonSave.TabIndex = 31; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // FormService + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(387, 181); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(labelServiceDescription); + Controls.Add(richTextBoxServiceDescription); + Name = "FormService"; + StartPosition = FormStartPosition.CenterParent; + Text = "Услуга"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + private Label labelServiceDescription; + private RichTextBox richTextBoxServiceDescription; + private Button buttonCancel; + private Button buttonSave; + } +} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.cs new file mode 100644 index 0000000..2d41b29 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.cs @@ -0,0 +1,58 @@ +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 FormService : Form + { + private readonly IServiceRepository _serviceRepository; + + private int? _serviceId; + + public int Id + { + set + { + try + { + var service = _serviceRepository.ReadServiceById(value); + if (service == null) throw new InvalidDataException(nameof(service)); + + richTextBoxServiceDescription.Text = service.Description; + _serviceId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormService(IServiceRepository serviceRepository) + { + InitializeComponent(); + _serviceRepository = serviceRepository ?? throw new ArgumentNullException(nameof(serviceRepository)); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrEmpty(richTextBoxServiceDescription.Text)) + throw new Exception("Имеются незаполненные поля"); + + if (_serviceId.HasValue) _serviceRepository.UpdateService(Service.CreateEntity(_serviceId.Value, richTextBoxServiceDescription.Text)); + else _serviceRepository.CreateService(Service.CreateEntity(0, richTextBoxServiceDescription.Text)); + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + } +} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Form1.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.resx similarity index 100% rename from PIbd-23_Gutorov_I.A._IT-Company/Form1.resx rename to PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.resx diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.Designer.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.Designer.cs new file mode 100644 index 0000000..1666c9a --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.Designer.cs @@ -0,0 +1,130 @@ +using static System.Net.Mime.MediaTypeNames; +using System.Windows.Forms; +using System.Xml.Linq; + +namespace PIbd_23_Gutorov_I.A._IT_Company.Forms +{ + partial class FormServices + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + 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 = 5; + // + // 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 = 4; + // + // 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; + // + // FormServices + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridViewData); + Controls.Add(panel); + Name = "FormServices"; + StartPosition = FormStartPosition.CenterParent; + Text = "Услуги"; + Load += FormServices_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/FormServices.cs b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.cs new file mode 100644 index 0000000..60f8f62 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.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 FormServices : Form + { + private readonly IUnityContainer _container; + + private readonly IServiceRepository _serviceRepository; + + public FormServices(IUnityContainer container, IServiceRepository serviceRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentException(nameof(container)); + _serviceRepository = serviceRepository ?? throw new ArgumentException(nameof(serviceRepository)); + } + + private void FormServices_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 + { + _serviceRepository.DeleteService(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => dataGridViewData.DataSource = _serviceRepository.ReadServices(); + + 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; + } + } +} \ No newline at end of file diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.resx b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.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..3c5e10d 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,20 @@ 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(); + + 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..7e882c4 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IContractRepository.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 IContractRepository +{ + IEnumerable ReadContracts(DateTime? dateFrom = null, DateTime? dateTo = null, int? customerId = null, int? executorId = null); + + void CreateContract(Contract contract); + + void DeleteContract(int id); +} 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..274e559 --- /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/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..8ee960e --- /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/IServiceRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/IServiceRepository.cs new file mode 100644 index 0000000..99d3a4f --- /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(); + + Service ReadServiceById(int id); + + void CreateService(Service service); + + void UpdateService(Service service); + + void DeleteService(int id); +} \ No newline at end of file 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..1e14ec1 --- /dev/null +++ b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ContractRepository.cs @@ -0,0 +1,19 @@ +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 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/CustomerExecutorReviewRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/CustomerExecutorReviewRepository.cs new file mode 100644 index 0000000..ebd6a67 --- /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/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..6533fc8 --- /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/ServiceRepository.cs b/PIbd-23_Gutorov_I.A._IT-Company/Repositories/Implementations/ServiceRepository.cs new file mode 100644 index 0000000..11f9679 --- /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); + } + + public IEnumerable ReadServices() + { + return []; + } + + public void UpdateService(Service service) + { + } +} \ No newline at end of file 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