diff --git a/PlumbingRepair/PlumbingRepair/nlog.Designer.config b/PlumbingRepair/PlumbingRepair/nlog.Designer.config
deleted file mode 100644
index 4bd8e34..0000000
--- a/PlumbingRepair/PlumbingRepair/nlog.Designer.config
+++ /dev/null
@@ -1,38 +0,0 @@
-namespace PlumbingRepairView
-{
- partial class nlog
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- } base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Text = "nlog";
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
index b0263c0..dfdb57d 100644
--- a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
+++ b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
@@ -85,11 +85,13 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
return false;
}
+ model.Status = newStatus;
model.DateCreate = viewModel.DateCreate;
model.Sum = viewModel.Sum;
model.Count = viewModel.Count;
model.DateImplement = viewModel.DateImplement;
model.WorkId = viewModel.WorkId;
+
if (viewModel.ImplementerId.HasValue)
{
model.ImplementerId = viewModel.ImplementerId;
diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/WorkModeling.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/WorkModeling.cs
index fb186a9..29fe3a8 100644
--- a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/WorkModeling.cs
+++ b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/WorkModeling.cs
@@ -15,13 +15,17 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
public class WorkModeling : IWorkProcess
{
private readonly ILogger _logger;
+
private readonly Random _rnd;
+
private IOrderLogic? _orderLogic;
+
public WorkModeling(ILogger logger)
{
_logger = logger;
_rnd = new Random(1000);
}
+
public void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic)
{
_orderLogic = orderLogic;
@@ -43,6 +47,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
Task.Run(() => WorkerWorkAsync(implementer, orders));
}
}
+
///
/// Иммитация работы исполнителя
///
@@ -55,6 +60,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
return;
}
await RunOrderInWork(implementer);
+
await Task.Run(() =>
{
foreach (var order in orders)
@@ -88,10 +94,12 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
{
_logger.LogError(ex, "Error while do work");
throw;
- }
+ }
+
}
});
}
+
///
/// Ищем заказ, которые уже в работе (вдруг исполнителя прервали)
///
@@ -114,6 +122,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
{
return;
}
+
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id);
// доделываем работу
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
diff --git a/PlumbingRepair/PlumbingRepairDataBaseImplement/Implements/OrderStorage.cs b/PlumbingRepair/PlumbingRepairDataBaseImplement/Implements/OrderStorage.cs
index fb5e3d0..8dbb5f4 100644
--- a/PlumbingRepair/PlumbingRepairDataBaseImplement/Implements/OrderStorage.cs
+++ b/PlumbingRepair/PlumbingRepairDataBaseImplement/Implements/OrderStorage.cs
@@ -90,8 +90,9 @@ namespace PlumbingRepairDataBaseImplement.Implements
.Include(x => x.Work)
.Include(x => x.Client)
.Include(x => x.Implementer)
- .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
- ?.GetViewModel;
+ .FirstOrDefault(x => (!model.ImplementerId.HasValue || x.ImplementerId == model.ImplementerId) &&
+ (!model.Status.HasValue || x.Status == model.Status) &&
+ (!model.Id.HasValue || x.Id == model.Id))?.GetViewModel;
}
public OrderViewModel? Insert(OrderBindingModel model)