public int CatalogPriceRuleConditionAdd(CatalogPriceRuleCondition catalogPriceRuleCondition, Int32 storeID, Int32 portalID, string userName, string culture)
        {
            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.Parameters.Add(new SqlParameter("@CatalogPriceRuleID", catalogPriceRuleCondition.CatalogPriceRuleID));
            sqlCommand.Parameters.Add(new SqlParameter("@IsAll", catalogPriceRuleCondition.IsAll));
            sqlCommand.Parameters.Add(new SqlParameter("@IsTrue", catalogPriceRuleCondition.IsTrue));
            sqlCommand.Parameters.Add(new SqlParameter("@ParentID", catalogPriceRuleCondition.ParentID));
            sqlCommand.Parameters.Add(new SqlParameter("@IsActive", true));
            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_CatalogPriceRuleConditionAdd";
            sqlCommand.CommandType = CommandType.StoredProcedure;
            SqlConnection sqlConnection = new SqlConnection(ConnectionString);

            try
            {
                sqlCommand.Connection = sqlConnection;
                sqlConnection.Open();
                object val = sqlCommand.ExecuteScalar();
                if (Convert.ToInt16(val) > 0)
                {
                    int catalogConditionDetailID = -1;
                    PriceRuleSqlProvider priceRuleSqlProvider = new PriceRuleSqlProvider();
                    foreach (CatalogConditionDetail catalogConditionDetail in catalogPriceRuleCondition.CatalogConditionDetail)
                    {
                        if (catalogConditionDetail != null)
                        {
                            catalogConditionDetail.CatalogPriceRuleConditionID = Convert.ToInt16(val);
                            catalogConditionDetail.CatalogPriceRuleID          = catalogPriceRuleCondition.CatalogPriceRuleID;
                            catalogConditionDetailID =
                                priceRuleSqlProvider.CatalogConditionDetailAdd(catalogConditionDetail, storeID, portalID,
                                                                               userName, culture);
                            if (!(catalogConditionDetailID > 0))
                            {
                            }
                        }
                    }
                }
                return(Convert.ToInt16(val));
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                sqlConnection.Close();
            }
        }
Example #2
0
        public static int CatalogPriceRuleConditionAdd(CatalogPriceRuleCondition catalogPriceRuleCondition, AspxCommonInfo aspxCommonObj)
        {
            OracleCommand sqlCommand = new OracleCommand();

            sqlCommand.Parameters.Add(new OracleParameter("CatalogPriceRuleID", catalogPriceRuleCondition.CatalogPriceRuleID));
            sqlCommand.Parameters.Add(new OracleParameter("IsAll", catalogPriceRuleCondition.IsAll));
            sqlCommand.Parameters.Add(new OracleParameter("IsTrue", catalogPriceRuleCondition.IsTrue));
            sqlCommand.Parameters.Add(new OracleParameter("ParentID", catalogPriceRuleCondition.ParentID));
            sqlCommand.Parameters.Add(new OracleParameter("IsActive", true));
            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_CatalogPriceRuleConditionAdd";
            sqlCommand.CommandType = CommandType.StoredProcedure;
            OracleConnection sqlConnection = new OracleConnection(ConnectionString);

            try
            {
                sqlCommand.Connection = sqlConnection;
                sqlConnection.Open();
                object val = sqlCommand.ExecuteScalar();
                if (Convert.ToInt16(val) > 0)
                {
                    int catalogConditionDetailID = -1;
                    foreach (CatalogConditionDetail catalogConditionDetail in catalogPriceRuleCondition.CatalogConditionDetail)
                    {
                        if (catalogConditionDetail != null)
                        {
                            catalogConditionDetail.CatalogPriceRuleConditionID = Convert.ToInt16(val);
                            catalogConditionDetail.CatalogPriceRuleID          = catalogPriceRuleCondition.CatalogPriceRuleID;
                            catalogConditionDetailID =
                                AspxCatalogPriceRuleProvider.CatalogConditionDetailAdd(catalogConditionDetail, aspxCommonObj);
                            if (!(catalogConditionDetailID > 0))
                            {
                            }
                        }
                    }
                }
                return(Convert.ToInt16(val));
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                sqlConnection.Close();
            }
        }
 public static int CatalogPriceRuleConditionAdd(CatalogPriceRuleCondition catalogPriceRuleCondition, AspxCommonInfo aspxCommonObj)
 {
     SqlCommand sqlCommand = new SqlCommand();
     sqlCommand.Parameters.Add(new SqlParameter("@CatalogPriceRuleID", catalogPriceRuleCondition.CatalogPriceRuleID));
     sqlCommand.Parameters.Add(new SqlParameter("@IsAll", catalogPriceRuleCondition.IsAll));
     sqlCommand.Parameters.Add(new SqlParameter("@IsTrue", catalogPriceRuleCondition.IsTrue));
     sqlCommand.Parameters.Add(new SqlParameter("@ParentID", catalogPriceRuleCondition.ParentID));
     sqlCommand.Parameters.Add(new SqlParameter("@IsActive", true));
     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_CatalogPriceRuleConditionAdd";
     sqlCommand.CommandType = CommandType.StoredProcedure;
     SqlConnection sqlConnection = new SqlConnection(ConnectionString);
     try
     {
         sqlCommand.Connection = sqlConnection;
         sqlConnection.Open();
         object val = sqlCommand.ExecuteScalar();
         if (Convert.ToInt16(val) > 0)
         {
             int catalogConditionDetailID = -1;
             foreach (CatalogConditionDetail catalogConditionDetail in catalogPriceRuleCondition.CatalogConditionDetail)
             {
                 if (catalogConditionDetail != null)
                 {
                     catalogConditionDetail.CatalogPriceRuleConditionID = Convert.ToInt16(val);
                     catalogConditionDetail.CatalogPriceRuleID = catalogPriceRuleCondition.CatalogPriceRuleID;
                     catalogConditionDetailID =
                         AspxCatalogPriceRuleProvider.CatalogConditionDetailAdd(catalogConditionDetail, aspxCommonObj);
                     if (!(catalogConditionDetailID > 0))
                     {
                     }
                 }
             }
         }
         return Convert.ToInt16(val);
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         sqlConnection.Close();
     }
 }