Exemplo n.º 1
0
        public static DAL.App.DTO.DomainLikeDTO.Sale MapFromDomain(Domain.Sale sale)
        {
            var res = sale == null ? null : new DAL.App.DTO.DomainLikeDTO.Sale
            {
                Id                      = sale.Id,
                Description             = sale.Description.Translate(),
                AppUserId               = sale.AppUserId,
                AppUser                 = AppUserMapper.MapFromDomain(sale.AppUser),
                SaleInitialCreationTime = sale.SaleInitialCreationTime,
            };

            if (sale?.ProductsSold != null)
            {
                res.ProductsSold         = sale.ProductsSold.Select(e => ProductSoldMapper.MapFromDomain(e)).ToList();
                res.AllTotalSaleAmount   = sale.ProductsSold.Sum(e => e.Quantity * e.Product.SellPrice);
                res.TodayTotalSaleAmount = sale.ProductsSold.Where(e => DateTime.Today < e.ProductSoldTime && e.ProductSoldTime < DateTime.Today.AddDays(1).AddTicks(-1))
                                           .Sum(e => e.Quantity * e.Product.SellPrice);
            }

            return(res);
        }
Exemplo n.º 2
0
 public Payment(Sale sale, decimal amount)
 {
     this.Sale = sale;
     this.Amount = amount;
 }
Exemplo n.º 3
0
 public EFTPOSPayment(Sale sale, decimal amount)
     : base(sale, amount)
 {
 }
Exemplo n.º 4
0
 public CashPayment(Sale sale, decimal amount)
     : base(sale, amount)
 {
 }
Exemplo n.º 5
0
 public SaleLineItem(Sale sale,MenuProduct menuProduct)
 {
     this.Sale = sale;
     this.MenuProduct = menuProduct;
     this.Quantity = 1;
 }