This commit is contained in:
Данияр Аглиуллов 2023-02-05 13:24:32 +04:00
parent bdd6aaa000
commit bac3eb0a04
3 changed files with 10 additions and 16 deletions

View File

@ -24,7 +24,8 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
CheckModel(model); CheckModel(model);
if (model.Status != OrderStatus.Неизвестен) if (model.Status != OrderStatus.Неизвестен)
{ {
throw new ArgumentException($"Статус заказа должен быть {OrderStatus.Неизвестен}", nameof(model.Status)); throw new ArgumentException(
$"Статус заказа должен быть {OrderStatus.Неизвестен}", nameof(model));
} }
model.Status = OrderStatus.Принят; model.Status = OrderStatus.Принят;
model.DateCreate = DateTime.Now; model.DateCreate = DateTime.Now;
@ -86,10 +87,12 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
if ((int)vmodel.Status + 1 != (int)orderStatus) if ((int)vmodel.Status + 1 != (int)orderStatus)
{ {
throw new ArgumentException($"Попытка перевести заказ не в следующий статус: " + throw new ArgumentException($"Попытка перевести заказ не в следующий статус: " +
$"Текущий статус: {vmodel.Status}" + $"Текущий статус: {vmodel.Status} \n" +
$"Планируемый статус: {orderStatus}", nameof(vmodel.Status)); $"Планируемый статус: {orderStatus} \n" +
$"Доступный статус: {(OrderStatus)((int)vmodel.Status + 1)}",
nameof(vmodel));
} }
model.Status++; model.Status = orderStatus;
if (_orderStorage.Update(model) == null) if (_orderStorage.Update(model) == null)
{ {
_logger.LogWarning("Update operation failed"); _logger.LogWarning("Update operation failed");

View File

@ -95,7 +95,7 @@
// buttonDel // buttonDel
// //
this.buttonDel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonDel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDel.Location = new System.Drawing.Point(680, 107); this.buttonDel.Location = new System.Drawing.Point(680, 158);
this.buttonDel.Name = "buttonDel"; this.buttonDel.Name = "buttonDel";
this.buttonDel.Size = new System.Drawing.Size(90, 33); this.buttonDel.Size = new System.Drawing.Size(90, 33);
this.buttonDel.TabIndex = 3; this.buttonDel.TabIndex = 3;
@ -106,7 +106,7 @@
// buttonUpd // buttonUpd
// //
this.buttonUpd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonUpd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUpd.Location = new System.Drawing.Point(680, 53); this.buttonUpd.Location = new System.Drawing.Point(680, 108);
this.buttonUpd.Name = "buttonUpd"; this.buttonUpd.Name = "buttonUpd";
this.buttonUpd.Size = new System.Drawing.Size(90, 34); this.buttonUpd.Size = new System.Drawing.Size(90, 34);
this.buttonUpd.TabIndex = 2; this.buttonUpd.TabIndex = 2;
@ -116,7 +116,7 @@
// //
// buttonAdd // buttonAdd
// //
this.buttonAdd.Location = new System.Drawing.Point(680, 157); this.buttonAdd.Location = new System.Drawing.Point(680, 62);
this.buttonAdd.Name = "buttonAdd"; this.buttonAdd.Name = "buttonAdd";
this.buttonAdd.Size = new System.Drawing.Size(90, 30); this.buttonAdd.Size = new System.Drawing.Size(90, 30);
this.buttonAdd.TabIndex = 1; this.buttonAdd.TabIndex = 1;

View File

@ -66,13 +66,4 @@
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Component.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>