From e422a509294ed73338789ec7cbb561cc0f13177b Mon Sep 17 00:00:00 2001 From: egorvasin01 Date: Sat, 14 Dec 2024 16:11:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=20=E2=84=961?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Client.cs | 7 ++- .../Entities/Contract.cs | 12 ++-- .../Entities/Contractor.cs | 7 ++- .../Entities/Enums/VacationType.cs | 12 ++++ .../Entities/ServiceContract.cs | 9 +-- .../Entities/Vacation.cs | 11 +++- .../Forms/FormClient.Designer.cs | 32 ++++++++-- .../Forms/FormClient.cs | 8 ++- .../Forms/FormContract.Designer.cs | 55 +++++----------- .../Forms/FormContract.cs | 62 +++---------------- .../Forms/FormContractor.Designer.cs | 32 ++++++++-- .../Forms/FormContractor.cs | 10 ++- .../Forms/FormContractorVacations.Designer.cs | 14 +++++ .../Forms/FormContractorVacations.cs | 21 ++++++- .../Forms/FormContracts.Designer.cs | 14 ----- .../Forms/FormContracts.cs | 31 ---------- .../Forms/FormVacation.Designer.cs | 29 ++++++++- .../Forms/FormVacation.cs | 15 ++++- .../ISEbd-22_Vasin_E.D._It_Company/Program.cs | 1 + .../Repositories/IContractRepository.cs | 8 +-- .../IContractorVacationRepository.cs | 2 + .../Implementations/ClientRepository.cs | 4 +- .../Implementations/ContractRepository.cs | 15 +---- .../Implementations/ContractorRepository.cs | 4 +- .../ContractorVacationRepository.cs | 6 +- .../Implementations/ServiceRepository.cs | 2 +- .../Implementations/VacationRepository.cs | 5 +- 27 files changed, 225 insertions(+), 203 deletions(-) create mode 100644 ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Enums/VacationType.cs diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Client.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Client.cs index 100b7ef..a26004a 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Client.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Client.cs @@ -6,12 +6,15 @@ public class Client public string Name { get; private set; } = string.Empty; - public static Client CreateEntity(int id, string name) + public string LegalForm { get; private set; } = string.Empty; + + public static Client CreateEntity(int id, string name, string legalForm) { return new Client { Id = id, - Name = name ?? string.Empty + Name = name ?? string.Empty, + LegalForm = legalForm ?? string.Empty }; } } diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Contract.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Contract.cs index 1b86ee8..1dd7b78 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Contract.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Contract.cs @@ -12,16 +12,16 @@ public class Contract public int Amount { get; private set; } - public DateTime Deadline { get; private set; } + public DateTime StartDate { get; private set; } - public Status Status { get; private set; } + public DateTime Deadline { get; private set; } public ContractType ContractType { get; private set; } - public IEnumerable Services { get; private set; } = []; + public IEnumerable ServiceContracts { get; private set; } = []; public static Contract CreateEntity(int id, int clientId, int contractorId, int amount, - DateTime deadline, Status status, ContractType contractType, IEnumerable services) + DateTime deadline, ContractType contractType, IEnumerable serviceContracts) { return new Contract { @@ -29,10 +29,10 @@ public class Contract ClientId = clientId, ContractorId = contractorId, Amount = amount, + StartDate = DateTime.Now, Deadline = deadline, - Status = status, ContractType = contractType, - Services = services + ServiceContracts = serviceContracts }; } } diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Contractor.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Contractor.cs index 4882d70..dcb235f 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Contractor.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Contractor.cs @@ -6,12 +6,15 @@ public class Contractor public string Name { get; private set; } = string.Empty; - public static Contractor CreateEntity(int id, string name) + public string Surname { get; private set; } = string.Empty; + + public static Contractor CreateEntity(int id, string name, string surname) { return new Contractor { Id = id, - Name = name ?? string.Empty + Name = name ?? string.Empty, + Surname = surname ?? string.Empty }; } } diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Enums/VacationType.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Enums/VacationType.cs new file mode 100644 index 0000000..85e3ca7 --- /dev/null +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Enums/VacationType.cs @@ -0,0 +1,12 @@ +namespace ISEbd_22_Vasin_E.D._It_Company.Entities.Enums; + +public enum VacationType +{ + None = 0, + + Paid = 1, + + NonPaid = 2, + + Maternity = 3 +} diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/ServiceContract.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/ServiceContract.cs index f20b687..c95b004 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/ServiceContract.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/ServiceContract.cs @@ -1,4 +1,4 @@ -namespace OISEbd_22_Vasin_E.D._It_CompanyTP.Entities; +namespace ISEbd_22_Vasin_E.D._It_Company.Entities; public class ServiceContract { @@ -6,15 +6,12 @@ public class ServiceContract public int ServiceId { get; private set; } - public int ContractId { get; private set; } - - public static ServiceContract CreateElement(int id, int serviceId, int contractId) + public static ServiceContract CreateElement(int id, int serviceId) { return new ServiceContract { Id = id, - ServiceId = serviceId, - ContractId = contractId + ServiceId = serviceId }; } } diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Vacation.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Vacation.cs index 91d297d..07946ae 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Vacation.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Entities/Vacation.cs @@ -1,4 +1,6 @@ -namespace ISEbd_22_Vasin_E.D._It_Company.Entities; +using ISEbd_22_Vasin_E.D._It_Company.Entities.Enums; + +namespace ISEbd_22_Vasin_E.D._It_Company.Entities; public class Vacation { @@ -8,13 +10,16 @@ public class Vacation public DateTime EndDate { get; private set; } - public static Vacation CreateEntity(int id, DateTime startDate, DateTime endDate) + public VacationType VacationType { get; private set; } + + public static Vacation CreateEntity(int id, DateTime startDate, DateTime endDate, VacationType vacationType) { return new Vacation { Id = id, StartDate = startDate, - EndDate = endDate + EndDate = endDate, + VacationType = vacationType }; } } diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormClient.Designer.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormClient.Designer.cs index 692c8c0..22e7c88 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormClient.Designer.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormClient.Designer.cs @@ -32,6 +32,8 @@ textBoxName = new TextBox(); buttonCancel = new Button(); buttonSave = new Button(); + textBoxLegalForm = new TextBox(); + labelLegalForm = new Label(); SuspendLayout(); // // labelName @@ -45,14 +47,14 @@ // // textBoxName // - textBoxName.Location = new Point(51, 12); + textBoxName.Location = new Point(103, 12); textBoxName.Name = "textBoxName"; - textBoxName.Size = new Size(217, 23); + textBoxName.Size = new Size(187, 23); textBoxName.TabIndex = 1; // // buttonCancel // - buttonCancel.Location = new Point(151, 41); + buttonCancel.Location = new Point(173, 77); buttonCancel.Name = "buttonCancel"; buttonCancel.Size = new Size(117, 23); buttonCancel.TabIndex = 10; @@ -62,7 +64,7 @@ // // buttonSave // - buttonSave.Location = new Point(11, 41); + buttonSave.Location = new Point(12, 77); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(117, 23); buttonSave.TabIndex = 9; @@ -70,11 +72,29 @@ buttonSave.UseVisualStyleBackColor = true; buttonSave.Click += ButtonSave_Click; // + // textBoxLegalForm + // + textBoxLegalForm.Location = new Point(103, 48); + textBoxLegalForm.Name = "textBoxLegalForm"; + textBoxLegalForm.Size = new Size(187, 23); + textBoxLegalForm.TabIndex = 14; + // + // labelLegalForm + // + labelLegalForm.AutoSize = true; + labelLegalForm.Location = new Point(11, 41); + labelLegalForm.Name = "labelLegalForm"; + labelLegalForm.Size = new Size(86, 30); + labelLegalForm.TabIndex = 13; + labelLegalForm.Text = "Юридическая \r\nформа:"; + // // FormClient // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(283, 75); + ClientSize = new Size(300, 113); + Controls.Add(textBoxLegalForm); + Controls.Add(labelLegalForm); Controls.Add(buttonCancel); Controls.Add(buttonSave); Controls.Add(textBoxName); @@ -92,5 +112,7 @@ private TextBox textBoxName; private Button buttonCancel; private Button buttonSave; + private TextBox textBoxLegalForm; + private Label labelLegalForm; } } \ No newline at end of file diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormClient.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormClient.cs index 6b433e8..eb144dc 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormClient.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormClient.cs @@ -22,6 +22,7 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms } textBoxName.Text = client.Name; + textBoxLegalForm.Text = client.LegalForm; _clientId = value; } catch (Exception ex) @@ -42,7 +43,8 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms { try { - if (string.IsNullOrEmpty(textBoxName.Text)) + if (string.IsNullOrEmpty(textBoxName.Text) || + string.IsNullOrEmpty(textBoxLegalForm.Text)) { throw new Exception("Имеются незаполненные поля"); } @@ -50,12 +52,12 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms if (_clientId.HasValue) { _clientRepository.UpdateClient(Client.CreateEntity(_clientId.Value, - textBoxName.Text)); + textBoxName.Text, textBoxLegalForm.Text)); } else { _clientRepository.CreateClient(Client.CreateEntity(0, - textBoxName.Text)); + textBoxName.Text, textBoxLegalForm.Text)); } Close(); diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContract.Designer.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContract.Designer.cs index 824a751..3dd88df 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContract.Designer.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContract.Designer.cs @@ -36,15 +36,13 @@ comboBoxContractor = new ComboBox(); labelDeadline = new Label(); dateTimePickerDeadline = new DateTimePicker(); - labelStatus = new Label(); - comboBoxStatus = new ComboBox(); checkedListBoxContractType = new CheckedListBox(); labelContractType = new Label(); groupBoxServices = new GroupBox(); dataGridViewServices = new DataGridView(); + ColumnServiceName = new DataGridViewComboBoxColumn(); buttonCancel = new Button(); buttonSave = new Button(); - ColumnServiceName = new DataGridViewComboBoxColumn(); ((System.ComponentModel.ISupportInitialize)numericUpDownAmount).BeginInit(); groupBoxServices.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridViewServices).BeginInit(); @@ -70,7 +68,9 @@ // // numericUpDownAmount // + numericUpDownAmount.Increment = new decimal(new int[] { 10000, 0, 0, 0 }); numericUpDownAmount.Location = new Point(117, 70); + numericUpDownAmount.Maximum = new decimal(new int[] { 1000000000, 0, 0, 0 }); numericUpDownAmount.Name = "numericUpDownAmount"; numericUpDownAmount.Size = new Size(199, 23); numericUpDownAmount.TabIndex = 2; @@ -116,27 +116,10 @@ dateTimePickerDeadline.Size = new Size(200, 23); dateTimePickerDeadline.TabIndex = 7; // - // labelStatus - // - labelStatus.AutoSize = true; - labelStatus.Location = new Point(12, 131); - labelStatus.Name = "labelStatus"; - labelStatus.Size = new Size(46, 15); - labelStatus.TabIndex = 8; - labelStatus.Text = "Статус:"; - // - // comboBoxStatus - // - comboBoxStatus.FormattingEnabled = true; - comboBoxStatus.Location = new Point(117, 128); - comboBoxStatus.Name = "comboBoxStatus"; - comboBoxStatus.Size = new Size(200, 23); - comboBoxStatus.TabIndex = 9; - // // checkedListBoxContractType // checkedListBoxContractType.FormattingEnabled = true; - checkedListBoxContractType.Location = new Point(117, 157); + checkedListBoxContractType.Location = new Point(117, 128); checkedListBoxContractType.Name = "checkedListBoxContractType"; checkedListBoxContractType.Size = new Size(199, 58); checkedListBoxContractType.TabIndex = 10; @@ -144,7 +127,7 @@ // labelContractType // labelContractType.AutoSize = true; - labelContractType.Location = new Point(12, 166); + labelContractType.Location = new Point(12, 137); labelContractType.Name = "labelContractType"; labelContractType.Size = new Size(89, 15); labelContractType.TabIndex = 11; @@ -153,7 +136,7 @@ // groupBoxServices // groupBoxServices.Controls.Add(dataGridViewServices); - groupBoxServices.Location = new Point(12, 221); + groupBoxServices.Location = new Point(12, 192); groupBoxServices.Name = "groupBoxServices"; groupBoxServices.Size = new Size(305, 246); groupBoxServices.TabIndex = 12; @@ -174,9 +157,17 @@ dataGridViewServices.Size = new Size(299, 224); dataGridViewServices.TabIndex = 0; // + // ColumnServiceName + // + ColumnServiceName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + ColumnServiceName.HeaderText = "Название услуги"; + ColumnServiceName.Name = "ColumnServiceName"; + ColumnServiceName.Resizable = DataGridViewTriState.True; + ColumnServiceName.SortMode = DataGridViewColumnSortMode.Automatic; + // // buttonCancel // - buttonCancel.Location = new Point(200, 470); + buttonCancel.Location = new Point(200, 441); buttonCancel.Name = "buttonCancel"; buttonCancel.Size = new Size(117, 23); buttonCancel.TabIndex = 14; @@ -186,7 +177,7 @@ // // buttonSave // - buttonSave.Location = new Point(12, 470); + buttonSave.Location = new Point(12, 441); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(117, 23); buttonSave.TabIndex = 13; @@ -194,26 +185,16 @@ buttonSave.UseVisualStyleBackColor = true; buttonSave.Click += ButtonSave_Click; // - // ColumnServiceName - // - ColumnServiceName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - ColumnServiceName.HeaderText = "Название услуги"; - ColumnServiceName.Name = "ColumnServiceName"; - ColumnServiceName.Resizable = DataGridViewTriState.True; - ColumnServiceName.SortMode = DataGridViewColumnSortMode.Automatic; - // // FormContract // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(332, 504); + ClientSize = new Size(332, 474); Controls.Add(buttonCancel); Controls.Add(buttonSave); Controls.Add(groupBoxServices); Controls.Add(labelContractType); Controls.Add(checkedListBoxContractType); - Controls.Add(comboBoxStatus); - Controls.Add(labelStatus); Controls.Add(dateTimePickerDeadline); Controls.Add(labelDeadline); Controls.Add(comboBoxContractor); @@ -242,8 +223,6 @@ private ComboBox comboBoxContractor; private Label labelDeadline; private DateTimePicker dateTimePickerDeadline; - private Label labelStatus; - private ComboBox comboBoxStatus; private CheckedListBox checkedListBoxContractType; private Label labelContractType; private GroupBox groupBoxServices; diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContract.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContract.cs index d75e6b3..5dd0bab 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContract.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContract.cs @@ -8,40 +8,6 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms { private readonly IContractRepository _contractRepository; - private int? _contractId; - - public int Id - { - set - { - try - { - var contract = _contractRepository.ReadContractById(value); - if (contract == null) - { - throw new InvalidDataException(nameof(contract)); - } - - comboBoxClient.SelectedItem = contract.ClientId; - comboBoxContractor.SelectedItem = contract.ContractorId; - numericUpDownAmount.Value = contract.Amount; - dateTimePickerDeadline.Value = contract.Deadline; - comboBoxStatus.SelectedItem = contract.Status; - checkedListBoxContractType.Items.Clear(); - foreach (ContractType type in Enum.GetValues(typeof(ContractType))) - { - checkedListBoxContractType.Items.Add(type, contract.ContractType.HasFlag(type)); - } - _contractId = value; - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - } - } - public FormContract(IContractRepository contractRepository, IClientRepository clientRepository, IContractorRepository contractorRepository, IServiceRepository serviceRepository) { @@ -64,8 +30,6 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms { checkedListBoxContractType.Items.Add(elem); } - - comboBoxStatus.DataSource = Enum.GetValues(typeof(Status)); } private void ButtonSave_Click(object sender, EventArgs e) @@ -75,19 +39,13 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms if (checkedListBoxContractType.CheckedItems.Count == 0 || comboBoxContractor.SelectedIndex < 0 || comboBoxClient.SelectedIndex < 0 || - comboBoxStatus.SelectedIndex < 0) + dataGridViewServices.Rows.Count == 1) { throw new Exception("Имеются незаполненные поля"); } - if (_contractId.HasValue) - { - _contractRepository.UpdateContract(CreateContract(_contractId.Value)); - } - else - { - _contractRepository.CreateContract(CreateContract(0)); - } + _contractRepository.CreateContract(CreateContract(0)); + Close(); } catch (Exception ex) @@ -108,20 +66,20 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms return Contract.CreateEntity(id, (int)comboBoxClient.SelectedValue!, (int)comboBoxContractor.SelectedValue!, Convert.ToInt32(numericUpDownAmount.Value), - dateTimePickerDeadline.Value, (Status)comboBoxStatus.SelectedItem!, contractType, - CreateListServicesFromDataGrid()); + dateTimePickerDeadline.Value, contractType, + CreateListServiceContractsFromDataGrid()); } - private List CreateListServicesFromDataGrid() + private List CreateListServiceContractsFromDataGrid() { - var list = new List(); + var list = new List(); foreach (DataGridViewRow row in dataGridViewServices.Rows) - if (row.Cells["ColumnServiceName"].Value != null && - row.Cells["ColumnServiceDescription"].Value != null) + if (row.Cells["ColumnServiceName"].Value != null) { - list.Add(Service.CreateEntity(0, Convert.ToString(row.Cells["ColumnServiceName"].Value)!)); + list.Add(ServiceContract.CreateElement(0, Convert.ToInt32(row.Cells["ColumnServiceName"].Value))); } + return list; } } diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractor.Designer.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractor.Designer.cs index 6e4c9c5..838c0a3 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractor.Designer.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractor.Designer.cs @@ -32,11 +32,13 @@ buttonSave = new Button(); textBoxName = new TextBox(); labelName = new Label(); + textBoxSurname = new TextBox(); + labelSurname = new Label(); SuspendLayout(); // // buttonCancel // - buttonCancel.Location = new Point(150, 41); + buttonCancel.Location = new Point(150, 70); buttonCancel.Name = "buttonCancel"; buttonCancel.Size = new Size(117, 23); buttonCancel.TabIndex = 14; @@ -46,7 +48,7 @@ // // buttonSave // - buttonSave.Location = new Point(10, 41); + buttonSave.Location = new Point(10, 70); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(117, 23); buttonSave.TabIndex = 13; @@ -56,9 +58,9 @@ // // textBoxName // - textBoxName.Location = new Point(50, 12); + textBoxName.Location = new Point(77, 12); textBoxName.Name = "textBoxName"; - textBoxName.Size = new Size(217, 23); + textBoxName.Size = new Size(190, 23); textBoxName.TabIndex = 12; // // labelName @@ -70,11 +72,29 @@ labelName.TabIndex = 11; labelName.Text = "Имя:"; // + // textBoxSurname + // + textBoxSurname.Location = new Point(77, 41); + textBoxSurname.Name = "textBoxSurname"; + textBoxSurname.Size = new Size(190, 23); + textBoxSurname.TabIndex = 16; + // + // labelSurname + // + labelSurname.AutoSize = true; + labelSurname.Location = new Point(10, 44); + labelSurname.Name = "labelSurname"; + labelSurname.Size = new Size(61, 15); + labelSurname.TabIndex = 15; + labelSurname.Text = "Фамилия:"; + // // FormContractor // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(286, 79); + ClientSize = new Size(281, 104); + Controls.Add(textBoxSurname); + Controls.Add(labelSurname); Controls.Add(buttonCancel); Controls.Add(buttonSave); Controls.Add(textBoxName); @@ -92,5 +112,7 @@ private Button buttonSave; private TextBox textBoxName; private Label labelName; + private TextBox textBoxSurname; + private Label labelSurname; } } \ No newline at end of file diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractor.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractor.cs index 7e97819..a278c7a 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractor.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractor.cs @@ -19,6 +19,7 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms if (contractor == null) throw new InvalidDataException(nameof(contractor)); textBoxName.Text = contractor.Name; + textBoxSurname.Text = contractor.Surname; _contractorId = value; } catch (Exception ex) @@ -39,18 +40,21 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms { try { - if (string.IsNullOrEmpty(textBoxName.Text)) + if (string.IsNullOrEmpty(textBoxName.Text) || + string.IsNullOrEmpty(textBoxSurname.Text)) { throw new Exception("Имеются незаполненные поля"); } if (_contractorId.HasValue) { - _contractorRepository.UpdateContractor(Contractor.CreateEntity(_contractorId.Value, textBoxName.Text)); + _contractorRepository.UpdateContractor(Contractor.CreateEntity(_contractorId.Value, + textBoxName.Text, textBoxSurname.Text)); } else { - _contractorRepository.CreateContractor(Contractor.CreateEntity(0, textBoxName.Text)); + _contractorRepository.CreateContractor(Contractor.CreateEntity(0, + textBoxName.Text, textBoxSurname.Text)); } Close(); diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractorVacations.Designer.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractorVacations.Designer.cs index 4b4f6b8..e6808c3 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractorVacations.Designer.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractorVacations.Designer.cs @@ -31,6 +31,7 @@ dataGridViewData = new DataGridView(); panel = new Panel(); buttonAdd = new Button(); + buttonDel = new Button(); ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit(); panel.SuspendLayout(); SuspendLayout(); @@ -55,6 +56,7 @@ // // panel // + panel.Controls.Add(buttonDel); panel.Controls.Add(buttonAdd); panel.Dock = DockStyle.Right; panel.Location = new Point(861, 0); @@ -73,6 +75,17 @@ buttonAdd.UseVisualStyleBackColor = true; buttonAdd.Click += ButtonAdd_Click; // + // buttonDel + // + buttonDel.BackgroundImage = Properties.Resources.icon_remove; + buttonDel.BackgroundImageLayout = ImageLayout.Stretch; + buttonDel.Location = new Point(16, 108); + buttonDel.Name = "buttonDel"; + buttonDel.Size = new Size(90, 90); + buttonDel.TabIndex = 3; + buttonDel.UseVisualStyleBackColor = true; + buttonDel.Click += ButtonDel_Click; + // // FormContractorVacations // AutoScaleDimensions = new SizeF(7F, 15F); @@ -94,5 +107,6 @@ private DataGridView dataGridViewData; private Panel panel; private Button buttonAdd; + private Button buttonDel; } } \ No newline at end of file diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractorVacations.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractorVacations.cs index 121df2b..a68c1f2 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractorVacations.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContractorVacations.cs @@ -13,7 +13,7 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms { InitializeComponent(); _container = container ?? throw new ArgumentException(nameof(container)); - _contractorVacationRepository = contractorVacationRepository ?? + _contractorVacationRepository = contractorVacationRepository ?? throw new ArgumentException(nameof(contractorVacationRepository)); } @@ -42,6 +42,25 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms } } + private void ButtonDel_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + return; + + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + return; + + try + { + _contractorVacationRepository.DeleteContractorVacation(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void LoadList() => dataGridViewData.DataSource = _contractorVacationRepository.ReadContractorVacations(); private bool TryGetIdentifierFromSelectedRow(out int id) diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContracts.Designer.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContracts.Designer.cs index 1d3a67b..4d0f311 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContracts.Designer.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContracts.Designer.cs @@ -30,7 +30,6 @@ { dataGridViewData = new DataGridView(); panel = new Panel(); - buttonUpd = new Button(); buttonAdd = new Button(); ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit(); panel.SuspendLayout(); @@ -56,7 +55,6 @@ // // panel // - panel.Controls.Add(buttonUpd); panel.Controls.Add(buttonAdd); panel.Dock = DockStyle.Right; panel.Location = new Point(861, 0); @@ -64,17 +62,6 @@ panel.Size = new Size(123, 461); panel.TabIndex = 6; // - // buttonUpd - // - buttonUpd.BackgroundImage = Properties.Resources.icon_edit; - 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; @@ -106,7 +93,6 @@ private DataGridView dataGridViewData; private Panel panel; - private Button buttonUpd; private Button buttonAdd; } } \ No newline at end of file diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContracts.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContracts.cs index 569a236..7fa9efe 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContracts.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormContracts.cs @@ -41,37 +41,6 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms } } - private void ButtonUpd_Click(object sender, EventArgs e) - { - if (!TryGetIdentifierFromSelectedRow(out var findId)) - return; - - try - { - var form = _container.Resolve(); - form.Id = findId; - form.ShowDialog(); - LoadList(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - private void LoadList() => dataGridViewData.DataSource = _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/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormVacation.Designer.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormVacation.Designer.cs index 288a2d1..b10b84f 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormVacation.Designer.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormVacation.Designer.cs @@ -34,6 +34,8 @@ labelEndDate = new Label(); buttonCancel = new Button(); buttonSave = new Button(); + comboBoxVacationType = new ComboBox(); + labelVacationType = new Label(); SuspendLayout(); // // labelStartDate @@ -70,7 +72,7 @@ // // buttonCancel // - buttonCancel.Location = new Point(178, 70); + buttonCancel.Location = new Point(178, 99); buttonCancel.Name = "buttonCancel"; buttonCancel.Size = new Size(117, 23); buttonCancel.TabIndex = 12; @@ -80,7 +82,7 @@ // // buttonSave // - buttonSave.Location = new Point(12, 70); + buttonSave.Location = new Point(15, 99); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(117, 23); buttonSave.TabIndex = 11; @@ -88,11 +90,30 @@ buttonSave.UseVisualStyleBackColor = true; buttonSave.Click += ButtonSave_Click; // + // comboBoxVacationType + // + comboBoxVacationType.FormattingEnabled = true; + comboBoxVacationType.Location = new Point(95, 70); + comboBoxVacationType.Name = "comboBoxVacationType"; + comboBoxVacationType.Size = new Size(200, 23); + comboBoxVacationType.TabIndex = 13; + // + // labelVacationType + // + labelVacationType.AutoSize = true; + labelVacationType.Location = new Point(12, 73); + labelVacationType.Name = "labelVacationType"; + labelVacationType.Size = new Size(77, 15); + labelVacationType.TabIndex = 14; + labelVacationType.Text = "Тип отпуска:"; + // // FormVacation // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(310, 102); + ClientSize = new Size(310, 136); + Controls.Add(labelVacationType); + Controls.Add(comboBoxVacationType); Controls.Add(buttonCancel); Controls.Add(buttonSave); Controls.Add(dateTimePickerEndDate); @@ -114,5 +135,7 @@ private Label labelEndDate; private Button buttonCancel; private Button buttonSave; + private ComboBox comboBoxVacationType; + private Label labelVacationType; } } \ No newline at end of file diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormVacation.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormVacation.cs index 8ad1155..688ba24 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormVacation.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Forms/FormVacation.cs @@ -1,4 +1,5 @@ using ISEbd_22_Vasin_E.D._It_Company.Entities; +using ISEbd_22_Vasin_E.D._It_Company.Entities.Enums; using ISEbd_22_Vasin_E.D._It_Company.Repositories; namespace ISEbd_22_Vasin_E.D._It_Company.Forms @@ -23,6 +24,7 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms dateTimePickerStartDate.Value = vacation.StartDate; dateTimePickerEndDate.Value = vacation.EndDate; + comboBoxVacationType.SelectedItem = vacation.VacationType; _vacationId = value; } catch (Exception ex) @@ -37,21 +39,28 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Forms { InitializeComponent(); _vacationRepository = vacationRepository ?? throw new ArgumentNullException(nameof(vacationRepository)); + + comboBoxVacationType.DataSource = Enum.GetValues(typeof(VacationType)); } private void ButtonSave_Click(object sender, EventArgs e) { try { + if (comboBoxVacationType.SelectedIndex < 1) + { + throw new Exception("Имеются незаполненные поля"); + } + if (_vacationId.HasValue) { - _vacationRepository.UpdateVacation(Vacation.CreateEntity(_vacationId.Value, - dateTimePickerStartDate.Value, dateTimePickerEndDate.Value)); + _vacationRepository.UpdateVacation(Vacation.CreateEntity(_vacationId.Value, + dateTimePickerStartDate.Value, dateTimePickerEndDate.Value, (VacationType)comboBoxVacationType.SelectedValue!)); } else { _vacationRepository.CreateVacation(Vacation.CreateEntity(0, dateTimePickerStartDate.Value, - dateTimePickerEndDate.Value)); + dateTimePickerEndDate.Value, (VacationType)comboBoxVacationType.SelectedValue!)); } Close(); diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Program.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Program.cs index 1e10bfb..e4dfb74 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Program.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Program.cs @@ -1,5 +1,6 @@ using ISEbd_22_Vasin_E.D._It_Company; using ISEbd_22_Vasin_E.D._It_Company.Repositories; +using ISEbd_22_Vasin_E.D._It_Company.Repositories.Implementations; using Unity; namespace ISEbd_22_Vasin_E.D._It_Company diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/IContractRepository.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/IContractRepository.cs index 8c72d6e..260c9de 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/IContractRepository.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/IContractRepository.cs @@ -6,12 +6,8 @@ namespace ISEbd_22_Vasin_E.D._It_Company.Repositories; public interface IContractRepository { IEnumerable ReadContracts(int? clientId = null, int? contractorId = null, int? amountFrom = null, - int? amountTo = null, DateTime? deadlineFrom = null, DateTime? deadlineTo = null, - Status? status = null, ContractType? contractType = null); - - Contract ReadContractById(int id); + int? amountTo = null, DateTime? startDateFrom = null, DateTime? startDateTo = null, + DateTime? deadlineFrom = null, DateTime? deadlineTo = null, ContractType? contractType = null); void CreateContract(Contract contract); - - void UpdateContract(Contract contract); } diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/IContractorVacationRepository.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/IContractorVacationRepository.cs index e10edb3..17fbf81 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/IContractorVacationRepository.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/IContractorVacationRepository.cs @@ -8,4 +8,6 @@ public interface IContractorVacationRepository int? vacationId = null); void CreateContractorVacation(ContractorVacation contractorVacation); + + void DeleteContractorVacation(int id); } diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ClientRepository.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ClientRepository.cs index e0c69ea..c2297f6 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ClientRepository.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ClientRepository.cs @@ -1,6 +1,6 @@ using ISEbd_22_Vasin_E.D._It_Company.Entities; -namespace ISEbd_22_Vasin_E.D._It_Company.Repositories; +namespace ISEbd_22_Vasin_E.D._It_Company.Repositories.Implementations; public class ClientRepository : IClientRepository { @@ -14,7 +14,7 @@ public class ClientRepository : IClientRepository public Client ReadClientById(int id) { - return Client.CreateEntity(0, string.Empty); + return Client.CreateEntity(0, string.Empty, string.Empty); } public IEnumerable ReadClients() diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractRepository.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractRepository.cs index 6aa9649..92d46ed 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractRepository.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractRepository.cs @@ -1,7 +1,7 @@ using ISEbd_22_Vasin_E.D._It_Company.Entities; using ISEbd_22_Vasin_E.D._It_Company.Entities.Enums; -namespace ISEbd_22_Vasin_E.D._It_Company.Repositories; +namespace ISEbd_22_Vasin_E.D._It_Company.Repositories.Implementations; public class ContractRepository : IContractRepository { @@ -9,19 +9,10 @@ public class ContractRepository : IContractRepository { } - public Contract ReadContractById(int id) - { - return Contract.CreateEntity(0, 0, 0, 0, DateTime.Now, Entities.Enums.Status.None, Entities.Enums.ContractType.None, []); - } - public IEnumerable ReadContracts(int? clientId = null, int? contractorId = null, int? amountFrom = null, - int? amountTo = null, DateTime? deadlineFrom = null, DateTime? deadlineTo = null, - Status? status = null, ContractType? contractType = null) + int? amountTo = null, DateTime? startDateFrom = null, DateTime? startDateTo = null, + DateTime? deadlineFrom = null, DateTime? deadlineTo = null, ContractType? contractType = null) { return []; } - - public void UpdateContract(Contract contract) - { - } } diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractorRepository.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractorRepository.cs index 44c70c6..5afaa75 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractorRepository.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractorRepository.cs @@ -1,6 +1,6 @@ using ISEbd_22_Vasin_E.D._It_Company.Entities; -namespace ISEbd_22_Vasin_E.D._It_Company.Repositories; +namespace ISEbd_22_Vasin_E.D._It_Company.Repositories.Implementations; public class ContractorRepository : IContractorRepository { @@ -14,7 +14,7 @@ public class ContractorRepository : IContractorRepository public Contractor ReadContractorById(int id) { - return Contractor.CreateEntity(0, string.Empty); + return Contractor.CreateEntity(0, string.Empty, string.Empty); } public IEnumerable ReadContractors() diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractorVacationRepository.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractorVacationRepository.cs index 8572649..87bfeda 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractorVacationRepository.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ContractorVacationRepository.cs @@ -1,6 +1,6 @@ using ISEbd_22_Vasin_E.D._It_Company.Entities; -namespace ISEbd_22_Vasin_E.D._It_Company.Repositories; +namespace ISEbd_22_Vasin_E.D._It_Company.Repositories.Implementations; public class ContractorVacationRepository : IContractorVacationRepository { @@ -13,4 +13,8 @@ public class ContractorVacationRepository : IContractorVacationRepository { return []; } + + public void DeleteContractorVacation(int id) + { + } } diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ServiceRepository.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ServiceRepository.cs index dbd68de..d9da758 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ServiceRepository.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/ServiceRepository.cs @@ -1,6 +1,6 @@ using ISEbd_22_Vasin_E.D._It_Company.Entities; -namespace ISEbd_22_Vasin_E.D._It_Company.Repositories; +namespace ISEbd_22_Vasin_E.D._It_Company.Repositories.Implementations; public class ServiceRepository : IServiceRepository { diff --git a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/VacationRepository.cs b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/VacationRepository.cs index b6270d2..9cbfbba 100644 --- a/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/VacationRepository.cs +++ b/ISEbd-22_Vasin_E.D._It_Company/ISEbd-22_Vasin_E.D._It_Company/Repositories/Implementations/VacationRepository.cs @@ -1,6 +1,7 @@ using ISEbd_22_Vasin_E.D._It_Company.Entities; +using ISEbd_22_Vasin_E.D._It_Company.Entities.Enums; -namespace ISEbd_22_Vasin_E.D._It_Company.Repositories; +namespace ISEbd_22_Vasin_E.D._It_Company.Repositories.Implementations; public class VacationRepository : IVacationRepository { @@ -14,7 +15,7 @@ public class VacationRepository : IVacationRepository public Vacation ReadVacationById(int id) { - return Vacation.CreateEntity(0, DateTime.Now, DateTime.Now); + return Vacation.CreateEntity(0, DateTime.Now, DateTime.Now, VacationType.None); } public IEnumerable ReadVacations()