Знаю как починить, но мб это неправильно
This commit is contained in:
parent
7d890d2294
commit
ea538ac02c
@ -1,38 +0,0 @@
|
|||||||
namespace PlumbingRepairView
|
|
||||||
{
|
|
||||||
partial class nlog
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
} base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
@ -85,11 +85,13 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model.Status = newStatus;
|
||||||
model.DateCreate = viewModel.DateCreate;
|
model.DateCreate = viewModel.DateCreate;
|
||||||
model.Sum = viewModel.Sum;
|
model.Sum = viewModel.Sum;
|
||||||
model.Count = viewModel.Count;
|
model.Count = viewModel.Count;
|
||||||
model.DateImplement = viewModel.DateImplement;
|
model.DateImplement = viewModel.DateImplement;
|
||||||
model.WorkId = viewModel.WorkId;
|
model.WorkId = viewModel.WorkId;
|
||||||
|
|
||||||
if (viewModel.ImplementerId.HasValue)
|
if (viewModel.ImplementerId.HasValue)
|
||||||
{
|
{
|
||||||
model.ImplementerId = viewModel.ImplementerId;
|
model.ImplementerId = viewModel.ImplementerId;
|
||||||
|
@ -15,13 +15,17 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
|||||||
public class WorkModeling : IWorkProcess
|
public class WorkModeling : IWorkProcess
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private readonly Random _rnd;
|
private readonly Random _rnd;
|
||||||
|
|
||||||
private IOrderLogic? _orderLogic;
|
private IOrderLogic? _orderLogic;
|
||||||
|
|
||||||
public WorkModeling(ILogger<WorkModeling> logger)
|
public WorkModeling(ILogger<WorkModeling> logger)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_rnd = new Random(1000);
|
_rnd = new Random(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic)
|
public void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic)
|
||||||
{
|
{
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
@ -43,6 +47,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
|||||||
Task.Run(() => WorkerWorkAsync(implementer, orders));
|
Task.Run(() => WorkerWorkAsync(implementer, orders));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Иммитация работы исполнителя
|
/// Иммитация работы исполнителя
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -55,6 +60,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await RunOrderInWork(implementer);
|
await RunOrderInWork(implementer);
|
||||||
|
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
foreach (var order in orders)
|
foreach (var order in orders)
|
||||||
@ -89,9 +95,11 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
|||||||
_logger.LogError(ex, "Error while do work");
|
_logger.LogError(ex, "Error while do work");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ищем заказ, которые уже в работе (вдруг исполнителя прервали)
|
/// Ищем заказ, которые уже в работе (вдруг исполнителя прервали)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -114,6 +122,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id);
|
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id);
|
||||||
// доделываем работу
|
// доделываем работу
|
||||||
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
|
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
|
||||||
|
@ -90,8 +90,9 @@ namespace PlumbingRepairDataBaseImplement.Implements
|
|||||||
.Include(x => x.Work)
|
.Include(x => x.Work)
|
||||||
.Include(x => x.Client)
|
.Include(x => x.Client)
|
||||||
.Include(x => x.Implementer)
|
.Include(x => x.Implementer)
|
||||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
|
.FirstOrDefault(x => (!model.ImplementerId.HasValue || x.ImplementerId == model.ImplementerId) &&
|
||||||
?.GetViewModel;
|
(!model.Status.HasValue || x.Status == model.Status) &&
|
||||||
|
(!model.Id.HasValue || x.Id == model.Id))?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
|
Loading…
Reference in New Issue
Block a user