Доработка оп 1 лабе
This commit is contained in:
parent
8e14ffaef6
commit
d5a10abe57
@ -26,7 +26,7 @@ public class Employee
|
||||
PostId = postId,
|
||||
Name = name,
|
||||
Phone = phone,
|
||||
Allowance = allowance
|
||||
Allowance = allowance,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
namespace Accounting_Time_It_Company.Entities.Enums;
|
||||
|
||||
[Flags]
|
||||
public enum TypePost
|
||||
{
|
||||
None = 0,
|
||||
|
@ -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
|
||||
}
|
@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -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<WorkTime> WorkTimesDevelop { get; private set; } = [];
|
||||
|
||||
public static TypeJob CreateOperation(int id, int productId, string discription, int allowanceForJob, int developId, int managerId)
|
||||
public IEnumerable<WorkTime> WorkTimesManager { get; private set; } = [];
|
||||
|
||||
public static TypeJob CreateOperation(int id, int productId, string discription, int allowanceForJob, IEnumerable<WorkTime> workTimesDevelop, IEnumerable<WorkTime> 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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -90,18 +90,5 @@ namespace Accounting_Time_It_Company
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void WorkTimeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormWorkTimes>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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<WorkTime> CreateListWorkTimeFromDataGrid(DataGridView dataGrid)
|
||||
{
|
||||
var list = new List<WorkTime>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,4 +117,16 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ColumnDevelop.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnHoursDev.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnManager.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnHoursMan.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
@ -1,170 +0,0 @@
|
||||
namespace Accounting_Time_It_Company.Forms
|
||||
{
|
||||
partial class FormWorkTime
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,112 +0,0 @@
|
||||
namespace Accounting_Time_It_Company.Forms
|
||||
{
|
||||
partial class FormWorkTimes
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
@ -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<FormWorkTime>().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;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -27,7 +27,6 @@ namespace Accounting_Time_It_Company
|
||||
container.RegisterType<IProductRepositories, ProductRepositories>();
|
||||
container.RegisterType<ITypeJobRepositories, TypeJobRepositories>();
|
||||
container.RegisterType<IVacationRepositories, VacationRepositories>();
|
||||
container.RegisterType<IWorkTimeRepositories, WorkTimeRepositories>();
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
@ -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<WorkTime> ReadWorkTimes(DateTime? DateFrom = null, DateTime? DateTo = null, int? typeJobId = null, int? developId = null);
|
||||
|
||||
void CreateWorkTime(WorkTime workTimeReplenishment);
|
||||
|
||||
void DeleteWorkTime(int id);
|
||||
}
|
@ -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<Product> ReadProducts()
|
||||
|
@ -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<WorkTime> ReadWorkTimes(DateTime? DateFrom = null, DateTime? DateTo = null, int? typeJobId = null, int? developId = null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user