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; }
/// <summary> /// Deprecated Method for adding a new object to the tblDiscounts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotblDiscounts(tblDiscounts tblDiscounts) { base.AddObject("tblDiscounts", tblDiscounts); }
/// <summary> /// Create a new tblDiscounts object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="productRef">Initial value of the ProductRef property.</param> /// <param name="tierId">Initial value of the TierId 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 tblDiscounts CreatetblDiscounts(global::System.Guid id, global::System.Guid productRef, global::System.Guid tierId, global::System.DateTime iM_DateCreated, global::System.DateTime iM_DateLastUpdated, global::System.Int32 iM_Status) { tblDiscounts tblDiscounts = new tblDiscounts(); tblDiscounts.id = id; tblDiscounts.ProductRef = productRef; tblDiscounts.TierId = tierId; tblDiscounts.IM_DateCreated = iM_DateCreated; tblDiscounts.IM_DateLastUpdated = iM_DateLastUpdated; tblDiscounts.IM_Status = iM_Status; return tblDiscounts; }