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 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 CatalogPriceRuleAdd(CatalogPriceRule catalogPriceRule, Int32 storeID, Int32 portalID, string userName, string culture) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Parameters.Add(new SqlParameter("@CatalogPriceRuleID", catalogPriceRule.CatalogPriceRuleID)); sqlCommand.Parameters.Add(new SqlParameter("@CatalogPriceRuleName", catalogPriceRule.CatalogPriceRuleName)); sqlCommand.Parameters.Add(new SqlParameter("@CatalogPriceRuleDescription", catalogPriceRule.CatalogPriceRuleDescription)); sqlCommand.Parameters.Add(new SqlParameter("@Apply", catalogPriceRule.Apply)); sqlCommand.Parameters.Add(new SqlParameter("@Value", catalogPriceRule.Value)); sqlCommand.Parameters.Add(new SqlParameter("@IsFurtherProcessing", catalogPriceRule.IsFurtherProcessing)); sqlCommand.Parameters.Add(new SqlParameter("@FromDate", catalogPriceRule.FromDate)); sqlCommand.Parameters.Add(new SqlParameter("@ToDate", catalogPriceRule.ToDate)); sqlCommand.Parameters.Add(new SqlParameter("@Priority", catalogPriceRule.Priority)); sqlCommand.Parameters.Add(new SqlParameter("@IsActive", catalogPriceRule.IsActive)); sqlCommand.Parameters.Add(new SqlParameter("@StoreID", storeID)); sqlCommand.Parameters.Add(new SqlParameter("@PortalID", portalID)); sqlCommand.Parameters.Add(new SqlParameter("@Username", userName)); sqlCommand.Parameters.Add(new SqlParameter("@CultureName", culture)); sqlCommand.CommandText = "usp_Aspx_CatalogPriceRuleAdd"; sqlCommand.CommandType = CommandType.StoredProcedure; SqlConnection sqlConnection = new SqlConnection(ConnectionString); try { sqlCommand.Connection = sqlConnection; sqlConnection.Open(); object val = sqlCommand.ExecuteScalar(); return(Convert.ToInt16(val)); } catch (Exception e) { throw e; } finally { sqlConnection.Close(); } }
public static int CatalogPriceRuleAdd(CatalogPriceRule catalogPriceRule, AspxCommonInfo aspxCommonObj) { OracleCommand sqlCommand = new OracleCommand(); sqlCommand.Parameters.Add(new OracleParameter("CatalogPriceRuleID", catalogPriceRule.CatalogPriceRuleID)); sqlCommand.Parameters.Add(new OracleParameter("CatalogPriceRuleName", catalogPriceRule.CatalogPriceRuleName)); sqlCommand.Parameters.Add(new OracleParameter("CatalogPriceRuleDescription", catalogPriceRule.CatalogPriceRuleDescription)); sqlCommand.Parameters.Add(new OracleParameter("Apply", catalogPriceRule.Apply)); sqlCommand.Parameters.Add(new OracleParameter("Value", catalogPriceRule.Value)); sqlCommand.Parameters.Add(new OracleParameter("IsFurtherProcessing", catalogPriceRule.IsFurtherProcessing)); sqlCommand.Parameters.Add(new OracleParameter("FromDate", catalogPriceRule.FromDate)); sqlCommand.Parameters.Add(new OracleParameter("ToDate", catalogPriceRule.ToDate)); sqlCommand.Parameters.Add(new OracleParameter("Priority", catalogPriceRule.Priority)); sqlCommand.Parameters.Add(new OracleParameter("IsActive", catalogPriceRule.IsActive)); sqlCommand.Parameters.Add(new OracleParameter("StoreID", aspxCommonObj.StoreID)); sqlCommand.Parameters.Add(new OracleParameter("PortalID", aspxCommonObj.PortalID)); sqlCommand.Parameters.Add(new OracleParameter("UserName", aspxCommonObj.UserName)); sqlCommand.Parameters.Add(new OracleParameter("CultureName", aspxCommonObj.CultureName)); sqlCommand.CommandText = "usp_Aspx_CatalogPriceRuleAdd"; sqlCommand.CommandType = CommandType.StoredProcedure; OracleConnection sqlConnection = new OracleConnection(ConnectionString); try { sqlCommand.Connection = sqlConnection; sqlConnection.Open(); object val = sqlCommand.ExecuteScalar(); return(Convert.ToInt16(val)); } catch (Exception e) { throw e; } finally { sqlConnection.Close(); } }
public static int CatalogPriceRuleAdd(CatalogPriceRule catalogPriceRule, AspxCommonInfo aspxCommonObj) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Parameters.Add(new SqlParameter("@CatalogPriceRuleID", catalogPriceRule.CatalogPriceRuleID)); sqlCommand.Parameters.Add(new SqlParameter("@CatalogPriceRuleName", catalogPriceRule.CatalogPriceRuleName)); sqlCommand.Parameters.Add(new SqlParameter("@CatalogPriceRuleDescription", catalogPriceRule.CatalogPriceRuleDescription)); sqlCommand.Parameters.Add(new SqlParameter("@Apply", catalogPriceRule.Apply)); sqlCommand.Parameters.Add(new SqlParameter("@Value", catalogPriceRule.Value)); sqlCommand.Parameters.Add(new SqlParameter("@IsFurtherProcessing", catalogPriceRule.IsFurtherProcessing)); sqlCommand.Parameters.Add(new SqlParameter("@FromDate", catalogPriceRule.FromDate)); sqlCommand.Parameters.Add(new SqlParameter("@ToDate", catalogPriceRule.ToDate)); sqlCommand.Parameters.Add(new SqlParameter("@Priority", catalogPriceRule.Priority)); sqlCommand.Parameters.Add(new SqlParameter("@IsActive", catalogPriceRule.IsActive)); sqlCommand.Parameters.Add(new SqlParameter("@StoreID", aspxCommonObj.StoreID)); sqlCommand.Parameters.Add(new SqlParameter("@PortalID", aspxCommonObj.PortalID)); sqlCommand.Parameters.Add(new SqlParameter("@UserName", aspxCommonObj.UserName)); sqlCommand.Parameters.Add(new SqlParameter("@CultureName", aspxCommonObj.CultureName)); sqlCommand.CommandText = "usp_Aspx_CatalogPriceRuleAdd"; sqlCommand.CommandType = CommandType.StoredProcedure; SqlConnection sqlConnection = new SqlConnection(ConnectionString); try { sqlCommand.Connection = sqlConnection; sqlConnection.Open(); object val = sqlCommand.ExecuteScalar(); return Convert.ToInt16(val); } catch (Exception e) { throw e; } finally { sqlConnection.Close(); } }