final changes

This commit is contained in:
Ivan Gutorov 2024-12-05 06:23:35 +04:00
parent 4e1acff83c
commit 413256e850
4 changed files with 52 additions and 44 deletions

View File

@ -41,8 +41,8 @@
labelContractDeadline = new Label();
labelContractPaymentAmount = new Label();
dataGridViewServices = new DataGridView();
groupBox = new GroupBox();
ColumnServiceDescription = new DataGridViewComboBoxColumn();
groupBox = new GroupBox();
((System.ComponentModel.ISupportInitialize)numericUpDownContractPaymentAmount).BeginInit();
((System.ComponentModel.ISupportInitialize)dataGridViewServices).BeginInit();
groupBox.SuspendLayout();
@ -172,6 +172,14 @@
dataGridViewServices.Size = new Size(352, 244);
dataGridViewServices.TabIndex = 17;
//
// ColumnServiceDescription
//
ColumnServiceDescription.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
ColumnServiceDescription.HeaderText = "Услуга";
ColumnServiceDescription.Name = "ColumnServiceDescription";
ColumnServiceDescription.Resizable = DataGridViewTriState.True;
ColumnServiceDescription.SortMode = DataGridViewColumnSortMode.Automatic;
//
// groupBox
//
groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
@ -183,14 +191,6 @@
groupBox.TabStop = false;
groupBox.Text = "Услуги:";
//
// ColumnServiceDescription
//
ColumnServiceDescription.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
ColumnServiceDescription.HeaderText = "Услуга";
ColumnServiceDescription.Name = "ColumnServiceDescription";
ColumnServiceDescription.Resizable = DataGridViewTriState.True;
ColumnServiceDescription.SortMode = DataGridViewColumnSortMode.Automatic;
//
// FormContract
//
AutoScaleDimensions = new SizeF(7F, 15F);

View File

@ -11,15 +11,16 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
ICustomerRepository customerRepository, IExecutorRepository executorRepository)
{
InitializeComponent();
_customerExecutorReviewRepository = customerExecutorReviewRepository ?? throw new ArgumentNullException(nameof(customerExecutorReviewRepository));
_customerExecutorReviewRepository = customerExecutorReviewRepository ??
throw new ArgumentNullException(nameof(customerExecutorReviewRepository));
comboBoxCustomerExecutorReviewCustomerId.DataSource = customerRepository.ReadCustomers();
comboBoxCustomerExecutorReviewCustomerId.DisplayMember = "Name";
comboBoxCustomerExecutorReviewCustomerId.DisplayMember = "Id";
comboBoxCustomerExecutorReviewCustomerId.ValueMember = "Id";
comboBoxCustomerExecutorReviewExecutorId.DataSource = executorRepository.ReadExecutors();
comboBoxCustomerExecutorReviewExecutorId.DisplayMember = "Name";
comboBoxCustomerExecutorReviewCustomerId.DisplayMember = "Id";
comboBoxCustomerExecutorReviewCustomerId.ValueMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
@ -33,9 +34,7 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
throw new Exception("Имеются незаполненные поля");
}
_customerExecutorReviewRepository.CreateCustomerExecutorReview(CustomerExecutorReview.CreateElement(
0, (int)comboBoxCustomerExecutorReviewCustomerId.SelectedValue!, (int)comboBoxCustomerExecutorReviewExecutorId.SelectedValue!,
richTextBoxCustomerExecutorReviewReview.Text, Convert.ToInt32(numericUpDownCustomerExecutorReviewGrade.Value)));
_customerExecutorReviewRepository.CreateCustomerExecutorReview(CreateCustomerExecutorReview(0));
Close();
}
@ -46,5 +45,14 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private CustomerExecutorReview CreateCustomerExecutorReview(int id)
{
return CustomerExecutorReview.CreateElement(
id, (int)comboBoxCustomerExecutorReviewCustomerId.SelectedValue!,
(int)comboBoxCustomerExecutorReviewExecutorId.SelectedValue!,
richTextBoxCustomerExecutorReviewReview.Text,
Convert.ToInt32(numericUpDownCustomerExecutorReviewGrade.Value));
}
}
}

View File

@ -42,8 +42,8 @@ namespace PIbd_23_Gutorov_I.A._IT_Company.Forms
if (string.IsNullOrEmpty(richTextBoxServiceDescription.Text))
throw new Exception("Имеются незаполненные поля");
_serviceRepository.CreateService(Service.CreateEntity(0,
richTextBoxServiceDescription.Text));
if (_serviceId.HasValue) _serviceRepository.UpdateService(Service.CreateEntity(_serviceId.Value, richTextBoxServiceDescription.Text));
else _serviceRepository.CreateService(Service.CreateEntity(0, richTextBoxServiceDescription.Text));
Close();
}

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
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
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>
@ -26,36 +26,36 @@
<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
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
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
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
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
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
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
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->