fix
This commit is contained in:
parent
4137695876
commit
44a14b6d77
@ -39,6 +39,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
|
|||||||
var paymeants = _paymeantstorage.GetFillteredList(new PaymeantSearchModel {
|
var paymeants = _paymeantstorage.GetFillteredList(new PaymeantSearchModel {
|
||||||
DateFrom = model.DateFrom,
|
DateFrom = model.DateFrom,
|
||||||
DateTo = model.DateTo,
|
DateTo = model.DateTo,
|
||||||
|
ClientID = model.ClientID,
|
||||||
});
|
});
|
||||||
|
|
||||||
List<ReportProductsViewModel>? products = new();
|
List<ReportProductsViewModel>? products = new();
|
||||||
@ -91,17 +92,15 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
|
|||||||
TotalCount = 0
|
TotalCount = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var payment in paymeants) {
|
var order = _orderStorage.GetElement(new OrderSearchModel { ID = paymeant.OrderID })
|
||||||
var order = _orderStorage.GetElement(new OrderSearchModel { ID = paymeant.OrderID })
|
?? throw new Exception("Ошибка полуения данных");
|
||||||
?? throw new Exception("Ошибка полуения данных");
|
|
||||||
|
|
||||||
foreach (var product in order.ProductList) {
|
foreach (var product in order.ProductList) {
|
||||||
record.Products.Add(new(product.Value.Item1.ProductName, product.Value.Item2));
|
record.Products.Add(new(product.Value.Item1.ProductName, product.Value.Item2));
|
||||||
record.TotalCount += product.Value.Item2;
|
record.TotalCount += product.Value.Item2;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
list.Add(record);
|
||||||
list.Add(record);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -13,5 +13,6 @@ namespace ElectronicsShopContracts.BindingModels
|
|||||||
public string ClientEmail { get; set; } = string.Empty;
|
public string ClientEmail { get; set; } = string.Empty;
|
||||||
public DateTime DateFrom { get; set; }
|
public DateTime DateFrom { get; set; }
|
||||||
public DateTime DateTo { get; set; }
|
public DateTime DateTo { get; set; }
|
||||||
|
public int ClientID { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,19 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_payLogic.CreatePay(model);
|
_payLogic.CreatePay(model);
|
||||||
|
var order = _orderLogic.ReadElement(new OrderSearchModel { ID = model.OrderID });
|
||||||
|
|
||||||
|
if (order == null) {
|
||||||
|
throw new Exception("Ошибка получения данных");
|
||||||
|
}
|
||||||
|
|
||||||
|
_orderLogic.Update(new OrderBindingModel {
|
||||||
|
ID = order.ID,
|
||||||
|
ClientID = order.ClientID,
|
||||||
|
DateCreate = order.DateCreate,
|
||||||
|
Sum = order.Sum - model.SumPayment,
|
||||||
|
ProductList = order.ProductList,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.PayOption == 0) {
|
if (model.PayOption == 0) {
|
||||||
@ -126,26 +139,11 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
ID = model.OrderID,
|
ID = model.OrderID,
|
||||||
ClientID = order.ClientID,
|
ClientID = order.ClientID,
|
||||||
DateCreate = order.DateCreate,
|
DateCreate = order.DateCreate,
|
||||||
Sum = order.Sum - model.SumPayment,
|
Sum = order.Sum,
|
||||||
ProductList = order.ProductList,
|
ProductList = order.ProductList,
|
||||||
Status = OrderStatus.Оплачено
|
Status = OrderStatus.Оплачено
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
var order = _orderLogic.ReadElement(new OrderSearchModel { ID = model.OrderID });
|
|
||||||
|
|
||||||
if (order == null) {
|
|
||||||
throw new Exception("Ошибка получения данных");
|
|
||||||
}
|
|
||||||
|
|
||||||
_orderLogic.Update(new OrderBindingModel {
|
|
||||||
ID = order.ID,
|
|
||||||
ClientID = order.ClientID,
|
|
||||||
DateCreate = order.DateCreate,
|
|
||||||
Sum = order.Sum - model.SumPayment,
|
|
||||||
ProductList = order.ProductList,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
_logger.LogError(ex, "Ошибка создания оплаты");
|
_logger.LogError(ex, "Ошибка создания оплаты");
|
||||||
|
Binary file not shown.
@ -274,6 +274,7 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
return PaymeantOption.Íåîïëà÷åíî;
|
return PaymeantOption.Íåîïëà÷åíî;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public double Calc(int count, int product) {
|
public double Calc(int count, int product) {
|
||||||
var _product = APIClient.GetRequset<ProductViewModel>($"api/main/getproduct?_productid={product}");
|
var _product = APIClient.GetRequset<ProductViewModel>($"api/main/getproduct?_productid={product}");
|
||||||
@ -333,7 +334,8 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
APIClient.PostRequest("api/client/SendReportMail", new ReportBindingModel {
|
APIClient.PostRequest("api/client/SendReportMail", new ReportBindingModel {
|
||||||
ClientEmail = APIClient.Client?.Email ?? throw new Exception("Îøèáêà ïîëó÷åíèÿ àäðåñà"),
|
ClientEmail = APIClient.Client?.Email ?? throw new Exception("Îøèáêà ïîëó÷åíèÿ àäðåñà"),
|
||||||
DateFrom = DateTime.Parse(DateFrom),
|
DateFrom = DateTime.Parse(DateFrom),
|
||||||
DateTo = DateTime.Parse(DateTo)
|
DateTo = DateTime.Parse(DateTo),
|
||||||
|
ClientID = APIClient.Client.ID
|
||||||
});
|
});
|
||||||
return View("Report");
|
return View("Report");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user