public static int SaveCatalogPricingRule(CatalogPricingRuleInfo objCatalogPricingRuleInfo, AspxCommonInfo aspxCommonObj, List <int> parentID) { int catalogPriceRuleID = -1; catalogPriceRuleID = AspxCatalogPriceRuleProvider.CatalogPriceRuleAdd(objCatalogPricingRuleInfo.CatalogPriceRule, aspxCommonObj); if (catalogPriceRuleID > 0) { int count = 0; int cpID = 0; int catalogConditionID = 0; List <int> lstParent = parentID;//new JavaScriptSerializer().ConvertToType<List<object>>(parentID); foreach (CatalogPriceRuleCondition catalogPriceRuleCondition in objCatalogPricingRuleInfo.CatalogPriceRuleConditions) { if (count == 1 && catalogConditionID > 1) { cpID = catalogConditionID - 1; } catalogPriceRuleCondition.ParentID = cpID + int.Parse(lstParent[count].ToString()); catalogPriceRuleCondition.CatalogPriceRuleID = catalogPriceRuleID; catalogConditionID = AspxCatalogPriceRuleProvider.CatalogPriceRuleConditionAdd(catalogPriceRuleCondition, aspxCommonObj); count++; } int catalogPriceRuleRoleID = -1; foreach (CatalogPriceRuleRole catalogPriceRuleRole in objCatalogPricingRuleInfo.CatalogPriceRuleRoles) { catalogPriceRuleRole.CatalogPriceRuleID = catalogPriceRuleID; catalogPriceRuleRoleID = AspxCatalogPriceRuleProvider.CatalogPriceRuleRoleAdd(catalogPriceRuleRole, aspxCommonObj); } } return(1); }
public CatalogPricingRuleInfo GetCatalogPricingRule(Int32 catalogPriceRuleID, Int32 storeID, Int32 portalID, string userName, string culture) { PriceRuleSqlProvider priceRuleSqlProvider = new PriceRuleSqlProvider(); DataSet ds = new DataSet(); ds = priceRuleSqlProvider.GetCatalogPricingRule(catalogPriceRuleID, storeID, portalID, userName, culture); DataTable dtCatalogPricingRule = ds.Tables[0]; DataTable dtCatalogPriceRuleCondition = ds.Tables[1]; DataTable dtCatalogConditionDetails = ds.Tables[2]; DataTable dtCatalogPriceRuleRoles = ds.Tables[3]; List <CatalogPriceRule> lstCatalogPriceRule; lstCatalogPriceRule = DataSourceHelper.FillCollection <CatalogPriceRule>(dtCatalogPricingRule); List <CatalogPriceRuleCondition> lstCatalogPriceRuleCondition; lstCatalogPriceRuleCondition = DataSourceHelper.FillCollection <CatalogPriceRuleCondition>(dtCatalogPriceRuleCondition); List <CatalogPriceRuleRole> lstCatalogPriceRuleRole; lstCatalogPriceRuleRole = DataSourceHelper.FillCollection <CatalogPriceRuleRole>(dtCatalogPriceRuleRoles); List <CatalogConditionDetail> lstCatalogConditionDetail; lstCatalogConditionDetail = DataSourceHelper.FillCollection <CatalogConditionDetail>(dtCatalogConditionDetails); CatalogPricingRuleInfo catalogPricingRuleInfo = new CatalogPricingRuleInfo(); CatalogPriceRule catalogPriceRule = lstCatalogPriceRule[0]; catalogPricingRuleInfo.CatalogPriceRule = catalogPriceRule; List <CatalogPriceRuleCondition> lstCPRC = new List <CatalogPriceRuleCondition>(); foreach (CatalogPriceRuleCondition catalogPriceRuleCondition in lstCatalogPriceRuleCondition) { List <CatalogConditionDetail> lstCCD = new List <CatalogConditionDetail>(); foreach (CatalogConditionDetail catalogConditionDetail in lstCatalogConditionDetail) { if (catalogPriceRuleCondition.CatalogPriceRuleConditionID == catalogConditionDetail.CatalogPriceRuleConditionID) { lstCCD.Add(catalogConditionDetail); } } catalogPriceRuleCondition.CatalogConditionDetail = lstCCD; lstCPRC.Add(catalogPriceRuleCondition); } catalogPricingRuleInfo.CatalogPriceRuleConditions = lstCPRC; List <CatalogPriceRuleRole> lstCPRR = new List <CatalogPriceRuleRole>(); foreach (CatalogPriceRuleRole catalogPriceRuleRole in lstCatalogPriceRuleRole) { if (catalogPriceRuleRole.CatalogPriceRuleID == catalogPriceRule.CatalogPriceRuleID) { lstCPRR.Add(catalogPriceRuleRole); } } catalogPricingRuleInfo.CatalogPriceRuleRoles = lstCPRR; return(catalogPricingRuleInfo); }
public static int SaveCatalogPricingRule(CatalogPricingRuleInfo objCatalogPricingRuleInfo, AspxCommonInfo aspxCommonObj, List<int> parentID) { int catalogPriceRuleID = -1; catalogPriceRuleID = AspxCatalogPriceRuleProvider.CatalogPriceRuleAdd(objCatalogPricingRuleInfo.CatalogPriceRule, aspxCommonObj); if (catalogPriceRuleID > 0) { int count = 0; int cpID = 0; int catalogConditionID = 0; List<int> lstParent = parentID;//new JavaScriptSerializer().ConvertToType<List<object>>(parentID); foreach (CatalogPriceRuleCondition catalogPriceRuleCondition in objCatalogPricingRuleInfo.CatalogPriceRuleConditions) { if (count == 1 && catalogConditionID > 1) cpID = catalogConditionID - 1; catalogPriceRuleCondition.ParentID = cpID + int.Parse(lstParent[count].ToString()); catalogPriceRuleCondition.CatalogPriceRuleID = catalogPriceRuleID; catalogConditionID = AspxCatalogPriceRuleProvider.CatalogPriceRuleConditionAdd(catalogPriceRuleCondition, aspxCommonObj); count++; } int catalogPriceRuleRoleID = -1; foreach (CatalogPriceRuleRole catalogPriceRuleRole in objCatalogPricingRuleInfo.CatalogPriceRuleRoles) { catalogPriceRuleRole.CatalogPriceRuleID = catalogPriceRuleID; catalogPriceRuleRoleID = AspxCatalogPriceRuleProvider.CatalogPriceRuleRoleAdd(catalogPriceRuleRole, aspxCommonObj); } } return 1; }
public static CatalogPricingRuleInfo GetCatalogPricingRule(Int32 catalogPriceRuleID, AspxCommonInfo aspxCommonObj) { DataSet ds = new DataSet(); ds = AspxCatalogPriceRuleProvider.GetCatalogPricingRule(catalogPriceRuleID, aspxCommonObj); DataTable dtCatalogPricingRule = ds.Tables[0]; DataTable dtCatalogPriceRuleCondition = ds.Tables[1]; DataTable dtCatalogConditionDetails = ds.Tables[2]; DataTable dtCatalogPriceRuleRoles = ds.Tables[3]; List <CatalogPriceRule> lstCatalogPriceRule; lstCatalogPriceRule = DataSourceHelper.FillCollection <CatalogPriceRule>(dtCatalogPricingRule); List <CatalogPriceRuleCondition> lstCatalogPriceRuleCondition; lstCatalogPriceRuleCondition = DataSourceHelper.FillCollection <CatalogPriceRuleCondition>(dtCatalogPriceRuleCondition); List <CatalogPriceRuleRole> lstCatalogPriceRuleRole; lstCatalogPriceRuleRole = DataSourceHelper.FillCollection <CatalogPriceRuleRole>(dtCatalogPriceRuleRoles); List <CatalogConditionDetail> lstCatalogConditionDetail; lstCatalogConditionDetail = DataSourceHelper.FillCollection <CatalogConditionDetail>(dtCatalogConditionDetails); CatalogPricingRuleInfo catalogPricingRuleInfo = new CatalogPricingRuleInfo(); CatalogPriceRule catalogPriceRule = lstCatalogPriceRule[0]; catalogPricingRuleInfo.CatalogPriceRule = catalogPriceRule; List <CatalogPriceRuleCondition> lstCPRC = new List <CatalogPriceRuleCondition>(); foreach (CatalogPriceRuleCondition catalogPriceRuleCondition in lstCatalogPriceRuleCondition) { List <CatalogConditionDetail> lstCCD = new List <CatalogConditionDetail>(); foreach (CatalogConditionDetail catalogConditionDetail in lstCatalogConditionDetail) { if (catalogPriceRuleCondition.CatalogPriceRuleConditionID == catalogConditionDetail.CatalogPriceRuleConditionID) { lstCCD.Add(catalogConditionDetail); } } catalogPriceRuleCondition.CatalogConditionDetail = lstCCD; lstCPRC.Add(catalogPriceRuleCondition); } catalogPricingRuleInfo.CatalogPriceRuleConditions = lstCPRC; List <CatalogPriceRuleRole> lstCPRR = new List <CatalogPriceRuleRole>(); foreach (CatalogPriceRuleRole catalogPriceRuleRole in lstCatalogPriceRuleRole) { if (catalogPriceRuleRole.CatalogPriceRuleID == catalogPriceRule.CatalogPriceRuleID) { lstCPRR.Add(catalogPriceRuleRole); } } catalogPricingRuleInfo.CatalogPriceRuleRoles = lstCPRR; return(catalogPricingRuleInfo); }
public static CatalogPricingRuleInfo GetCatalogPricingRule(Int32 catalogPriceRuleID, AspxCommonInfo aspxCommonObj) { DataSet ds = new DataSet(); ds = AspxCatalogPriceRuleProvider.GetCatalogPricingRule(catalogPriceRuleID, aspxCommonObj); DataTable dtCatalogPricingRule = ds.Tables[0]; DataTable dtCatalogPriceRuleCondition = ds.Tables[1]; DataTable dtCatalogConditionDetails = ds.Tables[2]; DataTable dtCatalogPriceRuleRoles = ds.Tables[3]; List<CatalogPriceRule> lstCatalogPriceRule; lstCatalogPriceRule = DataSourceHelper.FillCollection<CatalogPriceRule>(dtCatalogPricingRule); List<CatalogPriceRuleCondition> lstCatalogPriceRuleCondition; lstCatalogPriceRuleCondition = DataSourceHelper.FillCollection<CatalogPriceRuleCondition>(dtCatalogPriceRuleCondition); List<CatalogPriceRuleRole> lstCatalogPriceRuleRole; lstCatalogPriceRuleRole = DataSourceHelper.FillCollection<CatalogPriceRuleRole>(dtCatalogPriceRuleRoles); List<CatalogConditionDetail> lstCatalogConditionDetail; lstCatalogConditionDetail = DataSourceHelper.FillCollection<CatalogConditionDetail>(dtCatalogConditionDetails); CatalogPricingRuleInfo catalogPricingRuleInfo = new CatalogPricingRuleInfo(); CatalogPriceRule catalogPriceRule = lstCatalogPriceRule[0]; catalogPricingRuleInfo.CatalogPriceRule = catalogPriceRule; List<CatalogPriceRuleCondition> lstCPRC = new List<CatalogPriceRuleCondition>(); foreach (CatalogPriceRuleCondition catalogPriceRuleCondition in lstCatalogPriceRuleCondition) { List<CatalogConditionDetail> lstCCD = new List<CatalogConditionDetail>(); foreach (CatalogConditionDetail catalogConditionDetail in lstCatalogConditionDetail) { if (catalogPriceRuleCondition.CatalogPriceRuleConditionID == catalogConditionDetail.CatalogPriceRuleConditionID) { lstCCD.Add(catalogConditionDetail); } } catalogPriceRuleCondition.CatalogConditionDetail = lstCCD; lstCPRC.Add(catalogPriceRuleCondition); } catalogPricingRuleInfo.CatalogPriceRuleConditions = lstCPRC; List<CatalogPriceRuleRole> lstCPRR = new List<CatalogPriceRuleRole>(); foreach (CatalogPriceRuleRole catalogPriceRuleRole in lstCatalogPriceRuleRole) { if (catalogPriceRuleRole.CatalogPriceRuleID == catalogPriceRule.CatalogPriceRuleID) { lstCPRR.Add(catalogPriceRuleRole); } } catalogPricingRuleInfo.CatalogPriceRuleRoles = lstCPRR; return catalogPricingRuleInfo; }
public int SaveCatalogPricingRule(CatalogPricingRuleInfo objCatalogPricingRuleInfo, Int32 storeID, Int32 portalID, string userName, string culture, object parentID) { int catalogPriceRuleID = -1; PriceRuleSqlProvider priceRuleSqlProvider = new PriceRuleSqlProvider(); catalogPriceRuleID = priceRuleSqlProvider.CatalogPriceRuleAdd(objCatalogPricingRuleInfo.CatalogPriceRule, storeID, portalID, userName, culture); if (catalogPriceRuleID > 0) { int count = 0; int cpID = 0; int catalogConditionID = 0; List <object> lstParent = new JavaScriptSerializer().ConvertToType <List <object> >(parentID); foreach (CatalogPriceRuleCondition catalogPriceRuleCondition in objCatalogPricingRuleInfo.CatalogPriceRuleConditions) { if (count == 1 && catalogConditionID > 1) { cpID = catalogConditionID - 1; } catalogPriceRuleCondition.ParentID = cpID + int.Parse(lstParent[count].ToString()); catalogPriceRuleCondition.CatalogPriceRuleID = catalogPriceRuleID; catalogConditionID = priceRuleSqlProvider.CatalogPriceRuleConditionAdd(catalogPriceRuleCondition, storeID, portalID, userName, culture); count++; } int catalogPriceRuleRoleID = -1; foreach (CatalogPriceRuleRole catalogPriceRuleRole in objCatalogPricingRuleInfo.CatalogPriceRuleRoles) { catalogPriceRuleRole.CatalogPriceRuleID = catalogPriceRuleID; catalogPriceRuleRoleID = priceRuleSqlProvider.CatalogPriceRuleRoleAdd(catalogPriceRuleRole, storeID, portalID, userName, culture); } } return(1); }
public string SavePricingRule(CatalogPricingRuleInfo objCatalogPricingRuleInfo, Int32 storeID, Int32 portalID, string userName, string culture, object parentID) { try { List<KeyValuePair<string, object>> p1 = new List<KeyValuePair<string, object>>(); p1.Add(new KeyValuePair<string, object>("@StoreID", storeID)); p1.Add(new KeyValuePair<string, object>("@PortalID", portalID)); SQLHandler sql = new SQLHandler(); int count = sql.ExecuteAsScalar<int>("usp_Aspx_CatalogPriceRuleCount", p1); int maxAllowed = 3; int catalogPriceRuleId = objCatalogPricingRuleInfo.CatalogPriceRule.CatalogPriceRuleID; if (catalogPriceRuleId > 0) { maxAllowed++; } if (count < maxAllowed) { PriceRuleController priceRuleController = new PriceRuleController(); priceRuleController.SaveCatalogPricingRule(objCatalogPricingRuleInfo, storeID, portalID, userName, culture, parentID); //return "({ \"returnStatus\" : 1 , \"Message\" : \"Saving catalog pricing rule successfully.\" })"; return "success"; } else { //return "({ \"returnStatus\" : -1 , \"Message\" : \"No more than 3 rules are allowed in Free version of AspxCommerce!\" })"; return "notify"; } } catch (Exception ex) { ErrorHandler errHandler = new ErrorHandler(); if (errHandler.LogWCFException(ex)) { return "({ \"returnStatus\" : -1 , \"errorMessage\" : \"" + ex.Message + "\" })"; } else { return "({ \"returnStatus\" : -1, \"errorMessage\" : \"Error while saving catalog pricing rule!\" })"; } } }
public CatalogPricingRuleInfo GetCatalogPricingRule(Int32 catalogPriceRuleID, Int32 storeID, Int32 portalID, string userName, string culture) { PriceRuleSqlProvider priceRuleSqlProvider = new PriceRuleSqlProvider(); DataSet ds = new DataSet(); ds = priceRuleSqlProvider.GetCatalogPricingRule(catalogPriceRuleID, storeID, portalID, userName, culture); DataTable dtCatalogPricingRule = ds.Tables[0]; DataTable dtCatalogPriceRuleCondition = ds.Tables[1]; DataTable dtCatalogConditionDetails = ds.Tables[2]; DataTable dtCatalogPriceRuleRoles = ds.Tables[3]; List<CatalogPriceRule> lstCatalogPriceRule; lstCatalogPriceRule = DataSourceHelper.FillCollection<CatalogPriceRule>(dtCatalogPricingRule); List<CatalogPriceRuleCondition> lstCatalogPriceRuleCondition; lstCatalogPriceRuleCondition = DataSourceHelper.FillCollection<CatalogPriceRuleCondition>(dtCatalogPriceRuleCondition); List<CatalogPriceRuleRole> lstCatalogPriceRuleRole; lstCatalogPriceRuleRole = DataSourceHelper.FillCollection<CatalogPriceRuleRole>(dtCatalogPriceRuleRoles); List<CatalogConditionDetail> lstCatalogConditionDetail; lstCatalogConditionDetail = DataSourceHelper.FillCollection<CatalogConditionDetail>(dtCatalogConditionDetails); CatalogPricingRuleInfo catalogPricingRuleInfo = new CatalogPricingRuleInfo(); CatalogPriceRule catalogPriceRule = lstCatalogPriceRule[0]; catalogPricingRuleInfo.CatalogPriceRule = catalogPriceRule; List<CatalogPriceRuleCondition> lstCPRC = new List<CatalogPriceRuleCondition>(); foreach (CatalogPriceRuleCondition catalogPriceRuleCondition in lstCatalogPriceRuleCondition) { List<CatalogConditionDetail> lstCCD = new List<CatalogConditionDetail>(); foreach (CatalogConditionDetail catalogConditionDetail in lstCatalogConditionDetail) { if (catalogPriceRuleCondition.CatalogPriceRuleConditionID == catalogConditionDetail.CatalogPriceRuleConditionID) { lstCCD.Add(catalogConditionDetail); } } catalogPriceRuleCondition.CatalogConditionDetail = lstCCD; lstCPRC.Add(catalogPriceRuleCondition); } catalogPricingRuleInfo.CatalogPriceRuleConditions = lstCPRC; List<CatalogPriceRuleRole> lstCPRR = new List<CatalogPriceRuleRole>(); foreach (CatalogPriceRuleRole catalogPriceRuleRole in lstCatalogPriceRuleRole) { if (catalogPriceRuleRole.CatalogPriceRuleID == catalogPriceRule.CatalogPriceRuleID) { lstCPRR.Add(catalogPriceRuleRole); } } catalogPricingRuleInfo.CatalogPriceRuleRoles = lstCPRR; return catalogPricingRuleInfo; }
public int SaveCatalogPricingRule(CatalogPricingRuleInfo objCatalogPricingRuleInfo, Int32 storeID, Int32 portalID, string userName, string culture, object parentID) { int catalogPriceRuleID = -1; PriceRuleSqlProvider priceRuleSqlProvider = new PriceRuleSqlProvider(); catalogPriceRuleID = priceRuleSqlProvider.CatalogPriceRuleAdd(objCatalogPricingRuleInfo.CatalogPriceRule, storeID, portalID, userName, culture); if (catalogPriceRuleID > 0) { int count = 0; int cpID = 0; int catalogConditionID = 0; List<object> lstParent = new JavaScriptSerializer().ConvertToType<List<object>>(parentID); foreach (CatalogPriceRuleCondition catalogPriceRuleCondition in objCatalogPricingRuleInfo.CatalogPriceRuleConditions) { if (count == 1 && catalogConditionID > 1) cpID = catalogConditionID - 1; catalogPriceRuleCondition.ParentID = cpID + int.Parse(lstParent[count].ToString()); catalogPriceRuleCondition.CatalogPriceRuleID = catalogPriceRuleID; catalogConditionID = priceRuleSqlProvider.CatalogPriceRuleConditionAdd(catalogPriceRuleCondition, storeID, portalID, userName, culture); count++; } int catalogPriceRuleRoleID = -1; foreach (CatalogPriceRuleRole catalogPriceRuleRole in objCatalogPricingRuleInfo.CatalogPriceRuleRoles) { catalogPriceRuleRole.CatalogPriceRuleID = catalogPriceRuleID; catalogPriceRuleRoleID = priceRuleSqlProvider.CatalogPriceRuleRoleAdd(catalogPriceRuleRole, storeID, portalID, userName, culture); } } return 1; }
public string SavePricingRule(CatalogPricingRuleInfo catalogPricingRuleInfo, Int32 storeID, Int32 portalID, string userName, string culture, Array parentID) { try { PriceRuleController priceRuleController = new PriceRuleController(); priceRuleController.SaveCatalogPricingRule(catalogPricingRuleInfo, storeID, portalID, userName, culture, parentID); return "({ \"returnStatus\" : 1 , \"Message\" : \"Saving catalog pricing rule successfully.\" })"; } catch (Exception ex) { ErrorHandler errHandler = new ErrorHandler(); if (errHandler.LogWCFException(ex)) { return "({ \"returnStatus\" : -1 , \"errorMessage\" : \"" + ex.Message + "\" })"; } else { return "({ \"returnStatus\" : -1, \"errorMessage\" : \"Error while saving catalog pricing rule!\" })"; } } }
public CatalogPricingRuleInfo GetPricingRule(Int32 catalogPriceRuleID, Int32 storeID, Int32 portalID, string userName, string culture) { CatalogPricingRuleInfo catalogPricingRuleInfo = new CatalogPricingRuleInfo(); PriceRuleController priceRuleController = new PriceRuleController(); catalogPricingRuleInfo = priceRuleController.GetCatalogPricingRule(catalogPriceRuleID, storeID, portalID, userName, culture); return catalogPricingRuleInfo; }