Report logis запрос нв получение данных из бд
This commit is contained in:
parent
d934652b6c
commit
d07ef5499f
@ -0,0 +1,42 @@
|
|||||||
|
using ElectronicsShopContracts.BindingModels;
|
||||||
|
using ElectronicsShopContracts.BusinessLogicContracts;
|
||||||
|
using ElectronicsShopContracts.SearchModels;
|
||||||
|
using ElectronicsShopContracts.StorageContracts;
|
||||||
|
using ElectronicsShopContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ElectronicsShopBusinessLogic.BusinessLogic
|
||||||
|
{
|
||||||
|
public class ReportLogic : IReportLogic
|
||||||
|
{
|
||||||
|
private readonly IOrderStorage _orderStorage;
|
||||||
|
private readonly IProductStorage _productStorag;
|
||||||
|
|
||||||
|
public ReportLogic(IOrderStorage orderStorage, IProductStorage productStorag) {
|
||||||
|
_orderStorage = orderStorage;
|
||||||
|
_productStorag = productStorag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Получение списка заказов за определенный период
|
||||||
|
public List<ReportOrdersViewModel> GerOrders(ReportBindingModel model) {
|
||||||
|
return _orderStorage.GetFilteredList(new OrderSearchModel {
|
||||||
|
DateFrom = model.DateFrom,
|
||||||
|
DateTo = model.DateTo,
|
||||||
|
}).Select(x => new ReportOrdersViewModel {
|
||||||
|
ID = x.ID,
|
||||||
|
DateCreate = x.DateCreate,
|
||||||
|
Sum = x.Sum,
|
||||||
|
PaymeantOption = x.PaymeantOption.ToString(),
|
||||||
|
OrderStatus = x.Status.ToString(),
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ElectronicsShopContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class ReportBindingModel
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public DateTime? DateFrom { get; set; }
|
||||||
|
public DateTime? DateTo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using ElectronicsShopContracts.BindingModels;
|
||||||
|
using ElectronicsShopContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ElectronicsShopContracts.BusinessLogicContracts
|
||||||
|
{
|
||||||
|
public interface IReportLogic
|
||||||
|
{
|
||||||
|
// Получение списка заказов за определенный период
|
||||||
|
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ElectronicsShopContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportOrdersViewModel
|
||||||
|
{
|
||||||
|
public int ID { get; set; }
|
||||||
|
public DateTime DateCreate { get; set; }
|
||||||
|
public double Sum { get; set; }
|
||||||
|
public string PaymeantOption { get; set; } = string.Empty;
|
||||||
|
public string OrderStatus { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -23,7 +23,7 @@ namespace ElectronicsShopDataBaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public PaymeantOption PaymeantOption { get; set; } = PaymeantOption.Неизвестно;
|
public PaymeantOption PaymeantOption { get; set; } = PaymeantOption.Неизвестно;
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime DateCreate { get; set; }= DateTime.Now;
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime? DateImplement { get; set; }
|
public DateTime? DateImplement { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
Loading…
Reference in New Issue
Block a user