add all forms, fixed issues
This commit is contained in:
parent
e5f4eda60a
commit
780993b244
@ -30,14 +30,14 @@
|
|||||||
{
|
{
|
||||||
menuStrip = new MenuStrip();
|
menuStrip = new MenuStrip();
|
||||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
заказчикиToolStripMenuItem = new ToolStripMenuItem();
|
CustomersToolStripMenuItem = new ToolStripMenuItem();
|
||||||
исполнителиToolStripMenuItem = new ToolStripMenuItem();
|
ExecutorsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
услугиToolStripMenuItem = new ToolStripMenuItem();
|
ServicesToolStripMenuItem = new ToolStripMenuItem();
|
||||||
контрактыToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||||
выполнениеУслугиToolStripMenuItem = new ToolStripMenuItem();
|
CustomerContractReviewsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
отзывыКлиентовToolStripMenuItem = new ToolStripMenuItem();
|
контрактыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
выполнениеУслугToolStripMenuItem = new ToolStripMenuItem();
|
||||||
menuStrip.SuspendLayout();
|
menuStrip.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -52,53 +52,52 @@
|
|||||||
//
|
//
|
||||||
// справочникиToolStripMenuItem
|
// справочникиToolStripMenuItem
|
||||||
//
|
//
|
||||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { заказчикиToolStripMenuItem, исполнителиToolStripMenuItem, услугиToolStripMenuItem, контрактыToolStripMenuItem });
|
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CustomersToolStripMenuItem, ExecutorsToolStripMenuItem, ServicesToolStripMenuItem });
|
||||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||||
справочникиToolStripMenuItem.Text = "Справочники";
|
справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
//
|
//
|
||||||
// заказчикиToolStripMenuItem
|
// CustomersToolStripMenuItem
|
||||||
//
|
//
|
||||||
заказчикиToolStripMenuItem.Name = "заказчикиToolStripMenuItem";
|
CustomersToolStripMenuItem.Name = "CustomersToolStripMenuItem";
|
||||||
заказчикиToolStripMenuItem.Size = new Size(149, 22);
|
CustomersToolStripMenuItem.Size = new Size(149, 22);
|
||||||
заказчикиToolStripMenuItem.Text = "Заказчики";
|
CustomersToolStripMenuItem.Text = "Заказчики";
|
||||||
|
CustomersToolStripMenuItem.Click += CustomersToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// исполнителиToolStripMenuItem
|
// ExecutorsToolStripMenuItem
|
||||||
//
|
//
|
||||||
исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem";
|
ExecutorsToolStripMenuItem.Name = "ExecutorsToolStripMenuItem";
|
||||||
исполнителиToolStripMenuItem.Size = new Size(149, 22);
|
ExecutorsToolStripMenuItem.Size = new Size(149, 22);
|
||||||
исполнителиToolStripMenuItem.Text = "Исполнители";
|
ExecutorsToolStripMenuItem.Text = "Исполнители";
|
||||||
|
ExecutorsToolStripMenuItem.Click += ExecutorsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// услугиToolStripMenuItem
|
// ServicesToolStripMenuItem
|
||||||
//
|
//
|
||||||
услугиToolStripMenuItem.Name = "услугиToolStripMenuItem";
|
ServicesToolStripMenuItem.Name = "ServicesToolStripMenuItem";
|
||||||
услугиToolStripMenuItem.Size = new Size(149, 22);
|
ServicesToolStripMenuItem.Size = new Size(149, 22);
|
||||||
услугиToolStripMenuItem.Text = "Услуги";
|
ServicesToolStripMenuItem.Text = "Услуги";
|
||||||
//
|
ServicesToolStripMenuItem.Click += ServicesToolStripMenuItem_Click;
|
||||||
// контрактыToolStripMenuItem
|
|
||||||
//
|
|
||||||
контрактыToolStripMenuItem.Name = "контрактыToolStripMenuItem";
|
|
||||||
контрактыToolStripMenuItem.Size = new Size(149, 22);
|
|
||||||
контрактыToolStripMenuItem.Text = "Контракты";
|
|
||||||
//
|
//
|
||||||
// операцииToolStripMenuItem
|
// операцииToolStripMenuItem
|
||||||
//
|
//
|
||||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { выполнениеУслугиToolStripMenuItem, отзывыКлиентовToolStripMenuItem });
|
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CustomerContractReviewsToolStripMenuItem, контрактыToolStripMenuItem, выполнениеУслугToolStripMenuItem });
|
||||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||||
операцииToolStripMenuItem.Size = new Size(75, 20);
|
операцииToolStripMenuItem.Size = new Size(75, 20);
|
||||||
операцииToolStripMenuItem.Text = "Операции";
|
операцииToolStripMenuItem.Text = "Операции";
|
||||||
//
|
//
|
||||||
// выполнениеУслугиToolStripMenuItem
|
// CustomerContractReviewsToolStripMenuItem
|
||||||
//
|
//
|
||||||
выполнениеУслугиToolStripMenuItem.Name = "выполнениеУслугиToolStripMenuItem";
|
CustomerContractReviewsToolStripMenuItem.Name = "CustomerContractReviewsToolStripMenuItem";
|
||||||
выполнениеУслугиToolStripMenuItem.Size = new Size(184, 22);
|
CustomerContractReviewsToolStripMenuItem.Size = new Size(181, 22);
|
||||||
выполнениеУслугиToolStripMenuItem.Text = "Выполнение услуги";
|
CustomerContractReviewsToolStripMenuItem.Text = "Отзывы заказчиков";
|
||||||
|
CustomerContractReviewsToolStripMenuItem.Click += CustomerContractReviewsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// отзывыКлиентовToolStripMenuItem
|
// контрактыToolStripMenuItem
|
||||||
//
|
//
|
||||||
отзывыКлиентовToolStripMenuItem.Name = "отзывыКлиентовToolStripMenuItem";
|
контрактыToolStripMenuItem.Name = "контрактыToolStripMenuItem";
|
||||||
отзывыКлиентовToolStripMenuItem.Size = new Size(184, 22);
|
контрактыToolStripMenuItem.Size = new Size(181, 22);
|
||||||
отзывыКлиентовToolStripMenuItem.Text = "Отзывы заказчиков";
|
контрактыToolStripMenuItem.Text = "Контракты";
|
||||||
|
контрактыToolStripMenuItem.Click += ContractsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// отчетыToolStripMenuItem
|
// отчетыToolStripMenuItem
|
||||||
//
|
//
|
||||||
@ -106,6 +105,13 @@
|
|||||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
||||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||||
//
|
//
|
||||||
|
// выполнениеУслугToolStripMenuItem
|
||||||
|
//
|
||||||
|
выполнениеУслугToolStripMenuItem.Name = "выполнениеУслугToolStripMenuItem";
|
||||||
|
выполнениеУслугToolStripMenuItem.Size = new Size(181, 22);
|
||||||
|
выполнениеУслугToolStripMenuItem.Text = "Выполнение услуг";
|
||||||
|
выполнениеУслугToolStripMenuItem.Click += ServiceExecutionsToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// FormItCompany
|
// FormItCompany
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
@ -128,13 +134,13 @@
|
|||||||
|
|
||||||
private MenuStrip menuStrip;
|
private MenuStrip menuStrip;
|
||||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||||
private ToolStripMenuItem заказчикиToolStripMenuItem;
|
private ToolStripMenuItem CustomersToolStripMenuItem;
|
||||||
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
private ToolStripMenuItem ExecutorsToolStripMenuItem;
|
||||||
private ToolStripMenuItem услугиToolStripMenuItem;
|
private ToolStripMenuItem ServicesToolStripMenuItem;
|
||||||
private ToolStripMenuItem контрактыToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
private ToolStripMenuItem операцииToolStripMenuItem;
|
||||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||||
private ToolStripMenuItem выполнениеУслугиToolStripMenuItem;
|
private ToolStripMenuItem CustomerContractReviewsToolStripMenuItem;
|
||||||
private ToolStripMenuItem отзывыКлиентовToolStripMenuItem;
|
private ToolStripMenuItem контрактыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem выполнениеУслугToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,89 @@
|
|||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Forms;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
namespace PIbd_23_Gutorov_I.A._IT_Company
|
namespace PIbd_23_Gutorov_I.A._IT_Company
|
||||||
{
|
{
|
||||||
public partial class FormItCompany : Form
|
public partial class FormItCompany : Form
|
||||||
{
|
{
|
||||||
public FormItCompany()
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
public FormItCompany(IUnityContainer container)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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 ServicesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormServices>().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<FormCustomerContractReviews>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ServiceExecutionsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormServiceExecutions>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,11 @@
|
|||||||
comboBoxContractExecutorId = new ComboBox();
|
comboBoxContractExecutorId = new ComboBox();
|
||||||
labelContractDeadline = new Label();
|
labelContractDeadline = new Label();
|
||||||
labelContractPaymentAmount = new Label();
|
labelContractPaymentAmount = new Label();
|
||||||
|
dataGridViewServices = new DataGridView();
|
||||||
|
groupBox = new GroupBox();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewServices).BeginInit();
|
||||||
|
groupBox.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// checkedListBoxContractCategory
|
// checkedListBoxContractCategory
|
||||||
@ -60,14 +64,16 @@
|
|||||||
//
|
//
|
||||||
// numericUpDownContractPaymentAmount
|
// numericUpDownContractPaymentAmount
|
||||||
//
|
//
|
||||||
|
numericUpDownContractPaymentAmount.Increment = new decimal(new int[] { 100000, 0, 0, 0 });
|
||||||
numericUpDownContractPaymentAmount.Location = new Point(169, 139);
|
numericUpDownContractPaymentAmount.Location = new Point(169, 139);
|
||||||
|
numericUpDownContractPaymentAmount.Maximum = new decimal(new int[] { 1000000000, 0, 0, 0 });
|
||||||
numericUpDownContractPaymentAmount.Name = "numericUpDownContractPaymentAmount";
|
numericUpDownContractPaymentAmount.Name = "numericUpDownContractPaymentAmount";
|
||||||
numericUpDownContractPaymentAmount.Size = new Size(202, 23);
|
numericUpDownContractPaymentAmount.Size = new Size(202, 23);
|
||||||
numericUpDownContractPaymentAmount.TabIndex = 2;
|
numericUpDownContractPaymentAmount.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
buttonCancel.Location = new Point(12, 197);
|
buttonCancel.Location = new Point(12, 469);
|
||||||
buttonCancel.Name = "buttonCancel";
|
buttonCancel.Name = "buttonCancel";
|
||||||
buttonCancel.Size = new Size(358, 23);
|
buttonCancel.Size = new Size(358, 23);
|
||||||
buttonCancel.TabIndex = 9;
|
buttonCancel.TabIndex = 9;
|
||||||
@ -77,7 +83,7 @@
|
|||||||
//
|
//
|
||||||
// buttonSave
|
// buttonSave
|
||||||
//
|
//
|
||||||
buttonSave.Location = new Point(12, 168);
|
buttonSave.Location = new Point(12, 440);
|
||||||
buttonSave.Name = "buttonSave";
|
buttonSave.Name = "buttonSave";
|
||||||
buttonSave.Size = new Size(358, 23);
|
buttonSave.Size = new Size(358, 23);
|
||||||
buttonSave.TabIndex = 8;
|
buttonSave.TabIndex = 8;
|
||||||
@ -148,11 +154,32 @@
|
|||||||
labelContractPaymentAmount.TabIndex = 16;
|
labelContractPaymentAmount.TabIndex = 16;
|
||||||
labelContractPaymentAmount.Text = "Сумма платежа:";
|
labelContractPaymentAmount.Text = "Сумма платежа:";
|
||||||
//
|
//
|
||||||
|
// dataGridViewServices
|
||||||
|
//
|
||||||
|
dataGridViewServices.AllowUserToDeleteRows = false;
|
||||||
|
dataGridViewServices.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewServices.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewServices.Location = new Point(3, 19);
|
||||||
|
dataGridViewServices.Name = "dataGridViewServices";
|
||||||
|
dataGridViewServices.Size = new Size(352, 244);
|
||||||
|
dataGridViewServices.TabIndex = 17;
|
||||||
|
//
|
||||||
|
// groupBox
|
||||||
|
//
|
||||||
|
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
|
// FormContract
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(382, 231);
|
ClientSize = new Size(382, 502);
|
||||||
|
Controls.Add(groupBox);
|
||||||
Controls.Add(labelContractPaymentAmount);
|
Controls.Add(labelContractPaymentAmount);
|
||||||
Controls.Add(labelContractDeadline);
|
Controls.Add(labelContractDeadline);
|
||||||
Controls.Add(comboBoxContractExecutorId);
|
Controls.Add(comboBoxContractExecutorId);
|
||||||
@ -166,8 +193,11 @@
|
|||||||
Controls.Add(dateTimePickerContractDeadline);
|
Controls.Add(dateTimePickerContractDeadline);
|
||||||
Controls.Add(checkedListBoxContractCategory);
|
Controls.Add(checkedListBoxContractCategory);
|
||||||
Name = "FormContract";
|
Name = "FormContract";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
Text = "Контракт";
|
Text = "Контракт";
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewServices).EndInit();
|
||||||
|
groupBox.ResumeLayout(false);
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@ -186,5 +216,7 @@
|
|||||||
private ComboBox comboBoxContractExecutorId;
|
private ComboBox comboBoxContractExecutorId;
|
||||||
private Label labelContractDeadline;
|
private Label labelContractDeadline;
|
||||||
private Label labelContractPaymentAmount;
|
private Label labelContractPaymentAmount;
|
||||||
|
private DataGridView dataGridViewServices;
|
||||||
|
private GroupBox groupBox;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,10 +27,11 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dateTimePickerContractDeadline.Value = contract.Deadline;
|
dateTimePickerContractDeadline.Value = contract.Deadline;
|
||||||
numericUpDownContractPaymentAmount.Value = contract.PaymentAmount;
|
numericUpDownContractPaymentAmount.Value = contract.PaymentAmount;
|
||||||
_contractId = value;
|
_contractId = value;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -40,11 +41,18 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public FormContract(IContractRepository contractRepository)
|
public FormContract(IContractRepository contractRepository, ICustomerRepository customerRepository, IExecutorRepository executorRepository)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_contractRepository = contractRepository ?? throw new ArgumentNullException(nameof(contractRepository));
|
_contractRepository = contractRepository ?? throw new ArgumentNullException(nameof(contractRepository));
|
||||||
|
|
||||||
|
comboBoxContractCustomerId.DataSource = customerRepository.ReadCustomers();
|
||||||
|
comboBoxContractCustomerId.DisplayMember = "Id";
|
||||||
|
|
||||||
|
comboBoxContractExecutorId.DataSource = executorRepository.ReadExecutors();
|
||||||
|
comboBoxContractExecutorId.DisplayMember = "Name";
|
||||||
|
comboBoxContractExecutorId.DisplayMember = "Id";
|
||||||
|
|
||||||
foreach (var elem in Enum.GetValues(typeof(ContractCategory)))
|
foreach (var elem in Enum.GetValues(typeof(ContractCategory)))
|
||||||
{
|
{
|
||||||
checkedListBoxContractCategory.Items.Add(elem);
|
checkedListBoxContractCategory.Items.Add(elem);
|
||||||
@ -55,15 +63,16 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(textBoxCustomerName.Text) ||
|
if (checkedListBoxContractCategory.CheckedItems.Count == 0 ||
|
||||||
string.IsNullOrEmpty(textBoxCustomerContact.Text) ||
|
comboBoxContractCustomerId.SelectedIndex < 0 ||
|
||||||
string.IsNullOrEmpty(textBoxCustomerAddress.Text))
|
comboBoxContractExecutorId.SelectedIndex < 0)
|
||||||
{
|
{
|
||||||
throw new Exception("Имеются незаполненные поля");
|
throw new Exception("Имеются незаполненные поля");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_contractId.HasValue) _contractRepository.UpdateContract(CreateContract(_contractId.Value));
|
_contractRepository.CreateContract(CreateContract(0));
|
||||||
else _contractRepository.UpdateContract(CreateContract(0));
|
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -81,7 +90,8 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
|||||||
contractCategory |= (ContractCategory)elem;
|
contractCategory |= (ContractCategory)elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Contract.CreateEntity(id)
|
return Contract.CreateEntity(id, (int)comboBoxContractCustomerId.SelectedValue!, (int)comboBoxContractExecutorId.SelectedValue!,
|
||||||
|
contractCategory, dateTimePickerContractDeadline.Value, Convert.ToInt32(numericUpDownContractPaymentAmount.Value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
112
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.Designer.cs
generated
Normal file
112
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
78
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.cs
Normal file
78
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.resx
Normal file
120
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormContracts.resx
Normal 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>
|
@ -50,6 +50,8 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
|||||||
|
|
||||||
if (_customerId.HasValue) _customerRepository.UpdateCustomer(CreateCustomer(_customerId.Value));
|
if (_customerId.HasValue) _customerRepository.UpdateCustomer(CreateCustomer(_customerId.Value));
|
||||||
else _customerRepository.UpdateCustomer(CreateCustomer(0));
|
else _customerRepository.UpdateCustomer(CreateCustomer(0));
|
||||||
|
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
180
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReview.Designer.cs
generated
Normal file
180
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReview.Designer.cs
generated
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
||||||
|
{
|
||||||
|
partial class FormCustomerContractReview
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
labelCustomerContractReviewCustomerId = new Label();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSave = new Button();
|
||||||
|
richTextBoxCustomerContractReviewReview = new RichTextBox();
|
||||||
|
labelCustomerContractReviewReview = new Label();
|
||||||
|
numericUpDownCustomerContractReviewGrade = new NumericUpDown();
|
||||||
|
comboBoxCustomerContractReviewCustomerId = new ComboBox();
|
||||||
|
comboBoxCustomerContractReviewContractId = new ComboBox();
|
||||||
|
labelCustomerContractReviewContractId = new Label();
|
||||||
|
labelCustomerContractReviewGrade = new Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownCustomerContractReviewGrade).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelCustomerContractReviewCustomerId
|
||||||
|
//
|
||||||
|
labelCustomerContractReviewCustomerId.AutoSize = true;
|
||||||
|
labelCustomerContractReviewCustomerId.Location = new Point(12, 9);
|
||||||
|
labelCustomerContractReviewCustomerId.Name = "labelCustomerContractReviewCustomerId";
|
||||||
|
labelCustomerContractReviewCustomerId.Size = new Size(60, 15);
|
||||||
|
labelCustomerContractReviewCustomerId.TabIndex = 22;
|
||||||
|
labelCustomerContractReviewCustomerId.Text = "Заказчик:";
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(12, 224);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(358, 23);
|
||||||
|
buttonCancel.TabIndex = 21;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(12, 195);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(358, 23);
|
||||||
|
buttonSave.TabIndex = 20;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// richTextBoxCustomerContractReviewReview
|
||||||
|
//
|
||||||
|
richTextBoxCustomerContractReviewReview.Location = new Point(169, 64);
|
||||||
|
richTextBoxCustomerContractReviewReview.Name = "richTextBoxCustomerContractReviewReview";
|
||||||
|
richTextBoxCustomerContractReviewReview.Size = new Size(202, 96);
|
||||||
|
richTextBoxCustomerContractReviewReview.TabIndex = 27;
|
||||||
|
richTextBoxCustomerContractReviewReview.Text = "";
|
||||||
|
//
|
||||||
|
// labelCustomerContractReviewReview
|
||||||
|
//
|
||||||
|
labelCustomerContractReviewReview.AutoSize = true;
|
||||||
|
labelCustomerContractReviewReview.Location = new Point(12, 67);
|
||||||
|
labelCustomerContractReviewReview.Name = "labelCustomerContractReviewReview";
|
||||||
|
labelCustomerContractReviewReview.Size = new Size(44, 15);
|
||||||
|
labelCustomerContractReviewReview.TabIndex = 28;
|
||||||
|
labelCustomerContractReviewReview.Text = "Отзыв:";
|
||||||
|
//
|
||||||
|
// numericUpDownCustomerContractReviewGrade
|
||||||
|
//
|
||||||
|
numericUpDownCustomerContractReviewGrade.Location = new Point(169, 166);
|
||||||
|
numericUpDownCustomerContractReviewGrade.Maximum = new decimal(new int[] { 5, 0, 0, 0 });
|
||||||
|
numericUpDownCustomerContractReviewGrade.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
numericUpDownCustomerContractReviewGrade.Name = "numericUpDownCustomerContractReviewGrade";
|
||||||
|
numericUpDownCustomerContractReviewGrade.Size = new Size(201, 23);
|
||||||
|
numericUpDownCustomerContractReviewGrade.TabIndex = 29;
|
||||||
|
numericUpDownCustomerContractReviewGrade.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// comboBoxCustomerContractReviewCustomerId
|
||||||
|
//
|
||||||
|
comboBoxCustomerContractReviewCustomerId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxCustomerContractReviewCustomerId.FormattingEnabled = true;
|
||||||
|
comboBoxCustomerContractReviewCustomerId.Location = new Point(169, 6);
|
||||||
|
comboBoxCustomerContractReviewCustomerId.Name = "comboBoxCustomerContractReviewCustomerId";
|
||||||
|
comboBoxCustomerContractReviewCustomerId.Size = new Size(202, 23);
|
||||||
|
comboBoxCustomerContractReviewCustomerId.TabIndex = 30;
|
||||||
|
//
|
||||||
|
// comboBoxCustomerContractReviewContractId
|
||||||
|
//
|
||||||
|
comboBoxCustomerContractReviewContractId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxCustomerContractReviewContractId.FormattingEnabled = true;
|
||||||
|
comboBoxCustomerContractReviewContractId.Location = new Point(169, 35);
|
||||||
|
comboBoxCustomerContractReviewContractId.Name = "comboBoxCustomerContractReviewContractId";
|
||||||
|
comboBoxCustomerContractReviewContractId.Size = new Size(202, 23);
|
||||||
|
comboBoxCustomerContractReviewContractId.TabIndex = 31;
|
||||||
|
//
|
||||||
|
// labelCustomerContractReviewContractId
|
||||||
|
//
|
||||||
|
labelCustomerContractReviewContractId.AutoSize = true;
|
||||||
|
labelCustomerContractReviewContractId.Location = new Point(12, 38);
|
||||||
|
labelCustomerContractReviewContractId.Name = "labelCustomerContractReviewContractId";
|
||||||
|
labelCustomerContractReviewContractId.Size = new Size(60, 15);
|
||||||
|
labelCustomerContractReviewContractId.TabIndex = 32;
|
||||||
|
labelCustomerContractReviewContractId.Text = "Контракт:";
|
||||||
|
//
|
||||||
|
// labelCustomerContractReviewGrade
|
||||||
|
//
|
||||||
|
labelCustomerContractReviewGrade.AutoSize = true;
|
||||||
|
labelCustomerContractReviewGrade.Location = new Point(12, 168);
|
||||||
|
labelCustomerContractReviewGrade.Name = "labelCustomerContractReviewGrade";
|
||||||
|
labelCustomerContractReviewGrade.Size = new Size(51, 15);
|
||||||
|
labelCustomerContractReviewGrade.TabIndex = 33;
|
||||||
|
labelCustomerContractReviewGrade.Text = "Оценка:";
|
||||||
|
//
|
||||||
|
// FormCustomerContractReview
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(381, 260);
|
||||||
|
Controls.Add(labelCustomerContractReviewGrade);
|
||||||
|
Controls.Add(labelCustomerContractReviewContractId);
|
||||||
|
Controls.Add(comboBoxCustomerContractReviewContractId);
|
||||||
|
Controls.Add(comboBoxCustomerContractReviewCustomerId);
|
||||||
|
Controls.Add(numericUpDownCustomerContractReviewGrade);
|
||||||
|
Controls.Add(labelCustomerContractReviewReview);
|
||||||
|
Controls.Add(richTextBoxCustomerContractReviewReview);
|
||||||
|
Controls.Add(labelCustomerContractReviewCustomerId);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Name = "FormCustomerContractReview";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Отзыв заказчика";
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownCustomerContractReviewGrade).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelContractPaymentAmount;
|
||||||
|
private Label labelContractDeadline;
|
||||||
|
private ComboBox comboBoxCustomerContractReviewCustomerId;
|
||||||
|
private ComboBox comboBoxContractCustomerId;
|
||||||
|
private Label labelContractCategory;
|
||||||
|
private Label labelContractExecutorId;
|
||||||
|
private Label labelCustomerContractReviewCustomerId;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
private RichTextBox richTextBoxCustomerContractReviewReview;
|
||||||
|
private Label labelCustomerContractReviewReview;
|
||||||
|
private NumericUpDown numericUpDownCustomerContractReviewGrade;
|
||||||
|
private NumericUpDown numericUpDownContractPaymentAmount;
|
||||||
|
private DateTimePicker dateTimePickerContractDeadline;
|
||||||
|
private CheckedListBox checkedListBoxContractCategory;
|
||||||
|
private ComboBox comboBoxCustomerContractReviewContractId;
|
||||||
|
private Label labelCustomerContractReviewContractId;
|
||||||
|
private Label labelCustomerContractReviewGrade;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
|
||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
|
||||||
|
|
||||||
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
||||||
|
{
|
||||||
|
public partial class FormCustomerContractReview : Form
|
||||||
|
{
|
||||||
|
private readonly ICustomerContractReviewRepository _customerContractReviewRepository;
|
||||||
|
|
||||||
|
public FormCustomerContractReview(ICustomerContractReviewRepository customerContractReviewRepository,
|
||||||
|
ICustomerRepository customerRepository, IContractRepository contractRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_customerContractReviewRepository = customerContractReviewRepository ?? throw new ArgumentNullException(nameof(customerContractReviewRepository));
|
||||||
|
|
||||||
|
comboBoxCustomerContractReviewCustomerId.DataSource = customerRepository.ReadCustomers();
|
||||||
|
comboBoxCustomerContractReviewCustomerId.DisplayMember = "Name";
|
||||||
|
comboBoxCustomerContractReviewCustomerId.DisplayMember = "Id";
|
||||||
|
|
||||||
|
comboBoxCustomerContractReviewContractId.DataSource = contractRepository.ReadContracts();
|
||||||
|
comboBoxCustomerContractReviewCustomerId.DisplayMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comboBoxCustomerContractReviewContractId.SelectedIndex < 0 ||
|
||||||
|
comboBoxCustomerContractReviewCustomerId.SelectedIndex < 0 ||
|
||||||
|
string.IsNullOrEmpty(richTextBoxCustomerContractReviewReview.Text))
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
|
||||||
|
_customerContractReviewRepository.CreateCustomerContractReview(CustomerContractReview.CreateElement(
|
||||||
|
0, (int)comboBoxCustomerContractReviewCustomerId.SelectedValue!, (int)comboBoxCustomerContractReviewContractId.SelectedValue!,
|
||||||
|
richTextBoxCustomerContractReviewReview.Text, Convert.ToInt32(numericUpDownContractPaymentAmount.Value)));
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
98
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReviews.Designer.cs
generated
Normal file
98
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormCustomerContractReviews.Designer.cs
generated
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
||||||
|
{
|
||||||
|
partial class FormCustomerContractReviews
|
||||||
|
{
|
||||||
|
/// <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 += FormCustomerContractReviews_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
|
panel.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridViewData;
|
||||||
|
private Panel panel;
|
||||||
|
private Button buttonAdd;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
|
||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
||||||
|
{
|
||||||
|
public partial class FormCustomerContractReviews : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
private readonly ICustomerContractReviewRepository _customerContractReviewRepository;
|
||||||
|
|
||||||
|
public FormCustomerContractReviews(IUnityContainer container, ICustomerContractReviewRepository customerContractReviewRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ?? throw new ArgumentException(nameof(container));
|
||||||
|
_customerContractReviewRepository = customerContractReviewRepository ?? throw new ArgumentException(nameof(customerContractReviewRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormCustomerContractReviews_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<FormCustomerContractReview>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridViewData.DataSource = _customerContractReviewRepository.ReadCustomerContractReviews();
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -102,7 +102,8 @@
|
|||||||
Controls.Add(LabelExecutorName);
|
Controls.Add(LabelExecutorName);
|
||||||
Controls.Add(comboBoxExecutorPost);
|
Controls.Add(comboBoxExecutorPost);
|
||||||
Name = "FormExecutor";
|
Name = "FormExecutor";
|
||||||
Text = "FormExecutor";
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Исполнитель";
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,8 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
|||||||
|
|
||||||
if (_executorId.HasValue) _executorRepository.UpdateExecutor(CreateExecutor(_executorId.Value));
|
if (_executorId.HasValue) _executorRepository.UpdateExecutor(CreateExecutor(_executorId.Value));
|
||||||
else _executorRepository.UpdateExecutor(CreateExecutor(0));
|
else _executorRepository.UpdateExecutor(CreateExecutor(0));
|
||||||
|
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,8 @@
|
|||||||
Controls.Add(dataGridViewData);
|
Controls.Add(dataGridViewData);
|
||||||
Controls.Add(panel);
|
Controls.Add(panel);
|
||||||
Name = "FormExecutors";
|
Name = "FormExecutors";
|
||||||
Text = "FormExecutors";
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Исполнители";
|
||||||
Load += FormExecutors_Load;
|
Load += FormExecutors_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
panel.ResumeLayout(false);
|
panel.ResumeLayout(false);
|
||||||
|
@ -1,15 +1,4 @@
|
|||||||
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
|
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
|
||||||
using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using Unity;
|
using Unity;
|
||||||
|
|
||||||
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
||||||
|
121
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.Designer.cs
generated
Normal file
121
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.Designer.cs
generated
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
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()
|
||||||
|
{
|
||||||
|
comboBoxServiceContractId = new ComboBox();
|
||||||
|
labelServiceContractId = new Label();
|
||||||
|
labelServiceDescription = new Label();
|
||||||
|
richTextBoxServiceDescription = new RichTextBox();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSave = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// comboBoxServiceContractId
|
||||||
|
//
|
||||||
|
comboBoxServiceContractId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxServiceContractId.FormattingEnabled = true;
|
||||||
|
comboBoxServiceContractId.Location = new Point(169, 6);
|
||||||
|
comboBoxServiceContractId.Name = "comboBoxServiceContractId";
|
||||||
|
comboBoxServiceContractId.Size = new Size(202, 23);
|
||||||
|
comboBoxServiceContractId.TabIndex = 15;
|
||||||
|
//
|
||||||
|
// labelServiceContractId
|
||||||
|
//
|
||||||
|
labelServiceContractId.AutoSize = true;
|
||||||
|
labelServiceContractId.Location = new Point(12, 9);
|
||||||
|
labelServiceContractId.Name = "labelServiceContractId";
|
||||||
|
labelServiceContractId.Size = new Size(60, 15);
|
||||||
|
labelServiceContractId.TabIndex = 14;
|
||||||
|
labelServiceContractId.Text = "Контракт:";
|
||||||
|
//
|
||||||
|
// labelServiceDescription
|
||||||
|
//
|
||||||
|
labelServiceDescription.AutoSize = true;
|
||||||
|
labelServiceDescription.Location = new Point(12, 38);
|
||||||
|
labelServiceDescription.Name = "labelServiceDescription";
|
||||||
|
labelServiceDescription.Size = new Size(65, 15);
|
||||||
|
labelServiceDescription.TabIndex = 30;
|
||||||
|
labelServiceDescription.Text = "Описание:";
|
||||||
|
//
|
||||||
|
// richTextBoxServiceDescription
|
||||||
|
//
|
||||||
|
richTextBoxServiceDescription.Location = new Point(169, 35);
|
||||||
|
richTextBoxServiceDescription.Name = "richTextBoxServiceDescription";
|
||||||
|
richTextBoxServiceDescription.Size = new Size(202, 96);
|
||||||
|
richTextBoxServiceDescription.TabIndex = 29;
|
||||||
|
richTextBoxServiceDescription.Text = "";
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(12, 166);
|
||||||
|
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(12, 137);
|
||||||
|
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, 208);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(labelServiceDescription);
|
||||||
|
Controls.Add(richTextBoxServiceDescription);
|
||||||
|
Controls.Add(comboBoxServiceContractId);
|
||||||
|
Controls.Add(labelServiceContractId);
|
||||||
|
Name = "FormService";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Услуга";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ComboBox comboBoxServiceContractId;
|
||||||
|
private Label labelServiceContractId;
|
||||||
|
private Label labelServiceDescription;
|
||||||
|
private RichTextBox richTextBoxServiceDescription;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
}
|
||||||
|
}
|
75
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.cs
Normal file
75
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.cs
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Entities;
|
||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums;
|
||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
|
||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
||||||
|
{
|
||||||
|
public partial class FormService : Form
|
||||||
|
{
|
||||||
|
private readonly IServiceRepository _serviceRepository;
|
||||||
|
|
||||||
|
private int? _serviceId;
|
||||||
|
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var contract = _serviceRepository.ReadServiceById(value);
|
||||||
|
if (contract == null) throw new InvalidDataException(nameof(contract));
|
||||||
|
|
||||||
|
richTextBoxServiceDescription.Text = contract.Description;
|
||||||
|
_serviceId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormService(IServiceRepository serviceRepository, IContractRepository contractRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_serviceRepository = serviceRepository ?? throw new ArgumentNullException(nameof(serviceRepository));
|
||||||
|
|
||||||
|
comboBoxServiceContractId.DataSource = contractRepository.ReadContracts();
|
||||||
|
comboBoxServiceContractId.DisplayMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comboBoxServiceContractId.SelectedIndex < 0 ||
|
||||||
|
string.IsNullOrEmpty(richTextBoxServiceDescription.Text))
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
|
||||||
|
_serviceRepository.CreateService(Service.CreateEntity(0,
|
||||||
|
richTextBoxServiceDescription.Text, (int)comboBoxServiceContractId.SelectedValue!));
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
}
|
||||||
|
}
|
120
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.resx
Normal file
120
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormService.resx
Normal 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>
|
194
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.Designer.cs
generated
Normal file
194
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.Designer.cs
generated
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
||||||
|
{
|
||||||
|
partial class FormServiceExecution
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
labelContractDeadline = new Label();
|
||||||
|
comboBoxServiceExecutionExecutorId = new ComboBox();
|
||||||
|
labelServiceExecutionExecutorId = new Label();
|
||||||
|
dateTimePickerContractDeadline = new DateTimePicker();
|
||||||
|
comboBoxServiceExecutionContractId = new ComboBox();
|
||||||
|
labelServiceExecutionContractId = new Label();
|
||||||
|
comboBoxServiceExecutionServiceId = new ComboBox();
|
||||||
|
labelServiceExecutionServiceId = new Label();
|
||||||
|
labelServiceExecutionCompleteion = new Label();
|
||||||
|
numericUpDownContractPaymentAmount = new NumericUpDown();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonSave = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelContractDeadline
|
||||||
|
//
|
||||||
|
labelContractDeadline.AutoSize = true;
|
||||||
|
labelContractDeadline.Location = new Point(12, 128);
|
||||||
|
labelContractDeadline.Name = "labelContractDeadline";
|
||||||
|
labelContractDeadline.Size = new Size(110, 15);
|
||||||
|
labelContractDeadline.TabIndex = 21;
|
||||||
|
labelContractDeadline.Text = "Срок выполнения:";
|
||||||
|
//
|
||||||
|
// comboBoxServiceExecutionExecutorId
|
||||||
|
//
|
||||||
|
comboBoxServiceExecutionExecutorId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxServiceExecutionExecutorId.FormattingEnabled = true;
|
||||||
|
comboBoxServiceExecutionExecutorId.Location = new Point(169, 64);
|
||||||
|
comboBoxServiceExecutionExecutorId.Name = "comboBoxServiceExecutionExecutorId";
|
||||||
|
comboBoxServiceExecutionExecutorId.Size = new Size(202, 23);
|
||||||
|
comboBoxServiceExecutionExecutorId.TabIndex = 20;
|
||||||
|
//
|
||||||
|
// labelServiceExecutionExecutorId
|
||||||
|
//
|
||||||
|
labelServiceExecutionExecutorId.AutoSize = true;
|
||||||
|
labelServiceExecutionExecutorId.Location = new Point(12, 67);
|
||||||
|
labelServiceExecutionExecutorId.Name = "labelServiceExecutionExecutorId";
|
||||||
|
labelServiceExecutionExecutorId.Size = new Size(84, 15);
|
||||||
|
labelServiceExecutionExecutorId.TabIndex = 18;
|
||||||
|
labelServiceExecutionExecutorId.Text = "Исполнитель:";
|
||||||
|
//
|
||||||
|
// dateTimePickerContractDeadline
|
||||||
|
//
|
||||||
|
dateTimePickerContractDeadline.Location = new Point(169, 122);
|
||||||
|
dateTimePickerContractDeadline.Name = "dateTimePickerContractDeadline";
|
||||||
|
dateTimePickerContractDeadline.Size = new Size(202, 23);
|
||||||
|
dateTimePickerContractDeadline.TabIndex = 16;
|
||||||
|
//
|
||||||
|
// comboBoxServiceExecutionContractId
|
||||||
|
//
|
||||||
|
comboBoxServiceExecutionContractId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxServiceExecutionContractId.FormattingEnabled = true;
|
||||||
|
comboBoxServiceExecutionContractId.Location = new Point(169, 6);
|
||||||
|
comboBoxServiceExecutionContractId.Name = "comboBoxServiceExecutionContractId";
|
||||||
|
comboBoxServiceExecutionContractId.Size = new Size(202, 23);
|
||||||
|
comboBoxServiceExecutionContractId.TabIndex = 23;
|
||||||
|
//
|
||||||
|
// labelServiceExecutionContractId
|
||||||
|
//
|
||||||
|
labelServiceExecutionContractId.AutoSize = true;
|
||||||
|
labelServiceExecutionContractId.Location = new Point(12, 9);
|
||||||
|
labelServiceExecutionContractId.Name = "labelServiceExecutionContractId";
|
||||||
|
labelServiceExecutionContractId.Size = new Size(60, 15);
|
||||||
|
labelServiceExecutionContractId.TabIndex = 22;
|
||||||
|
labelServiceExecutionContractId.Text = "Контракт:";
|
||||||
|
//
|
||||||
|
// comboBoxServiceExecutionServiceId
|
||||||
|
//
|
||||||
|
comboBoxServiceExecutionServiceId.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxServiceExecutionServiceId.FormattingEnabled = true;
|
||||||
|
comboBoxServiceExecutionServiceId.Location = new Point(169, 35);
|
||||||
|
comboBoxServiceExecutionServiceId.Name = "comboBoxServiceExecutionServiceId";
|
||||||
|
comboBoxServiceExecutionServiceId.Size = new Size(202, 23);
|
||||||
|
comboBoxServiceExecutionServiceId.TabIndex = 25;
|
||||||
|
//
|
||||||
|
// labelServiceExecutionServiceId
|
||||||
|
//
|
||||||
|
labelServiceExecutionServiceId.AutoSize = true;
|
||||||
|
labelServiceExecutionServiceId.Location = new Point(12, 38);
|
||||||
|
labelServiceExecutionServiceId.Name = "labelServiceExecutionServiceId";
|
||||||
|
labelServiceExecutionServiceId.Size = new Size(47, 15);
|
||||||
|
labelServiceExecutionServiceId.TabIndex = 24;
|
||||||
|
labelServiceExecutionServiceId.Text = "Услуга:";
|
||||||
|
//
|
||||||
|
// labelServiceExecutionCompleteion
|
||||||
|
//
|
||||||
|
labelServiceExecutionCompleteion.AutoSize = true;
|
||||||
|
labelServiceExecutionCompleteion.Location = new Point(12, 95);
|
||||||
|
labelServiceExecutionCompleteion.Name = "labelServiceExecutionCompleteion";
|
||||||
|
labelServiceExecutionCompleteion.Size = new Size(94, 15);
|
||||||
|
labelServiceExecutionCompleteion.TabIndex = 27;
|
||||||
|
labelServiceExecutionCompleteion.Text = "Готовность в %:";
|
||||||
|
//
|
||||||
|
// numericUpDownContractPaymentAmount
|
||||||
|
//
|
||||||
|
numericUpDownContractPaymentAmount.Increment = new decimal(new int[] { 100000, 0, 0, 0 });
|
||||||
|
numericUpDownContractPaymentAmount.Location = new Point(169, 93);
|
||||||
|
numericUpDownContractPaymentAmount.Maximum = new decimal(new int[] { 1000000000, 0, 0, 0 });
|
||||||
|
numericUpDownContractPaymentAmount.Name = "numericUpDownContractPaymentAmount";
|
||||||
|
numericUpDownContractPaymentAmount.Size = new Size(202, 23);
|
||||||
|
numericUpDownContractPaymentAmount.TabIndex = 26;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(12, 180);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(359, 23);
|
||||||
|
buttonCancel.TabIndex = 29;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(12, 151);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(359, 23);
|
||||||
|
buttonSave.TabIndex = 28;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// FormServiceExecution
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(387, 214);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(labelServiceExecutionCompleteion);
|
||||||
|
Controls.Add(numericUpDownContractPaymentAmount);
|
||||||
|
Controls.Add(comboBoxServiceExecutionServiceId);
|
||||||
|
Controls.Add(labelServiceExecutionServiceId);
|
||||||
|
Controls.Add(comboBoxServiceExecutionContractId);
|
||||||
|
Controls.Add(labelServiceExecutionContractId);
|
||||||
|
Controls.Add(labelContractDeadline);
|
||||||
|
Controls.Add(comboBoxServiceExecutionExecutorId);
|
||||||
|
Controls.Add(labelServiceExecutionExecutorId);
|
||||||
|
Controls.Add(dateTimePickerContractDeadline);
|
||||||
|
Name = "FormServiceExecution";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Выполнение услуги";
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelContractDeadline;
|
||||||
|
private ComboBox comboBoxServiceExecutionExecutorId;
|
||||||
|
private Label labelServiceExecutionExecutorId;
|
||||||
|
private DateTimePicker dateTimePickerContractDeadline;
|
||||||
|
private ComboBox comboBoxServiceExecutionContractId;
|
||||||
|
private Label labelServiceExecutionContractId;
|
||||||
|
private ComboBox comboBoxServiceExecutionServiceId;
|
||||||
|
private Label labelServiceExecutionServiceId;
|
||||||
|
private Label labelServiceExecutionCompleteion;
|
||||||
|
private NumericUpDown numericUpDownContractPaymentAmount;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonSave;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Entities.Enums;
|
||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
|
||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
||||||
|
{
|
||||||
|
public partial class FormServiceExecution : Form
|
||||||
|
{
|
||||||
|
private readonly IServiceExecutionRepository _serviceExecutionRepository;
|
||||||
|
|
||||||
|
private int? _serviceExecutionId;
|
||||||
|
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var executor = _serviceExecutionRepository.ReadServiceExecutionById(value);
|
||||||
|
if (executor == null) throw new InvalidDataException(nameof(executor));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormServiceExecution(IServiceExecutionRepository serviceExecutionRepository, IContractRepository contractRepository,
|
||||||
|
IServiceRepository serviceRepository, IExecutorRepository executorRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_serviceExecutionRepository = serviceExecutionRepository ?? throw new ArgumentNullException(nameof(serviceExecutionRepository));
|
||||||
|
|
||||||
|
comboBoxServiceExecutionContractId.DataSource = contractRepository.ReadContracts();
|
||||||
|
comboBoxServiceExecutionContractId.DisplayMember = "Id";
|
||||||
|
|
||||||
|
comboBoxServiceExecutionServiceId.DataSource = serviceRepository.ReadServices();
|
||||||
|
comboBoxServiceExecutionServiceId.DisplayMember = "Id";
|
||||||
|
|
||||||
|
comboBoxServiceExecutionExecutorId.DataSource = executorRepository.ReadExecutors();
|
||||||
|
comboBoxServiceExecutionExecutorId.DisplayMember = "Name";
|
||||||
|
comboBoxServiceExecutionExecutorId.DisplayMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
}
|
||||||
|
}
|
120
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.resx
Normal file
120
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecution.resx
Normal 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>
|
112
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.Designer.cs
generated
Normal file
112
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.Designer.cs
generated
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
||||||
|
{
|
||||||
|
partial class FormServiceExecutions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
dataGridViewData = new DataGridView();
|
||||||
|
panel = new Panel();
|
||||||
|
buttonUpd = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
|
panel.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridViewData
|
||||||
|
//
|
||||||
|
dataGridViewData.AllowUserToAddRows = false;
|
||||||
|
dataGridViewData.AllowUserToDeleteRows = false;
|
||||||
|
dataGridViewData.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewData.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewData.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewData.Location = new Point(0, 0);
|
||||||
|
dataGridViewData.MultiSelect = false;
|
||||||
|
dataGridViewData.Name = "dataGridViewData";
|
||||||
|
dataGridViewData.ReadOnly = true;
|
||||||
|
dataGridViewData.RowHeadersVisible = false;
|
||||||
|
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewData.Size = new Size(677, 450);
|
||||||
|
dataGridViewData.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// panel
|
||||||
|
//
|
||||||
|
panel.Controls.Add(buttonUpd);
|
||||||
|
panel.Controls.Add(buttonAdd);
|
||||||
|
panel.Dock = DockStyle.Right;
|
||||||
|
panel.Location = new Point(677, 0);
|
||||||
|
panel.Name = "panel";
|
||||||
|
panel.Size = new Size(123, 450);
|
||||||
|
panel.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// buttonUpd
|
||||||
|
//
|
||||||
|
buttonUpd.BackgroundImage = Properties.Resources.icon_edit_button;
|
||||||
|
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonUpd.Location = new Point(16, 108);
|
||||||
|
buttonUpd.Name = "buttonUpd";
|
||||||
|
buttonUpd.Size = new Size(90, 90);
|
||||||
|
buttonUpd.TabIndex = 1;
|
||||||
|
buttonUpd.UseVisualStyleBackColor = true;
|
||||||
|
buttonUpd.Click += ButtonUpd_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.BackgroundImage = Properties.Resources.icon_add_button;
|
||||||
|
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonAdd.Location = new Point(16, 12);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(90, 90);
|
||||||
|
buttonAdd.TabIndex = 0;
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// FormServiceExecutions
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridViewData);
|
||||||
|
Controls.Add(panel);
|
||||||
|
Name = "FormServiceExecutions";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Выполнение услуг";
|
||||||
|
Load += FormServiceExecutions_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
|
panel.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridViewData;
|
||||||
|
private Panel panel;
|
||||||
|
private Button buttonUpd;
|
||||||
|
private Button buttonAdd;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
||||||
|
{
|
||||||
|
public partial class FormServiceExecutions : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
private readonly IServiceExecutionRepository _serviceExecutionRepository;
|
||||||
|
|
||||||
|
public FormServiceExecutions(IUnityContainer container, IServiceExecutionRepository serviceExecutionRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ?? throw new ArgumentException(nameof(container));
|
||||||
|
_serviceExecutionRepository = serviceExecutionRepository ?? throw new ArgumentException(nameof(serviceExecutionRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormServiceExecutions_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormServiceExecution>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormServiceExecution>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridViewData.DataSource = _serviceExecutionRepository.ReadServiceExecutions();
|
||||||
|
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridViewData.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.resx
Normal file
120
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServiceExecutions.resx
Normal 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>
|
126
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.Designer.cs
generated
Normal file
126
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
97
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.cs
Normal file
97
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.cs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Repositories;
|
||||||
|
using PIbd_23_Gutorov_I.A._IT_Company.Repositories.Implementations;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
|
||||||
|
{
|
||||||
|
public partial class 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.resx
Normal file
120
PIbd-23_Gutorov_I.A._IT-Company/Forms/FormServices.resx
Normal 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>
|
@ -10,7 +10,5 @@ public interface IContractRepository
|
|||||||
|
|
||||||
void CreateContract(Contract Contract);
|
void CreateContract(Contract Contract);
|
||||||
|
|
||||||
void UpdateContract(Contract Contract);
|
|
||||||
|
|
||||||
void DeleteContract(int id);
|
void DeleteContract(int id);
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,4 @@ public class ContractRepository : IContractRepository
|
|||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateContract(Contract Contract)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user