remove useless entity, make "review" entity "many-to-many", add DataGridView to contract form

This commit is contained in:
Ivan Gutorov 2024-11-25 02:30:29 +04:00
parent 780993b244
commit 61792d9116
34 changed files with 306 additions and 1116 deletions

View File

@ -1,24 +1,24 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Entities;
public class CustomerContractReview
public class CustomerExecutorReview
{
public int Id { get; private set; }
public int CustomerId { get; private set; }
public int ContractId { get; private set; }
public int ExecutorId { get; private set; }
public string Review { get; private set; } = string.Empty;
public int Grade { get; private set; }
public static CustomerContractReview CreateElement(int id, int customerId, int contractId, string review, int grade)
public static CustomerExecutorReview CreateElement(int id, int customerId, int executorId, string review, int grade)
{
return new CustomerContractReview
return new CustomerExecutorReview
{
Id = id,
CustomerId = customerId,
ContractId = contractId,
ExecutorId = executorId,
Review = review ?? String.Empty,
Grade = grade
};

View File

@ -7,7 +7,7 @@ public enum ExecutorPost
Junior = 1,
Middle = 2,
Senior = 3,
TeamLead = 4

View File

@ -1,29 +0,0 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Entities;
public class ServiceExecution
{
public int Id { get; private set; }
public int ContractId { get; private set; }
public int ServiceId { get; private set; }
public int ExecutorId { get; private set; }
public int Completion { get; private set; }
public DateTime Deadline { get; private set; }
public static ServiceExecution CreateOperation(int id, int contractId, int serviceId, int executorId, int completion, DateTime deadline)
{
return new ServiceExecution
{
Id = id,
ContractId = contractId,
ServiceId = serviceId,
ExecutorId = executorId,
Completion = completion,
Deadline = deadline
};
}
}

View File

@ -37,7 +37,6 @@
CustomerContractReviewsToolStripMenuItem = new ToolStripMenuItem();
контрактыToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
выполнениеУслугToolStripMenuItem = new ToolStripMenuItem();
menuStrip.SuspendLayout();
SuspendLayout();
//
@ -60,27 +59,27 @@
// CustomersToolStripMenuItem
//
CustomersToolStripMenuItem.Name = "CustomersToolStripMenuItem";
CustomersToolStripMenuItem.Size = new Size(149, 22);
CustomersToolStripMenuItem.Size = new Size(180, 22);
CustomersToolStripMenuItem.Text = "Заказчики";
CustomersToolStripMenuItem.Click += CustomersToolStripMenuItem_Click;
//
// ExecutorsToolStripMenuItem
//
ExecutorsToolStripMenuItem.Name = "ExecutorsToolStripMenuItem";
ExecutorsToolStripMenuItem.Size = new Size(149, 22);
ExecutorsToolStripMenuItem.Size = new Size(180, 22);
ExecutorsToolStripMenuItem.Text = "Исполнители";
ExecutorsToolStripMenuItem.Click += ExecutorsToolStripMenuItem_Click;
//
// ServicesToolStripMenuItem
//
ServicesToolStripMenuItem.Name = "ServicesToolStripMenuItem";
ServicesToolStripMenuItem.Size = new Size(149, 22);
ServicesToolStripMenuItem.Size = new Size(180, 22);
ServicesToolStripMenuItem.Text = "Услуги";
ServicesToolStripMenuItem.Click += ServicesToolStripMenuItem_Click;
//
// операцииToolStripMenuItem
//
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CustomerContractReviewsToolStripMenuItem, контрактыToolStripMenuItem, выполнениеУслугToolStripMenuItem });
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CustomerContractReviewsToolStripMenuItem, контрактыToolStripMenuItem });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
операцииToolStripMenuItem.Size = new Size(75, 20);
операцииToolStripMenuItem.Text = "Операции";
@ -105,13 +104,6 @@
отчетыToolStripMenuItem.Size = new Size(60, 20);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// выполнениеУслугToolStripMenuItem
//
выполнениеУслугToolStripMenuItem.Name = "выполнениеУслугToolStripMenuItem";
выполнениеУслугToolStripMenuItem.Size = new Size(181, 22);
выполнениеУслугToolStripMenuItem.Text = "Выполнение услуг";
выполнениеУслугToolStripMenuItem.Click += ServiceExecutionsToolStripMenuItem_Click;
//
// FormItCompany
//
AutoScaleDimensions = new SizeF(7F, 15F);
@ -141,6 +133,5 @@
private ToolStripMenuItem отчетыToolStripMenuItem;
private ToolStripMenuItem CustomerContractReviewsToolStripMenuItem;
private ToolStripMenuItem контрактыToolStripMenuItem;
private ToolStripMenuItem выполнениеУслугToolStripMenuItem;
}
}

View File

@ -1,5 +1,4 @@
using PIbd_23_Gutorov_I.A._IT_Company.Forms;
using System.Runtime.Serialization;
using Unity;
namespace PIbd_23_Gutorov_I.A._IT_Company
@ -66,19 +65,7 @@ namespace PIbd_23_Gutorov_I.A._IT_Company
{
try
{
_container.Resolve<FormCustomerContractReviews>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ServiceExecutionsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormServiceExecutions>().ShowDialog();
_container.Resolve<FormCustomerExecutorReviews>().ShowDialog();
}
catch (Exception ex)
{

View File

@ -42,6 +42,7 @@
labelContractPaymentAmount = new Label();
dataGridViewServices = new DataGridView();
groupBox = new GroupBox();
ColumnServiceDescription = new DataGridViewComboBoxColumn();
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).BeginInit();
((System.ComponentModel.ISupportInitialize)dataGridViewServices).BeginInit();
groupBox.SuspendLayout();
@ -73,6 +74,7 @@
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
buttonCancel.Location = new Point(12, 469);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(358, 23);
@ -83,6 +85,7 @@
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
buttonSave.Location = new Point(12, 440);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(358, 23);
@ -156,16 +159,22 @@
//
// dataGridViewServices
//
dataGridViewServices.AllowUserToDeleteRows = false;
dataGridViewServices.AllowUserToResizeColumns = false;
dataGridViewServices.AllowUserToResizeRows = false;
dataGridViewServices.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewServices.Columns.AddRange(new DataGridViewColumn[] { ColumnServiceDescription });
dataGridViewServices.Dock = DockStyle.Fill;
dataGridViewServices.Location = new Point(3, 19);
dataGridViewServices.MultiSelect = false;
dataGridViewServices.Name = "dataGridViewServices";
dataGridViewServices.RowHeadersVisible = false;
dataGridViewServices.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewServices.Size = new Size(352, 244);
dataGridViewServices.TabIndex = 17;
//
// groupBox
//
groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
groupBox.Controls.Add(dataGridViewServices);
groupBox.Location = new Point(12, 168);
groupBox.Name = "groupBox";
@ -174,6 +183,13 @@
groupBox.TabStop = false;
groupBox.Text = "Услуги:";
//
// ColumnServiceDescription
//
ColumnServiceDescription.HeaderText = "Услуга";
ColumnServiceDescription.Name = "ColumnServiceDescription";
ColumnServiceDescription.Resizable = DataGridViewTriState.True;
ColumnServiceDescription.SortMode = DataGridViewColumnSortMode.Automatic;
//
// FormContract
//
AutoScaleDimensions = new SizeF(7F, 15F);
@ -218,5 +234,6 @@
private Label labelContractPaymentAmount;
private DataGridView dataGridViewServices;
private GroupBox groupBox;
private DataGridViewComboBoxColumn ColumnServiceDescription;
}
}

View File

@ -8,51 +8,24 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
private readonly IContractRepository _contractRepository;
private int? _contractId;
public int Id
{
set
{
try
{
var contract = _contractRepository.ReadContractById(value);
if (contract == null) throw new InvalidDataException(nameof(contract));
foreach (ContractCategory elem in Enum.GetValues(typeof(ContractCategory)))
{
if ((elem & contract.Category) != 0)
{
checkedListBoxContractCategory.SetItemChecked(checkedListBoxContractCategory.Items.IndexOf(elem), true);
}
}
dateTimePickerContractDeadline.Value = contract.Deadline;
numericUpDownContractPaymentAmount.Value = contract.PaymentAmount;
_contractId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormContract(IContractRepository contractRepository, ICustomerRepository customerRepository, IExecutorRepository executorRepository)
public FormContract(IContractRepository contractRepository, ICustomerRepository customerRepository,
IExecutorRepository executorRepository, IServiceRepository serviceRepository)
{
InitializeComponent();
_contractRepository = contractRepository ?? throw new ArgumentNullException(nameof(contractRepository));
comboBoxContractCustomerId.DataSource = customerRepository.ReadCustomers();
comboBoxContractCustomerId.DisplayMember = "Name";
comboBoxContractCustomerId.DisplayMember = "Id";
comboBoxContractExecutorId.DataSource = executorRepository.ReadExecutors();
comboBoxContractExecutorId.DisplayMember = "Name";
comboBoxContractExecutorId.DisplayMember = "Id";
ColumnServiceDescription.DataSource = serviceRepository.ReadServices();
ColumnServiceDescription.DisplayMember = "Description";
comboBoxContractExecutorId.DisplayMember = "Id";
foreach (var elem in Enum.GetValues(typeof(ContractCategory)))
{
checkedListBoxContractCategory.Items.Add(elem);

View File

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ColumnServiceDescription.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -17,7 +17,7 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
var customer = _customerRepository.ReadCustomerById(value);
if (customer == null) throw new InvalidDataException(nameof(customer));
textBoxCustomerName.Text = customer.Name;
textBoxCustomerContact.Text = customer.Contact;
textBoxCustomerAddress.Text = customer.Address;
@ -62,7 +62,7 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Customer CreateCustomer(int id) => Customer.CreateEntity(
id, textBoxCustomerName.Text, textBoxCustomerContact.Text,
id, textBoxCustomerName.Text, textBoxCustomerContact.Text,
textBoxCustomerAddress.Text);
}
}

View File

@ -1,180 +0,0 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormCustomerContractReview
{
/// <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()
{
labelCustomerContractReviewCustomerId = new Label();
buttonCancel = new Button();
buttonSave = new Button();
richTextBoxCustomerContractReviewReview = new RichTextBox();
labelCustomerContractReviewReview = new Label();
numericUpDownCustomerContractReviewGrade = new NumericUpDown();
comboBoxCustomerContractReviewCustomerId = new ComboBox();
comboBoxCustomerContractReviewContractId = new ComboBox();
labelCustomerContractReviewContractId = new Label();
labelCustomerContractReviewGrade = new Label();
((System.ComponentModel.ISupportInitialize)numericUpDownCustomerContractReviewGrade).BeginInit();
SuspendLayout();
//
// labelCustomerContractReviewCustomerId
//
labelCustomerContractReviewCustomerId.AutoSize = true;
labelCustomerContractReviewCustomerId.Location = new Point(12, 9);
labelCustomerContractReviewCustomerId.Name = "labelCustomerContractReviewCustomerId";
labelCustomerContractReviewCustomerId.Size = new Size(60, 15);
labelCustomerContractReviewCustomerId.TabIndex = 22;
labelCustomerContractReviewCustomerId.Text = "Заказчик:";
//
// buttonCancel
//
buttonCancel.Location = new Point(12, 224);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(358, 23);
buttonCancel.TabIndex = 21;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// buttonSave
//
buttonSave.Location = new Point(12, 195);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(358, 23);
buttonSave.TabIndex = 20;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// richTextBoxCustomerContractReviewReview
//
richTextBoxCustomerContractReviewReview.Location = new Point(169, 64);
richTextBoxCustomerContractReviewReview.Name = "richTextBoxCustomerContractReviewReview";
richTextBoxCustomerContractReviewReview.Size = new Size(202, 96);
richTextBoxCustomerContractReviewReview.TabIndex = 27;
richTextBoxCustomerContractReviewReview.Text = "";
//
// labelCustomerContractReviewReview
//
labelCustomerContractReviewReview.AutoSize = true;
labelCustomerContractReviewReview.Location = new Point(12, 67);
labelCustomerContractReviewReview.Name = "labelCustomerContractReviewReview";
labelCustomerContractReviewReview.Size = new Size(44, 15);
labelCustomerContractReviewReview.TabIndex = 28;
labelCustomerContractReviewReview.Text = "Отзыв:";
//
// numericUpDownCustomerContractReviewGrade
//
numericUpDownCustomerContractReviewGrade.Location = new Point(169, 166);
numericUpDownCustomerContractReviewGrade.Maximum = new decimal(new int[] { 5, 0, 0, 0 });
numericUpDownCustomerContractReviewGrade.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
numericUpDownCustomerContractReviewGrade.Name = "numericUpDownCustomerContractReviewGrade";
numericUpDownCustomerContractReviewGrade.Size = new Size(201, 23);
numericUpDownCustomerContractReviewGrade.TabIndex = 29;
numericUpDownCustomerContractReviewGrade.Value = new decimal(new int[] { 1, 0, 0, 0 });
//
// comboBoxCustomerContractReviewCustomerId
//
comboBoxCustomerContractReviewCustomerId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxCustomerContractReviewCustomerId.FormattingEnabled = true;
comboBoxCustomerContractReviewCustomerId.Location = new Point(169, 6);
comboBoxCustomerContractReviewCustomerId.Name = "comboBoxCustomerContractReviewCustomerId";
comboBoxCustomerContractReviewCustomerId.Size = new Size(202, 23);
comboBoxCustomerContractReviewCustomerId.TabIndex = 30;
//
// comboBoxCustomerContractReviewContractId
//
comboBoxCustomerContractReviewContractId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxCustomerContractReviewContractId.FormattingEnabled = true;
comboBoxCustomerContractReviewContractId.Location = new Point(169, 35);
comboBoxCustomerContractReviewContractId.Name = "comboBoxCustomerContractReviewContractId";
comboBoxCustomerContractReviewContractId.Size = new Size(202, 23);
comboBoxCustomerContractReviewContractId.TabIndex = 31;
//
// labelCustomerContractReviewContractId
//
labelCustomerContractReviewContractId.AutoSize = true;
labelCustomerContractReviewContractId.Location = new Point(12, 38);
labelCustomerContractReviewContractId.Name = "labelCustomerContractReviewContractId";
labelCustomerContractReviewContractId.Size = new Size(60, 15);
labelCustomerContractReviewContractId.TabIndex = 32;
labelCustomerContractReviewContractId.Text = "Контракт:";
//
// labelCustomerContractReviewGrade
//
labelCustomerContractReviewGrade.AutoSize = true;
labelCustomerContractReviewGrade.Location = new Point(12, 168);
labelCustomerContractReviewGrade.Name = "labelCustomerContractReviewGrade";
labelCustomerContractReviewGrade.Size = new Size(51, 15);
labelCustomerContractReviewGrade.TabIndex = 33;
labelCustomerContractReviewGrade.Text = "Оценка:";
//
// FormCustomerContractReview
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(381, 260);
Controls.Add(labelCustomerContractReviewGrade);
Controls.Add(labelCustomerContractReviewContractId);
Controls.Add(comboBoxCustomerContractReviewContractId);
Controls.Add(comboBoxCustomerContractReviewCustomerId);
Controls.Add(numericUpDownCustomerContractReviewGrade);
Controls.Add(labelCustomerContractReviewReview);
Controls.Add(richTextBoxCustomerContractReviewReview);
Controls.Add(labelCustomerContractReviewCustomerId);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Name = "FormCustomerContractReview";
StartPosition = FormStartPosition.CenterParent;
Text = "Отзыв заказчика";
((System.ComponentModel.ISupportInitialize)numericUpDownCustomerContractReviewGrade).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelContractPaymentAmount;
private Label labelContractDeadline;
private ComboBox comboBoxCustomerContractReviewCustomerId;
private ComboBox comboBoxContractCustomerId;
private Label labelContractCategory;
private Label labelContractExecutorId;
private Label labelCustomerContractReviewCustomerId;
private Button buttonCancel;
private Button buttonSave;
private RichTextBox richTextBoxCustomerContractReviewReview;
private Label labelCustomerContractReviewReview;
private NumericUpDown numericUpDownCustomerContractReviewGrade;
private NumericUpDown numericUpDownContractPaymentAmount;
private DateTimePicker dateTimePickerContractDeadline;
private CheckedListBox checkedListBoxContractCategory;
private ComboBox comboBoxCustomerContractReviewContractId;
private Label labelCustomerContractReviewContractId;
private Label labelCustomerContractReviewGrade;
}
}

View File

@ -1,49 +0,0 @@
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormCustomerContractReview : Form
{
private readonly ICustomerContractReviewRepository _customerContractReviewRepository;
public FormCustomerContractReview(ICustomerContractReviewRepository customerContractReviewRepository,
ICustomerRepository customerRepository, IContractRepository contractRepository)
{
InitializeComponent();
_customerContractReviewRepository = customerContractReviewRepository ?? throw new ArgumentNullException(nameof(customerContractReviewRepository));
comboBoxCustomerContractReviewCustomerId.DataSource = customerRepository.ReadCustomers();
comboBoxCustomerContractReviewCustomerId.DisplayMember = "Name";
comboBoxCustomerContractReviewCustomerId.DisplayMember = "Id";
comboBoxCustomerContractReviewContractId.DataSource = contractRepository.ReadContracts();
comboBoxCustomerContractReviewCustomerId.DisplayMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxCustomerContractReviewContractId.SelectedIndex < 0 ||
comboBoxCustomerContractReviewCustomerId.SelectedIndex < 0 ||
string.IsNullOrEmpty(richTextBoxCustomerContractReviewReview.Text))
{
throw new Exception("Имеются незаполненные поля");
}
_customerContractReviewRepository.CreateCustomerContractReview(CustomerContractReview.CreateElement(
0, (int)comboBoxCustomerContractReviewCustomerId.SelectedValue!, (int)comboBoxCustomerContractReviewContractId.SelectedValue!,
richTextBoxCustomerContractReviewReview.Text, Convert.ToInt32(numericUpDownContractPaymentAmount.Value)));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
}
}

View File

@ -0,0 +1,172 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormCustomerExecutorReview
{
/// <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()
{
labelCustomerExecutorReviewCustomerId = new Label();
buttonCancel = new Button();
buttonSave = new Button();
richTextBoxCustomerExecutorReviewReview = new RichTextBox();
labelCustomerExecutorReviewReview = new Label();
numericUpDownCustomerExecutorReviewGrade = new NumericUpDown();
comboBoxCustomerExecutorReviewCustomerId = new ComboBox();
comboBoxCustomerExecutorReviewExecutorId = new ComboBox();
labelCustomerExecutorReviewExecutorId = new Label();
labelCustomerExecutorReviewGrade = new Label();
((System.ComponentModel.ISupportInitialize)numericUpDownCustomerExecutorReviewGrade).BeginInit();
SuspendLayout();
//
// labelCustomerExecutorReviewCustomerId
//
labelCustomerExecutorReviewCustomerId.AutoSize = true;
labelCustomerExecutorReviewCustomerId.Location = new Point(12, 9);
labelCustomerExecutorReviewCustomerId.Name = "labelCustomerExecutorReviewCustomerId";
labelCustomerExecutorReviewCustomerId.Size = new Size(60, 15);
labelCustomerExecutorReviewCustomerId.TabIndex = 22;
labelCustomerExecutorReviewCustomerId.Text = "Заказчик:";
//
// buttonCancel
//
buttonCancel.Location = new Point(12, 224);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(358, 23);
buttonCancel.TabIndex = 21;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// buttonSave
//
buttonSave.Location = new Point(12, 195);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(358, 23);
buttonSave.TabIndex = 20;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// richTextBoxCustomerExecutorReviewReview
//
richTextBoxCustomerExecutorReviewReview.Location = new Point(169, 64);
richTextBoxCustomerExecutorReviewReview.Name = "richTextBoxCustomerExecutorReviewReview";
richTextBoxCustomerExecutorReviewReview.Size = new Size(202, 96);
richTextBoxCustomerExecutorReviewReview.TabIndex = 27;
richTextBoxCustomerExecutorReviewReview.Text = "";
//
// labelCustomerExecutorReviewReview
//
labelCustomerExecutorReviewReview.AutoSize = true;
labelCustomerExecutorReviewReview.Location = new Point(12, 67);
labelCustomerExecutorReviewReview.Name = "labelCustomerExecutorReviewReview";
labelCustomerExecutorReviewReview.Size = new Size(44, 15);
labelCustomerExecutorReviewReview.TabIndex = 28;
labelCustomerExecutorReviewReview.Text = "Отзыв:";
//
// numericUpDownCustomerExecutorReviewGrade
//
numericUpDownCustomerExecutorReviewGrade.Location = new Point(169, 166);
numericUpDownCustomerExecutorReviewGrade.Maximum = new decimal(new int[] { 5, 0, 0, 0 });
numericUpDownCustomerExecutorReviewGrade.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
numericUpDownCustomerExecutorReviewGrade.Name = "numericUpDownCustomerExecutorReviewGrade";
numericUpDownCustomerExecutorReviewGrade.Size = new Size(201, 23);
numericUpDownCustomerExecutorReviewGrade.TabIndex = 29;
numericUpDownCustomerExecutorReviewGrade.Value = new decimal(new int[] { 1, 0, 0, 0 });
//
// comboBoxCustomerExecutorReviewCustomerId
//
comboBoxCustomerExecutorReviewCustomerId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxCustomerExecutorReviewCustomerId.FormattingEnabled = true;
comboBoxCustomerExecutorReviewCustomerId.Location = new Point(169, 6);
comboBoxCustomerExecutorReviewCustomerId.Name = "comboBoxCustomerExecutorReviewCustomerId";
comboBoxCustomerExecutorReviewCustomerId.Size = new Size(202, 23);
comboBoxCustomerExecutorReviewCustomerId.TabIndex = 30;
//
// comboBoxCustomerExecutorReviewExecutorId
//
comboBoxCustomerExecutorReviewExecutorId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxCustomerExecutorReviewExecutorId.FormattingEnabled = true;
comboBoxCustomerExecutorReviewExecutorId.Location = new Point(169, 35);
comboBoxCustomerExecutorReviewExecutorId.Name = "comboBoxCustomerExecutorReviewExecutorId";
comboBoxCustomerExecutorReviewExecutorId.Size = new Size(202, 23);
comboBoxCustomerExecutorReviewExecutorId.TabIndex = 31;
//
// labelCustomerExecutorReviewExecutorId
//
labelCustomerExecutorReviewExecutorId.AutoSize = true;
labelCustomerExecutorReviewExecutorId.Location = new Point(12, 38);
labelCustomerExecutorReviewExecutorId.Name = "labelCustomerExecutorReviewExecutorId";
labelCustomerExecutorReviewExecutorId.Size = new Size(84, 15);
labelCustomerExecutorReviewExecutorId.TabIndex = 32;
labelCustomerExecutorReviewExecutorId.Text = "Исполнитель:";
//
// labelCustomerExecutorReviewGrade
//
labelCustomerExecutorReviewGrade.AutoSize = true;
labelCustomerExecutorReviewGrade.Location = new Point(12, 168);
labelCustomerExecutorReviewGrade.Name = "labelCustomerExecutorReviewGrade";
labelCustomerExecutorReviewGrade.Size = new Size(51, 15);
labelCustomerExecutorReviewGrade.TabIndex = 33;
labelCustomerExecutorReviewGrade.Text = "Оценка:";
//
// FormCustomerExecutorReview
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(381, 260);
Controls.Add(labelCustomerExecutorReviewGrade);
Controls.Add(labelCustomerExecutorReviewExecutorId);
Controls.Add(comboBoxCustomerExecutorReviewExecutorId);
Controls.Add(comboBoxCustomerExecutorReviewCustomerId);
Controls.Add(numericUpDownCustomerExecutorReviewGrade);
Controls.Add(labelCustomerExecutorReviewReview);
Controls.Add(richTextBoxCustomerExecutorReviewReview);
Controls.Add(labelCustomerExecutorReviewCustomerId);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Name = "FormCustomerExecutorReview";
StartPosition = FormStartPosition.CenterParent;
Text = "Отзыв заказчика";
((System.ComponentModel.ISupportInitialize)numericUpDownCustomerExecutorReviewGrade).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private ComboBox comboBoxCustomerExecutorReviewCustomerId;
private Label labelCustomerExecutorReviewCustomerId;
private Button buttonCancel;
private Button buttonSave;
private RichTextBox richTextBoxCustomerExecutorReviewReview;
private Label labelCustomerExecutorReviewReview;
private NumericUpDown numericUpDownCustomerExecutorReviewGrade;
private ComboBox comboBoxCustomerExecutorReviewExecutorId;
private Label labelCustomerExecutorReviewExecutorId;
private Label labelCustomerExecutorReviewGrade;
}
}

View File

@ -0,0 +1,50 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormCustomerExecutorReview : Form
{
private readonly ICustomerExecutorReviewRepository _customerExecutorReviewRepository;
public FormCustomerExecutorReview(ICustomerExecutorReviewRepository customerExecutorReviewRepository,
ICustomerRepository customerRepository, IExecutorRepository executorRepository)
{
InitializeComponent();
_customerExecutorReviewRepository = customerExecutorReviewRepository ?? throw new ArgumentNullException(nameof(customerExecutorReviewRepository));
comboBoxCustomerExecutorReviewCustomerId.DataSource = customerRepository.ReadCustomers();
comboBoxCustomerExecutorReviewCustomerId.DisplayMember = "Name";
comboBoxCustomerExecutorReviewCustomerId.DisplayMember = "Id";
comboBoxCustomerExecutorReviewExecutorId.DataSource = executorRepository.ReadExecutors();
comboBoxCustomerExecutorReviewExecutorId.DisplayMember = "Name";
comboBoxCustomerExecutorReviewCustomerId.DisplayMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxCustomerExecutorReviewExecutorId.SelectedIndex < 0 ||
comboBoxCustomerExecutorReviewCustomerId.SelectedIndex < 0 ||
string.IsNullOrEmpty(richTextBoxCustomerExecutorReviewReview.Text))
{
throw new Exception("Имеются незаполненные поля");
}
_customerExecutorReviewRepository.CreateCustomerExecutorReview(CustomerExecutorReview.CreateElement(
0, (int)comboBoxCustomerExecutorReviewCustomerId.SelectedValue!, (int)comboBoxCustomerExecutorReviewExecutorId.SelectedValue!,
richTextBoxCustomerExecutorReviewReview.Text, Convert.ToInt32(numericUpDownCustomerExecutorReviewGrade.Value)));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
}
}

View File

@ -1,6 +1,6 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormCustomerContractReviews
partial class FormCustomerExecutorReviews
{
/// <summary>
/// Required designer variable.
@ -83,7 +83,7 @@
Name = "FormCustomerContractReviews";
StartPosition = FormStartPosition.CenterParent;
Text = "Отзывы заказчиков";
Load += FormCustomerContractReviews_Load;
Load += FormCustomerExecutorReviews_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
panel.ResumeLayout(false);
ResumeLayout(false);

View File

@ -1,23 +1,22 @@
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
using Unity;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormCustomerContractReviews : Form
public partial class FormCustomerExecutorReviews : Form
{
private readonly IUnityContainer _container;
private readonly ICustomerContractReviewRepository _customerContractReviewRepository;
private readonly ICustomerExecutorReviewRepository _customerExecutorReviewRepository;
public FormCustomerContractReviews(IUnityContainer container, ICustomerContractReviewRepository customerContractReviewRepository)
public FormCustomerExecutorReviews(IUnityContainer container, ICustomerExecutorReviewRepository customerExecutorReviewRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentException(nameof(container));
_customerContractReviewRepository = customerContractReviewRepository ?? throw new ArgumentException(nameof(customerContractReviewRepository));
_customerExecutorReviewRepository = customerExecutorReviewRepository ?? throw new ArgumentException(nameof(customerExecutorReviewRepository));
}
private void FormCustomerContractReviews_Load(object sender, EventArgs e)
private void FormCustomerExecutorReviews_Load(object sender, EventArgs e)
{
try
{
@ -33,7 +32,7 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
try
{
_container.Resolve<FormCustomerContractReview>().ShowDialog();
_container.Resolve<FormCustomerExecutorReview>().ShowDialog();
LoadList();
}
catch (Exception ex)
@ -42,6 +41,6 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
}
}
private void LoadList() => dataGridViewData.DataSource = _customerContractReviewRepository.ReadCustomerContractReviews();
private void LoadList() => dataGridViewData.DataSource = _customerExecutorReviewRepository.ReadCustomerExecutorReviews();
}
}

View File

@ -1,16 +1,5 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
using PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums;
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
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 PIbd_23_Gutorov_I.A._IT_Company.Forms
{
@ -59,7 +48,7 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
throw new Exception("Имеются незаполненные поля");
}
_serviceRepository.CreateService(Service.CreateEntity(0,
_serviceRepository.CreateService(Service.CreateEntity(0,
richTextBoxServiceDescription.Text, (int)comboBoxServiceContractId.SelectedValue!));
Close();

View File

@ -1,194 +0,0 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormServiceExecution
{
/// <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()
{
labelContractDeadline = new Label();
comboBoxServiceExecutionExecutorId = new ComboBox();
labelServiceExecutionExecutorId = new Label();
dateTimePickerContractDeadline = new DateTimePicker();
comboBoxServiceExecutionContractId = new ComboBox();
labelServiceExecutionContractId = new Label();
comboBoxServiceExecutionServiceId = new ComboBox();
labelServiceExecutionServiceId = new Label();
labelServiceExecutionCompleteion = new Label();
numericUpDownContractPaymentAmount = new NumericUpDown();
buttonCancel = new Button();
buttonSave = new Button();
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).BeginInit();
SuspendLayout();
//
// labelContractDeadline
//
labelContractDeadline.AutoSize = true;
labelContractDeadline.Location = new Point(12, 128);
labelContractDeadline.Name = "labelContractDeadline";
labelContractDeadline.Size = new Size(110, 15);
labelContractDeadline.TabIndex = 21;
labelContractDeadline.Text = "Срок выполнения:";
//
// comboBoxServiceExecutionExecutorId
//
comboBoxServiceExecutionExecutorId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxServiceExecutionExecutorId.FormattingEnabled = true;
comboBoxServiceExecutionExecutorId.Location = new Point(169, 64);
comboBoxServiceExecutionExecutorId.Name = "comboBoxServiceExecutionExecutorId";
comboBoxServiceExecutionExecutorId.Size = new Size(202, 23);
comboBoxServiceExecutionExecutorId.TabIndex = 20;
//
// labelServiceExecutionExecutorId
//
labelServiceExecutionExecutorId.AutoSize = true;
labelServiceExecutionExecutorId.Location = new Point(12, 67);
labelServiceExecutionExecutorId.Name = "labelServiceExecutionExecutorId";
labelServiceExecutionExecutorId.Size = new Size(84, 15);
labelServiceExecutionExecutorId.TabIndex = 18;
labelServiceExecutionExecutorId.Text = "Исполнитель:";
//
// dateTimePickerContractDeadline
//
dateTimePickerContractDeadline.Location = new Point(169, 122);
dateTimePickerContractDeadline.Name = "dateTimePickerContractDeadline";
dateTimePickerContractDeadline.Size = new Size(202, 23);
dateTimePickerContractDeadline.TabIndex = 16;
//
// comboBoxServiceExecutionContractId
//
comboBoxServiceExecutionContractId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxServiceExecutionContractId.FormattingEnabled = true;
comboBoxServiceExecutionContractId.Location = new Point(169, 6);
comboBoxServiceExecutionContractId.Name = "comboBoxServiceExecutionContractId";
comboBoxServiceExecutionContractId.Size = new Size(202, 23);
comboBoxServiceExecutionContractId.TabIndex = 23;
//
// labelServiceExecutionContractId
//
labelServiceExecutionContractId.AutoSize = true;
labelServiceExecutionContractId.Location = new Point(12, 9);
labelServiceExecutionContractId.Name = "labelServiceExecutionContractId";
labelServiceExecutionContractId.Size = new Size(60, 15);
labelServiceExecutionContractId.TabIndex = 22;
labelServiceExecutionContractId.Text = "Контракт:";
//
// comboBoxServiceExecutionServiceId
//
comboBoxServiceExecutionServiceId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxServiceExecutionServiceId.FormattingEnabled = true;
comboBoxServiceExecutionServiceId.Location = new Point(169, 35);
comboBoxServiceExecutionServiceId.Name = "comboBoxServiceExecutionServiceId";
comboBoxServiceExecutionServiceId.Size = new Size(202, 23);
comboBoxServiceExecutionServiceId.TabIndex = 25;
//
// labelServiceExecutionServiceId
//
labelServiceExecutionServiceId.AutoSize = true;
labelServiceExecutionServiceId.Location = new Point(12, 38);
labelServiceExecutionServiceId.Name = "labelServiceExecutionServiceId";
labelServiceExecutionServiceId.Size = new Size(47, 15);
labelServiceExecutionServiceId.TabIndex = 24;
labelServiceExecutionServiceId.Text = "Услуга:";
//
// labelServiceExecutionCompleteion
//
labelServiceExecutionCompleteion.AutoSize = true;
labelServiceExecutionCompleteion.Location = new Point(12, 95);
labelServiceExecutionCompleteion.Name = "labelServiceExecutionCompleteion";
labelServiceExecutionCompleteion.Size = new Size(94, 15);
labelServiceExecutionCompleteion.TabIndex = 27;
labelServiceExecutionCompleteion.Text = "Готовность в %:";
//
// numericUpDownContractPaymentAmount
//
numericUpDownContractPaymentAmount.Increment = new decimal(new int[] { 100000, 0, 0, 0 });
numericUpDownContractPaymentAmount.Location = new Point(169, 93);
numericUpDownContractPaymentAmount.Maximum = new decimal(new int[] { 1000000000, 0, 0, 0 });
numericUpDownContractPaymentAmount.Name = "numericUpDownContractPaymentAmount";
numericUpDownContractPaymentAmount.Size = new Size(202, 23);
numericUpDownContractPaymentAmount.TabIndex = 26;
//
// buttonCancel
//
buttonCancel.Location = new Point(12, 180);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(359, 23);
buttonCancel.TabIndex = 29;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// buttonSave
//
buttonSave.Location = new Point(12, 151);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(359, 23);
buttonSave.TabIndex = 28;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// FormServiceExecution
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(387, 214);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(labelServiceExecutionCompleteion);
Controls.Add(numericUpDownContractPaymentAmount);
Controls.Add(comboBoxServiceExecutionServiceId);
Controls.Add(labelServiceExecutionServiceId);
Controls.Add(comboBoxServiceExecutionContractId);
Controls.Add(labelServiceExecutionContractId);
Controls.Add(labelContractDeadline);
Controls.Add(comboBoxServiceExecutionExecutorId);
Controls.Add(labelServiceExecutionExecutorId);
Controls.Add(dateTimePickerContractDeadline);
Name = "FormServiceExecution";
StartPosition = FormStartPosition.CenterParent;
Text = "Выполнение услуги";
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelContractDeadline;
private ComboBox comboBoxServiceExecutionExecutorId;
private Label labelServiceExecutionExecutorId;
private DateTimePicker dateTimePickerContractDeadline;
private ComboBox comboBoxServiceExecutionContractId;
private Label labelServiceExecutionContractId;
private ComboBox comboBoxServiceExecutionServiceId;
private Label labelServiceExecutionServiceId;
private Label labelServiceExecutionCompleteion;
private NumericUpDown numericUpDownContractPaymentAmount;
private Button buttonCancel;
private Button buttonSave;
}
}

View File

@ -1,63 +0,0 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums;
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
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 PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormServiceExecution : Form
{
private readonly IServiceExecutionRepository _serviceExecutionRepository;
private int? _serviceExecutionId;
public int Id
{
set
{
try
{
var executor = _serviceExecutionRepository.ReadServiceExecutionById(value);
if (executor == null) throw new InvalidDataException(nameof(executor));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormServiceExecution(IServiceExecutionRepository serviceExecutionRepository, IContractRepository contractRepository,
IServiceRepository serviceRepository, IExecutorRepository executorRepository)
{
InitializeComponent();
_serviceExecutionRepository = serviceExecutionRepository ?? throw new ArgumentNullException(nameof(serviceExecutionRepository));
comboBoxServiceExecutionContractId.DataSource = contractRepository.ReadContracts();
comboBoxServiceExecutionContractId.DisplayMember = "Id";
comboBoxServiceExecutionServiceId.DataSource = serviceRepository.ReadServices();
comboBoxServiceExecutionServiceId.DisplayMember = "Id";
comboBoxServiceExecutionExecutorId.DataSource = executorRepository.ReadExecutors();
comboBoxServiceExecutionExecutorId.DisplayMember = "Name";
comboBoxServiceExecutionExecutorId.DisplayMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
Close();
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
}
}

View File

@ -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>

View File

@ -1,112 +0,0 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormServiceExecutions
{
/// <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()
{
dataGridViewData = new DataGridView();
panel = new Panel();
buttonUpd = new Button();
buttonAdd = new Button();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
panel.SuspendLayout();
SuspendLayout();
//
// dataGridViewData
//
dataGridViewData.AllowUserToAddRows = false;
dataGridViewData.AllowUserToDeleteRows = false;
dataGridViewData.AllowUserToResizeColumns = false;
dataGridViewData.AllowUserToResizeRows = false;
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewData.Dock = DockStyle.Fill;
dataGridViewData.Location = new Point(0, 0);
dataGridViewData.MultiSelect = false;
dataGridViewData.Name = "dataGridViewData";
dataGridViewData.ReadOnly = true;
dataGridViewData.RowHeadersVisible = false;
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewData.Size = new Size(677, 450);
dataGridViewData.TabIndex = 5;
//
// panel
//
panel.Controls.Add(buttonUpd);
panel.Controls.Add(buttonAdd);
panel.Dock = DockStyle.Right;
panel.Location = new Point(677, 0);
panel.Name = "panel";
panel.Size = new Size(123, 450);
panel.TabIndex = 4;
//
// buttonUpd
//
buttonUpd.BackgroundImage = Properties.Resources.icon_edit_button;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(16, 108);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(90, 90);
buttonUpd.TabIndex = 1;
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += ButtonUpd_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.icon_add_button;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(16, 12);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(90, 90);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// FormServiceExecutions
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
Controls.Add(panel);
Name = "FormServiceExecutions";
StartPosition = FormStartPosition.CenterParent;
Text = "Выполнение услуг";
Load += FormServiceExecutions_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
panel.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewData;
private Panel panel;
private Button buttonUpd;
private Button buttonAdd;
}
}

View File

@ -1,77 +0,0 @@
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
using Unity;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormServiceExecutions : Form
{
private readonly IUnityContainer _container;
private readonly IServiceExecutionRepository _serviceExecutionRepository;
public FormServiceExecutions(IUnityContainer container, IServiceExecutionRepository serviceExecutionRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentException(nameof(container));
_serviceExecutionRepository = serviceExecutionRepository ?? throw new ArgumentException(nameof(serviceExecutionRepository));
}
private void FormServiceExecutions_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<FormServiceExecution>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
return;
try
{
var form = _container.Resolve<FormServiceExecution>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _serviceExecutionRepository.ReadServiceExecutions();
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;
}
}
}

View File

@ -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>

View File

@ -1,5 +1,4 @@
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
using Unity;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms

View File

@ -23,10 +23,9 @@ namespace PIbd_23_Gutorov_I.A._IT_Company
var container = new UnityContainer();
container.RegisterType<IContractRepository, ContractRepository>();
container.RegisterType<ICustomerContractReviewRepository, CustomerContractReviewRepository>();
container.RegisterType<ICustomerExecutorReviewRepository, CustomerExecutorReviewRepository>();
container.RegisterType<ICustomerRepository, CustomerRepository>();
container.RegisterType<IExecutorRepository, ExecutorRepository>();
container.RegisterType<IServiceExecutionRepository, ServiceExecutionRepository>();
container.RegisterType<IServiceRepository, ServiceRepository>();
return container;

View File

@ -6,8 +6,6 @@ public interface IContractRepository
{
IEnumerable<Contract> ReadContracts(DateTime? dateFrom = null, DateTime? dateTo = null, int? customerId = null, int? executorId = null);
Contract ReadContractById(int id);
void CreateContract(Contract Contract);
void DeleteContract(int id);

View File

@ -1,12 +0,0 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories;
public interface ICustomerContractReviewRepository
{
IEnumerable<CustomerContractReview> ReadCustomerContractReviews(int? customerId = null);
CustomerContractReview ReadCustomerContractReviewById(int id);
void CreateCustomerContractReview(CustomerContractReview CustomerContractReview);
}

View File

@ -0,0 +1,12 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories;
public interface ICustomerExecutorReviewRepository
{
IEnumerable<CustomerExecutorReview> ReadCustomerExecutorReviews(int? customerId = null, int? executorId = null);
CustomerExecutorReview ReadCustomerExecutorReviewById(int id);
void CreateCustomerExecutorReview(CustomerExecutorReview CustomerContractReview);
}

View File

@ -1,14 +0,0 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories;
public interface IServiceExecutionRepository
{
IEnumerable<ServiceExecution> ReadServiceExecutions();
ServiceExecution ReadServiceExecutionById(int id);
void CreateServiceExecution(ServiceExecution ServiceExecution);
void UpdateServiceExecution(ServiceExecution ServiceExecution);
}

View File

@ -12,11 +12,6 @@ public class ContractRepository : IContractRepository
{
}
public Contract ReadContractById(int id)
{
return Contract.CreateEntity(0, 0, 0, Entities.Enums.ContractCategory.None, DateTime.Now, 0);
}
public IEnumerable<Contract> ReadContracts(DateTime? dateFrom = null, DateTime? dateTo = null, int? customerId = null, int? executorId = null)
{
return [];

View File

@ -1,20 +0,0 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
public class CustomerContractReviewRepository : ICustomerContractReviewRepository
{
public void CreateCustomerContractReview(CustomerContractReview CustomerContractReview)
{
}
public CustomerContractReview ReadCustomerContractReviewById(int id)
{
return CustomerContractReview.CreateElement(0, 0, 0, string.Empty, 0);
}
public IEnumerable<CustomerContractReview> ReadCustomerContractReviews(int? customerId = null)
{
return [];
}
}

View File

@ -0,0 +1,20 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
public class CustomerExecutorReviewRepository : ICustomerExecutorReviewRepository
{
public void CreateCustomerExecutorReview(CustomerExecutorReview CustomerContractReview)
{
}
public CustomerExecutorReview ReadCustomerExecutorReviewById(int id)
{
return CustomerExecutorReview.CreateElement(0, 0, 0, string.Empty, 0);
}
public IEnumerable<CustomerExecutorReview> ReadCustomerExecutorReviews(int? customerId = null, int? executorId = null)
{
return [];
}
}

View File

@ -1,24 +0,0 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
public class ServiceExecutionRepository : IServiceExecutionRepository
{
public void CreateServiceExecution(ServiceExecution ServiceExecution)
{
}
public ServiceExecution ReadServiceExecutionById(int id)
{
return ServiceExecution.CreateOperation(0, 0, 0, 0, 0, DateTime.Now);
}
public IEnumerable<ServiceExecution> ReadServiceExecutions()
{
return [];
}
public void UpdateServiceExecution(ServiceExecution ServiceExecution)
{
}
}