private ProductDiscountDTO Map(tblDiscounts tbl,DateTime from)
 {
     var dto = new ProductDiscountDTO
     {
         MasterId = tbl.id,
         DateCreated = tbl.IM_DateCreated,
         DateLastUpdated = tbl.IM_DateLastUpdated,
         StatusId = tbl.IM_Status,
         ProductMasterId = tbl.ProductRef,
         TierMasterId = tbl.TierId,
         DiscountItem = new List<ProductDiscountItemDTO>()
     };
     foreach (var item in tbl.tblDiscountItem.Where(n => n.IM_Status == (int)EntityStatus.Active))
     {
         var dtoitem = new ProductDiscountItemDTO
                           {
                               MasterId = item.id,
                               DateCreated = item.IM_DateCreated,
                               DateLastUpdated = item.IM_DateLastUpdated,
                               StatusId = item.IM_Status,
                               DiscountRate = item.DiscountRate,
                               EffectiveDate = item.EffectiveDate,
                               EndDate = item.EndDate ?? DateTime.Now,
                               IsByQuantity = item.IsByQuantity,
                               Quantity = item.Quantity,
                               
                           };
         dto.DiscountItem.Add(dtoitem);
     }
     dto.DeletedProductDiscountItem = tbl.tblDiscountItem.Where(n => n.IM_Status == (int)EntityStatus.Inactive && n.IM_DateLastUpdated > from).Select(s => s.id).ToList();
    
     return dto;
 }
예제 #2
0
 public ProductDiscount.ProductDiscountItem Map(ProductDiscountItemDTO dto, Guid id)
 {
     if (dto == null) return null;
     var productDiscountItem = Mapper.Map<ProductDiscountItemDTO, ProductDiscount.ProductDiscountItem>(dto);
     productDiscountItem._Status = EntityStatus.New;
     return productDiscountItem;
 }