Готово
This commit is contained in:
parent
9d47e1d3a0
commit
4b9b9046f0
@ -40,6 +40,7 @@
|
||||
//
|
||||
// comboBoxRepair
|
||||
//
|
||||
comboBoxRepair.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxRepair.FormattingEnabled = true;
|
||||
comboBoxRepair.Location = new Point(131, 9);
|
||||
comboBoxRepair.Name = "comboBoxRepair";
|
||||
@ -91,6 +92,7 @@
|
||||
textBoxSum.ReadOnly = true;
|
||||
textBoxSum.Size = new Size(260, 27);
|
||||
textBoxSum.TabIndex = 5;
|
||||
textBoxSum.TextChanged += TextBoxSum_TextChanged;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
|
@ -69,6 +69,10 @@ namespace CarRepairShop
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
private void TextBoxSum_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
private void ComboBoxRepair_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
|
@ -1,5 +1,6 @@
|
||||
using CarRepairShopContracts.BindingModels;
|
||||
using CarRepairShopContracts.BusinessLogicsContracts;
|
||||
using CarRepairShopDataModels.Enums;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace CarRepairShop
|
||||
@ -65,6 +66,18 @@ namespace CarRepairShop
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
private OrderBindingModel CreateBindingModel(int id, bool isDone = false)
|
||||
{
|
||||
return new OrderBindingModel
|
||||
{
|
||||
Id = id,
|
||||
RepairId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["RepairId"].Value),
|
||||
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
||||
};
|
||||
}
|
||||
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
@ -74,9 +87,7 @@ namespace CarRepairShop
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new
|
||||
OrderBindingModel
|
||||
{ Id = id });
|
||||
var operationResult = _orderLogic.TakeOrderInWork(CreateBindingModel(id));
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
@ -101,9 +112,7 @@ namespace CarRepairShop
|
||||
id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.FinishOrder(new
|
||||
OrderBindingModel
|
||||
{ Id = id });
|
||||
var operationResult = _orderLogic.FinishOrder(CreateBindingModel(id));
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
@ -127,9 +136,7 @@ namespace CarRepairShop
|
||||
id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.DeliveryOrder(new
|
||||
OrderBindingModel
|
||||
{ Id = id });
|
||||
var operationResult = _orderLogic.DeliveryOrder(CreateBindingModel(id));
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
|
49
CarRepairShop/CarRepairShop/FormRepair.Designer.cs
generated
49
CarRepairShop/CarRepairShop/FormRepair.Designer.cs
generated
@ -36,12 +36,13 @@
|
||||
buttonUpdate = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewComponents = new DataGridView();
|
||||
ComponentNameColumn = new DataGridViewTextBoxColumn();
|
||||
CountColumn = new DataGridViewTextBoxColumn();
|
||||
textBoxName = new TextBox();
|
||||
textBoxCost = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
id = new DataGridViewTextBoxColumn();
|
||||
ComponentNameColumn = new DataGridViewTextBoxColumn();
|
||||
CountColumn = new DataGridViewTextBoxColumn();
|
||||
groupBoxComponents.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewComponents).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -122,7 +123,7 @@
|
||||
//
|
||||
dataGridViewComponents.BackgroundColor = Color.White;
|
||||
dataGridViewComponents.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewComponents.Columns.AddRange(new DataGridViewColumn[] { ComponentNameColumn, CountColumn });
|
||||
dataGridViewComponents.Columns.AddRange(new DataGridViewColumn[] { id, ComponentNameColumn, CountColumn });
|
||||
dataGridViewComponents.Location = new Point(13, 23);
|
||||
dataGridViewComponents.Name = "dataGridViewComponents";
|
||||
dataGridViewComponents.RowHeadersWidth = 51;
|
||||
@ -130,20 +131,6 @@
|
||||
dataGridViewComponents.Size = new Size(573, 274);
|
||||
dataGridViewComponents.TabIndex = 0;
|
||||
//
|
||||
// ComponentNameColumn
|
||||
//
|
||||
ComponentNameColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
ComponentNameColumn.HeaderText = "Компонент";
|
||||
ComponentNameColumn.MinimumWidth = 320;
|
||||
ComponentNameColumn.Name = "ComponentNameColumn";
|
||||
//
|
||||
// CountColumn
|
||||
//
|
||||
CountColumn.HeaderText = "Количество";
|
||||
CountColumn.MinimumWidth = 6;
|
||||
CountColumn.Name = "CountColumn";
|
||||
CountColumn.Width = 200;
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(117, 18);
|
||||
@ -155,6 +142,7 @@
|
||||
//
|
||||
textBoxCost.Location = new Point(117, 58);
|
||||
textBoxCost.Name = "textBoxCost";
|
||||
textBoxCost.ReadOnly = true;
|
||||
textBoxCost.Size = new Size(229, 27);
|
||||
textBoxCost.TabIndex = 3;
|
||||
//
|
||||
@ -178,6 +166,28 @@
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// id
|
||||
//
|
||||
id.HeaderText = "";
|
||||
id.MinimumWidth = 6;
|
||||
id.Name = "id";
|
||||
id.Visible = false;
|
||||
id.Width = 125;
|
||||
//
|
||||
// ComponentNameColumn
|
||||
//
|
||||
ComponentNameColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
ComponentNameColumn.HeaderText = "Компонент";
|
||||
ComponentNameColumn.MinimumWidth = 320;
|
||||
ComponentNameColumn.Name = "ComponentNameColumn";
|
||||
//
|
||||
// CountColumn
|
||||
//
|
||||
CountColumn.HeaderText = "Количество";
|
||||
CountColumn.MinimumWidth = 6;
|
||||
CountColumn.Name = "CountColumn";
|
||||
CountColumn.Width = 200;
|
||||
//
|
||||
// FormRepair
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
@ -206,8 +216,6 @@
|
||||
private Label labelCost;
|
||||
private GroupBox groupBoxComponents;
|
||||
private DataGridView dataGridViewComponents;
|
||||
private DataGridViewTextBoxColumn ComponentNameColumn;
|
||||
private DataGridViewTextBoxColumn CountColumn;
|
||||
private Button buttonRefresh;
|
||||
private Button buttonDelete;
|
||||
private Button buttonUpdate;
|
||||
@ -216,5 +224,8 @@
|
||||
private TextBox textBoxCost;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private DataGridViewTextBoxColumn id;
|
||||
private DataGridViewTextBoxColumn ComponentNameColumn;
|
||||
private DataGridViewTextBoxColumn CountColumn;
|
||||
}
|
||||
}
|
@ -29,15 +29,13 @@ namespace CarRepairShop
|
||||
{
|
||||
var view = _logic.ReadElement(new RepairSearchModel
|
||||
{
|
||||
Id =
|
||||
_id.Value
|
||||
Id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
textBoxName.Text = view.RepairName;
|
||||
textBoxCost.Text = view.Price.ToString();
|
||||
_repairComponents = view.RepairComponents ?? new
|
||||
Dictionary<int, (IComponentModel, int)>();
|
||||
_repairComponents = view.RepairComponents ?? new Dictionary<int, (IComponentModel, int)>();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ComponentNameColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
@ -56,6 +56,7 @@
|
||||
//
|
||||
// comboBoxComponent
|
||||
//
|
||||
comboBoxComponent.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxComponent.FormattingEnabled = true;
|
||||
comboBoxComponent.Location = new Point(124, 23);
|
||||
comboBoxComponent.Name = "comboBoxComponent";
|
||||
|
Loading…
x
Reference in New Issue
Block a user