Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 public static bool CheckCatalogPriorityUniqueness(int catalogPriceRuleID, int priority, AspxCommonInfo aspxCommonObj)
 {
     try
     {
         bool isUnique = AspxCatalogPriceRuleProvider.CheckCatalogPriorityUniqueness(catalogPriceRuleID, priority, aspxCommonObj);
         return(isUnique);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #4
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();
            }
        }
Beispiel #5
0
        public static List <CatalogPriceRulePaging> GetCatalogPricingRules(string ruleName, System.Nullable <DateTime> startDate, System.Nullable <DateTime> endDate, System.Nullable <bool> isActive, AspxCommonInfo aspxCommonObj, int offset, int limit)
        {
            List <CatalogPriceRulePaging> lstCatalogPriceRule = AspxCatalogPriceRuleProvider.GetCatalogPricingRules(ruleName, startDate, endDate, isActive, aspxCommonObj, offset, limit);

            return(lstCatalogPriceRule);
        }
Beispiel #6
0
        public static List <PricingRuleAttributeInfo> GetPricingRuleAttributes(AspxCommonInfo aspxCommonObj)
        {
            List <PricingRuleAttributeInfo> lstPriceRuleAttr = AspxCatalogPriceRuleProvider.GetPricingRuleAttributes(aspxCommonObj);

            return(lstPriceRuleAttr);
        }
Beispiel #7
0
        public static int CatalogPriceMultipleRulesDelete(string catRulesIds, AspxCommonInfo aspxCommonObj)
        {
            int retValue = AspxCatalogPriceRuleProvider.CatalogPriceRulesMultipleDelete(catRulesIds, aspxCommonObj);

            return(retValue);
        }
Beispiel #8
0
        public static int CatalogPriceRuleDelete(int catalogPriceRuleID, AspxCommonInfo aspxCommonObj)
        {
            int retValue = AspxCatalogPriceRuleProvider.CatalogPriceRuleDelete(catalogPriceRuleID, aspxCommonObj);

            return(retValue);
        }
Beispiel #9
0
        public bool CheckCatalogRuleExist(AspxCommonInfo aspxCommonObj)
        {
            AspxCatalogPriceRuleProvider objCatalog = new AspxCatalogPriceRuleProvider();

            return(objCatalog.CheckCatalogRuleExist(aspxCommonObj));
        }
Beispiel #10
0
        public void ApplyCatalogPricingRule(AspxCommonInfo aspxCommonObj)
        {
            AspxCatalogPriceRuleProvider objCatalog = new AspxCatalogPriceRuleProvider();

            objCatalog.ApplyCatalogPricingRule(aspxCommonObj);
        }
 public bool CheckCatalogRuleExist(AspxCommonInfo aspxCommonObj)
 {
     AspxCatalogPriceRuleProvider objCatalog = new AspxCatalogPriceRuleProvider();
     return objCatalog.CheckCatalogRuleExist(aspxCommonObj);
 }
 public void ApplyCatalogPricingRule(AspxCommonInfo aspxCommonObj)
 {
     AspxCatalogPriceRuleProvider objCatalog = new AspxCatalogPriceRuleProvider();
     objCatalog.ApplyCatalogPricingRule(aspxCommonObj);
    
 }