Compare commits
20 Commits
bb74221578
...
7aa92dbb74
Author | SHA1 | Date | |
---|---|---|---|
7aa92dbb74 | |||
29a8bf30cc | |||
8507a11132 | |||
716e94751c | |||
b2c61a619a | |||
862baf93b6 | |||
daf95e27b6 | |||
75a544e690 | |||
e390ece7b6 | |||
9c80b7fd37 | |||
3b2493bbaf | |||
b1dfb228b2 | |||
cf13f3028e | |||
5c57715fe3 | |||
72b59a71eb | |||
14a2efbb78 | |||
8597edb910 | |||
d67f6123f2 | |||
49152e95c5 | |||
ccfe49dde9 |
@ -103,7 +103,6 @@ namespace LawFirmView
|
|||||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
||||||
{
|
{
|
||||||
DocumentId = Convert.ToInt32(comboBoxDocument.SelectedValue),
|
DocumentId = Convert.ToInt32(comboBoxDocument.SelectedValue),
|
||||||
DocumentName = comboBoxDocument.Text,
|
|
||||||
Count = Convert.ToInt32(textBoxCount.Text),
|
Count = Convert.ToInt32(textBoxCount.Text),
|
||||||
Sum = Convert.ToDouble(textBoxSum.Text)
|
Sum = Convert.ToDouble(textBoxSum.Text)
|
||||||
});
|
});
|
||||||
|
@ -64,7 +64,6 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
Id = viewModel.Id,
|
Id = viewModel.Id,
|
||||||
DocumentId = viewModel.DocumentId,
|
DocumentId = viewModel.DocumentId,
|
||||||
DocumentName = viewModel.DocumentName,
|
|
||||||
Status = viewModel.Status,
|
Status = viewModel.Status,
|
||||||
DateCreate = viewModel.DateCreate,
|
DateCreate = viewModel.DateCreate,
|
||||||
DateImplement = viewModel.DateImplement,
|
DateImplement = viewModel.DateImplement,
|
||||||
@ -72,7 +71,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
|||||||
Sum = viewModel.Sum
|
Sum = viewModel.Sum
|
||||||
};
|
};
|
||||||
|
|
||||||
CheckModel(model);
|
CheckModel(model, false);
|
||||||
if (model.Status + 1 != newStatus)
|
if (model.Status + 1 != newStatus)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Status update to " + newStatus.ToString() +" operation failed. Order status incorrect.");
|
_logger.LogWarning("Status update to " + newStatus.ToString() +" operation failed. Order status incorrect.");
|
||||||
|
@ -12,8 +12,6 @@ namespace LawFirmContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public int DocumentId { get; set; }
|
public int DocumentId { get; set; }
|
||||||
|
|
||||||
public string DocumentName { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
|
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
|
@ -10,7 +10,6 @@ namespace LawFirmDataModels.Models
|
|||||||
public interface IOrderModel : IId
|
public interface IOrderModel : IId
|
||||||
{
|
{
|
||||||
int DocumentId { get; }
|
int DocumentId { get; }
|
||||||
string DocumentName { get; }
|
|
||||||
int Count { get; }
|
int Count { get; }
|
||||||
double Sum { get; }
|
double Sum { get; }
|
||||||
OrderStatus Status { get; }
|
OrderStatus Status { get; }
|
||||||
|
@ -26,8 +26,8 @@ namespace LawFirmFileImplement.Implements
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return source.Orders
|
return GetViewModel(source.Orders
|
||||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
@ -38,13 +38,13 @@ namespace LawFirmFileImplement.Implements
|
|||||||
}
|
}
|
||||||
return source.Orders
|
return source.Orders
|
||||||
.Where(x => x.Id == model.Id)
|
.Where(x => x.Id == model.Id)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => GetViewModel(x))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
return source.Orders.Select(x => x.GetViewModel).ToList();
|
return source.Orders.Select(x => GetViewModel(x)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
@ -57,7 +57,7 @@ namespace LawFirmFileImplement.Implements
|
|||||||
}
|
}
|
||||||
source.Orders.Add(newOrder);
|
source.Orders.Add(newOrder);
|
||||||
source.SaveOrders();
|
source.SaveOrders();
|
||||||
return newOrder.GetViewModel;
|
return GetViewModel(newOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
@ -69,7 +69,7 @@ namespace LawFirmFileImplement.Implements
|
|||||||
}
|
}
|
||||||
order.Update(model);
|
order.Update(model);
|
||||||
source.SaveOrders();
|
source.SaveOrders();
|
||||||
return order.GetViewModel;
|
return GetViewModel(order);
|
||||||
}
|
}
|
||||||
public OrderViewModel? Delete(OrderBindingModel model)
|
public OrderViewModel? Delete(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -80,7 +80,21 @@ namespace LawFirmFileImplement.Implements
|
|||||||
}
|
}
|
||||||
source.Orders.Remove(order);
|
source.Orders.Remove(order);
|
||||||
source.SaveOrders();
|
source.SaveOrders();
|
||||||
return order.GetViewModel;
|
return GetViewModel(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
private OrderViewModel GetViewModel(Order order)
|
||||||
|
{
|
||||||
|
var viewModel = order.GetViewModel;
|
||||||
|
foreach (var document in source.Documents)
|
||||||
|
{
|
||||||
|
if (document.Id == order.DocumentId)
|
||||||
|
{
|
||||||
|
viewModel.DocumentName = document.DocumentName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return viewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@ namespace LawFirmFileImplement.Models
|
|||||||
{
|
{
|
||||||
public int DocumentId { get; private set; }
|
public int DocumentId { get; private set; }
|
||||||
|
|
||||||
public string DocumentName { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
public double Sum { get; private set; }
|
public double Sum { get; private set; }
|
||||||
@ -38,7 +36,6 @@ namespace LawFirmFileImplement.Models
|
|||||||
return new Order
|
return new Order
|
||||||
{
|
{
|
||||||
DocumentId = model.DocumentId,
|
DocumentId = model.DocumentId,
|
||||||
DocumentName = model.DocumentName,
|
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
@ -57,7 +54,6 @@ namespace LawFirmFileImplement.Models
|
|||||||
return new Order()
|
return new Order()
|
||||||
{
|
{
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
DocumentName = element.Element("DocumentName")!.Value,
|
|
||||||
DocumentId = Convert.ToInt32(element.Element("DocumentId")!.Value),
|
DocumentId = Convert.ToInt32(element.Element("DocumentId")!.Value),
|
||||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||||
@ -73,20 +69,13 @@ namespace LawFirmFileImplement.Models
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DocumentId = model.DocumentId;
|
|
||||||
DocumentName = model.DocumentName;
|
|
||||||
Count = model.Count;
|
|
||||||
Sum = model.Sum;
|
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
DateCreate = model.DateCreate;
|
|
||||||
DateImplement = model.DateImplement;
|
DateImplement = model.DateImplement;
|
||||||
Id = model.Id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
DocumentId = DocumentId,
|
DocumentId = DocumentId,
|
||||||
DocumentName = DocumentName,
|
|
||||||
Count = Count,
|
Count = Count,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
DateCreate = DateCreate,
|
DateCreate = DateCreate,
|
||||||
@ -98,7 +87,6 @@ namespace LawFirmFileImplement.Models
|
|||||||
public XElement GetXElement => new(
|
public XElement GetXElement => new(
|
||||||
"Order",
|
"Order",
|
||||||
new XAttribute("Id", Id),
|
new XAttribute("Id", Id),
|
||||||
new XElement("DocumentName", DocumentName),
|
|
||||||
new XElement("DocumentId", DocumentId.ToString()),
|
new XElement("DocumentId", DocumentId.ToString()),
|
||||||
new XElement("Count", Count.ToString()),
|
new XElement("Count", Count.ToString()),
|
||||||
new XElement("Sum", Sum.ToString()),
|
new XElement("Sum", Sum.ToString()),
|
||||||
|
@ -30,7 +30,7 @@ namespace LawFirmListImplements.Implements
|
|||||||
{
|
{
|
||||||
if (model.Id.HasValue && order.Id == model.Id)
|
if (model.Id.HasValue && order.Id == model.Id)
|
||||||
{
|
{
|
||||||
return order.GetViewModel;
|
return GetViewModel(order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -47,7 +47,7 @@ namespace LawFirmListImplements.Implements
|
|||||||
{
|
{
|
||||||
if (order.Id == model.Id)
|
if (order.Id == model.Id)
|
||||||
{
|
{
|
||||||
result.Add(order.GetViewModel);
|
result.Add(GetViewModel(order));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -58,7 +58,7 @@ namespace LawFirmListImplements.Implements
|
|||||||
var result = new List<OrderViewModel>();
|
var result = new List<OrderViewModel>();
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
result.Add(order.GetViewModel);
|
result.Add(GetViewModel(order));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ namespace LawFirmListImplements.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_source.Orders.Add(newOrder);
|
_source.Orders.Add(newOrder);
|
||||||
return newOrder.GetViewModel;
|
return GetViewModel(newOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
@ -89,7 +89,7 @@ namespace LawFirmListImplements.Implements
|
|||||||
if (order.Id == model.Id)
|
if (order.Id == model.Id)
|
||||||
{
|
{
|
||||||
order.Update(model);
|
order.Update(model);
|
||||||
return order.GetViewModel;
|
return GetViewModel(order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -102,11 +102,25 @@ namespace LawFirmListImplements.Implements
|
|||||||
{
|
{
|
||||||
var element = _source.Orders[i];
|
var element = _source.Orders[i];
|
||||||
_source.Orders.RemoveAt(i);
|
_source.Orders.RemoveAt(i);
|
||||||
return element.GetViewModel;
|
return GetViewModel(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private OrderViewModel GetViewModel(Order order)
|
||||||
|
{
|
||||||
|
var viewModel = order.GetViewModel;
|
||||||
|
foreach (var document in _source.Documents)
|
||||||
|
{
|
||||||
|
if (document.Id == order.DocumentId)
|
||||||
|
{
|
||||||
|
viewModel.DocumentName = document.DocumentName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return viewModel;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,6 @@ namespace LawFirmListImplements.Models
|
|||||||
{
|
{
|
||||||
public int DocumentId { get; private set; }
|
public int DocumentId { get; private set; }
|
||||||
|
|
||||||
public string DocumentName { get; private set; } = string.Empty;
|
|
||||||
|
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
public double Sum { get; private set; }
|
public double Sum { get; private set; }
|
||||||
@ -37,7 +35,6 @@ namespace LawFirmListImplements.Models
|
|||||||
return new Order
|
return new Order
|
||||||
{
|
{
|
||||||
DocumentId = model.DocumentId,
|
DocumentId = model.DocumentId,
|
||||||
DocumentName = model.DocumentName,
|
|
||||||
Count = model.Count,
|
Count = model.Count,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
@ -53,20 +50,13 @@ namespace LawFirmListImplements.Models
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DocumentId = model.DocumentId;
|
|
||||||
DocumentName = model.DocumentName;
|
|
||||||
Count = model.Count;
|
|
||||||
Sum = model.Sum;
|
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
DateCreate = model.DateCreate;
|
|
||||||
DateImplement = model.DateImplement;
|
DateImplement = model.DateImplement;
|
||||||
Id = model.Id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
DocumentId = DocumentId,
|
DocumentId = DocumentId,
|
||||||
DocumentName = DocumentName,
|
|
||||||
Count = Count,
|
Count = Count,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
DateCreate = DateCreate,
|
DateCreate = DateCreate,
|
||||||
|
Loading…
Reference in New Issue
Block a user