Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id = RequestTool.RequestInt("id", 0);
     if (id == 0)
     {
         if (!Power("supplier_product_add", "添加商品"))
         {
             PageReturnMsg = PageNoPowerMsg();
         }
         addflag = true;
     }
     else
     {
         if (!Power("supplier_product_edit", "编辑商品"))
         {
             PageReturnMsg = PageNoPowerMsg();
         }
     }
     action = RequestTool.RequestInt("action", 1);
     model  = B_Lebi_Product.GetModel("(IsDel!=1 or IsDel is null) and Supplier_id = " + CurrentSupplier.id + " and id = " + id + "");
     if (model == null)
     {
         model = new Lebi_Product();
         Lebi_Product modellast = B_Lebi_Product.GetModel("(IsDel!=1 or IsDel is null) and Supplier_id = " + CurrentSupplier.id + " order by Time_Edit desc,id desc");
         if (modellast != null)
         {
             model.Pro_Type_id = modellast.Pro_Type_id;
         }
     }
     if (model.Images != "")
     {
         if (model.Images.Substring(model.Images.Length - 1, 1) == "@")
         {
             model.Images = model.Images.Substring(0, model.Images.Length - 1);
         }
         if (model.Images.Substring(0, 1) != "@")
         {
             model.Images = "@" + model.Images;
         }
     }
     wap        = Ishavewap();
     StepPrices = EX_Product.StepPrice(model.StepPrice);
     if (StepPrices == null)
     {
         StepPrices = new List <ProductStepPrice>();
     }
     UserLevelPrices = EX_Product.UserLevelPrice(model.UserLevelPrice);
     if (UserLevelPrices == null)
     {
         UserLevelPrices = new List <ProductUserLevelPrice>();
     }
     UserLevelCounts = EX_Product.UserLevelCount(model.UserLevelCount);
     if (UserLevelCounts == null)
     {
         UserLevelCounts = new List <ProductUserLevelCount>();
     }
     userlevels = B_Lebi_UserLevel.GetList("", "Grade asc");
 }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Random Random = new Random();

            randnum = RequestTool.RequestInt("randnum", 0);
            id      = RequestTool.RequestInt("id", 0);
            if (id == 0 || (id > 0 && randnum > 0))
            {
                if (!EX_Admin.Power("product_add", "添加商品"))
                {
                    PageNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("product_edit", "编辑商品"))
                {
                    PageNoPower();
                }
            }
            action = RequestTool.RequestInt("action", 1);
            model  = B_Lebi_Product.GetModel(id);
            if (model == null)
            {
                model = new Lebi_Product();
                model.Type_id_ProductType = 320;
            }
            wap = Ishavewap();

            StepPrices = EX_Product.StepPrice(model.StepPrice);
            if (StepPrices == null)
            {
                StepPrices = new List <ProductStepPrice>();
            }
            UserLevelPrices = EX_Product.UserLevelPrice(model.UserLevelPrice);
            if (UserLevelPrices == null)
            {
                UserLevelPrices = new List <ProductUserLevelPrice>();
            }
            UserLevelCounts = EX_Product.UserLevelCount(model.UserLevelCount);
            if (UserLevelCounts == null)
            {
                UserLevelCounts = new List <ProductUserLevelCount>();
            }
            userlevels = B_Lebi_UserLevel.GetList("", "Grade asc");
            if (model.IsCombo == 1)
            {
                comboProducts = B_Lebi_Product_Combo.GetList("Product_id=" + model.id + "", "");
            }
            else
            {
                comboProducts = new List <Lebi_Product_Combo>();
            }
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Random Random = new Random();

            randnum = RequestTool.RequestInt("randnum", 0);
            id      = RequestTool.RequestInt("id", 0);
            if (id == 0 || (id > 0 && randnum > 0))
            {
                if (!Power("supplier_product_add", "添加商品"))
                {
                    PageNoPower();
                }
            }
            else
            {
                if (!Power("supplier_product_edit", "编辑商品"))
                {
                    PageNoPower();
                }
            }
            action = RequestTool.RequestInt("action", 1);
            model  = B_Lebi_Product.GetModel("Supplier_id = " + CurrentSupplier.id + " and (IsDel!=1 or IsDel is null) and id = " + id);
            if (model == null)
            {
                model = new Lebi_Product();
                model.Type_id_ProductType = 320;
            }
            wap        = Ishavewap();
            StepPrices = EX_Product.StepPrice(model.StepPrice);
            if (StepPrices == null)
            {
                StepPrices = new List <ProductStepPrice>();
            }
            UserLevelPrices = EX_Product.UserLevelPrice(model.UserLevelPrice);
            if (UserLevelPrices == null)
            {
                UserLevelPrices = new List <ProductUserLevelPrice>();
            }
            UserLevelCounts = EX_Product.UserLevelCount(model.UserLevelCount);
            if (UserLevelCounts == null)
            {
                UserLevelCounts = new List <ProductUserLevelCount>();
            }
            userlevels = B_Lebi_UserLevel.GetList("", "Grade asc");
        }
Exemple #4
0
        public string StepPriceShow(Lebi_Product pro)
        {
            string str = "";
            List <ProductStepPrice> StepPrices = EX_Product.StepPrice(pro.StepPrice);

            if (StepPrices == null)
            {
                StepPrices = new List <ProductStepPrice>();
            }
            if (StepPrices.Count > 0)
            {
                foreach (var v in StepPrices)
                {
                    if (v.Count > 1)
                    {
                        str += ">" + v.Count + ":" + FormatMoney(v.Price) + ";";
                    }
                }
            }
            str = str.Trim(';');
            return(str);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Random Random = new Random();

            t     = RequestTool.RequestString("t");
            id    = RequestTool.RequestInt("id", 0);
            model = B_Lebi_Product.GetModel(id);
            int Type_id_ProductType = RequestTool.RequestInt("Type_id_ProductType", 320);

            if (id == 0 || (id > 0 && t == "copy"))
            {
                if (!EX_Admin.Power("product_add", "添加商品"))
                {
                    PageReturnMsg = PageNoPowerMsg();
                }
                ////如果添加商品时随机数小于9位数 重定向生成随机数 防止破坏已有数据
                //if (randnum.ToString().Length < 9)
                //{
                //    Response.Redirect(site.AdminPath + "/product/product_edit.aspx?id=" + id + "&t=" + t + "&randnum=" + Random.Next(100000000, 999999999));
                //    Response.End();
                //    return;
                //}
            }
            else
            {
                if (!EX_Admin.Power("product_edit", "编辑商品"))
                {
                    PageReturnMsg = PageNoPowerMsg();
                }
                if (site.SiteCount > 1 && CurrentAdmin.Site_ids != "" && model.Site_ids != "")
                {
                    string[] psids = model.Site_ids.Split(',');
                    bool     flag  = false;
                    foreach (string pdis in psids)
                    {
                        if (("," + CurrentAdmin.Site_ids + ",").Contains("," + pdis + ","))
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        PageReturnMsg = PageErrorMsg();
                    }
                }
            }

            action = RequestTool.RequestInt("action", 1);

            if (model == null)
            {
                model                     = new Lebi_Product();
                model.Site_ids            = site.Sitesid();
                model.Type_id_ProductType = Type_id_ProductType;
                Lebi_Product modellast = B_Lebi_Product.GetModel("Type_id_ProductType = " + Type_id_ProductType + " and Supplier_id = 0 order by Time_Edit desc,id desc");
                if (modellast != null)
                {
                    model.Pro_Type_id = modellast.Pro_Type_id;
                }
            }
            else
            {
                if (t == "copy")
                {
                    model.id = 0;
                }
            }
            if (model.Images != "")
            {
                if (model.Images.Substring(model.Images.Length - 1, 1) == "@")
                {
                    model.Images = model.Images.Substring(0, model.Images.Length - 1);
                }
                if (model.Images.Substring(0, 1) != "@")
                {
                    model.Images = "@" + model.Images;
                }
            }
            StepPrices = EX_Product.StepPrice(model.StepPrice);
            if (StepPrices == null)
            {
                StepPrices = new List <ProductStepPrice>();
            }
            UserLevelPrices = EX_Product.UserLevelPrice(model.UserLevelPrice);
            if (UserLevelPrices == null)
            {
                UserLevelPrices = new List <ProductUserLevelPrice>();
            }
            UserLevelCounts = EX_Product.UserLevelCount(model.UserLevelCount);
            if (UserLevelCounts == null)
            {
                UserLevelCounts = new List <ProductUserLevelCount>();
            }
            userlevels = B_Lebi_UserLevel.GetList("", "Grade asc");
            wap        = Ishavewap();

            if (model.IsCombo == 1)
            {
                comboProducts = B_Lebi_Product_Combo.GetList("Product_id=" + model.id + "", "");
            }
            else
            {
                comboProducts = new List <Lebi_Product_Combo>();
            }
        }