ПИбд-23. Гуторов И.А. Лабораторная работа 1 #1

Closed
vasmaae wants to merge 11 commits from LabWork_1 into main
61 changed files with 4166 additions and 50 deletions

View File

@ -0,0 +1,39 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums;
namespace PIbd_23_Gutorov_I.A._IT_Company.Entities;
public class Contract
{
public int Id { get; private set; }
public int CustomerID { get; private set; }
public int ExecutorID { get; private set; }
public ContractCategory Category { get; private set; }
public DateTime ConclusionDate { get; private set; }
public DateTime Deadline { get; private set; }
public int PaymentAmount { get; private set; }
public IEnumerable<Service> Services { get; private set; } = [];
public static Contract CreateEntity(int id, int customerID, int executorID,
ContractCategory category, DateTime deadline,
int paymentAmount, IEnumerable<Service> services)
{
return new Contract
{
Id = id,
CustomerID = customerID,
ExecutorID = executorID,
Category = category,
ConclusionDate = DateTime.Now,
Deadline = deadline,
PaymentAmount = paymentAmount,
Services = services
};
}
}

View File

@ -0,0 +1,23 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Entities;
public class Customer
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public string Contact { get; private set; } = string.Empty;
public string Address { get; private set; } = string.Empty;
public static Customer CreateEntity(int id, string name, string contact, string address)
{
return new Customer
{
Id = id,
Name = name ?? String.Empty,
Contact = contact ?? String.Empty,
Address = address ?? String.Empty
};
}
}

View File

@ -0,0 +1,26 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Entities;
public class CustomerExecutorReview
{
public int Id { get; private set; }
public int CustomerId { 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 CustomerExecutorReview CreateElement(int id, int customerId, int executorId, string review, int grade)
{
return new CustomerExecutorReview
{
Id = id,
CustomerId = customerId,
ExecutorId = executorId,
Review = review ?? String.Empty,
Grade = grade
};
}
}

View File

@ -0,0 +1,11 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums;
[Flags]
public enum ContractCategory
{
None = 0,
Support = 1,
Development = 2
}

View File

@ -0,0 +1,14 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums;
public enum ExecutorPost
{
None = 0,
Junior = 1,
Middle = 2,
Senior = 3,
TeamLead = 4
}

View File

@ -0,0 +1,22 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums;
namespace PIbd_23_Gutorov_I.A._IT_Company.Entities;
public class Executor
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public ExecutorPost Post { get; private set; }
public static Executor CreateEntity(int id, string name, ExecutorPost post)
{
return new Executor
{
Id = id,
Name = name ?? String.Empty,
Post = post
};
}
}

View File

@ -0,0 +1,17 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Entities;
public class Service
{
public int Id { get; private set; }
public string Description { get; private set; } = string.Empty;
public static Service CreateEntity(int id, string description)
{
return new Service
{
Id = id,
Description = description
};
}
}

View File

@ -0,0 +1,20 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Entities;
public class ServiceContract
{
public int Id { get; private set; }
public int ServiceId { get; private set; }
public int ContractId { get; private set; }
public static ServiceContract CreateElement(int id, int serviceId, int contractId)
{
return new ServiceContract
{
Id = id,
ContractId = contractId,
ServiceId = serviceId
};
}
}

View File

@ -1,39 +0,0 @@
namespace PIbd_23_Gutorov_I.A._IT_Company
{
partial class Form1
{
/// <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()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
}
#endregion
}
}

View File

@ -1,10 +0,0 @@
namespace PIbd_23_Gutorov_I.A._IT_Company
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,137 @@
namespace PIbd_23_Gutorov_I.A._IT_Company
{
partial class FormItCompany
{
/// <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()
{
menuStrip = new MenuStrip();
EntitiesToolStripMenuItem = new ToolStripMenuItem();
CustomersToolStripMenuItem = new ToolStripMenuItem();
ExecutorsToolStripMenuItem = new ToolStripMenuItem();
ServicesToolStripMenuItem = new ToolStripMenuItem();
OperationsToolStripMenuItem = new ToolStripMenuItem();
CustomerContractReviewsToolStripMenuItem = new ToolStripMenuItem();
ContractsToolStripMenuItem = new ToolStripMenuItem();
ReportsToolStripMenuItem = new ToolStripMenuItem();
menuStrip.SuspendLayout();
SuspendLayout();
//
// menuStrip
//
menuStrip.Items.AddRange(new ToolStripItem[] { EntitiesToolStripMenuItem, OperationsToolStripMenuItem, ReportsToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(734, 24);
menuStrip.TabIndex = 0;
menuStrip.Text = "menuStrip1";
//
// EntitiesToolStripMenuItem
//
EntitiesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CustomersToolStripMenuItem, ExecutorsToolStripMenuItem, ServicesToolStripMenuItem });
EntitiesToolStripMenuItem.Name = "EntitiesToolStripMenuItem";
EntitiesToolStripMenuItem.Size = new Size(94, 20);
EntitiesToolStripMenuItem.Text = "Справочники";
//
// CustomersToolStripMenuItem
//
CustomersToolStripMenuItem.Name = "CustomersToolStripMenuItem";
CustomersToolStripMenuItem.Size = new Size(180, 22);
CustomersToolStripMenuItem.Text = "Заказчики";
CustomersToolStripMenuItem.Click += CustomersToolStripMenuItem_Click;
//
// ExecutorsToolStripMenuItem
//
ExecutorsToolStripMenuItem.Name = "ExecutorsToolStripMenuItem";
ExecutorsToolStripMenuItem.Size = new Size(180, 22);
ExecutorsToolStripMenuItem.Text = "Исполнители";
ExecutorsToolStripMenuItem.Click += ExecutorsToolStripMenuItem_Click;
//
// ServicesToolStripMenuItem
//
ServicesToolStripMenuItem.Name = "ServicesToolStripMenuItem";
ServicesToolStripMenuItem.Size = new Size(180, 22);
ServicesToolStripMenuItem.Text = "Услуги";
ServicesToolStripMenuItem.Click += ServicesToolStripMenuItem_Click;
//
// OperationsToolStripMenuItem
//
OperationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CustomerContractReviewsToolStripMenuItem, ContractsToolStripMenuItem });
OperationsToolStripMenuItem.Name = "OperationsToolStripMenuItem";
OperationsToolStripMenuItem.Size = new Size(75, 20);
OperationsToolStripMenuItem.Text = "Операции";
//
// CustomerContractReviewsToolStripMenuItem
//
CustomerContractReviewsToolStripMenuItem.Name = "CustomerContractReviewsToolStripMenuItem";
CustomerContractReviewsToolStripMenuItem.Size = new Size(181, 22);
CustomerContractReviewsToolStripMenuItem.Text = "Отзывы заказчиков";
CustomerContractReviewsToolStripMenuItem.Click += CustomerContractReviewsToolStripMenuItem_Click;
//
// ContractsToolStripMenuItem
//
ContractsToolStripMenuItem.Name = "ContractsToolStripMenuItem";
ContractsToolStripMenuItem.Size = new Size(181, 22);
ContractsToolStripMenuItem.Text = "Контракты";
ContractsToolStripMenuItem.Click += ContractsToolStripMenuItem_Click;
//
// ReportsToolStripMenuItem
//
ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem";
ReportsToolStripMenuItem.Size = new Size(60, 20);
ReportsToolStripMenuItem.Text = "Отчеты";
//
// FormItCompany
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.modern_equipped_computer_lab;
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(734, 461);
Controls.Add(menuStrip);
MainMenuStrip = menuStrip;
Name = "FormItCompany";
StartPosition = FormStartPosition.CenterScreen;
Text = "IT-компания";
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStrip;
private ToolStripMenuItem EntitiesToolStripMenuItem;
private ToolStripMenuItem CustomersToolStripMenuItem;
private ToolStripMenuItem ExecutorsToolStripMenuItem;
private ToolStripMenuItem OperationsToolStripMenuItem;
private ToolStripMenuItem ReportsToolStripMenuItem;
private ToolStripMenuItem CustomerContractReviewsToolStripMenuItem;
private ToolStripMenuItem ContractsToolStripMenuItem;
private ToolStripMenuItem ServicesToolStripMenuItem;
}
}

View File

@ -0,0 +1,76 @@
using PIbd_23_Gutorov_I.A._IT_Company.Forms;
using Unity;
namespace PIbd_23_Gutorov_I.A._IT_Company
{
public partial class FormItCompany : Form
{
private readonly IUnityContainer _container;
public FormItCompany(IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
}
private void CustomersToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCustomers>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ExecutorsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormExecutors>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ContractsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormContracts>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void CustomerContractReviewsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCustomerExecutorReviews>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ServicesToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormServices>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@ -0,0 +1,123 @@
<?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>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,240 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormContract
{
/// <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()
{
checkedListBoxContractCategory = new CheckedListBox();
dateTimePickerContractDeadline = new DateTimePicker();
numericUpDownContractPaymentAmount = new NumericUpDown();
buttonCancel = new Button();
buttonSave = new Button();
labelContractCustomerId = new Label();
labelContractExecutorId = new Label();
labelContractCategory = new Label();
comboBoxContractCustomerId = new ComboBox();
comboBoxContractExecutorId = new ComboBox();
labelContractDeadline = new Label();
labelContractPaymentAmount = new Label();
dataGridViewServices = new DataGridView();
ColumnServiceDescription = new DataGridViewComboBoxColumn();
groupBox = new GroupBox();
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).BeginInit();
((System.ComponentModel.ISupportInitialize)dataGridViewServices).BeginInit();
groupBox.SuspendLayout();
SuspendLayout();
//
// checkedListBoxContractCategory
//
checkedListBoxContractCategory.FormattingEnabled = true;
checkedListBoxContractCategory.Location = new Point(169, 64);
checkedListBoxContractCategory.Name = "checkedListBoxContractCategory";
checkedListBoxContractCategory.Size = new Size(202, 40);
checkedListBoxContractCategory.TabIndex = 0;
//
// dateTimePickerContractDeadline
//
dateTimePickerContractDeadline.Location = new Point(169, 110);
dateTimePickerContractDeadline.Name = "dateTimePickerContractDeadline";
dateTimePickerContractDeadline.Size = new Size(202, 23);
dateTimePickerContractDeadline.TabIndex = 1;
//
// numericUpDownContractPaymentAmount
//
numericUpDownContractPaymentAmount.Increment = new decimal(new int[] { 100000, 0, 0, 0 });
numericUpDownContractPaymentAmount.Location = new Point(169, 139);
numericUpDownContractPaymentAmount.Maximum = new decimal(new int[] { 1000000000, 0, 0, 0 });
numericUpDownContractPaymentAmount.Name = "numericUpDownContractPaymentAmount";
numericUpDownContractPaymentAmount.Size = new Size(202, 23);
numericUpDownContractPaymentAmount.TabIndex = 2;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
buttonCancel.Location = new Point(12, 469);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(358, 23);
buttonCancel.TabIndex = 9;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
buttonSave.Location = new Point(12, 440);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(358, 23);
buttonSave.TabIndex = 8;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// labelContractCustomerId
//
labelContractCustomerId.AutoSize = true;
labelContractCustomerId.Location = new Point(12, 9);
labelContractCustomerId.Name = "labelContractCustomerId";
labelContractCustomerId.Size = new Size(60, 15);
labelContractCustomerId.TabIndex = 10;
labelContractCustomerId.Text = "Заказчик:";
//
// labelContractExecutorId
//
labelContractExecutorId.AutoSize = true;
labelContractExecutorId.Location = new Point(12, 38);
labelContractExecutorId.Name = "labelContractExecutorId";
labelContractExecutorId.Size = new Size(84, 15);
labelContractExecutorId.TabIndex = 11;
labelContractExecutorId.Text = "Исполнитель:";
//
// labelContractCategory
//
labelContractCategory.AutoSize = true;
labelContractCategory.Location = new Point(12, 64);
labelContractCategory.Name = "labelContractCategory";
labelContractCategory.Size = new Size(66, 15);
labelContractCategory.TabIndex = 12;
labelContractCategory.Text = "Категория:";
//
// comboBoxContractCustomerId
//
comboBoxContractCustomerId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxContractCustomerId.FormattingEnabled = true;
comboBoxContractCustomerId.Location = new Point(169, 6);
comboBoxContractCustomerId.Name = "comboBoxContractCustomerId";
comboBoxContractCustomerId.Size = new Size(202, 23);
comboBoxContractCustomerId.TabIndex = 13;
//
// comboBoxContractExecutorId
//
comboBoxContractExecutorId.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxContractExecutorId.FormattingEnabled = true;
comboBoxContractExecutorId.Location = new Point(169, 35);
comboBoxContractExecutorId.Name = "comboBoxContractExecutorId";
comboBoxContractExecutorId.Size = new Size(202, 23);
comboBoxContractExecutorId.TabIndex = 14;
//
// labelContractDeadline
//
labelContractDeadline.AutoSize = true;
labelContractDeadline.Location = new Point(12, 116);
labelContractDeadline.Name = "labelContractDeadline";
labelContractDeadline.Size = new Size(110, 15);
labelContractDeadline.TabIndex = 15;
labelContractDeadline.Text = "Срок выполнения:";
//
// labelContractPaymentAmount
//
labelContractPaymentAmount.AutoSize = true;
labelContractPaymentAmount.Location = new Point(12, 141);
labelContractPaymentAmount.Name = "labelContractPaymentAmount";
labelContractPaymentAmount.Size = new Size(97, 15);
labelContractPaymentAmount.TabIndex = 16;
labelContractPaymentAmount.Text = "Сумма платежа:";
//
// dataGridViewServices
//
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;
//
// ColumnServiceDescription
//
ColumnServiceDescription.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
ColumnServiceDescription.HeaderText = "Услуга";
ColumnServiceDescription.Name = "ColumnServiceDescription";
ColumnServiceDescription.Resizable = DataGridViewTriState.True;
ColumnServiceDescription.SortMode = DataGridViewColumnSortMode.Automatic;
//
// groupBox
//
groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
groupBox.Controls.Add(dataGridViewServices);
groupBox.Location = new Point(12, 168);
groupBox.Name = "groupBox";
groupBox.Size = new Size(358, 266);
groupBox.TabIndex = 18;
groupBox.TabStop = false;
groupBox.Text = "Услуги:";
//
// FormContract
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(382, 502);
Controls.Add(groupBox);
Controls.Add(labelContractPaymentAmount);
Controls.Add(labelContractDeadline);
Controls.Add(comboBoxContractExecutorId);
Controls.Add(comboBoxContractCustomerId);
Controls.Add(labelContractCategory);
Controls.Add(labelContractExecutorId);
Controls.Add(labelContractCustomerId);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(numericUpDownContractPaymentAmount);
Controls.Add(dateTimePickerContractDeadline);
Controls.Add(checkedListBoxContractCategory);
Name = "FormContract";
StartPosition = FormStartPosition.CenterParent;
Text = "Контракт";
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).EndInit();
((System.ComponentModel.ISupportInitialize)dataGridViewServices).EndInit();
groupBox.ResumeLayout(false);
ResumeLayout(false);
PerformLayout();
}
#endregion
private CheckedListBox checkedListBoxContractCategory;
private DateTimePicker dateTimePickerContractDeadline;
private NumericUpDown numericUpDownContractPaymentAmount;
private Button buttonCancel;
private Button buttonSave;
private Label labelContractCustomerId;
private Label labelContractExecutorId;
private Label labelContractCategory;
private ComboBox comboBoxContractCustomerId;
private ComboBox comboBoxContractExecutorId;
private Label labelContractDeadline;
private Label labelContractPaymentAmount;
private DataGridView dataGridViewServices;
private GroupBox groupBox;
private DataGridViewComboBoxColumn ColumnServiceDescription;
}
}

View File

@ -0,0 +1,83 @@
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;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormContract : Form
{
private readonly IContractRepository _contractRepository;
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.ValueMember = "Id";
comboBoxContractExecutorId.DataSource = executorRepository.ReadExecutors();
comboBoxContractExecutorId.DisplayMember = "Name";
comboBoxContractExecutorId.ValueMember = "Id";
ColumnServiceDescription.DataSource = serviceRepository.ReadServices();
ColumnServiceDescription.DisplayMember = "Description";
ColumnServiceDescription.ValueMember = "Id";
foreach (var elem in Enum.GetValues(typeof(ContractCategory)))
{
checkedListBoxContractCategory.Items.Add(elem);
}
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (checkedListBoxContractCategory.CheckedItems.Count == 0 ||
comboBoxContractCustomerId.SelectedIndex < 0 ||
comboBoxContractExecutorId.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
_contractRepository.CreateContract(CreateContract(0));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Contract CreateContract(int id)
{
ContractCategory contractCategory = ContractCategory.None;
foreach (var elem in checkedListBoxContractCategory.CheckedItems)
{
contractCategory |= (ContractCategory)elem;
}
return Contract.CreateEntity(id, (int)comboBoxContractCustomerId.SelectedValue!,
(int)comboBoxContractExecutorId.SelectedValue!, contractCategory,
dateTimePickerContractDeadline.Value, Convert.ToInt32(numericUpDownContractPaymentAmount.Value),
CreateListServicesFromDataGrid());
}
private List<Service> CreateListServicesFromDataGrid()
{
var list = new List<Service>();
foreach (DataGridViewRow row in dataGridViewServices.Rows)
if (row.Cells["ColumnServiceDescription"].Value != null)
list.Add(Service.CreateEntity(0, Convert.ToString(row.Cells["ColumnServiceDescription"].Value)!));
return list;
}
}
}

View File

@ -0,0 +1,123 @@
<?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>
<metadata name="ColumnServiceDescription.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,112 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormContracts
{
/// <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();
buttonDel = 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(buttonDel);
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;
//
// buttonDel
//
buttonDel.BackgroundImage = Properties.Resources.icon_remove_button;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(16, 108);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(90, 90);
buttonDel.TabIndex = 2;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += ButtonDel_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;
//
// FormContracts
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
Controls.Add(panel);
Name = "FormContracts";
StartPosition = FormStartPosition.CenterParent;
Text = "Контракты";
Load += FormContracts_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
panel.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewData;
private Panel panel;
private Button buttonDel;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,78 @@
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
using Unity;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormContracts : Form
{
private readonly IUnityContainer _container;
private readonly IContractRepository _contractRepository;
public FormContracts(IUnityContainer container, IContractRepository contractRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentException(nameof(container));
_contractRepository = contractRepository ?? throw new ArgumentException(nameof(contractRepository));
}
private void FormContracts_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<FormContract>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
return;
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
return;
try
{
_contractRepository.DeleteContract(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _contractRepository.ReadContracts();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridViewData.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

@ -0,0 +1,120 @@
<?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

@ -0,0 +1,140 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormCustomer
{
/// <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()
{
labelCustomerName = new Label();
labelCustomerContact = new Label();
labelCustomerAddress = new Label();
textBoxCustomerName = new TextBox();
textBoxCustomerContact = new TextBox();
textBoxCustomerAddress = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// labelCustomerName
//
labelCustomerName.AutoSize = true;
labelCustomerName.Location = new Point(12, 9);
labelCustomerName.Name = "labelCustomerName";
labelCustomerName.Size = new Size(34, 15);
labelCustomerName.TabIndex = 0;
labelCustomerName.Text = "Имя:";
//
// labelCustomerContact
//
labelCustomerContact.AutoSize = true;
labelCustomerContact.Location = new Point(12, 38);
labelCustomerContact.Name = "labelCustomerContact";
labelCustomerContact.Size = new Size(107, 15);
labelCustomerContact.TabIndex = 1;
labelCustomerContact.Text = "Контактная почта:";
//
// labelCustomerAddress
//
labelCustomerAddress.AutoSize = true;
labelCustomerAddress.Location = new Point(12, 67);
labelCustomerAddress.Name = "labelCustomerAddress";
labelCustomerAddress.Size = new Size(43, 15);
labelCustomerAddress.TabIndex = 2;
labelCustomerAddress.Text = "Адрес:";
//
// textBoxCustomerName
//
textBoxCustomerName.Location = new Point(125, 6);
textBoxCustomerName.Name = "textBoxCustomerName";
textBoxCustomerName.Size = new Size(168, 23);
textBoxCustomerName.TabIndex = 3;
//
// textBoxCustomerContact
//
textBoxCustomerContact.Location = new Point(125, 35);
textBoxCustomerContact.Name = "textBoxCustomerContact";
textBoxCustomerContact.Size = new Size(168, 23);
textBoxCustomerContact.TabIndex = 4;
//
// textBoxCustomerAddress
//
textBoxCustomerAddress.Location = new Point(125, 64);
textBoxCustomerAddress.Name = "textBoxCustomerAddress";
textBoxCustomerAddress.Size = new Size(168, 23);
textBoxCustomerAddress.TabIndex = 5;
//
// buttonSave
//
buttonSave.Location = new Point(12, 93);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(281, 23);
buttonSave.TabIndex = 6;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(12, 122);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(281, 23);
buttonCancel.TabIndex = 7;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// FormCustomer
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(309, 159);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxCustomerAddress);
Controls.Add(textBoxCustomerContact);
Controls.Add(textBoxCustomerName);
Controls.Add(labelCustomerAddress);
Controls.Add(labelCustomerContact);
Controls.Add(labelCustomerName);
Name = "FormCustomer";
StartPosition = FormStartPosition.CenterParent;
Text = "Заказчик";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelCustomerName;
private Label labelCustomerContact;
private Label labelCustomerAddress;
private TextBox textBoxCustomerName;
private TextBox textBoxCustomerContact;
private TextBox textBoxCustomerAddress;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,68 @@
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 FormCustomer : Form
{
private readonly ICustomerRepository _customerRepository;
private int? _customerId;
public int Id
{
set
{
try
{
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;
_customerId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormCustomer(ICustomerRepository customerRepository)
{
InitializeComponent();
_customerRepository = customerRepository ?? throw new ArgumentNullException(nameof(customerRepository));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrEmpty(textBoxCustomerName.Text) ||
string.IsNullOrEmpty(textBoxCustomerContact.Text) ||
string.IsNullOrEmpty(textBoxCustomerAddress.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_customerId.HasValue) _customerRepository.UpdateCustomer(CreateCustomer(_customerId.Value));
else _customerRepository.CreateCustomer(CreateCustomer(0));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Customer CreateCustomer(int id) => Customer.CreateEntity(
id, textBoxCustomerName.Text, textBoxCustomerContact.Text,
textBoxCustomerAddress.Text);
}
}

View File

@ -0,0 +1,120 @@
<?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

@ -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,58 @@
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.ValueMember = "Id";
comboBoxCustomerExecutorReviewExecutorId.DataSource = executorRepository.ReadExecutors();
comboBoxCustomerExecutorReviewExecutorId.DisplayMember = "Name";
comboBoxCustomerExecutorReviewExecutorId.ValueMember = "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(CreateCustomerExecutorReview(0));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private CustomerExecutorReview CreateCustomerExecutorReview(int id)
{
return CustomerExecutorReview.CreateElement(
id, (int)comboBoxCustomerExecutorReviewCustomerId.SelectedValue!,
(int)comboBoxCustomerExecutorReviewExecutorId.SelectedValue!,
richTextBoxCustomerExecutorReviewReview.Text,
Convert.ToInt32(numericUpDownCustomerExecutorReviewGrade.Value));
}
}
}

View File

@ -0,0 +1,120 @@
<?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

@ -0,0 +1,98 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormCustomerExecutorReviews
{
/// <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();
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(buttonAdd);
panel.Dock = DockStyle.Right;
panel.Location = new Point(677, 0);
panel.Name = "panel";
panel.Size = new Size(123, 450);
panel.TabIndex = 4;
//
// 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;
//
// FormCustomerContractReviews
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
Controls.Add(panel);
Name = "FormCustomerContractReviews";
StartPosition = FormStartPosition.CenterParent;
Text = "Отзывы заказчиков";
Load += FormCustomerExecutorReviews_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
panel.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewData;
private Panel panel;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,46 @@
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
using Unity;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormCustomerExecutorReviews : Form
{
private readonly IUnityContainer _container;
private readonly ICustomerExecutorReviewRepository _customerExecutorReviewRepository;
public FormCustomerExecutorReviews(IUnityContainer container, ICustomerExecutorReviewRepository customerExecutorReviewRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentException(nameof(container));
_customerExecutorReviewRepository = customerExecutorReviewRepository ?? throw new ArgumentException(nameof(customerExecutorReviewRepository));
}
private void FormCustomerExecutorReviews_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<FormCustomerExecutorReview>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _customerExecutorReviewRepository.ReadCustomerExecutorReviews();
}
}

View File

@ -0,0 +1,120 @@
<?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

@ -0,0 +1,126 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormCustomers
{
/// <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()
{
panel = new Panel();
buttonDel = new Button();
buttonUpd = new Button();
buttonAdd = new Button();
dataGridViewData = new DataGridView();
panel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
SuspendLayout();
//
// panel
//
panel.Controls.Add(buttonDel);
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 = 0;
//
// buttonDel
//
buttonDel.BackgroundImage = Properties.Resources.icon_remove_button;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(16, 204);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(90, 90);
buttonDel.TabIndex = 2;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += ButtonDel_Click;
//
// 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;
//
// 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 = 1;
//
// FormCustomers
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
Controls.Add(panel);
Name = "FormCustomers";
StartPosition = FormStartPosition.CenterParent;
Text = "Заказчики";
Load += FormCustomers_Load;
panel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel;
private Button buttonAdd;
private Button buttonDel;
private Button buttonUpd;
private DataGridView dataGridViewData;
}
}

View File

@ -0,0 +1,96 @@
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
using Unity;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormCustomers : Form
{
private readonly IUnityContainer _container;
private readonly ICustomerRepository _customerRepository;
public FormCustomers(IUnityContainer container, ICustomerRepository customerRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentException(nameof(container));
_customerRepository = customerRepository ?? throw new ArgumentException(nameof(customerRepository));
}
private void FormCustomers_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<FormCustomer>().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<FormCustomer>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
return;
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
return;
try
{
_customerRepository.DeleteCustomer(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _customerRepository.ReadCustomers();
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

@ -0,0 +1,120 @@
<?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

@ -0,0 +1,120 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormExecutor
{
/// <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()
{
comboBoxExecutorPost = new ComboBox();
LabelExecutorName = new Label();
labelExecutorPost = new Label();
textBoxExecutorName = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// comboBoxExecutorPost
//
comboBoxExecutorPost.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxExecutorPost.FormattingEnabled = true;
comboBoxExecutorPost.Location = new Point(101, 41);
comboBoxExecutorPost.Name = "comboBoxExecutorPost";
comboBoxExecutorPost.Size = new Size(168, 23);
comboBoxExecutorPost.TabIndex = 0;
//
// LabelExecutorName
//
LabelExecutorName.AutoSize = true;
LabelExecutorName.Location = new Point(12, 15);
LabelExecutorName.Name = "LabelExecutorName";
LabelExecutorName.Size = new Size(34, 15);
LabelExecutorName.TabIndex = 1;
LabelExecutorName.Text = "Имя:";
//
// labelExecutorPost
//
labelExecutorPost.AutoSize = true;
labelExecutorPost.Location = new Point(12, 44);
labelExecutorPost.Name = "labelExecutorPost";
labelExecutorPost.Size = new Size(72, 15);
labelExecutorPost.TabIndex = 2;
labelExecutorPost.Text = "Должность:";
//
// textBoxExecutorName
//
textBoxExecutorName.Location = new Point(101, 12);
textBoxExecutorName.Name = "textBoxExecutorName";
textBoxExecutorName.Size = new Size(168, 23);
textBoxExecutorName.TabIndex = 4;
//
// buttonSave
//
buttonSave.Location = new Point(12, 70);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(257, 23);
buttonSave.TabIndex = 7;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
buttonCancel.Location = new Point(12, 99);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(257, 23);
buttonCancel.TabIndex = 8;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// FormExecutor
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(281, 133);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxExecutorName);
Controls.Add(labelExecutorPost);
Controls.Add(LabelExecutorName);
Controls.Add(comboBoxExecutorPost);
Name = "FormExecutor";
StartPosition = FormStartPosition.CenterParent;
Text = "Исполнитель";
ResumeLayout(false);
PerformLayout();
}
#endregion
private ComboBox comboBoxExecutorPost;
private Label LabelExecutorName;
private Label labelExecutorPost;
private TextBox textBoxExecutorName;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,68 @@
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;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormExecutor : Form
{
private readonly IExecutorRepository _executorRepository;
private int? _executorId;
public int Id
{
set
{
try
{
var executor = _executorRepository.ReadExecutorById(value);
if (executor == null) throw new InvalidDataException(nameof(executor));
textBoxExecutorName.Text = executor.Name;
comboBoxExecutorPost.SelectedItem = executor.Post;
_executorId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormExecutor(IExecutorRepository executorRepository)
{
InitializeComponent();
_executorRepository = executorRepository ?? throw new ArgumentNullException(nameof(executorRepository));
comboBoxExecutorPost.DataSource = Enum.GetValues(typeof(ExecutorPost));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrEmpty(textBoxExecutorName.Text) ||
comboBoxExecutorPost.SelectedIndex < 1)
{
throw new Exception("Имеются незаполненные поля");
}
if (_executorId.HasValue) _executorRepository.UpdateExecutor(CreateExecutor(_executorId.Value));
else _executorRepository.CreateExecutor(CreateExecutor(0));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Executor CreateExecutor(int id) =>
Executor.CreateEntity(id, textBoxExecutorName.Text, (ExecutorPost)comboBoxExecutorPost.SelectedItem!);
}
}

View File

@ -0,0 +1,120 @@
<?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

@ -0,0 +1,126 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormExecutors
{
/// <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();
buttonDel = new Button();
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 = 3;
//
// panel
//
panel.Controls.Add(buttonDel);
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 = 2;
//
// buttonDel
//
buttonDel.BackgroundImage = Properties.Resources.icon_remove_button;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(16, 204);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(90, 90);
buttonDel.TabIndex = 2;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += ButtonDel_Click;
//
// 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;
//
// FormExecutors
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
Controls.Add(panel);
Name = "FormExecutors";
StartPosition = FormStartPosition.CenterParent;
Text = "Исполнители";
Load += FormExecutors_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
panel.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewData;
private Panel panel;
private Button buttonDel;
private Button buttonUpd;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,96 @@
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
using Unity;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormExecutors : Form
{
private readonly IUnityContainer _container;
private readonly IExecutorRepository _executorRepository;
public FormExecutors(IUnityContainer container, IExecutorRepository executorRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentException(nameof(container));
_executorRepository = executorRepository ?? throw new ArgumentException(nameof(executorRepository));
}
private void FormExecutors_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<FormExecutor>().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<FormExecutor>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
return;
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
return;
try
{
_executorRepository.DeleteExecutor(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _executorRepository.ReadExecutors();
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

@ -0,0 +1,120 @@
<?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

@ -0,0 +1,96 @@
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormService
{
/// <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()
{
labelServiceDescription = new Label();
richTextBoxServiceDescription = new RichTextBox();
buttonCancel = new Button();
buttonSave = new Button();
SuspendLayout();
//
// labelServiceDescription
//
labelServiceDescription.AutoSize = true;
labelServiceDescription.Location = new Point(16, 15);
labelServiceDescription.Name = "labelServiceDescription";
labelServiceDescription.Size = new Size(65, 15);
labelServiceDescription.TabIndex = 30;
labelServiceDescription.Text = "Описание:";
//
// richTextBoxServiceDescription
//
richTextBoxServiceDescription.Location = new Point(173, 12);
richTextBoxServiceDescription.Name = "richTextBoxServiceDescription";
richTextBoxServiceDescription.Size = new Size(202, 96);
richTextBoxServiceDescription.TabIndex = 29;
richTextBoxServiceDescription.Text = "";
//
// buttonCancel
//
buttonCancel.Location = new Point(16, 143);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(359, 23);
buttonCancel.TabIndex = 32;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// buttonSave
//
buttonSave.Location = new Point(16, 114);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(359, 23);
buttonSave.TabIndex = 31;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// FormService
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(387, 181);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(labelServiceDescription);
Controls.Add(richTextBoxServiceDescription);
Name = "FormService";
StartPosition = FormStartPosition.CenterParent;
Text = "Услуга";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelServiceDescription;
private RichTextBox richTextBoxServiceDescription;
private Button buttonCancel;
private Button buttonSave;
}
}

View File

@ -0,0 +1,58 @@
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 FormService : Form
{
private readonly IServiceRepository _serviceRepository;
private int? _serviceId;
public int Id
{
set
{
try
{
var service = _serviceRepository.ReadServiceById(value);
if (service == null) throw new InvalidDataException(nameof(service));
richTextBoxServiceDescription.Text = service.Description;
_serviceId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormService(IServiceRepository serviceRepository)
{
InitializeComponent();
_serviceRepository = serviceRepository ?? throw new ArgumentNullException(nameof(serviceRepository));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrEmpty(richTextBoxServiceDescription.Text))
throw new Exception("Имеются незаполненные поля");
if (_serviceId.HasValue) _serviceRepository.UpdateService(Service.CreateEntity(_serviceId.Value, richTextBoxServiceDescription.Text));
else _serviceRepository.CreateService(Service.CreateEntity(0, richTextBoxServiceDescription.Text));
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,130 @@
using static System.Net.Mime.MediaTypeNames;
using System.Windows.Forms;
using System.Xml.Linq;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
partial class FormServices
{
/// <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();
buttonDel = new Button();
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(buttonDel);
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;
//
// buttonDel
//
buttonDel.BackgroundImage = Properties.Resources.icon_remove_button;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(16, 204);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(90, 90);
buttonDel.TabIndex = 2;
buttonDel.UseVisualStyleBackColor = true;
buttonDel.Click += ButtonDel_Click;
//
// 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;
//
// FormServices
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
Controls.Add(panel);
Name = "FormServices";
StartPosition = FormStartPosition.CenterParent;
Text = "Услуги";
Load += FormServices_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
panel.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewData;
private Panel panel;
private Button buttonDel;
private Button buttonUpd;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,96 @@
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
using Unity;
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
{
public partial class FormServices : Form
{
private readonly IUnityContainer _container;
private readonly IServiceRepository _serviceRepository;
public FormServices(IUnityContainer container, IServiceRepository serviceRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentException(nameof(container));
_serviceRepository = serviceRepository ?? throw new ArgumentException(nameof(serviceRepository));
}
private void FormServices_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<FormService>().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<FormService>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
return;
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
return;
try
{
_serviceRepository.DeleteService(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _serviceRepository.ReadServices();
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

@ -0,0 +1,120 @@
<?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

@ -9,4 +9,23 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -1,3 +1,7 @@
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
{
internal static class Program
@ -11,7 +15,20 @@ namespace PIbd_23_Gutorov_I.A._IT_Company
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(CreateContainer().Resolve<FormItCompany>());
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<IContractRepository, ContractRepository>();
container.RegisterType<ICustomerExecutorReviewRepository, CustomerExecutorReviewRepository>();
container.RegisterType<ICustomerRepository, CustomerRepository>();
container.RegisterType<IExecutorRepository, ExecutorRepository>();
container.RegisterType<IServiceRepository, ServiceRepository>();
return container;
}
}
}

View File

@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PIbd_23_Gutorov_I.A._IT_Company.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PIbd_23_Gutorov_I.A._IT_Company.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icon_add_button {
get {
object obj = ResourceManager.GetObject("icon-add-button", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icon_edit_button {
get {
object obj = ResourceManager.GetObject("icon-edit-button", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icon_remove_button {
get {
object obj = ResourceManager.GetObject("icon-remove-button", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap modern_equipped_computer_lab {
get {
object obj = ResourceManager.GetObject("modern-equipped-computer-lab", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,133 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="modern-equipped-computer-lab" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\modern-equipped-computer-lab.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-add-button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-add-button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-edit-button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-edit-button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-remove-button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-remove-button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

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 IContractRepository
{
IEnumerable<Contract> ReadContracts(DateTime? dateFrom = null, DateTime? dateTo = null, int? customerId = null, int? executorId = null);
void CreateContract(Contract contract);
void DeleteContract(int id);
}

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

@ -0,0 +1,16 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories;
public interface ICustomerRepository
{
IEnumerable<Customer> ReadCustomers();
Customer ReadCustomerById(int id);
void CreateCustomer(Customer customer);
void UpdateCustomer(Customer customer);
void DeleteCustomer(int id);
}

View File

@ -0,0 +1,16 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories;
public interface IExecutorRepository
{
IEnumerable<Executor> ReadExecutors();
Executor ReadExecutorById(int id);
void CreateExecutor(Executor executor);
void UpdateExecutor(Executor executor);
void DeleteExecutor(int id);
}

View File

@ -0,0 +1,16 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories;
public interface IServiceRepository
{
IEnumerable<Service> ReadServices();
Service ReadServiceById(int id);
void CreateService(Service service);
void UpdateService(Service service);
void DeleteService(int id);
}

View File

@ -0,0 +1,19 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
public class ContractRepository : IContractRepository
{
public void CreateContract(Contract contract)
{
}
public void DeleteContract(int id)
{
}
public IEnumerable<Contract> ReadContracts(DateTime? dateFrom = null, DateTime? dateTo = null, int? customerId = null, int? executorId = 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

@ -0,0 +1,28 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
public class CustomerRepository : ICustomerRepository
{
public void CreateCustomer(Customer customer)
{
}
public void DeleteCustomer(int id)
{
}
public Customer ReadCustomerById(int id)
{
return Customer.CreateEntity(0, string.Empty, string.Empty, string.Empty);
}
public IEnumerable<Customer> ReadCustomers()
{
return [];
}
public void UpdateCustomer(Customer customer)
{
}
}

View File

@ -0,0 +1,28 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
public class ExecutorRepository : IExecutorRepository
{
public void CreateExecutor(Executor executor)
{
}
public void DeleteExecutor(int id)
{
}
public Executor ReadExecutorById(int id)
{
return Executor.CreateEntity(0, string.Empty, Entities.Enums.ExecutorPost.None);
}
public IEnumerable<Executor> ReadExecutors()
{
return [];
}
public void UpdateExecutor(Executor executor)
{
}
}

View File

@ -0,0 +1,28 @@
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
namespace PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
internal class ServiceRepository : IServiceRepository
{
public void CreateService(Service service)
{
}
public void DeleteService(int id)
{
}
public Service ReadServiceById(int id)
{
return Service.CreateEntity(0, string.Empty);
}
public IEnumerable<Service> ReadServices()
{
return [];
}
public void UpdateService(Service service)
{
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 MiB