Lab1
This commit is contained in:
parent
5e47cf258b
commit
f18602b2c8
@ -11,22 +11,21 @@ public class Contract
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public DateTime Date { get; private set; }
|
||||
public decimal CustomerId { get; private set; }
|
||||
public TypeProjects TypeProject { get; private set; }
|
||||
public IEnumerable<ContractOnProject> ContractOnProject
|
||||
public decimal ProjectId { get; private set; }
|
||||
public IEnumerable<CustomerOnProject> CustomerId
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = [];
|
||||
public static Contract CreateOpeartion(int id, DateTime date, decimal customerid, TypeProjects typeProject, IEnumerable<ContractOnProject> contractOnProjects)
|
||||
|
||||
public static Contract CreateOpeartion(int id, DateTime date, decimal projectid, IEnumerable<CustomerOnProject> customerOnContract)
|
||||
{
|
||||
return new Contract
|
||||
{
|
||||
Id = id,
|
||||
Date = date,
|
||||
CustomerId = customerid,
|
||||
TypeProject = typeProject,
|
||||
ContractOnProject = contractOnProjects
|
||||
ProjectId = projectid,
|
||||
CustomerId = customerOnContract
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
using ProjectItCompany.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectItCompany.Entities;
|
||||
|
||||
public class ContractOnProject
|
||||
{
|
||||
public int ProjectId { get; private set; }
|
||||
public int ContractId { get; private set; }
|
||||
public string Description { get; private set; } = string.Empty;
|
||||
public static ContractOnProject CreateElement(int projectId, int contractId, string description)
|
||||
{
|
||||
return new ContractOnProject
|
||||
{
|
||||
ProjectId = projectId,
|
||||
ContractId = contractId,
|
||||
Description = description
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
using ProjectItCompany.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectItCompany.Entities;
|
||||
|
||||
public class CustomerOnProject
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public decimal ContractId { get; private set; }
|
||||
public decimal CustomerId { get; private set; }
|
||||
public string Description { get; private set; } = string.Empty;
|
||||
public static CustomerOnProject CreateElement(int id, decimal contractId, decimal customerid, string description)
|
||||
{
|
||||
return new CustomerOnProject
|
||||
{
|
||||
Id = id,
|
||||
ContractId = contractId,
|
||||
CustomerId = customerid,
|
||||
Description = description
|
||||
};
|
||||
}
|
||||
}
|
23
ProjectItCompany/ProjectItCompany/Entities/Enums/Month.cs
Normal file
23
ProjectItCompany/ProjectItCompany/Entities/Enums/Month.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectItCompany.Entities.Enums;
|
||||
|
||||
public enum Month
|
||||
{
|
||||
January = 0,
|
||||
February = 1,
|
||||
March = 2,
|
||||
April = 3,
|
||||
May = 4,
|
||||
June = 5,
|
||||
July = 6,
|
||||
August = 7,
|
||||
September = 8,
|
||||
October = 9,
|
||||
November = 10,
|
||||
December = 11
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectItCompany.Entities.Enums;
|
||||
|
||||
public enum TypeProjects
|
||||
{
|
||||
None = 0,
|
||||
Creation = 1,
|
||||
Maintenance = 2
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ProjectItCompany.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -12,15 +13,17 @@ public class Executor
|
||||
public string FullName { get; private set; } = string.Empty;
|
||||
public DateTime DateOfBirth { get; private set; }
|
||||
public decimal HourlyRate { get; private set; }
|
||||
public JobTitles JobTitles { get; private set; }
|
||||
|
||||
public static Executor CreateEntity(int id, string fullName, DateTime dateOfBirth, decimal hourlyRate)
|
||||
public static Executor CreateEntity(int id, string fullName, DateTime dateOfBirth, decimal hourlyRate, JobTitles jobTitles)
|
||||
{
|
||||
return new Executor
|
||||
{
|
||||
Id = id,
|
||||
FullName = fullName ?? string.Empty,
|
||||
DateOfBirth = dateOfBirth,
|
||||
HourlyRate = hourlyRate
|
||||
HourlyRate = hourlyRate,
|
||||
JobTitles = jobTitles
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -11,15 +11,16 @@ public class Project
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string NameProject { get; private set; } = string.Empty;
|
||||
public decimal CustomerId { get; private set; }
|
||||
public CompletedStages CompletedStages { get; private set; }
|
||||
|
||||
|
||||
public static Project CreateEntity(int id, string nameProject, CompletedStages completedStages)
|
||||
public static Project CreateEntity(int id, string nameProject, decimal customerid, CompletedStages completedStages)
|
||||
{
|
||||
return new Project
|
||||
{
|
||||
Id = id,
|
||||
NameProject = nameProject ?? string.Empty,
|
||||
CustomerId = customerid,
|
||||
CompletedStages = completedStages
|
||||
};
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ProjectItCompany.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -9,16 +10,16 @@ namespace ProjectItCompany.Entities;
|
||||
public class Wage
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Month { get; private set; } = string.Empty;
|
||||
public Month Month { get; private set; }
|
||||
public int Year { get; private set; }
|
||||
public int NumberOfHours { get; private set; }
|
||||
public int ExecutorID { get; private set; }
|
||||
public static Wage CreateOpeartion(int id, string month, int year, int numberOfHours, int executorId)
|
||||
public static Wage CreateOpeartion(int id, Month month, int year, int numberOfHours, int executorId)
|
||||
{
|
||||
return new Wage
|
||||
{
|
||||
Id = id,
|
||||
Month = month ?? string.Empty,
|
||||
Month = month,
|
||||
Year = year,
|
||||
NumberOfHours = numberOfHours,
|
||||
ExecutorID = executorId
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace ProjectItCompany.Forms
|
||||
{
|
||||
partial class FormContractOnProject
|
||||
partial class FormContract
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -28,30 +28,19 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelCustomer = new Label();
|
||||
ButtonSave = new Button();
|
||||
ButtonCancel = new Button();
|
||||
groupBox1 = new GroupBox();
|
||||
groupBoxContract = new GroupBox();
|
||||
dataGridViewContract = new DataGridView();
|
||||
comboBoxCustomer = new ComboBox();
|
||||
ColumnProject = new DataGridViewComboBoxColumn();
|
||||
ColumnContract = new DataGridViewComboBoxColumn();
|
||||
groupBox1.SuspendLayout();
|
||||
ColumnCustomer = new DataGridViewComboBoxColumn();
|
||||
groupBoxContract.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewContract).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelCustomer
|
||||
//
|
||||
labelCustomer.AutoSize = true;
|
||||
labelCustomer.Location = new Point(15, 16);
|
||||
labelCustomer.Name = "labelCustomer";
|
||||
labelCustomer.Size = new Size(57, 15);
|
||||
labelCustomer.TabIndex = 2;
|
||||
labelCustomer.Text = "Заказчик";
|
||||
//
|
||||
// ButtonSave
|
||||
//
|
||||
ButtonSave.Location = new Point(39, 265);
|
||||
ButtonSave.Location = new Point(68, 254);
|
||||
ButtonSave.Name = "ButtonSave";
|
||||
ButtonSave.Size = new Size(75, 23);
|
||||
ButtonSave.TabIndex = 11;
|
||||
@ -61,7 +50,7 @@
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
ButtonCancel.Location = new Point(161, 265);
|
||||
ButtonCancel.Location = new Point(245, 255);
|
||||
ButtonCancel.Name = "ButtonCancel";
|
||||
ButtonCancel.Size = new Size(75, 23);
|
||||
ButtonCancel.TabIndex = 12;
|
||||
@ -69,16 +58,15 @@
|
||||
ButtonCancel.UseVisualStyleBackColor = true;
|
||||
ButtonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// groupBox1
|
||||
// groupBoxContract
|
||||
//
|
||||
groupBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
groupBox1.Controls.Add(dataGridViewContract);
|
||||
groupBox1.Location = new Point(12, 37);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(267, 222);
|
||||
groupBox1.TabIndex = 13;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Договоры";
|
||||
groupBoxContract.Controls.Add(dataGridViewContract);
|
||||
groupBoxContract.Location = new Point(12, 12);
|
||||
groupBoxContract.Name = "groupBoxContract";
|
||||
groupBoxContract.Size = new Size(375, 237);
|
||||
groupBoxContract.TabIndex = 13;
|
||||
groupBoxContract.TabStop = false;
|
||||
groupBoxContract.Text = "Договоры";
|
||||
//
|
||||
// dataGridViewContract
|
||||
//
|
||||
@ -86,66 +74,53 @@
|
||||
dataGridViewContract.AllowUserToResizeRows = false;
|
||||
dataGridViewContract.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewContract.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewContract.Columns.AddRange(new DataGridViewColumn[] { ColumnProject, ColumnContract });
|
||||
dataGridViewContract.Dock = DockStyle.Fill;
|
||||
dataGridViewContract.Columns.AddRange(new DataGridViewColumn[] { ColumnProject, ColumnCustomer });
|
||||
dataGridViewContract.Dock = DockStyle.Right;
|
||||
dataGridViewContract.Location = new Point(3, 19);
|
||||
dataGridViewContract.MultiSelect = false;
|
||||
dataGridViewContract.Name = "dataGridViewContract";
|
||||
dataGridViewContract.RowHeadersVisible = false;
|
||||
dataGridViewContract.RowTemplate.Height = 25;
|
||||
dataGridViewContract.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewContract.Size = new Size(261, 200);
|
||||
dataGridViewContract.Size = new Size(369, 215);
|
||||
dataGridViewContract.TabIndex = 0;
|
||||
//
|
||||
// comboBoxCustomer
|
||||
//
|
||||
comboBoxCustomer.FormattingEnabled = true;
|
||||
comboBoxCustomer.Location = new Point(78, 8);
|
||||
comboBoxCustomer.Name = "comboBoxCustomer";
|
||||
comboBoxCustomer.Size = new Size(194, 23);
|
||||
comboBoxCustomer.TabIndex = 14;
|
||||
//
|
||||
// ColumnProject
|
||||
//
|
||||
ColumnProject.HeaderText = "Проект";
|
||||
ColumnProject.Name = "ColumnProject";
|
||||
//
|
||||
// ColumnContract
|
||||
// ColumnCustomer
|
||||
//
|
||||
ColumnContract.HeaderText = "Контракт";
|
||||
ColumnContract.Name = "ColumnContract";
|
||||
ColumnCustomer.HeaderText = "Заказчик";
|
||||
ColumnCustomer.Name = "ColumnCustomer";
|
||||
//
|
||||
// FormContractOnProject
|
||||
// FormContract
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(291, 300);
|
||||
Controls.Add(comboBoxCustomer);
|
||||
Controls.Add(groupBox1);
|
||||
ClientSize = new Size(399, 286);
|
||||
Controls.Add(groupBoxContract);
|
||||
Controls.Add(ButtonCancel);
|
||||
Controls.Add(ButtonSave);
|
||||
Controls.Add(labelCustomer);
|
||||
Name = "FormContractOnProject";
|
||||
Name = "FormContract";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Заключение договора";
|
||||
groupBox1.ResumeLayout(false);
|
||||
groupBoxContract.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewContract).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelDate;
|
||||
private Label labelCustomer;
|
||||
private DateTimePicker dateTimePickerDate;
|
||||
private ComboBox comboBoxTypeProject;
|
||||
private Button ButtonSave;
|
||||
private Button ButtonCancel;
|
||||
private GroupBox groupBox1;
|
||||
private GroupBox groupBoxContract;
|
||||
private DataGridView dataGridViewContract;
|
||||
private ComboBox comboBoxCustomer;
|
||||
private DataGridViewComboBoxColumn ColumnProject;
|
||||
private DataGridViewComboBoxColumn ColumnContract;
|
||||
private DataGridViewComboBoxColumn ColumnCustomer;
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using ProjectItCompany.Entities;
|
||||
using ProjectItCompany.Entities.Enums;
|
||||
using ProjectItCompany.Repositories;
|
||||
using ProjectItCompany.Repositories.Implementations;
|
||||
using System;
|
||||
@ -13,35 +14,34 @@ using System.Windows.Forms;
|
||||
|
||||
namespace ProjectItCompany.Forms
|
||||
{
|
||||
public partial class FormContractOnProject : Form
|
||||
public partial class FormContract : Form
|
||||
{
|
||||
private readonly IContractRepository _contractRepository;
|
||||
|
||||
public FormContractOnProject(IContractRepository contractRepository,
|
||||
public FormContract(IContractRepository contractRepository,
|
||||
IProjectRepository projectRepository, ICustomerRepository customerRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_contractRepository = contractRepository ?? throw new ArgumentNullException(nameof(contractRepository));
|
||||
|
||||
comboBoxCustomer.DataSource = customerRepository.ReadCustomers();
|
||||
|
||||
ColumnProject.DataSource = projectRepository.ReadProjects();
|
||||
ColumnProject.DisplayMember = "NameProject";
|
||||
ColumnProject.ValueMember = "Id";
|
||||
|
||||
ColumnContract.DataSource = contractRepository.ReadContract();
|
||||
ColumnContract.ValueMember = "Id";
|
||||
ColumnCustomer.DataSource = customerRepository.ReadCustomers();
|
||||
ColumnCustomer.DisplayMember = "NameCustomer";
|
||||
ColumnCustomer.ValueMember = "Id";
|
||||
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxCustomer.SelectedIndex < 0 || dataGridViewContract.RowCount < 1)
|
||||
if (dataGridViewContract.RowCount < 1)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_contractRepository.CreateContract(Contract.CreateOpeartion(0, DateTime.Today, 0, Entities.Enums.TypeProjects.Maintenance, CreateListExecutorOnProject()));
|
||||
_contractRepository.CreateContract(Contract.CreateOpeartion(0, DateTime.Now, 0, CreateListExecutorOnProject()));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -53,9 +53,9 @@ namespace ProjectItCompany.Forms
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private List<ContractOnProject> CreateListExecutorOnProject()
|
||||
private List<Entities.CustomerOnProject> CreateListExecutorOnProject()
|
||||
{
|
||||
var list = new List<ContractOnProject>();
|
||||
var list = new List<Entities.CustomerOnProject>();
|
||||
foreach (DataGridViewRow row in dataGridViewContract.Rows)
|
||||
{
|
||||
if (row.Cells["ColumnProject"].Value == null ||
|
||||
@ -63,9 +63,8 @@ namespace ProjectItCompany.Forms
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(ContractOnProject.CreateElement(
|
||||
Convert.ToInt32(row.Cells["ColumnProject"].Value),
|
||||
Convert.ToInt32(row.Cells["ColumnContract"].Value), string.Empty));
|
||||
list.Add(Entities.CustomerOnProject.CreateElement(0,
|
||||
Convert.ToInt32(row.Cells["ColumnProject"].Value), Convert.ToInt32(row.Cells["ColumnCustomer"].Value), string.Empty));
|
||||
}
|
||||
return list;
|
||||
}
|
@ -27,13 +27,12 @@ namespace ProjectItCompany.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormContractOnProject>().ShowDialog();
|
||||
_container.Resolve<FormContract>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,8 @@
|
||||
numericUpDownHourlyRate = new NumericUpDown();
|
||||
ButtonSave = new Button();
|
||||
ButtonCancel = new Button();
|
||||
labelJobTitle = new Label();
|
||||
comboBoxJobTitle = new ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownHourlyRate).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
@ -89,7 +91,7 @@
|
||||
//
|
||||
// ButtonSave
|
||||
//
|
||||
ButtonSave.Location = new Point(68, 128);
|
||||
ButtonSave.Location = new Point(68, 160);
|
||||
ButtonSave.Name = "ButtonSave";
|
||||
ButtonSave.Size = new Size(75, 23);
|
||||
ButtonSave.TabIndex = 6;
|
||||
@ -99,7 +101,7 @@
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
ButtonCancel.Location = new Point(165, 128);
|
||||
ButtonCancel.Location = new Point(165, 160);
|
||||
ButtonCancel.Name = "ButtonCancel";
|
||||
ButtonCancel.Size = new Size(75, 23);
|
||||
ButtonCancel.TabIndex = 7;
|
||||
@ -107,11 +109,30 @@
|
||||
ButtonCancel.UseVisualStyleBackColor = true;
|
||||
ButtonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// labelJobTitle
|
||||
//
|
||||
labelJobTitle.AutoSize = true;
|
||||
labelJobTitle.Location = new Point(21, 120);
|
||||
labelJobTitle.Name = "labelJobTitle";
|
||||
labelJobTitle.Size = new Size(69, 15);
|
||||
labelJobTitle.TabIndex = 8;
|
||||
labelJobTitle.Text = "Должность";
|
||||
//
|
||||
// comboBoxJobTitle
|
||||
//
|
||||
comboBoxJobTitle.FormattingEnabled = true;
|
||||
comboBoxJobTitle.Location = new Point(136, 116);
|
||||
comboBoxJobTitle.Name = "comboBoxJobTitle";
|
||||
comboBoxJobTitle.Size = new Size(151, 23);
|
||||
comboBoxJobTitle.TabIndex = 9;
|
||||
//
|
||||
// FormExecutor
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(319, 173);
|
||||
ClientSize = new Size(319, 217);
|
||||
Controls.Add(comboBoxJobTitle);
|
||||
Controls.Add(labelJobTitle);
|
||||
Controls.Add(ButtonCancel);
|
||||
Controls.Add(ButtonSave);
|
||||
Controls.Add(numericUpDownHourlyRate);
|
||||
@ -138,5 +159,7 @@
|
||||
private NumericUpDown numericUpDownHourlyRate;
|
||||
private Button ButtonSave;
|
||||
private Button ButtonCancel;
|
||||
private Label labelJobTitle;
|
||||
private ComboBox comboBoxJobTitle;
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using ProjectItCompany.Entities;
|
||||
using ProjectItCompany.Entities.Enums;
|
||||
using ProjectItCompany.Repositories;
|
||||
using ProjectItCompany.Repositories.Implementations;
|
||||
using System;
|
||||
@ -32,6 +33,7 @@ namespace ProjectItCompany.Forms
|
||||
textBoxFullName.Text = executor.FullName;
|
||||
dateTimePickerDateOfBirth.Value = executor.DateOfBirth;
|
||||
numericUpDownHourlyRate.Value = executor.HourlyRate;
|
||||
comboBoxJobTitle.SelectedItem = executor.JobTitles;
|
||||
_executorId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -45,6 +47,9 @@ namespace ProjectItCompany.Forms
|
||||
{
|
||||
InitializeComponent();
|
||||
_executorRepository = executorRepository ?? throw new ArgumentNullException(nameof(executorRepository));
|
||||
|
||||
comboBoxJobTitle.DataSource = Enum.GetValues(typeof(JobTitles));
|
||||
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
@ -75,6 +80,6 @@ namespace ProjectItCompany.Forms
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Executor CreateExecutor(int id) => Executor.CreateEntity(id, textBoxFullName.Text, dateTimePickerDateOfBirth.Value, numericUpDownHourlyRate.Value);
|
||||
private Executor CreateExecutor(int id) => Executor.CreateEntity(id, textBoxFullName.Text, dateTimePickerDateOfBirth.Value, numericUpDownHourlyRate.Value, Entities.Enums.JobTitles.Analyst);
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace ProjectItCompany.Forms
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormCustomer>();
|
||||
var form = _container.Resolve<FormExecutor>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
|
@ -34,6 +34,8 @@
|
||||
ButtonSave = new Button();
|
||||
ButtonCancel = new Button();
|
||||
checkedListBoxCompletedStage = new CheckedListBox();
|
||||
labelCustomer = new Label();
|
||||
comboBoxCustomer = new ComboBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelNameProject
|
||||
@ -48,7 +50,7 @@
|
||||
// labelCompletedStages
|
||||
//
|
||||
labelCompletedStages.AutoSize = true;
|
||||
labelCompletedStages.Location = new Point(12, 39);
|
||||
labelCompletedStages.Location = new Point(12, 72);
|
||||
labelCompletedStages.Name = "labelCompletedStages";
|
||||
labelCompletedStages.Size = new Size(121, 15);
|
||||
labelCompletedStages.TabIndex = 2;
|
||||
@ -63,7 +65,7 @@
|
||||
//
|
||||
// ButtonSave
|
||||
//
|
||||
ButtonSave.Location = new Point(53, 126);
|
||||
ButtonSave.Location = new Point(43, 185);
|
||||
ButtonSave.Name = "ButtonSave";
|
||||
ButtonSave.Size = new Size(75, 23);
|
||||
ButtonSave.TabIndex = 10;
|
||||
@ -73,7 +75,7 @@
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
ButtonCancel.Location = new Point(164, 124);
|
||||
ButtonCancel.Location = new Point(154, 184);
|
||||
ButtonCancel.Name = "ButtonCancel";
|
||||
ButtonCancel.Size = new Size(75, 23);
|
||||
ButtonCancel.TabIndex = 11;
|
||||
@ -84,16 +86,35 @@
|
||||
// checkedListBoxCompletedStage
|
||||
//
|
||||
checkedListBoxCompletedStage.FormattingEnabled = true;
|
||||
checkedListBoxCompletedStage.Location = new Point(154, 35);
|
||||
checkedListBoxCompletedStage.Location = new Point(154, 74);
|
||||
checkedListBoxCompletedStage.Name = "checkedListBoxCompletedStage";
|
||||
checkedListBoxCompletedStage.Size = new Size(150, 76);
|
||||
checkedListBoxCompletedStage.Size = new Size(150, 94);
|
||||
checkedListBoxCompletedStage.TabIndex = 12;
|
||||
//
|
||||
// labelCustomer
|
||||
//
|
||||
labelCustomer.AutoSize = true;
|
||||
labelCustomer.Location = new Point(12, 40);
|
||||
labelCustomer.Name = "labelCustomer";
|
||||
labelCustomer.Size = new Size(57, 15);
|
||||
labelCustomer.TabIndex = 13;
|
||||
labelCustomer.Text = "Заказчик";
|
||||
//
|
||||
// comboBoxCustomer
|
||||
//
|
||||
comboBoxCustomer.FormattingEnabled = true;
|
||||
comboBoxCustomer.Location = new Point(154, 39);
|
||||
comboBoxCustomer.Name = "comboBoxCustomer";
|
||||
comboBoxCustomer.Size = new Size(150, 23);
|
||||
comboBoxCustomer.TabIndex = 14;
|
||||
//
|
||||
// FormProject
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(315, 157);
|
||||
ClientSize = new Size(315, 217);
|
||||
Controls.Add(comboBoxCustomer);
|
||||
Controls.Add(labelCustomer);
|
||||
Controls.Add(checkedListBoxCompletedStage);
|
||||
Controls.Add(ButtonCancel);
|
||||
Controls.Add(ButtonSave);
|
||||
@ -115,5 +136,7 @@
|
||||
private Button ButtonSave;
|
||||
private Button ButtonCancel;
|
||||
private CheckedListBox checkedListBoxCompletedStage;
|
||||
private Label labelCustomer;
|
||||
private ComboBox comboBoxCustomer;
|
||||
}
|
||||
}
|
@ -39,7 +39,6 @@ namespace ProjectItCompany.Forms
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
textBoxNameProject.Text = project.NameProject;
|
||||
_projectId = value;
|
||||
}
|
||||
@ -88,6 +87,6 @@ namespace ProjectItCompany.Forms
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Project CreateProject(int id) => Project.CreateEntity(id, textBoxNameProject.Text, (CompletedStages)checkedListBoxCompletedStage.SelectedItem!);
|
||||
private Project CreateProject(int id) => Project.CreateEntity(id, textBoxNameProject.Text, (int)comboBoxCustomer.SelectedValue, (CompletedStages)checkedListBoxCompletedStage.SelectedItem!);
|
||||
}
|
||||
}
|
||||
|
@ -32,12 +32,12 @@
|
||||
labelYear = new Label();
|
||||
labelNumberOfHours = new Label();
|
||||
labelExecutor = new Label();
|
||||
textBoxMonth = new TextBox();
|
||||
numericUpDownYear = new NumericUpDown();
|
||||
numericUpDownNumberOfHours = new NumericUpDown();
|
||||
ButtonSave = new Button();
|
||||
ButtonCancel = new Button();
|
||||
comboBoxExecutor = new ComboBox();
|
||||
comboBoxMonth = new ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownYear).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumberOfHours).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -78,13 +78,6 @@
|
||||
labelExecutor.TabIndex = 3;
|
||||
labelExecutor.Text = "Исполнитель";
|
||||
//
|
||||
// textBoxMonth
|
||||
//
|
||||
textBoxMonth.Location = new Point(130, 5);
|
||||
textBoxMonth.Name = "textBoxMonth";
|
||||
textBoxMonth.Size = new Size(120, 23);
|
||||
textBoxMonth.TabIndex = 4;
|
||||
//
|
||||
// numericUpDownYear
|
||||
//
|
||||
numericUpDownYear.Location = new Point(130, 32);
|
||||
@ -127,17 +120,25 @@
|
||||
comboBoxExecutor.Size = new Size(121, 23);
|
||||
comboBoxExecutor.TabIndex = 10;
|
||||
//
|
||||
// comboBoxMonth
|
||||
//
|
||||
comboBoxMonth.FormattingEnabled = true;
|
||||
comboBoxMonth.Location = new Point(129, 4);
|
||||
comboBoxMonth.Name = "comboBoxMonth";
|
||||
comboBoxMonth.Size = new Size(121, 23);
|
||||
comboBoxMonth.TabIndex = 11;
|
||||
//
|
||||
// FormWage
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(267, 161);
|
||||
Controls.Add(comboBoxMonth);
|
||||
Controls.Add(comboBoxExecutor);
|
||||
Controls.Add(ButtonCancel);
|
||||
Controls.Add(ButtonSave);
|
||||
Controls.Add(numericUpDownNumberOfHours);
|
||||
Controls.Add(numericUpDownYear);
|
||||
Controls.Add(textBoxMonth);
|
||||
Controls.Add(labelExecutor);
|
||||
Controls.Add(labelNumberOfHours);
|
||||
Controls.Add(labelYear);
|
||||
@ -157,11 +158,11 @@
|
||||
private Label labelYear;
|
||||
private Label labelNumberOfHours;
|
||||
private Label labelExecutor;
|
||||
private TextBox textBoxMonth;
|
||||
private NumericUpDown numericUpDownYear;
|
||||
private NumericUpDown numericUpDownNumberOfHours;
|
||||
private Button ButtonSave;
|
||||
private Button ButtonCancel;
|
||||
private ComboBox comboBoxExecutor;
|
||||
private ComboBox comboBoxMonth;
|
||||
}
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
using ProjectItCompany.Entities;
|
||||
using ProjectItCompany.Entities.Enums;
|
||||
using ProjectItCompany.Repositories;
|
||||
using ProjectItCompany.Repositories.Implementations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -17,12 +19,16 @@ namespace ProjectItCompany.Forms
|
||||
{
|
||||
private readonly IWageRepository _wageRepository;
|
||||
|
||||
|
||||
public FormWage(IWageRepository wageRepository)
|
||||
public FormWage(IWageRepository wageRepository, IExecutorRepository executorRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_wageRepository = wageRepository ?? throw new ArgumentNullException(nameof(wageRepository));
|
||||
|
||||
comboBoxExecutor.DataSource = executorRepository.ReadExecutors();
|
||||
comboBoxExecutor.DisplayMember = "FullName";
|
||||
comboBoxExecutor.ValueMember = "Id";
|
||||
|
||||
comboBoxMonth.DataSource = Enum.GetValues(typeof(Month));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
@ -33,7 +39,7 @@ namespace ProjectItCompany.Forms
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_wageRepository.CreateWage(Wage.CreateOpeartion(0, string.Empty, 2022, 180, 1));
|
||||
_wageRepository.CreateWage(Wage.CreateOpeartion(0, (Month)comboBoxMonth.SelectedValue!, Convert.ToInt32(numericUpDownYear.Value), Convert.ToInt32(numericUpDownNumberOfHours.Value), (int)comboBoxExecutor.SelectedValue));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -11,4 +11,6 @@ public interface IContractRepository
|
||||
{
|
||||
IEnumerable<Contract> ReadContract(DateTime? dateForm = null, DateTime? dateTo = null, decimal? typeProject = null, int? customerId = null);
|
||||
void CreateContract(Contract contract);
|
||||
void DeleteContract(int id);
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ namespace ProjectItCompany.Repositories;
|
||||
|
||||
public interface IWageRepository
|
||||
{
|
||||
IEnumerable<Wage> ReadWage(int? yearForm = null, int? yearTo = null, int? numberOfHoursFrom = null, int? numberOfHoursTo = null, int? executorId = null);
|
||||
IEnumerable<Wage> ReadWage(int? yearForm = null, int? yearTo = null,
|
||||
int? numberOfHoursFrom = null, int? numberOfHoursTo = null, int? executorId = null);
|
||||
void CreateWage(Wage wages);
|
||||
}
|
||||
|
@ -14,6 +14,11 @@ internal class ContractRepository : IContractRepository
|
||||
|
||||
}
|
||||
|
||||
public void DeleteContract(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<Contract> ReadContract(DateTime? dateForm = null, DateTime? dateTo = null, decimal? typeProject = null, int? customerId = null)
|
||||
{
|
||||
return [];
|
||||
|
@ -21,7 +21,7 @@ internal class ExecutorRepository : IExecutorRepository
|
||||
|
||||
public Executor ReadExecutorById(int id)
|
||||
{
|
||||
return Executor.CreateEntity(0, string.Empty, DateTime.Today, 1000);
|
||||
return Executor.CreateEntity(0, string.Empty, DateTime.Today, 1000, Entities.Enums.JobTitles.Developer);
|
||||
}
|
||||
|
||||
public IEnumerable<Executor> ReadExecutors()
|
||||
|
@ -21,7 +21,7 @@ internal class ProjectRepository : IProjectRepository
|
||||
|
||||
public Project ReadProjectById(int id)
|
||||
{
|
||||
return Project.CreateEntity(1, string.Empty, Entities.Enums.CompletedStages.Planning);
|
||||
return Project.CreateEntity(1, string.Empty, 0, Entities.Enums.CompletedStages.Planning);
|
||||
}
|
||||
|
||||
public IEnumerable<Project> ReadProjects()
|
||||
|
Loading…
Reference in New Issue
Block a user