private PromotionDiscountDTO Map(tblPromotionDiscount tbl)
 {
     var dto = new PromotionDiscountDTO
     {
         MasterId = tbl.id,
         DateCreated = tbl.IM_DateCreated,
         DateLastUpdated = tbl.IM_DateLastUpdated,
         StatusId = tbl.IM_Status,
         ProductMasterId = tbl.ProductRef,
         PromotionDiscountItems = new List<PromotionDiscountItemDTO>()
     };
     foreach (var item in tbl.tblPromotionDiscountItem.Where(n => n.IM_Status == (int)EntityStatus.Active))
     {
         var dtoitem = new PromotionDiscountItemDTO
                           {
                               MasterId = item.id,
                               DateCreated = item.IM_DateCreated,
                               DateLastUpdated = item.IM_DateLastUpdated,
                               StatusId = item.IM_Status,
                               ProductMasterId = item.FreeOfChargeProductRef ?? Guid.Empty,
                               FreeQuantity = item.FreeOfChargeQuantity ?? 0,
                               ParentQuantity = item.ParentProductQuantity,
                               DiscountRate = item.DiscountRate ?? 0,
                               EffectiveDate = item.EffectiveDate,
                               EndDate = item.EndDate ?? DateTime.Now,
                               PromotionDiscountMasterId = item.PromotionDiscountId
                           };
         dto.PromotionDiscountItems.Add(dtoitem);
     }
     return dto;
 }
 /// <summary>
 /// Create a new tblPromotionDiscount object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="productRef">Initial value of the ProductRef property.</param>
 /// <param name="iM_DateCreated">Initial value of the IM_DateCreated property.</param>
 /// <param name="iM_DateLastUpdated">Initial value of the IM_DateLastUpdated property.</param>
 /// <param name="iM_Status">Initial value of the IM_Status property.</param>
 public static tblPromotionDiscount CreatetblPromotionDiscount(global::System.Guid id, global::System.Guid productRef, global::System.DateTime iM_DateCreated, global::System.DateTime iM_DateLastUpdated, global::System.Int32 iM_Status)
 {
     tblPromotionDiscount tblPromotionDiscount = new tblPromotionDiscount();
     tblPromotionDiscount.id = id;
     tblPromotionDiscount.ProductRef = productRef;
     tblPromotionDiscount.IM_DateCreated = iM_DateCreated;
     tblPromotionDiscount.IM_DateLastUpdated = iM_DateLastUpdated;
     tblPromotionDiscount.IM_Status = iM_Status;
     return tblPromotionDiscount;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the tblPromotionDiscount EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblPromotionDiscount(tblPromotionDiscount tblPromotionDiscount)
 {
     base.AddObject("tblPromotionDiscount", tblPromotionDiscount);
 }