public DiscountsRelation(string username, Guid discountId, DiscountRuleRelation discountRuleRelation, Guid storeId, Guid discountId1, Guid discountId2, bool decide) { this.Id = discountId; this.Username = username; this.DiscountRuleRelation = discountRuleRelation; this.StoreId = storeId; this.DiscountId1 = discountId1; this.DiscountId2 = discountId2; this.Decide = decide; }
public async Task <Guid> AddDiscountRuleAsync(string username, DiscountRuleRelation discountRuleRelation, Guid storeId, Guid discountId1, Guid discountId2, bool decide = false) { Guid discountId = await marketRules.GenerateConditionalDiscountsAsync(await MarketStores.Instance.GetStoreById(storeId), username, discountRuleRelation, storeId, discountId1, discountId2, decide); await StorePredicatesManager.Instance.SaveRequest(++counter, "GenerateConditionalDiscountsAsync", username, discountRuleRelation, storeId, discountId1, discountId2, decide, discountId); var discountRelation = new DiscountsRelation(username, discountId, discountRuleRelation, storeId, discountId1, discountId2, decide); await discountsManager.AddRelation(discountRelation); return(discountId); }
public MarketRulesRequestType5(int counter, string functionName, string username, DiscountRuleRelation discountRuleRelation, Guid storeId, Guid discountId, Guid discountId2, bool decide, Guid originDiscountId) { this.id = counter; this.functionName = functionName; this.username = username; this.discountRuleRelation = discountRuleRelation; this.storeId = storeId; this.discountId = discountId; this.discountId2 = discountId2; this.decide = decide; this.originDiscountId = originDiscountId; }
internal async Task SaveRequest(int counter, string functionName, string username, DiscountRuleRelation discountRuleRelation, Guid storeId, Guid discountId, Guid discountId2, bool decide, Guid originDiscountId) { var marketRulesRequest = new MarketRulesRequestType5(counter, functionName, username, discountRuleRelation, storeId, discountId, discountId2, decide, originDiscountId); await marketDAL.AddRequestType5(marketRulesRequest); }
public async Task <Guid> GenerateConditionalDiscountsAsync(Store store, string username, DiscountRuleRelation discountRuleRelation, Guid storeId, Guid discountId1, Guid discountId2, bool decide, Guid originalDiscountId = new Guid()) { if (store == null) { return(new Guid()); } switch (discountRuleRelation) { case DiscountRuleRelation.And: return(await AddDiscountAndRuleAsync(username, storeId, discountId1, discountId2, originalDiscountId)); case DiscountRuleRelation.Or: return(await AddDiscountOrRuleAsync(store, username, storeId, discountId1, discountId2, originalDiscountId)); default: return(await AddDiscountXorRuleAsync(store, username, storeId, discountId1, discountId2, decide, originalDiscountId)); } }