From d5a10abe5733ec5cffe58bb06abe0f5c7ca651cb Mon Sep 17 00:00:00 2001 From: Pipiaka Date: Wed, 13 Nov 2024 10:49:04 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BE=D0=BF=201=20=D0=BB=D0=B0=D0=B1=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Employee.cs | 2 +- .../Entities/Enums/TypePost.cs | 1 + .../Entities/Enums/TypeProduct.cs | 19 ++ .../Entities/Product.cs | 10 +- .../Entities/TypeJob.cs | 15 +- .../Entities/WorkTime.cs | 9 +- .../FormCompany.Designer.cs | 11 +- .../Accounting-Time-It-Company/FormCompany.cs | 13 -- .../Forms/FormProduct.Designer.cs | 37 +++- .../Forms/FormProduct.cs | 27 ++- .../Forms/FormTypeJob.Designer.cs | 182 +++++++++++++----- .../Forms/FormTypeJob.cs | 34 ++-- .../Forms/FormTypeJob.resx | 12 ++ .../Forms/FormWorkTime.Designer.cs | 170 ---------------- .../Forms/FormWorkTime.cs | 56 ------ .../Forms/FormWorkTime.resx | 120 ------------ .../Forms/FormWorkTimes.Designer.cs | 112 ----------- .../Forms/FormWorkTimes.cs | 88 --------- .../Forms/FormWorkTimes.resx | 120 ------------ .../Accounting-Time-It-Company/Program.cs | 1 - .../Repositories/IWorkTimeRepositories.cs | 17 -- .../Implementations/ProductRepositories.cs | 2 +- .../Implementations/WorkTimeRepositories.cs | 24 --- 23 files changed, 263 insertions(+), 819 deletions(-) create mode 100644 Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Enums/TypeProduct.cs delete mode 100644 Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.Designer.cs delete mode 100644 Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.cs delete mode 100644 Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.resx delete mode 100644 Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.Designer.cs delete mode 100644 Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.cs delete mode 100644 Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.resx delete mode 100644 Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/IWorkTimeRepositories.cs delete mode 100644 Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/Implementations/WorkTimeRepositories.cs diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Employee.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Employee.cs index c7600be..781b35c 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Employee.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Employee.cs @@ -26,7 +26,7 @@ public class Employee PostId = postId, Name = name, Phone = phone, - Allowance = allowance + Allowance = allowance, }; } } diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Enums/TypePost.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Enums/TypePost.cs index d6647d6..24ea43c 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Enums/TypePost.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Enums/TypePost.cs @@ -1,5 +1,6 @@ namespace Accounting_Time_It_Company.Entities.Enums; +[Flags] public enum TypePost { None = 0, diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Enums/TypeProduct.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Enums/TypeProduct.cs new file mode 100644 index 0000000..a366dd0 --- /dev/null +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Enums/TypeProduct.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Accounting_Time_It_Company.Entities.Enums; + +[Flags] +public enum TypeProduct +{ + None = 0, + + Development = 1, + + Suppurt = 2, + + Supervision = 3 +} diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Product.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Product.cs index f491128..c32a042 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Product.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/Product.cs @@ -1,4 +1,5 @@ -using System; +using Accounting_Time_It_Company.Entities.Enums; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -14,13 +15,16 @@ public class Product public string Name { get; private set; } = string.Empty; - public static Product CreateEntity(int id, int clientId, string name) + public TypeProduct Type { get; private set; } + + public static Product CreateEntity(int id, int clientId, string name, TypeProduct type) { return new Product { Id = id, ClientId = clientId, - Name = name + Name = name, + Type = type }; } } diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/TypeJob.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/TypeJob.cs index 9d8878a..129a448 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/TypeJob.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/TypeJob.cs @@ -14,13 +14,15 @@ public class TypeJob public string Description { get; private set; } = string.Empty; - public int AllowanceForJob { get; private set; } + public int AllowanceForJob { get; private set; } - public int DevelopId { get; private set; } + public DateTime Date { get; private set; } - public int ManagerId { get; private set; } + public IEnumerable WorkTimesDevelop { get; private set; } = []; - public static TypeJob CreateOperation(int id, int productId, string discription, int allowanceForJob, int developId, int managerId) + public IEnumerable WorkTimesManager { get; private set; } = []; + + public static TypeJob CreateOperation(int id, int productId, string discription, int allowanceForJob, IEnumerable workTimesDevelop, IEnumerable workTimesManager) { return new TypeJob { @@ -28,8 +30,9 @@ public class TypeJob ProductId = productId, Description = discription, AllowanceForJob = allowanceForJob, - DevelopId = developId, - ManagerId = managerId + Date = DateTime.Now, + WorkTimesDevelop = workTimesDevelop, + WorkTimesManager = workTimesManager }; } } diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/WorkTime.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/WorkTime.cs index c983191..36fcef8 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/WorkTime.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Entities/WorkTime.cs @@ -8,21 +8,18 @@ namespace Accounting_Time_It_Company.Entities; public class WorkTime { - public int TypeJobId { get; private set; } + public int Id { get; private set; } public int EmployeeId { get; private set; } - public DateTime Date { get; private set;} - public int Hours { get; private set; } - public static WorkTime CreateOperation(int typeJobId, int employeeId, DateTime date, int hours) + public static WorkTime CreateElement(int id, int employeeId, int hours) { return new WorkTime { - TypeJobId = typeJobId, + Id = id, EmployeeId = employeeId, - Date = date, Hours = hours }; } diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/FormCompany.Designer.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/FormCompany.Designer.cs index 1be544f..24d0be2 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/FormCompany.Designer.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/FormCompany.Designer.cs @@ -37,7 +37,6 @@ operationsToolStripMenuItem = new ToolStripMenuItem(); vacationsToolStripMenuItem = new ToolStripMenuItem(); typeJobsРаботуToolStripMenuItem = new ToolStripMenuItem(); - workTimeToolStripMenuItem = new ToolStripMenuItem(); reportsToolStripMenuItem = new ToolStripMenuItem(); menuStrip1.SuspendLayout(); SuspendLayout(); @@ -89,7 +88,7 @@ // // operationsToolStripMenuItem // - operationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { vacationsToolStripMenuItem, typeJobsРаботуToolStripMenuItem, workTimeToolStripMenuItem }); + operationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { vacationsToolStripMenuItem, typeJobsРаботуToolStripMenuItem }); operationsToolStripMenuItem.Name = "operationsToolStripMenuItem"; operationsToolStripMenuItem.Size = new Size(95, 24); operationsToolStripMenuItem.Text = "Операции"; @@ -108,13 +107,6 @@ typeJobsРаботуToolStripMenuItem.Text = "Добавит работу"; typeJobsРаботуToolStripMenuItem.Click += TypeJobsToolStripMenuItem_Click; // - // workTimeToolStripMenuItem - // - workTimeToolStripMenuItem.Name = "workTimeToolStripMenuItem"; - workTimeToolStripMenuItem.Size = new Size(227, 26); - workTimeToolStripMenuItem.Text = "Учет времени"; - workTimeToolStripMenuItem.Click += WorkTimeToolStripMenuItem_Click; - // // reportsToolStripMenuItem // reportsToolStripMenuItem.Name = "reportsToolStripMenuItem"; @@ -151,6 +143,5 @@ private ToolStripMenuItem typeJobsРаботуToolStripMenuItem; private ToolStripMenuItem reportsToolStripMenuItem; private ToolStripMenuItem EmployeesToolStripMenuItem; - private ToolStripMenuItem workTimeToolStripMenuItem; } } diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/FormCompany.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/FormCompany.cs index 3788eeb..65493b4 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/FormCompany.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/FormCompany.cs @@ -90,18 +90,5 @@ namespace Accounting_Time_It_Company MessageBoxButtons.OK, MessageBoxIcon.Error); } } - - private void WorkTimeToolStripMenuItem_Click(object sender, EventArgs e) - { - try - { - _container.Resolve().ShowDialog(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, " ", - MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } } } diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProduct.Designer.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProduct.Designer.cs index 92ff9e4..c326ff7 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProduct.Designer.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProduct.Designer.cs @@ -34,11 +34,13 @@ comboBoxClientName = new ComboBox(); buttonCansle = new Button(); buttonSave = new Button(); + checkedListBoxTypeProduct = new CheckedListBox(); + labelTypeProduct = new Label(); SuspendLayout(); // // textBoxName // - textBoxName.Location = new Point(100, 29); + textBoxName.Location = new Point(85, 207); textBoxName.Name = "textBoxName"; textBoxName.Size = new Size(205, 27); textBoxName.TabIndex = 20; @@ -46,7 +48,7 @@ // labelName // labelName.AutoSize = true; - labelName.Location = new Point(25, 32); + labelName.Location = new Point(10, 210); labelName.Name = "labelName"; labelName.Size = new Size(42, 20); labelName.TabIndex = 19; @@ -55,7 +57,7 @@ // labelClientName // labelClientName.AutoSize = true; - labelClientName.Location = new Point(25, 74); + labelClientName.Location = new Point(10, 252); labelClientName.Name = "labelClientName"; labelClientName.Size = new Size(74, 20); labelClientName.TabIndex = 21; @@ -65,14 +67,14 @@ // comboBoxClientName.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxClientName.FormattingEnabled = true; - comboBoxClientName.Location = new Point(100, 71); + comboBoxClientName.Location = new Point(85, 249); comboBoxClientName.Name = "comboBoxClientName"; comboBoxClientName.Size = new Size(205, 28); comboBoxClientName.TabIndex = 23; // // buttonCansle // - buttonCansle.Location = new Point(209, 122); + buttonCansle.Location = new Point(196, 290); buttonCansle.Name = "buttonCansle"; buttonCansle.Size = new Size(94, 29); buttonCansle.TabIndex = 25; @@ -82,7 +84,7 @@ // // buttonSave // - buttonSave.Location = new Point(100, 122); + buttonSave.Location = new Point(87, 290); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(94, 29); buttonSave.TabIndex = 24; @@ -90,11 +92,30 @@ buttonSave.UseVisualStyleBackColor = true; buttonSave.Click += ButtonSave_Click; // + // checkedListBoxTypeProduct + // + checkedListBoxTypeProduct.FormattingEnabled = true; + checkedListBoxTypeProduct.Location = new Point(87, 12); + checkedListBoxTypeProduct.Name = "checkedListBoxTypeProduct"; + checkedListBoxTypeProduct.Size = new Size(203, 180); + checkedListBoxTypeProduct.TabIndex = 26; + // + // labelTypeProduct + // + labelTypeProduct.AutoSize = true; + labelTypeProduct.Location = new Point(10, 12); + labelTypeProduct.Name = "labelTypeProduct"; + labelTypeProduct.Size = new Size(38, 20); + labelTypeProduct.TabIndex = 27; + labelTypeProduct.Text = "Тип:"; + // // FormProduct // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(315, 169); + ClientSize = new Size(315, 336); + Controls.Add(labelTypeProduct); + Controls.Add(checkedListBoxTypeProduct); Controls.Add(buttonCansle); Controls.Add(buttonSave); Controls.Add(comboBoxClientName); @@ -115,5 +136,7 @@ private ComboBox comboBoxClientName; private Button buttonCansle; private Button buttonSave; + private CheckedListBox checkedListBoxTypeProduct; + private Label labelTypeProduct; } } \ No newline at end of file diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProduct.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProduct.cs index 6809521..8dc3258 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProduct.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProduct.cs @@ -1,5 +1,7 @@ using Accounting_Time_It_Company.Entities; +using Accounting_Time_It_Company.Entities.Enums; using Accounting_Time_It_Company.Repositories; +using Microsoft.VisualBasic.FileIO; using System; using System.Collections.Generic; using System.ComponentModel; @@ -29,6 +31,13 @@ namespace Accounting_Time_It_Company.Forms { throw new InvalidDataException(nameof(product)); } + foreach (TypeProduct elem in Enum.GetValues(typeof(TypeProduct))) + { + if ((elem & product.Type) != 0) + { + checkedListBoxTypeProduct.SetItemChecked(checkedListBoxTypeProduct.Items.IndexOf(elem), true); + } + } textBoxName.Text = product.Name; comboBoxClientName.SelectedValue = product.ClientId; _productId = value; @@ -49,6 +58,11 @@ namespace Accounting_Time_It_Company.Forms comboBoxClientName.DataSource = clientRepositories.ReadClients(); comboBoxClientName.DisplayMember = "NameClient"; comboBoxClientName.ValueMember = "Id"; + + foreach (TypeProduct elem in Enum.GetValues(typeof(TypeProduct))) + { + checkedListBoxTypeProduct.Items.Add(elem); + } } private void ButtonSave_Click(object sender, EventArgs e) @@ -56,7 +70,8 @@ namespace Accounting_Time_It_Company.Forms try { if (string.IsNullOrWhiteSpace(textBoxName.Text) || - comboBoxClientName.SelectedIndex < 0) + comboBoxClientName.SelectedIndex < 0 || + checkedListBoxTypeProduct.CheckedItems.Count == 0) { throw new Exception("Имеются незаполненные поля"); } @@ -80,6 +95,14 @@ namespace Accounting_Time_It_Company.Forms private void ButtonCansle_Click(object sender, EventArgs e) => Close(); - private Product CreateProduct(int id) => Product.CreateEntity(id, (int)comboBoxClientName.SelectedValue!, textBoxName.Text); + private Product CreateProduct(int id) + { + TypeProduct type = TypeProduct.None; + foreach (var elem in Enum.GetValues( typeof(TypeProduct))) + { + type |= (TypeProduct)elem; + } + return Product.CreateEntity(id, (int)comboBoxClientName.SelectedValue!, textBoxName.Text, type); + } } } diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.Designer.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.Designer.cs index 2f626c9..51c9e05 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.Designer.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.Designer.cs @@ -31,16 +31,26 @@ labelProduct = new Label(); textBoxDescriptoin = new TextBox(); comboBoxProduct = new ComboBox(); - comboBoxManager = new ComboBox(); - comboBoxDevelop = new ComboBox(); numericUpDownAllowanceForJob = new NumericUpDown(); labelDescriptoin = new Label(); labelAllowanceForJob = new Label(); - labelDevelop = new Label(); - labelManager = new Label(); buttonCansle = new Button(); buttonSave = new Button(); + groupBoxDevelops = new GroupBox(); + dataGridViewDevelops = new DataGridView(); + ColumnDevelop = new DataGridViewComboBoxColumn(); + ColumnHoursDev = new DataGridViewTextBoxColumn(); + groupBoxManagers = new GroupBox(); + dataGridViewManagers = new DataGridView(); + ColumnManager = new DataGridViewComboBoxColumn(); + ColumnHoursMan = new DataGridViewTextBoxColumn(); + labelDate = new Label(); + dateTimePickerDate = new DateTimePicker(); ((System.ComponentModel.ISupportInitialize)numericUpDownAllowanceForJob).BeginInit(); + groupBoxDevelops.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewDevelops).BeginInit(); + groupBoxManagers.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewManagers).BeginInit(); SuspendLayout(); // // labelProduct @@ -68,24 +78,6 @@ comboBoxProduct.Size = new Size(203, 28); comboBoxProduct.TabIndex = 2; // - // comboBoxManager - // - comboBoxManager.DropDownStyle = ComboBoxStyle.DropDownList; - comboBoxManager.FormattingEnabled = true; - comboBoxManager.Location = new Point(178, 154); - comboBoxManager.Name = "comboBoxManager"; - comboBoxManager.Size = new Size(203, 28); - comboBoxManager.TabIndex = 3; - // - // comboBoxDevelop - // - comboBoxDevelop.DropDownStyle = ComboBoxStyle.DropDownList; - comboBoxDevelop.FormattingEnabled = true; - comboBoxDevelop.Location = new Point(179, 120); - comboBoxDevelop.Name = "comboBoxDevelop"; - comboBoxDevelop.Size = new Size(203, 28); - comboBoxDevelop.TabIndex = 4; - // // numericUpDownAllowanceForJob // numericUpDownAllowanceForJob.Location = new Point(179, 87); @@ -112,27 +104,9 @@ labelAllowanceForJob.TabIndex = 7; labelAllowanceForJob.Text = "Надбавка за работу:"; // - // labelDevelop - // - labelDevelop.AutoSize = true; - labelDevelop.Location = new Point(22, 125); - labelDevelop.Name = "labelDevelop"; - labelDevelop.Size = new Size(100, 20); - labelDevelop.TabIndex = 8; - labelDevelop.Text = "Разработчик:"; - // - // labelManager - // - labelManager.AutoSize = true; - labelManager.Location = new Point(22, 157); - labelManager.Name = "labelManager"; - labelManager.Size = new Size(86, 20); - labelManager.TabIndex = 9; - labelManager.Text = "Менеджер:"; - // // buttonCansle // - buttonCansle.Location = new Point(288, 197); + buttonCansle.Location = new Point(289, 557); buttonCansle.Name = "buttonCansle"; buttonCansle.Size = new Size(94, 29); buttonCansle.TabIndex = 11; @@ -142,7 +116,7 @@ // // buttonSave // - buttonSave.Location = new Point(178, 197); + buttonSave.Location = new Point(179, 557); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(94, 29); buttonSave.TabIndex = 10; @@ -150,26 +124,126 @@ buttonSave.UseVisualStyleBackColor = true; buttonSave.Click += ButtonSave_Click; // + // groupBoxDevelops + // + groupBoxDevelops.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + groupBoxDevelops.Controls.Add(dataGridViewDevelops); + groupBoxDevelops.Location = new Point(26, 165); + groupBoxDevelops.Name = "groupBoxDevelops"; + groupBoxDevelops.Size = new Size(358, 167); + groupBoxDevelops.TabIndex = 12; + groupBoxDevelops.TabStop = false; + groupBoxDevelops.Text = "Разработчики"; + // + // dataGridViewDevelops + // + dataGridViewDevelops.AllowUserToResizeColumns = false; + dataGridViewDevelops.AllowUserToResizeRows = false; + dataGridViewDevelops.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridViewDevelops.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewDevelops.Columns.AddRange(new DataGridViewColumn[] { ColumnDevelop, ColumnHoursDev }); + dataGridViewDevelops.Location = new Point(3, 23); + dataGridViewDevelops.MultiSelect = false; + dataGridViewDevelops.Name = "dataGridViewDevelops"; + dataGridViewDevelops.RowHeadersVisible = false; + dataGridViewDevelops.RowHeadersWidth = 51; + dataGridViewDevelops.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewDevelops.Size = new Size(352, 141); + dataGridViewDevelops.TabIndex = 8; + // + // ColumnDevelop + // + ColumnDevelop.HeaderText = "Разработчик"; + ColumnDevelop.MinimumWidth = 6; + ColumnDevelop.Name = "ColumnDevelop"; + // + // ColumnHoursDev + // + ColumnHoursDev.HeaderText = "Часы"; + ColumnHoursDev.MinimumWidth = 6; + ColumnHoursDev.Name = "ColumnHoursDev"; + // + // groupBoxManagers + // + groupBoxManagers.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + groupBoxManagers.Controls.Add(dataGridViewManagers); + groupBoxManagers.Location = new Point(26, 352); + groupBoxManagers.Name = "groupBoxManagers"; + groupBoxManagers.Size = new Size(358, 168); + groupBoxManagers.TabIndex = 13; + groupBoxManagers.TabStop = false; + groupBoxManagers.Text = "Менеджеры"; + // + // dataGridViewManagers + // + dataGridViewManagers.AllowUserToResizeColumns = false; + dataGridViewManagers.AllowUserToResizeRows = false; + dataGridViewManagers.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridViewManagers.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewManagers.Columns.AddRange(new DataGridViewColumn[] { ColumnManager, ColumnHoursMan }); + dataGridViewManagers.Dock = DockStyle.Fill; + dataGridViewManagers.Location = new Point(3, 23); + dataGridViewManagers.MultiSelect = false; + dataGridViewManagers.Name = "dataGridViewManagers"; + dataGridViewManagers.RowHeadersVisible = false; + dataGridViewManagers.RowHeadersWidth = 51; + dataGridViewManagers.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewManagers.Size = new Size(352, 142); + dataGridViewManagers.TabIndex = 9; + // + // ColumnManager + // + ColumnManager.HeaderText = "Менеджер"; + ColumnManager.MinimumWidth = 6; + ColumnManager.Name = "ColumnManager"; + // + // ColumnHoursMan + // + ColumnHoursMan.HeaderText = "Часы"; + ColumnHoursMan.MinimumWidth = 6; + ColumnHoursMan.Name = "ColumnHoursMan"; + // + // labelDate + // + labelDate.AutoSize = true; + labelDate.Location = new Point(22, 125); + labelDate.Name = "labelDate"; + labelDate.Size = new Size(44, 20); + labelDate.TabIndex = 14; + labelDate.Text = "Дата:"; + // + // dateTimePickerDate + // + dateTimePickerDate.Enabled = false; + dateTimePickerDate.Location = new Point(178, 120); + dateTimePickerDate.Name = "dateTimePickerDate"; + dateTimePickerDate.Size = new Size(206, 27); + dateTimePickerDate.TabIndex = 15; + // // FormTypeJob // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(391, 240); + ClientSize = new Size(391, 598); + Controls.Add(dateTimePickerDate); + Controls.Add(labelDate); + Controls.Add(groupBoxManagers); + Controls.Add(groupBoxDevelops); Controls.Add(buttonCansle); Controls.Add(buttonSave); - Controls.Add(labelManager); - Controls.Add(labelDevelop); Controls.Add(labelAllowanceForJob); Controls.Add(labelDescriptoin); Controls.Add(numericUpDownAllowanceForJob); - Controls.Add(comboBoxDevelop); - Controls.Add(comboBoxManager); Controls.Add(comboBoxProduct); Controls.Add(textBoxDescriptoin); Controls.Add(labelProduct); Name = "FormTypeJob"; Text = "Тип работы"; ((System.ComponentModel.ISupportInitialize)numericUpDownAllowanceForJob).EndInit(); + groupBoxDevelops.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewDevelops).EndInit(); + groupBoxManagers.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridViewManagers).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -179,14 +253,20 @@ private Label labelProduct; private TextBox textBoxDescriptoin; private ComboBox comboBoxProduct; - private ComboBox comboBoxManager; - private ComboBox comboBoxDevelop; private NumericUpDown numericUpDownAllowanceForJob; private Label labelDescriptoin; private Label labelAllowanceForJob; - private Label labelDevelop; - private Label labelManager; private Button buttonCansle; private Button buttonSave; + private GroupBox groupBoxDevelops; + private GroupBox groupBoxManagers; + private DataGridView dataGridViewDevelops; + private DataGridView dataGridViewManagers; + private Label labelDate; + private DateTimePicker dateTimePickerDate; + private DataGridViewComboBoxColumn ColumnDevelop; + private DataGridViewTextBoxColumn ColumnHoursDev; + private DataGridViewComboBoxColumn ColumnManager; + private DataGridViewTextBoxColumn ColumnHoursMan; } } \ No newline at end of file diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.cs index 679ef96..8f74629 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.cs @@ -26,13 +26,13 @@ namespace Accounting_Time_It_Company.Forms comboBoxProduct.DisplayMember = "Name"; comboBoxProduct.ValueMember = "Id"; - comboBoxDevelop.DataSource = employeeRepositories.ReadEmployees().Where(x => x.PostId == (int)TypePost.Developer).ToList(); - comboBoxDevelop.DisplayMember = "Name"; - comboBoxDevelop.ValueMember = "Id"; + ColumnDevelop.DataSource = employeeRepositories.ReadEmployees().Where(x => x.PostId == (int)TypePost.Developer).ToList(); + ColumnDevelop.DisplayMember = "Name"; + ColumnDevelop.ValueMember = "Id"; - comboBoxManager.DataSource = employeeRepositories.ReadEmployees().Where(x => x.PostId == (int)TypePost.Manager).ToList(); - comboBoxManager.DisplayMember = "Name"; - comboBoxManager.ValueMember = "Id"; + ColumnManager.DataSource = employeeRepositories.ReadEmployees().Where(x => x.PostId == (int)TypePost.Manager).ToList(); + ColumnManager.DisplayMember = "Name"; + ColumnManager.ValueMember = "Id"; } private void ButtonSave_Click(object sender, EventArgs e) @@ -40,16 +40,14 @@ namespace Accounting_Time_It_Company.Forms try { if (string.IsNullOrWhiteSpace(textBoxDescriptoin.Text) || - comboBoxProduct.SelectedIndex < 0 || - comboBoxDevelop.SelectedIndex < 0 || - comboBoxManager.SelectedIndex < 0) + comboBoxProduct.SelectedIndex < 0) { throw new Exception("Имеются незаполненные поля"); } _typeJobRepositories.CreateTypeJob(TypeJob.CreateOperation(0, (int)comboBoxProduct.SelectedIndex!, textBoxDescriptoin.Text, - (int)numericUpDownAllowanceForJob.Value, (int)comboBoxDevelop.SelectedIndex!, - (int)comboBoxManager.SelectedIndex!)); + (int)numericUpDownAllowanceForJob.Value, CreateListWorkTimeFromDataGrid(dataGridViewDevelops), + CreateListWorkTimeFromDataGrid(dataGridViewManagers))); Close(); } @@ -60,5 +58,19 @@ namespace Accounting_Time_It_Company.Forms } private void ButtonCansle_Click(object sender, EventArgs e) => Close(); + + private List CreateListWorkTimeFromDataGrid(DataGridView dataGrid) + { + var list = new List(); + foreach (DataGridViewRow row in dataGrid.Rows) + { + if (row.Cells[0].Value == null || row.Cells[1] == null) + { + continue; + } + list.Add(WorkTime.CreateElement(0, Convert.ToInt32(row.Cells[0].Value), Convert.ToInt32(row.Cells[1].Value))); + } + return list; + } } } diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.resx b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.resx index 8b2ff64..1e111df 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.resx +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.resx @@ -117,4 +117,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + + + True + + + True + + + True + \ No newline at end of file diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.Designer.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.Designer.cs deleted file mode 100644 index 62378fc..0000000 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.Designer.cs +++ /dev/null @@ -1,170 +0,0 @@ -namespace Accounting_Time_It_Company.Forms -{ - partial class FormWorkTime - { - /// - /// 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() - { - comboBoxTypeJob = new ComboBox(); - labelTypeJob = new Label(); - comboBoxEmployee = new ComboBox(); - labelEmployee = new Label(); - labelDate = new Label(); - dateTimePickerDate = new DateTimePicker(); - labelHour = new Label(); - numericUpDownHour = new NumericUpDown(); - buttonCansle = new Button(); - buttonSave = new Button(); - ((System.ComponentModel.ISupportInitialize)numericUpDownHour).BeginInit(); - SuspendLayout(); - // - // comboBoxTypeJob - // - comboBoxTypeJob.DropDownStyle = ComboBoxStyle.DropDownList; - comboBoxTypeJob.FormattingEnabled = true; - comboBoxTypeJob.Location = new Point(139, 6); - comboBoxTypeJob.Name = "comboBoxTypeJob"; - comboBoxTypeJob.Size = new Size(203, 28); - comboBoxTypeJob.TabIndex = 4; - // - // labelTypeJob - // - labelTypeJob.AutoSize = true; - labelTypeJob.Location = new Point(12, 9); - labelTypeJob.Name = "labelTypeJob"; - labelTypeJob.Size = new Size(60, 20); - labelTypeJob.TabIndex = 3; - labelTypeJob.Text = "Задача:"; - // - // comboBoxEmployee - // - comboBoxEmployee.DropDownStyle = ComboBoxStyle.DropDownList; - comboBoxEmployee.FormattingEnabled = true; - comboBoxEmployee.Location = new Point(139, 40); - comboBoxEmployee.Name = "comboBoxEmployee"; - comboBoxEmployee.Size = new Size(203, 28); - comboBoxEmployee.TabIndex = 6; - // - // labelEmployee - // - labelEmployee.AutoSize = true; - labelEmployee.Location = new Point(12, 43); - labelEmployee.Name = "labelEmployee"; - labelEmployee.Size = new Size(77, 20); - labelEmployee.TabIndex = 5; - labelEmployee.Text = "Работник:"; - // - // labelDate - // - labelDate.AutoSize = true; - labelDate.Location = new Point(12, 79); - labelDate.Name = "labelDate"; - labelDate.Size = new Size(64, 20); - labelDate.TabIndex = 8; - labelDate.Text = "Начало:"; - // - // dateTimePickerDate - // - dateTimePickerDate.Location = new Point(139, 74); - dateTimePickerDate.Name = "dateTimePickerDate"; - dateTimePickerDate.Size = new Size(203, 27); - dateTimePickerDate.TabIndex = 7; - // - // labelHour - // - labelHour.AutoSize = true; - labelHour.Location = new Point(12, 111); - labelHour.Name = "labelHour"; - labelHour.Size = new Size(110, 20); - labelHour.TabIndex = 9; - labelHour.Text = "Часов работы:"; - // - // numericUpDownHour - // - numericUpDownHour.Location = new Point(139, 107); - numericUpDownHour.Maximum = new decimal(new int[] { 1000, 0, 0, 0 }); - numericUpDownHour.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); - numericUpDownHour.Name = "numericUpDownHour"; - numericUpDownHour.Size = new Size(203, 27); - numericUpDownHour.TabIndex = 10; - numericUpDownHour.Value = new decimal(new int[] { 1, 0, 0, 0 }); - // - // buttonCansle - // - buttonCansle.Location = new Point(248, 166); - buttonCansle.Name = "buttonCansle"; - buttonCansle.Size = new Size(94, 29); - buttonCansle.TabIndex = 26; - buttonCansle.Text = "Отмена"; - buttonCansle.UseVisualStyleBackColor = true; - buttonCansle.Click += ButtonCansle_Click; - // - // buttonSave - // - buttonSave.Location = new Point(139, 166); - buttonSave.Name = "buttonSave"; - buttonSave.Size = new Size(94, 29); - buttonSave.TabIndex = 25; - buttonSave.Text = "Сохранить"; - buttonSave.UseVisualStyleBackColor = true; - buttonSave.Click += ButtonSave_Click; - // - // FormWorkTime - // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(358, 206); - Controls.Add(buttonCansle); - Controls.Add(buttonSave); - Controls.Add(numericUpDownHour); - Controls.Add(labelHour); - Controls.Add(labelDate); - Controls.Add(dateTimePickerDate); - Controls.Add(comboBoxEmployee); - Controls.Add(labelEmployee); - Controls.Add(comboBoxTypeJob); - Controls.Add(labelTypeJob); - Name = "FormWorkTime"; - Text = "Учет времени"; - ((System.ComponentModel.ISupportInitialize)numericUpDownHour).EndInit(); - ResumeLayout(false); - PerformLayout(); - } - - #endregion - - private ComboBox comboBoxTypeJob; - private Label labelTypeJob; - private ComboBox comboBoxEmployee; - private Label labelEmployee; - private Label labelDate; - private DateTimePicker dateTimePickerDate; - private Label labelHour; - private NumericUpDown numericUpDownHour; - private Button buttonCansle; - private Button buttonSave; - } -} \ No newline at end of file diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.cs deleted file mode 100644 index 8fcc702..0000000 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Accounting_Time_It_Company.Entities.Enums; -using Accounting_Time_It_Company.Entities; -using Accounting_Time_It_Company.Repositories; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Accounting_Time_It_Company.Forms -{ - public partial class FormWorkTime : Form - { - private readonly IWorkTimeRepositories _workTimeRepositories; - - public FormWorkTime(IWorkTimeRepositories workTimeRepositories, ITypeJobRepositories typeJobRepositories, IEmployeeRepositories employeeRepositories) - { - InitializeComponent(); - _workTimeRepositories = workTimeRepositories ?? throw new ArgumentNullException(nameof(workTimeRepositories)); - - comboBoxTypeJob.DataSource = typeJobRepositories.ReadTypeJobs(); - comboBoxTypeJob.DisplayMember = "Description"; - comboBoxTypeJob.ValueMember = "Id"; - - comboBoxEmployee.DataSource = employeeRepositories.ReadEmployees(); - comboBoxEmployee.DisplayMember = "Name"; - comboBoxEmployee.ValueMember = "Id"; - } - - private void ButtonSave_Click(object sender, EventArgs e) - { - try - { - if (comboBoxEmployee.SelectedIndex < 0 || - comboBoxTypeJob.SelectedIndex < 0) - { - throw new Exception("Имеются незаполненные поля"); - } - - _workTimeRepositories.CreateWorkTime(WorkTime.CreateOperation(0, (int)comboBoxEmployee.SelectedValue!, dateTimePickerDate.Value, (int)numericUpDownHour.Value)); - - Close(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void ButtonCansle_Click(object sender, EventArgs e) => Close(); - } -} diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.resx b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.resx deleted file mode 100644 index 8b2ff64..0000000 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTime.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.Designer.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.Designer.cs deleted file mode 100644 index 6b488dd..0000000 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.Designer.cs +++ /dev/null @@ -1,112 +0,0 @@ -namespace Accounting_Time_It_Company.Forms -{ - partial class FormWorkTimes - { - /// - /// 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() - { - buttonDelete = new Button(); - buttonAdd = new Button(); - panel1 = new Panel(); - dataGridViewData = new DataGridView(); - panel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit(); - SuspendLayout(); - // - // buttonDelete - // - buttonDelete.BackgroundImage = Properties.Resources.Delete; - buttonDelete.BackgroundImageLayout = ImageLayout.Stretch; - buttonDelete.Location = new Point(8, 159); - buttonDelete.Name = "buttonDelete"; - buttonDelete.Size = new Size(94, 94); - buttonDelete.TabIndex = 2; - buttonDelete.UseVisualStyleBackColor = true; - buttonDelete.Click += ButtonDelete_Click; - // - // buttonAdd - // - buttonAdd.BackgroundImage = Properties.Resources.Add; - buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; - buttonAdd.Location = new Point(8, 59); - buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(94, 94); - buttonAdd.TabIndex = 0; - buttonAdd.UseVisualStyleBackColor = true; - buttonAdd.Click += ButtonAdd_Click; - // - // panel1 - // - panel1.Controls.Add(buttonDelete); - panel1.Controls.Add(buttonAdd); - panel1.Dock = DockStyle.Right; - panel1.Location = new Point(686, 0); - panel1.Name = "panel1"; - panel1.Size = new Size(114, 450); - panel1.TabIndex = 8; - // - // 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.RowHeadersWidth = 51; - dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridViewData.Size = new Size(800, 450); - dataGridViewData.TabIndex = 9; - // - // FormWorkTimes - // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(panel1); - Controls.Add(dataGridViewData); - Name = "FormWorkTimes"; - Text = "Учеты времени"; - Load += FormWorkTimes_Load; - panel1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit(); - ResumeLayout(false); - } - - #endregion - - private Button buttonDelete; - private Button buttonAdd; - private Panel panel1; - private DataGridView dataGridViewData; - } -} \ No newline at end of file diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.cs deleted file mode 100644 index b3eb105..0000000 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.cs +++ /dev/null @@ -1,88 +0,0 @@ -using Accounting_Time_It_Company.Repositories; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using Unity; - -namespace Accounting_Time_It_Company.Forms -{ - public partial class FormWorkTimes : Form - { - private readonly IUnityContainer _container; - - private readonly IWorkTimeRepositories _workTimeRepositories; - - public FormWorkTimes(IUnityContainer container, IWorkTimeRepositories workTimeRepositories) - { - InitializeComponent(); - _container = container ?? throw new ArgumentNullException(nameof(container)); - _workTimeRepositories = workTimeRepositories ?? throw new ArgumentNullException(nameof(workTimeRepositories)); - } - - private void FormWorkTimes_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 ButtonDelete_Click(object sender, EventArgs e) - { - if (!TryGetIdentifierFromSelectedRow(out var findId)) - { - return; - } - if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) - { - return; - } - try - { - _workTimeRepositories.DeleteWorkTime(findId); - LoadList(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void LoadList() => dataGridViewData.DataSource = _workTimeRepositories.ReadWorkTimes(); - - 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/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.resx b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.resx deleted file mode 100644 index 8b2ff64..0000000 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormWorkTimes.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Program.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Program.cs index 0b7c290..e187315 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Program.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Program.cs @@ -27,7 +27,6 @@ namespace Accounting_Time_It_Company container.RegisterType(); container.RegisterType(); container.RegisterType(); - container.RegisterType(); return container; } } diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/IWorkTimeRepositories.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/IWorkTimeRepositories.cs deleted file mode 100644 index 231de68..0000000 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/IWorkTimeRepositories.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Accounting_Time_It_Company.Entities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Accounting_Time_It_Company.Repositories; - -public interface IWorkTimeRepositories -{ - IEnumerable ReadWorkTimes(DateTime? DateFrom = null, DateTime? DateTo = null, int? typeJobId = null, int? developId = null); - - void CreateWorkTime(WorkTime workTimeReplenishment); - - void DeleteWorkTime(int id); -} diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/Implementations/ProductRepositories.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/Implementations/ProductRepositories.cs index 9c01315..f24c0c9 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/Implementations/ProductRepositories.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/Implementations/ProductRepositories.cs @@ -19,7 +19,7 @@ public class ProductRepositories : IProductRepositories public Product ReadProductById(int id) { - return Product.CreateEntity(0, 0, string.Empty); + return Product.CreateEntity(0, 0, string.Empty, 0); } public IEnumerable ReadProducts() diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/Implementations/WorkTimeRepositories.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/Implementations/WorkTimeRepositories.cs deleted file mode 100644 index 41ee320..0000000 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Repositories/Implementations/WorkTimeRepositories.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Accounting_Time_It_Company.Entities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Accounting_Time_It_Company.Repositories.Implementations; - -internal class WorkTimeRepositories : IWorkTimeRepositories -{ - public void CreateWorkTime(WorkTime workTimeReplenishment) - { - } - - public void DeleteWorkTime(int id) - { - } - - public IEnumerable ReadWorkTimes(DateTime? DateFrom = null, DateTime? DateTo = null, int? typeJobId = null, int? developId = null) - { - return []; - } -}