public static CartPricingRuleInfo GetCartPriceRules(Int32 cartPriceRuleID, AspxCommonInfo aspxCommonObj) { CartPricingRuleInfo cartPricingRuleInfo = new CartPricingRuleInfo(); DataSet ds = new DataSet(); ds = AspxCartPriceRuleProvider.GetCartPriceRule(cartPriceRuleID, aspxCommonObj); DataTable dtCartPricingRule = ds.Tables[0]; DataTable dtRuleConditions = ds.Tables[1]; DataTable dtCartPriceRuleRoles = ds.Tables[2]; DataTable dtCartPriceRuleStores = ds.Tables[3]; List<CartPriceRule> lstCartPriceRule; lstCartPriceRule = DataSourceHelper.FillCollection<CartPriceRule>(dtCartPricingRule); List<RuleCondition> lstRuleConditions; lstRuleConditions = DataSourceHelper.FillCollection<RuleCondition>(dtRuleConditions); List<CartPriceRuleRole> lstCartPriceRuleRole; lstCartPriceRuleRole = DataSourceHelper.FillCollection<CartPriceRuleRole>(dtCartPriceRuleRoles); List<CartPriceRuleStore> lstCartPriceRuleStore; lstCartPriceRuleStore = DataSourceHelper.FillCollection<CartPriceRuleStore>(dtCartPriceRuleStores); cartPricingRuleInfo.CartPriceRule = lstCartPriceRule[0]; List<RuleCondition> lstRC = new List<RuleCondition>(); foreach (RuleCondition rc in lstRuleConditions) { RuleCondition objRC = new RuleCondition(); objRC.ParentID = rc.ParentID; objRC.RuleConditionID = rc.RuleConditionID; objRC.RuleConditionType = rc.RuleConditionType; objRC.CartPriceRuleID = rc.CartPriceRuleID; if (rc.RuleConditionType.ToUpper().Trim() == "PAC".ToUpper().Trim()) { objRC.LstProductAttributeRuleConditions = AspxCartPriceRuleProvider.GetCartPriceProductAttributeConditions(rc.RuleConditionID, aspxCommonObj.PortalID); objRC.LstProductAttributeRuleConditions[0].LstCartConditionDetails = AspxCartPriceRuleProvider.GetCartPriceRuleConditionDetails(rc.CartPriceRuleID, rc.RuleConditionID, aspxCommonObj.PortalID, aspxCommonObj.UserName); lstRC.Add(objRC); } else if (rc.RuleConditionType.ToUpper().Trim() == "PS".ToUpper().Trim()) { objRC.LstProductSublectionRuleConditions = AspxCartPriceRuleProvider.GetCartPriceSubSelections(rc.RuleConditionID, aspxCommonObj.PortalID); objRC.LstProductSublectionRuleConditions[0].LstCartConditionDetails = AspxCartPriceRuleProvider.GetCartPriceRuleConditionDetails(rc.CartPriceRuleID, rc.RuleConditionID, aspxCommonObj.PortalID, aspxCommonObj.UserName); lstRC.Add(objRC); } else if (rc.RuleConditionType.ToUpper().Trim() == "CC".ToUpper().Trim()) { objRC.LstCartPriceRuleConditions = AspxCartPriceRuleProvider.GetCartPriceRuleConditions(rc.RuleConditionID, aspxCommonObj.PortalID); objRC.LstCartPriceRuleConditions[0].LstCartConditionDetails = AspxCartPriceRuleProvider.GetCartPriceRuleConditionDetails(rc.CartPriceRuleID, rc.RuleConditionID, aspxCommonObj.PortalID, aspxCommonObj.UserName); lstRC.Add(objRC); } } cartPricingRuleInfo.LstRuleCondition = lstRC; cartPricingRuleInfo.LstCartPriceRuleRoles = lstCartPriceRuleRole; cartPricingRuleInfo.LstCartPriceRuleStores = lstCartPriceRuleStore; return cartPricingRuleInfo; }
public CartPricingRuleInfo GetCartPriceRules(Int32 cartPriceRuleID, AspxCommonInfo aspxCommonObj) { PriceRuleSqlProvider priceRuleSqlProvider = new PriceRuleSqlProvider(); CartPricingRuleInfo cartPricingRuleInfo = new CartPricingRuleInfo(); DataSet ds = new DataSet(); ds = priceRuleSqlProvider.GetCartPriceRule(cartPriceRuleID,aspxCommonObj); DataTable dtCartPricingRule = ds.Tables[0]; DataTable dtRuleConditions = ds.Tables[1]; DataTable dtCartPriceRuleRoles = ds.Tables[2]; DataTable dtCartPriceRuleStores = ds.Tables[3]; List<CartPriceRule> lstCartPriceRule; lstCartPriceRule = DataSourceHelper.FillCollection<CartPriceRule>(dtCartPricingRule); List<RuleCondition> lstRuleConditions; lstRuleConditions = DataSourceHelper.FillCollection<RuleCondition>(dtRuleConditions); List<CartPriceRuleRole> lstCartPriceRuleRole; lstCartPriceRuleRole = DataSourceHelper.FillCollection<CartPriceRuleRole>(dtCartPriceRuleRoles); List<CartPriceRuleStore> lstCartPriceRuleStore; lstCartPriceRuleStore = DataSourceHelper.FillCollection<CartPriceRuleStore>(dtCartPriceRuleStores); cartPricingRuleInfo.CartPriceRule = lstCartPriceRule[0]; List<RuleCondition> lstRC = new List<RuleCondition>(); foreach (RuleCondition rc in lstRuleConditions) { RuleCondition objRC = new RuleCondition(); objRC.ParentID = rc.ParentID; objRC.RuleConditionID = rc.RuleConditionID; objRC.RuleConditionType = rc.RuleConditionType; objRC.CartPriceRuleID = rc.CartPriceRuleID; if (rc.RuleConditionType.ToUpper().Trim() == "PAC".ToUpper().Trim()) { objRC.LstProductAttributeRuleConditions = priceRuleSqlProvider.GetCartPriceProductAttributeConditions(rc.RuleConditionID, aspxCommonObj.PortalID); objRC.LstProductAttributeRuleConditions[0].LstCartConditionDetails = priceRuleSqlProvider.GetCartPriceRuleConditionDetails(rc.CartPriceRuleID,rc.RuleConditionID, aspxCommonObj.PortalID, aspxCommonObj.UserName); lstRC.Add(objRC); } else if (rc.RuleConditionType.ToUpper().Trim() == "PS".ToUpper().Trim()) { objRC.LstProductSublectionRuleConditions = priceRuleSqlProvider.GetCartPriceSubSelections(rc.RuleConditionID, aspxCommonObj.PortalID); objRC.LstProductSublectionRuleConditions[0].LstCartConditionDetails = priceRuleSqlProvider.GetCartPriceRuleConditionDetails(rc.CartPriceRuleID, rc.RuleConditionID, aspxCommonObj.PortalID, aspxCommonObj.UserName); lstRC.Add(objRC); } else if (rc.RuleConditionType.ToUpper().Trim() == "CC".ToUpper().Trim()) { objRC.LstCartPriceRuleConditions = priceRuleSqlProvider.GetCartPriceRuleConditions(rc.RuleConditionID, aspxCommonObj.PortalID); objRC.LstCartPriceRuleConditions[0].LstCartConditionDetails = priceRuleSqlProvider.GetCartPriceRuleConditionDetails(rc.CartPriceRuleID, rc.RuleConditionID, aspxCommonObj.PortalID, aspxCommonObj.UserName); lstRC.Add(objRC); } } cartPricingRuleInfo.LstRuleCondition = lstRC; cartPricingRuleInfo.LstCartPriceRuleRoles = lstCartPriceRuleRole; cartPricingRuleInfo.LstCartPriceRuleStores = lstCartPriceRuleStore; return cartPricingRuleInfo; }