/// <summary> /// Marks Promotion as deleted /// </summary> /// <param name="Promotion">Promotion</param> public virtual void DeletePromotion(PromotionProducts Promotion) { if (Promotion == null) { throw new ArgumentNullException("Promotion"); } Promotion.Deleted = true; UpdatePromotion(Promotion); }
/// <summary> /// Updates the Promotion /// </summary> /// <param name="Promotion">Promotion</param> public virtual void UpdatePromotion(PromotionProducts Promotion) { if (Promotion == null) { throw new ArgumentNullException("Promotion"); } _PromotionRepository.Update(Promotion); //event notification _eventPublisher.EntityUpdated(Promotion); }
public PromotionProductsModel ToModel(PromotionProducts model) { return(new PromotionProductsModel { ProductId = model.ProductId, CategoryId = model.CategoryId, Id = model.Id, Deleted = model.Deleted, Product = model.Product.ToModel(), Category = model.CategoryId > 0 ? model.Category.ToModel() : new CategoryModel() }); }
public void RemoveValidationRule(GenericProduct p, bool promotion, bool update = false, bool active = true) { client = new SQSAdminServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress(CommonVariables.WcfEndpoint); client.SQSAdmin_StandardInclusion_RemoveValidationRule(p.validationruleID, update, active); client.Close(); if (promotion && !update) { PromotionProducts.Remove(p); } else { UpgradeOptionProducts.Remove(p); } }
private bool IsProductAllowed(int productId, int promoId, int id = 0) { bool available = true; PromotionProducts products = _promotionProductsService.FindProductsByPromoId(promoId, productId); if (products != null) { int previousName = 0; if (id > 0 && id == products.Id) { previousName = products.ProductId; available = products.ProductId == previousName ? true : false; } else { available = false; } } return(available); }
public void GetUpgradeForStandardInclusion(string productid, string pbrandids) { DateTime dateValue = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue; client = new SQSAdminServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress(CommonVariables.WcfEndpoint); DataSet ds = client.SQSAdmin_StandardInclusion_GetUpgradeOptionByStandardInclusion(productid, pbrandids); client.Close(); UpgradeOptionProducts.Clear(); PromotionProducts.Clear(); foreach (DataRow dr in ds.Tables[0].Rows) { GenericProduct p = new GenericProduct(); p.BrandID = int.Parse(dr["brandid"].ToString()); p.BrandName = dr["brandname"].ToString(); p.ProductID = dr["productid"].ToString(); p.ProductName = dr["productname"].ToString(); p.ProductDescription = dr["productdescription"].ToString(); p.validationruleID = int.Parse(dr["idStudioM_Inclusionvalidationrule"].ToString()); p.Promotion = bool.Parse(dr["Promotion"].ToString()); DateTime.TryParse(dr["EffectiveDate"].ToString(), out dateValue); if (dateValue != (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue) { p.EffectiveDate = dateValue.AddHours(3); } p.Active = bool.Parse(dr["active"].ToString()); if (p.Promotion) { PromotionProducts.Add(p); } else if (p.Active) { // upgrade products show only the active items UpgradeOptionProducts.Add(p); } } }
public void GetStandardInclusion(string productid, string productname, int pstateid, string brandids) { client = new SQSAdminServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress(CommonVariables.WcfEndpoint); DataSet ds = client.SQSAdmin_StandardInclusion_GetStandardInclusionProducts(productid, productname, pstateid, brandids); client.Close(); StandarInclusionProducts.Clear(); foreach (DataRow dr in ds.Tables[0].Rows) { GenericProduct p = new GenericProduct(); p.BrandID = int.Parse(dr["BrandID"].ToString()); p.BrandName = dr["BrandName"].ToString(); p.ProductID = dr["productid"].ToString(); p.ProductName = dr["productname"].ToString(); p.ProductDescription = dr["productdescription"].ToString(); p.validationruleID = 0; StandarInclusionProducts.Add(p); } UpgradeOptionProducts.Clear(); PromotionProducts.Clear(); }