/// <summary> /// Calculate /// </summary> /// <param name="promotionFormula"></param> /// <param name="promotionRules"></param> /// <returns></returns> public double Calculate(string promotionFormula, Dictionary <string, string> promotionRules) { try { if (CheckPromotionFormula(promotionFormula)) { var InventoryScales = _AddScaleOperations.ApplyScale(CurrentInventory(), promotionFormula); if (InventoryScales.Any()) { var InventoryRules = _AddScaleOperations.ApplyRules(CurrentInventory(), promotionFormula, promotionRules, InventoryScales); } } else { throw new Exception("This is an invalid formula/expression. Please check again."); } return(0); } catch (Exception ex) { throw ex; } }