Compare commits
No commits in common. "46658bd34050705a0b2222a295cba94d42ee6527" and "6acb10c427ee4b0077f00f444774d3d77163a200" have entirely different histories.
46658bd340
...
6acb10c427
@ -30,11 +30,13 @@
|
||||
{
|
||||
labelName = new Label();
|
||||
labelType = new Label();
|
||||
labelOptovik = new Label();
|
||||
textBoxName = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
radioButtonOptYes = new RadioButton();
|
||||
radioButtonOptNo = new RadioButton();
|
||||
comboBoxClientType = new ComboBox();
|
||||
checkBoxOptYes = new CheckBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
@ -55,6 +57,15 @@
|
||||
labelType.TabIndex = 1;
|
||||
labelType.Text = "Тип клиента:";
|
||||
//
|
||||
// labelOptovik
|
||||
//
|
||||
labelOptovik.AutoSize = true;
|
||||
labelOptovik.Location = new Point(38, 179);
|
||||
labelOptovik.Name = "labelOptovik";
|
||||
labelOptovik.Size = new Size(75, 20);
|
||||
labelOptovik.TabIndex = 2;
|
||||
labelOptovik.Text = "Оптовик?";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(157, 36);
|
||||
@ -84,6 +95,28 @@
|
||||
buttonCancel.UseVisualStyleBackColor = false;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// radioButtonOptYes
|
||||
//
|
||||
radioButtonOptYes.AutoSize = true;
|
||||
radioButtonOptYes.Location = new Point(157, 177);
|
||||
radioButtonOptYes.Name = "radioButtonOptYes";
|
||||
radioButtonOptYes.Size = new Size(48, 24);
|
||||
radioButtonOptYes.TabIndex = 8;
|
||||
radioButtonOptYes.TabStop = true;
|
||||
radioButtonOptYes.Text = "Да";
|
||||
radioButtonOptYes.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButtonOptNo
|
||||
//
|
||||
radioButtonOptNo.AutoSize = true;
|
||||
radioButtonOptNo.Location = new Point(227, 177);
|
||||
radioButtonOptNo.Name = "radioButtonOptNo";
|
||||
radioButtonOptNo.Size = new Size(55, 24);
|
||||
radioButtonOptNo.TabIndex = 9;
|
||||
radioButtonOptNo.TabStop = true;
|
||||
radioButtonOptNo.Text = "Нет";
|
||||
radioButtonOptNo.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// comboBoxClientType
|
||||
//
|
||||
comboBoxClientType.FormattingEnabled = true;
|
||||
@ -92,27 +125,18 @@
|
||||
comboBoxClientType.Size = new Size(125, 28);
|
||||
comboBoxClientType.TabIndex = 10;
|
||||
//
|
||||
// checkBoxOptYes
|
||||
//
|
||||
checkBoxOptYes.AutoSize = true;
|
||||
checkBoxOptYes.CheckAlign = ContentAlignment.MiddleRight;
|
||||
checkBoxOptYes.Location = new Point(45, 185);
|
||||
checkBoxOptYes.Name = "checkBoxOptYes";
|
||||
checkBoxOptYes.Size = new Size(90, 24);
|
||||
checkBoxOptYes.TabIndex = 12;
|
||||
checkBoxOptYes.Text = "Оптивик";
|
||||
checkBoxOptYes.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormClient
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(329, 324);
|
||||
Controls.Add(checkBoxOptYes);
|
||||
Controls.Add(comboBoxClientType);
|
||||
Controls.Add(radioButtonOptNo);
|
||||
Controls.Add(radioButtonOptYes);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelOptovik);
|
||||
Controls.Add(labelType);
|
||||
Controls.Add(labelName);
|
||||
Name = "FormClient";
|
||||
@ -126,10 +150,12 @@
|
||||
|
||||
private Label labelName;
|
||||
private Label labelType;
|
||||
private Label labelOptovik;
|
||||
private TextBox textBoxName;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private RadioButton radioButtonOptYes;
|
||||
private RadioButton radioButtonOptNo;
|
||||
private ComboBox comboBoxClientType;
|
||||
private CheckBox checkBoxOptYes;
|
||||
}
|
||||
}
|
@ -32,7 +32,11 @@ namespace ProjectCompanyFurniture.Forms
|
||||
comboBoxClientType.SelectedItem = client.ClientType;
|
||||
if (client.Optovik)
|
||||
{
|
||||
checkBoxOptYes.Checked = true;
|
||||
radioButtonOptYes.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
radioButtonOptNo.Checked = true;
|
||||
}
|
||||
_clientId = value;
|
||||
}
|
||||
@ -56,7 +60,7 @@ namespace ProjectCompanyFurniture.Forms
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text)
|
||||
|| checkBoxOptYes.Checked == false
|
||||
|| (radioButtonOptYes.Checked == false && radioButtonOptNo.Checked == false)
|
||||
|| comboBoxClientType.SelectedIndex < 1)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
@ -81,6 +85,6 @@ namespace ProjectCompanyFurniture.Forms
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Client CreateClient(int id) => Client.CreateEntity(id, textBoxName.Text,
|
||||
(ClientType)comboBoxClientType.SelectedItem!, checkBoxOptYes.Checked);
|
||||
(ClientType)comboBoxClientType.SelectedItem!, radioButtonOptYes.Checked);
|
||||
}
|
||||
}
|
@ -28,6 +28,8 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
label5 = new Label();
|
||||
dateTimePickerDateInvoice = new DateTimePicker();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
groupBoxProducts = new GroupBox();
|
||||
@ -35,23 +37,41 @@
|
||||
ColumnProduct = new DataGridViewComboBoxColumn();
|
||||
ColumnCount = new DataGridViewTextBoxColumn();
|
||||
labelClientName = new Label();
|
||||
radioButtonPromYes = new RadioButton();
|
||||
radioButtonPromNot = new RadioButton();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
numericUpDownDiscPercentage = new NumericUpDown();
|
||||
comboBoxClient = new ComboBox();
|
||||
label3 = new Label();
|
||||
numericUpDownSellingPrice = new NumericUpDown();
|
||||
checkBoxPromYes = new CheckBox();
|
||||
groupBoxProducts.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProducts).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownDiscPercentage).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSellingPrice).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(27, 251);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(44, 20);
|
||||
label5.TabIndex = 4;
|
||||
label5.Text = "Дата:";
|
||||
//
|
||||
// dateTimePickerDateInvoice
|
||||
//
|
||||
dateTimePickerDateInvoice.Location = new Point(216, 246);
|
||||
dateTimePickerDateInvoice.Name = "dateTimePickerDateInvoice";
|
||||
dateTimePickerDateInvoice.Size = new Size(151, 27);
|
||||
dateTimePickerDateInvoice.TabIndex = 10;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.BackColor = Color.FromArgb(192, 255, 192);
|
||||
buttonCancel.Location = new Point(270, 548);
|
||||
buttonCancel.Location = new Point(270, 691);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(102, 29);
|
||||
buttonCancel.TabIndex = 11;
|
||||
@ -63,7 +83,7 @@
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonSave.BackColor = Color.FromArgb(192, 255, 192);
|
||||
buttonSave.Location = new Point(24, 548);
|
||||
buttonSave.Location = new Point(24, 691);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(102, 29);
|
||||
buttonSave.TabIndex = 12;
|
||||
@ -75,9 +95,9 @@
|
||||
//
|
||||
groupBoxProducts.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
groupBoxProducts.Controls.Add(dataGridViewProducts);
|
||||
groupBoxProducts.Location = new Point(24, 236);
|
||||
groupBoxProducts.Location = new Point(24, 306);
|
||||
groupBoxProducts.Name = "groupBoxProducts";
|
||||
groupBoxProducts.Size = new Size(348, 291);
|
||||
groupBoxProducts.Size = new Size(348, 366);
|
||||
groupBoxProducts.TabIndex = 13;
|
||||
groupBoxProducts.TabStop = false;
|
||||
groupBoxProducts.Text = "Продукты";
|
||||
@ -91,7 +111,7 @@
|
||||
dataGridViewProducts.Location = new Point(3, 23);
|
||||
dataGridViewProducts.Name = "dataGridViewProducts";
|
||||
dataGridViewProducts.RowHeadersWidth = 51;
|
||||
dataGridViewProducts.Size = new Size(342, 265);
|
||||
dataGridViewProducts.Size = new Size(342, 340);
|
||||
dataGridViewProducts.TabIndex = 0;
|
||||
//
|
||||
// ColumnProduct
|
||||
@ -117,6 +137,37 @@
|
||||
labelClientName.TabIndex = 14;
|
||||
labelClientName.Text = "ФИО клиента:";
|
||||
//
|
||||
// radioButtonPromYes
|
||||
//
|
||||
radioButtonPromYes.AutoSize = true;
|
||||
radioButtonPromYes.Location = new Point(213, 89);
|
||||
radioButtonPromYes.Name = "radioButtonPromYes";
|
||||
radioButtonPromYes.Size = new Size(48, 24);
|
||||
radioButtonPromYes.TabIndex = 16;
|
||||
radioButtonPromYes.TabStop = true;
|
||||
radioButtonPromYes.Text = "Да";
|
||||
radioButtonPromYes.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButtonPromNot
|
||||
//
|
||||
radioButtonPromNot.AutoSize = true;
|
||||
radioButtonPromNot.Location = new Point(309, 89);
|
||||
radioButtonPromNot.Name = "radioButtonPromNot";
|
||||
radioButtonPromNot.Size = new Size(55, 24);
|
||||
radioButtonPromNot.TabIndex = 17;
|
||||
radioButtonPromNot.TabStop = true;
|
||||
radioButtonPromNot.Text = "Нет";
|
||||
radioButtonPromNot.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(27, 93);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(156, 20);
|
||||
label1.TabIndex = 18;
|
||||
label1.Text = "Наличие промокода:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
@ -158,32 +209,25 @@
|
||||
numericUpDownSellingPrice.Size = new Size(151, 27);
|
||||
numericUpDownSellingPrice.TabIndex = 23;
|
||||
//
|
||||
// checkBoxPromYes
|
||||
//
|
||||
checkBoxPromYes.AutoSize = true;
|
||||
checkBoxPromYes.CheckAlign = ContentAlignment.MiddleRight;
|
||||
checkBoxPromYes.Location = new Point(27, 94);
|
||||
checkBoxPromYes.Name = "checkBoxPromYes";
|
||||
checkBoxPromYes.Size = new Size(175, 24);
|
||||
checkBoxPromYes.TabIndex = 24;
|
||||
checkBoxPromYes.Text = "Наличие промокода";
|
||||
checkBoxPromYes.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormInvoice
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(403, 589);
|
||||
Controls.Add(checkBoxPromYes);
|
||||
ClientSize = new Size(403, 747);
|
||||
Controls.Add(numericUpDownSellingPrice);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(comboBoxClient);
|
||||
Controls.Add(numericUpDownDiscPercentage);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(radioButtonPromNot);
|
||||
Controls.Add(radioButtonPromYes);
|
||||
Controls.Add(labelClientName);
|
||||
Controls.Add(groupBoxProducts);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(dateTimePickerDateInvoice);
|
||||
Controls.Add(label5);
|
||||
Name = "FormInvoice";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Накладная";
|
||||
@ -196,6 +240,8 @@
|
||||
}
|
||||
|
||||
#endregion
|
||||
private Label label5;
|
||||
private DateTimePicker dateTimePickerDateInvoice;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private GroupBox groupBoxProducts;
|
||||
@ -204,10 +250,12 @@
|
||||
private DataGridViewTextBoxColumn ColumnCount;
|
||||
private Label label2;
|
||||
private Label labelClientName;
|
||||
private RadioButton radioButtonPromYes;
|
||||
private RadioButton radioButtonPromNot;
|
||||
private Label label1;
|
||||
private NumericUpDown numericUpDownDiscPercentage;
|
||||
private ComboBox comboBoxClient;
|
||||
private Label label3;
|
||||
private NumericUpDown numericUpDownSellingPrice;
|
||||
private CheckBox checkBoxPromYes;
|
||||
}
|
||||
}
|
@ -36,26 +36,29 @@ namespace ProjectCompanyFurniture.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dataGridViewProducts.RowCount < 1 || comboBoxClient.SelectedIndex < 0 || checkBoxPromYes.Checked == false)
|
||||
if (dataGridViewProducts.RowCount < 1 || comboBoxClient.SelectedIndex < 0 ||
|
||||
(radioButtonPromYes.Checked == false && radioButtonPromNot.Checked == false))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (checkBoxPromYes.Checked && numericUpDownDiscPercentage.Value == 0)
|
||||
if (radioButtonPromYes.Checked && numericUpDownDiscPercentage.Value == 0)
|
||||
{
|
||||
throw new Exception("Не указан процент скидки");
|
||||
}
|
||||
|
||||
if (checkBoxPromYes.Checked)
|
||||
if (radioButtonPromYes.Checked)
|
||||
{
|
||||
_invoiceRepository.CreateInvoice(Invoice.CreateOperation(0,
|
||||
(int)comboBoxClient.SelectedValue!, 1, Convert.ToInt32(numericUpDownDiscPercentage.Value),
|
||||
Convert.ToInt32(numericUpDownSellingPrice.Value), CreateListInvoiceProductFromDataGrid()));
|
||||
Convert.ToInt32(numericUpDownSellingPrice.Value),
|
||||
/*dateTimePickerDateInvoice.Value,*/
|
||||
CreateListInvoiceProductFromDataGrid()));
|
||||
}
|
||||
else
|
||||
{
|
||||
_invoiceRepository.CreateInvoice(Invoice.CreateOperation(0,
|
||||
(int)comboBoxClient.SelectedValue!, 0, 0, Convert.ToInt32(numericUpDownSellingPrice.Value),
|
||||
CreateListInvoiceProductFromDataGrid()));
|
||||
/*dateTimePickerDateInvoice.Value,*/ CreateListInvoiceProductFromDataGrid()));
|
||||
}
|
||||
|
||||
Close();
|
||||
|
@ -123,4 +123,10 @@
|
||||
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnProduct.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
@ -30,6 +30,8 @@
|
||||
{
|
||||
labelProductID = new Label();
|
||||
labelMovement = new Label();
|
||||
labelDate = new Label();
|
||||
dateTimePickerProductMovementDate = new DateTimePicker();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
checkedListBoxMovement = new CheckedListBox();
|
||||
@ -54,11 +56,27 @@
|
||||
labelMovement.TabIndex = 1;
|
||||
labelMovement.Text = "Тип движения:";
|
||||
//
|
||||
// labelDate
|
||||
//
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(31, 232);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(44, 20);
|
||||
labelDate.TabIndex = 2;
|
||||
labelDate.Text = "Дата:";
|
||||
//
|
||||
// dateTimePickerProductMovementDate
|
||||
//
|
||||
dateTimePickerProductMovementDate.Enabled = false;
|
||||
dateTimePickerProductMovementDate.Location = new Point(267, 232);
|
||||
dateTimePickerProductMovementDate.Name = "dateTimePickerProductMovementDate";
|
||||
dateTimePickerProductMovementDate.Size = new Size(181, 27);
|
||||
dateTimePickerProductMovementDate.TabIndex = 3;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.BackColor = Color.FromArgb(255, 192, 192);
|
||||
buttonCancel.Location = new Point(286, 232);
|
||||
buttonCancel.Location = new Point(286, 296);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(162, 29);
|
||||
buttonCancel.TabIndex = 6;
|
||||
@ -68,9 +86,8 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonSave.BackColor = Color.FromArgb(255, 192, 192);
|
||||
buttonSave.Location = new Point(31, 232);
|
||||
buttonSave.Location = new Point(31, 296);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(162, 29);
|
||||
buttonSave.TabIndex = 7;
|
||||
@ -99,11 +116,13 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(485, 290);
|
||||
ClientSize = new Size(485, 399);
|
||||
Controls.Add(comboBoxProduct);
|
||||
Controls.Add(checkedListBoxMovement);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(dateTimePickerProductMovementDate);
|
||||
Controls.Add(labelDate);
|
||||
Controls.Add(labelMovement);
|
||||
Controls.Add(labelProductID);
|
||||
Name = "FormProductMovement";
|
||||
@ -117,6 +136,8 @@
|
||||
|
||||
private Label labelProductID;
|
||||
private Label labelMovement;
|
||||
private Label labelDate;
|
||||
private DateTimePicker dateTimePickerProductMovementDate;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private CheckedListBox checkedListBoxMovement;
|
||||
|
@ -50,7 +50,7 @@ namespace ProjectCompanyFurniture.Forms
|
||||
movement |= (Movement)elem;
|
||||
}
|
||||
_productMovementRepository.CreateProductMovement(ProductMovement.CreateOperation(0,
|
||||
(int)comboBoxProduct.SelectedValue!, movement));
|
||||
(int)comboBoxProduct.SelectedValue!, movement)); //dateTimePickerProductMovementDate.Value));
|
||||
|
||||
Close();
|
||||
}
|
||||
|
@ -111,7 +111,6 @@
|
||||
Name = "FormProducts";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Продукты";
|
||||
Load += FormProducts_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
|
@ -25,19 +25,6 @@ namespace ProjectCompanyFurniture.Forms
|
||||
_productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
|
||||
}
|
||||
|
||||
private void FormProducts_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
|
||||
|
Loading…
Reference in New Issue
Block a user