public bool ApplyPriceRules <T> (IEnumerable <PriceRule> priceRules, Operation <T> operation, PriceGroup partnerPriceGroup, PriceGroup locationPriceGroup) where T : OperationDetail, new () { if (operation.PartnerId < 0 || operation.LocationId < 0 || itemId < 0) { return(false); } if (PromotionForDetailHashCode != 0) { return(false); } AppliedPriceRules = PriceRule.AppliedActions.None; if (!ManualDiscount) { DiscountEvaluate(0); } PriceGroup priceGroup = Operation.GetPriceGroup(partnerPriceGroup, locationPriceGroup); if (!ManualSalePrice && Item != null) { OriginalPriceOutEvaluate(GetItemPriceOut(Item, priceGroup)); TotalEvaluate(); } if (!ManualPurchasePrice && Item != null) { OriginalPriceInEvaluate(lotObject == null ? GetItemPriceIn(Item) : lotObject.PriceIn, operation); TotalEvaluate(); } operation.ClearPromotionForDetail(this); return(PriceRule.ApplyBeforeOperationSaved(operation, null, false, priceRules)); }
protected bool TryApplyRules(bool priceWithVAT = false) { return(editMode || PriceRule.ApplyBeforeOperationSaved(operation, (rules, details) => ConfirmPriceRules <TOperDetail> .GetRulesToApply(rules, operation, priceWithVAT), true, PriceRules)); }