вроде полный фикс
This commit is contained in:
parent
a8a2fd350e
commit
8a60aa872a
@ -32,7 +32,7 @@
|
|||||||
ButtonCancel = new Button();
|
ButtonCancel = new Button();
|
||||||
label1 = new Label();
|
label1 = new Label();
|
||||||
label2 = new Label();
|
label2 = new Label();
|
||||||
dateTimePicker1 = new DateTimePicker();
|
dateTimePickerOrderDate = new DateTimePicker();
|
||||||
dateTimeCompletion = new DateTimePicker();
|
dateTimeCompletion = new DateTimePicker();
|
||||||
dateTimeIssue = new DateTimePicker();
|
dateTimeIssue = new DateTimePicker();
|
||||||
label3 = new Label();
|
label3 = new Label();
|
||||||
@ -40,12 +40,12 @@
|
|||||||
numericUpDownFullPrice = new NumericUpDown();
|
numericUpDownFullPrice = new NumericUpDown();
|
||||||
label5 = new Label();
|
label5 = new Label();
|
||||||
comboBoxMaster = new ComboBox();
|
comboBoxMaster = new ComboBox();
|
||||||
groupBox1 = new GroupBox();
|
groupBoxDetail = new GroupBox();
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
Detail = new DataGridViewComboBoxColumn();
|
Detail = new DataGridViewComboBoxColumn();
|
||||||
DetailCount = new DataGridViewTextBoxColumn();
|
DetailCount = new DataGridViewTextBoxColumn();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownFullPrice).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownFullPrice).BeginInit();
|
||||||
groupBox1.SuspendLayout();
|
groupBoxDetail.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -89,13 +89,13 @@
|
|||||||
label2.TabIndex = 3;
|
label2.TabIndex = 3;
|
||||||
label2.Text = "Дата начала работы:";
|
label2.Text = "Дата начала работы:";
|
||||||
//
|
//
|
||||||
// dateTimePicker1
|
// dateTimePickerOrderDate
|
||||||
//
|
//
|
||||||
dateTimePicker1.Enabled = false;
|
dateTimePickerOrderDate.Enabled = false;
|
||||||
dateTimePicker1.Location = new Point(190, 12);
|
dateTimePickerOrderDate.Location = new Point(190, 12);
|
||||||
dateTimePicker1.Name = "dateTimePicker1";
|
dateTimePickerOrderDate.Name = "dateTimePickerOrderDate";
|
||||||
dateTimePicker1.Size = new Size(188, 25);
|
dateTimePickerOrderDate.Size = new Size(188, 25);
|
||||||
dateTimePicker1.TabIndex = 4;
|
dateTimePickerOrderDate.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// dateTimeCompletion
|
// dateTimeCompletion
|
||||||
//
|
//
|
||||||
@ -156,28 +156,31 @@
|
|||||||
comboBoxMaster.Size = new Size(182, 25);
|
comboBoxMaster.Size = new Size(182, 25);
|
||||||
comboBoxMaster.TabIndex = 11;
|
comboBoxMaster.TabIndex = 11;
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBoxDetail
|
||||||
//
|
//
|
||||||
groupBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
groupBoxDetail.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
groupBox1.Controls.Add(dataGridView);
|
groupBoxDetail.Controls.Add(dataGridView);
|
||||||
groupBox1.Location = new Point(30, 234);
|
groupBoxDetail.Location = new Point(30, 234);
|
||||||
groupBox1.Name = "groupBox1";
|
groupBoxDetail.Name = "groupBoxDetail";
|
||||||
groupBox1.Size = new Size(401, 224);
|
groupBoxDetail.RightToLeft = RightToLeft.No;
|
||||||
groupBox1.TabIndex = 12;
|
groupBoxDetail.Size = new Size(401, 224);
|
||||||
groupBox1.TabStop = false;
|
groupBoxDetail.TabIndex = 12;
|
||||||
groupBox1.Text = "groupBox1";
|
groupBoxDetail.TabStop = false;
|
||||||
|
groupBoxDetail.Text = "Детали";
|
||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
dataGridView.AllowUserToDeleteRows = false;
|
dataGridView.AllowUserToDeleteRows = false;
|
||||||
dataGridView.AllowUserToResizeColumns = false;
|
dataGridView.AllowUserToResizeColumns = false;
|
||||||
dataGridView.AllowUserToResizeRows = false;
|
dataGridView.AllowUserToResizeRows = false;
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Detail, DetailCount });
|
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Detail, DetailCount });
|
||||||
dataGridView.Location = new Point(3, 21);
|
dataGridView.Location = new Point(3, 21);
|
||||||
dataGridView.MultiSelect = false;
|
dataGridView.MultiSelect = false;
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.RowHeadersVisible = false;
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
|
||||||
dataGridView.Size = new Size(395, 200);
|
dataGridView.Size = new Size(395, 200);
|
||||||
dataGridView.TabIndex = 0;
|
dataGridView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
@ -196,7 +199,7 @@
|
|||||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(461, 532);
|
ClientSize = new Size(461, 532);
|
||||||
Controls.Add(groupBox1);
|
Controls.Add(groupBoxDetail);
|
||||||
Controls.Add(comboBoxMaster);
|
Controls.Add(comboBoxMaster);
|
||||||
Controls.Add(label5);
|
Controls.Add(label5);
|
||||||
Controls.Add(numericUpDownFullPrice);
|
Controls.Add(numericUpDownFullPrice);
|
||||||
@ -204,7 +207,7 @@
|
|||||||
Controls.Add(label3);
|
Controls.Add(label3);
|
||||||
Controls.Add(dateTimeIssue);
|
Controls.Add(dateTimeIssue);
|
||||||
Controls.Add(dateTimeCompletion);
|
Controls.Add(dateTimeCompletion);
|
||||||
Controls.Add(dateTimePicker1);
|
Controls.Add(dateTimePickerOrderDate);
|
||||||
Controls.Add(label2);
|
Controls.Add(label2);
|
||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
Controls.Add(ButtonCancel);
|
Controls.Add(ButtonCancel);
|
||||||
@ -213,7 +216,7 @@
|
|||||||
StartPosition = FormStartPosition.CenterParent;
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
Text = "Заказ";
|
Text = "Заказ";
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownFullPrice).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownFullPrice).EndInit();
|
||||||
groupBox1.ResumeLayout(false);
|
groupBoxDetail.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@ -225,7 +228,7 @@
|
|||||||
private Button ButtonCancel;
|
private Button ButtonCancel;
|
||||||
private Label label1;
|
private Label label1;
|
||||||
private Label label2;
|
private Label label2;
|
||||||
private DateTimePicker dateTimePicker1;
|
private DateTimePicker dateTimePickerOrderDate;
|
||||||
private DateTimePicker dateTimeCompletion;
|
private DateTimePicker dateTimeCompletion;
|
||||||
private DateTimePicker dateTimeIssue;
|
private DateTimePicker dateTimeIssue;
|
||||||
private Label label3;
|
private Label label3;
|
||||||
@ -233,7 +236,7 @@
|
|||||||
private NumericUpDown numericUpDownFullPrice;
|
private NumericUpDown numericUpDownFullPrice;
|
||||||
private Label label5;
|
private Label label5;
|
||||||
private ComboBox comboBoxMaster;
|
private ComboBox comboBoxMaster;
|
||||||
private GroupBox groupBox1;
|
private GroupBox groupBoxDetail;
|
||||||
private DataGridView dataGridView;
|
private DataGridView dataGridView;
|
||||||
private DataGridViewComboBoxColumn Detail;
|
private DataGridViewComboBoxColumn Detail;
|
||||||
private DataGridViewTextBoxColumn DetailCount;
|
private DataGridViewTextBoxColumn DetailCount;
|
||||||
|
@ -12,15 +12,48 @@ namespace ProjectRepairCompany.Forms
|
|||||||
public partial class FormOrder : Form
|
public partial class FormOrder : Form
|
||||||
{
|
{
|
||||||
private readonly IOrderRepository _orderRepository;
|
private readonly IOrderRepository _orderRepository;
|
||||||
private readonly IDetailRepository _detailRepository;
|
private int? _orderId;
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var order = _orderRepository.ReadOrderById(value);
|
||||||
|
if (order == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(nameof(order));
|
||||||
|
}
|
||||||
|
|
||||||
|
comboBoxMaster.SelectedValue = order.MasterId;
|
||||||
|
numericUpDownFullPrice.Value = (decimal)order.FullPrice;
|
||||||
|
dateTimeCompletion.Value = order.DateCompletion;
|
||||||
|
dateTimeIssue.Value = order.DateIssue;
|
||||||
|
|
||||||
|
foreach (var detail in order.OrderDetails)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Add(detail.DetailId, detail.DetailCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
_orderId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public FormOrder(IOrderRepository orderRepository, IMasterRepository masterRepository, IDetailRepository detailRepository)
|
public FormOrder(IOrderRepository orderRepository, IMasterRepository masterRepository, IDetailRepository detailRepository)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
|
_orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
|
||||||
|
|
||||||
|
|
||||||
comboBoxMaster.DataSource = masterRepository.ReadMasters();
|
comboBoxMaster.DataSource = masterRepository.ReadMasters();
|
||||||
comboBoxMaster.DisplayMember = "Name";
|
comboBoxMaster.DisplayMember = "MasterName";
|
||||||
comboBoxMaster.ValueMember = "Id";
|
comboBoxMaster.ValueMember = "Id";
|
||||||
|
|
||||||
Detail.DataSource = detailRepository.ReadDetails();
|
Detail.DataSource = detailRepository.ReadDetails();
|
||||||
@ -37,29 +70,16 @@ namespace ProjectRepairCompany.Forms
|
|||||||
throw new Exception("Имеются незаполненные поля.");
|
throw new Exception("Имеются незаполненные поля.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var order = Order.CreateOperation(
|
var order = CreateOrder();
|
||||||
id: 0,
|
if (_orderId.HasValue)
|
||||||
fullPrice: (int)numericUpDownFullPrice.Value,
|
|
||||||
masterId: (int)comboBoxMaster.SelectedValue!,
|
|
||||||
dateCompletion: dateTimeCompletion.Value,
|
|
||||||
dateIssue: dateTimeIssue.Value);
|
|
||||||
|
|
||||||
foreach (DataGridViewRow row in dataGridView.Rows)
|
|
||||||
{
|
{
|
||||||
if (row.Cells["Detail"].Value == null || row.Cells["DetailCount"].Value == null)
|
_orderRepository.UpdateOrder(order);
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int detailId = (int)row.Cells["Detail"].Value;
|
|
||||||
int detailCount = int.Parse(row.Cells["DetailCount"].Value.ToString() ?? "0");
|
|
||||||
var detailPrice = (int)_detailRepository.ReadDetailById(detailId).PriceDetail;
|
|
||||||
|
|
||||||
order.AddOrderDetail(detailId, detailPrice, detailCount);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
_orderRepository.CreateOrder(order);
|
{
|
||||||
|
_orderRepository.CreateOrder(order);
|
||||||
|
}
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -69,5 +89,36 @@ namespace ProjectRepairCompany.Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private List<OrderDetail> CreateListOrderDetailsFromDataGrid()
|
||||||
|
{
|
||||||
|
var list = new List<OrderDetail>();
|
||||||
|
foreach (DataGridViewRow row in dataGridView.Rows)
|
||||||
|
{
|
||||||
|
if (row.Cells["Detail"].Value == null ||
|
||||||
|
row.Cells["DetailCount"].Value == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list.Add(OrderDetail.CreateOperation(0,
|
||||||
|
Convert.ToInt32(row.Cells["Detail"].Value),
|
||||||
|
Convert.ToInt32(row.Cells["DetailCount"].Value)));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
private Order CreateOrder()
|
||||||
|
{
|
||||||
|
var orderDetails = CreateListOrderDetailsFromDataGrid();
|
||||||
|
|
||||||
|
return Order.CreateOperation(
|
||||||
|
_orderId ?? 0,
|
||||||
|
Convert.ToInt32(numericUpDownFullPrice.Value),
|
||||||
|
(int)comboBoxMaster.SelectedValue,
|
||||||
|
dateTimeCompletion.Value,
|
||||||
|
dateTimeIssue.Value,
|
||||||
|
orderDetails
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using ProjectRepairCompany.Repositories;
|
using ProjectRepairCompany.Repositories;
|
||||||
|
using ProjectRepairCompany.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -53,16 +54,19 @@ namespace ProjectRepairCompany.Forms
|
|||||||
|
|
||||||
private void ButtonUp_Click(object sender, EventArgs e)
|
private void ButtonUp_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!TryGetIdentifierFromSelectRow(out int findId))
|
if (!TryGetIdentifierFromSelectRow(out var findId))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var form = _container.Resolve<FormMaster>();
|
var form = _container.Resolve<FormOrder>();
|
||||||
form.Id = findId;
|
form.Id = findId;
|
||||||
form.ShowDialog();
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
LoadList();
|
{
|
||||||
|
LoadList();
|
||||||
|
dataGridView.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -72,7 +76,7 @@ namespace ProjectRepairCompany.Forms
|
|||||||
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
private void ButtonDel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!TryGetIdentifierFromSelectRow(out int findId))
|
if (!TryGetIdentifierFromSelectRow(out var findId))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -91,17 +95,7 @@ namespace ProjectRepairCompany.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadList()
|
private void LoadList() => dataGridView.DataSource = _orderRepository.ReadOrders();
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = _orderRepository.ReadOrders();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка загрузки данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool TryGetIdentifierFromSelectRow(out int id)
|
private bool TryGetIdentifierFromSelectRow(out int id)
|
||||||
{
|
{
|
||||||
|
@ -33,12 +33,12 @@
|
|||||||
label1 = new Label();
|
label1 = new Label();
|
||||||
label2 = new Label();
|
label2 = new Label();
|
||||||
label3 = new Label();
|
label3 = new Label();
|
||||||
numericUpDown1 = new NumericUpDown();
|
numericUpDownCount = new NumericUpDown();
|
||||||
dateTimePicker1 = new DateTimePicker();
|
dateTimePickerDate = new DateTimePicker();
|
||||||
comboBoxAddress = new ComboBox();
|
comboBoxAddress = new ComboBox();
|
||||||
label4 = new Label();
|
label4 = new Label();
|
||||||
comboBoxDetail = new ComboBox();
|
comboBoxDetail = new ComboBox();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// ButtonSave
|
// ButtonSave
|
||||||
@ -88,19 +88,19 @@
|
|||||||
label3.TabIndex = 4;
|
label3.TabIndex = 4;
|
||||||
label3.Text = "Дата";
|
label3.Text = "Дата";
|
||||||
//
|
//
|
||||||
// numericUpDown1
|
// numericUpDownCount
|
||||||
//
|
//
|
||||||
numericUpDown1.Location = new Point(128, 62);
|
numericUpDownCount.Location = new Point(128, 62);
|
||||||
numericUpDown1.Name = "numericUpDown1";
|
numericUpDownCount.Name = "numericUpDownCount";
|
||||||
numericUpDown1.Size = new Size(154, 25);
|
numericUpDownCount.Size = new Size(154, 25);
|
||||||
numericUpDown1.TabIndex = 5;
|
numericUpDownCount.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// dateTimePicker1
|
// dateTimePickerDate
|
||||||
//
|
//
|
||||||
dateTimePicker1.Location = new Point(119, 104);
|
dateTimePickerDate.Location = new Point(119, 104);
|
||||||
dateTimePicker1.Name = "dateTimePicker1";
|
dateTimePickerDate.Name = "dateTimePickerDate";
|
||||||
dateTimePicker1.Size = new Size(187, 25);
|
dateTimePickerDate.Size = new Size(187, 25);
|
||||||
dateTimePicker1.TabIndex = 6;
|
dateTimePickerDate.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// comboBoxAddress
|
// comboBoxAddress
|
||||||
//
|
//
|
||||||
@ -137,8 +137,8 @@
|
|||||||
Controls.Add(comboBoxDetail);
|
Controls.Add(comboBoxDetail);
|
||||||
Controls.Add(label4);
|
Controls.Add(label4);
|
||||||
Controls.Add(comboBoxAddress);
|
Controls.Add(comboBoxAddress);
|
||||||
Controls.Add(dateTimePicker1);
|
Controls.Add(dateTimePickerDate);
|
||||||
Controls.Add(numericUpDown1);
|
Controls.Add(numericUpDownCount);
|
||||||
Controls.Add(label3);
|
Controls.Add(label3);
|
||||||
Controls.Add(label2);
|
Controls.Add(label2);
|
||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
@ -146,7 +146,7 @@
|
|||||||
Controls.Add(ButtonSave);
|
Controls.Add(ButtonSave);
|
||||||
Name = "FormStorageDetail";
|
Name = "FormStorageDetail";
|
||||||
Text = "FormStorageDetail";
|
Text = "FormStorageDetail";
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@ -158,8 +158,8 @@
|
|||||||
private Label label1;
|
private Label label1;
|
||||||
private Label label2;
|
private Label label2;
|
||||||
private Label label3;
|
private Label label3;
|
||||||
private NumericUpDown numericUpDown1;
|
private NumericUpDown numericUpDownCount;
|
||||||
private DateTimePicker dateTimePicker1;
|
private DateTimePicker dateTimePickerDate;
|
||||||
private ComboBox comboBoxAddress;
|
private ComboBox comboBoxAddress;
|
||||||
private Label label4;
|
private Label label4;
|
||||||
private ComboBox comboBoxDetail;
|
private ComboBox comboBoxDetail;
|
||||||
|
@ -28,11 +28,11 @@ namespace ProjectRepairCompany.Forms
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (comboBoxDetail.SelectedIndex < 0 || comboBoxAddress.SelectedIndex < 0 || Convert.ToInt32(numericUpDown1.Value) == 0)
|
if (comboBoxDetail.SelectedIndex < 0 || comboBoxAddress.SelectedIndex < 0 || Convert.ToInt32(numericUpDownCount.Value) == 0)
|
||||||
{
|
{
|
||||||
throw new Exception("Заполни все поля");
|
throw new Exception("Заполни все поля");
|
||||||
}
|
}
|
||||||
_storageDetailRepository.CreateStorageDetail(StorageDetail.CreateOperation((int)comboBoxAddress.SelectedValue!, (int)comboBoxDetail.SelectedValue!, Convert.ToInt32(numericUpDown1.Value), dateTimePicker1.Value));
|
_storageDetailRepository.CreateStorageDetail(StorageDetail.CreateOperation((int)comboBoxAddress.SelectedValue!, (int)comboBoxDetail.SelectedValue!, Convert.ToInt32(numericUpDownCount.Value), dateTimePickerDate.Value));
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Controls.Add(panel1);
|
Controls.Add(panel1);
|
||||||
Name = "FormStorageDetails";
|
Name = "FormStorageDetails";
|
||||||
Text = "Пополнение деталей";
|
Text = "Пополнение складов";
|
||||||
Load += FormStorageDetail_Load;
|
Load += FormStorageDetail_Load;
|
||||||
panel1.ResumeLayout(false);
|
panel1.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
@ -34,7 +34,7 @@ namespace ProjectRepairCompany.Forms
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_container.Resolve<FormStorageDetail>().ShowDialog(); // Форма добавления StorageDetail
|
_container.Resolve<FormStorageDetail>().ShowDialog();
|
||||||
LoadList();
|
LoadList();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user