예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            tid = RequestTool.RequestInt("tid", 0);
            int pid = RequestTool.RequestInt("pid", 0);

            model = B_Lebi_Product.GetModel(pid);
            if (model == null)
            {
                model = new Lebi_Product();
            }
            //Lebi_ProPerty_Type ptype = B_Lebi_ProPerty_Type.GetModel(tid);
            string property = EX_Product.ProductType_ProPertystr(tid, model.Supplier_id);

            if (property != "")
            {
                pros = B_Lebi_ProPerty.GetList("Type_id_ProPertyType in (132,133) and id in (" + property + ")", "Sort desc");
            }
            if (pros == null)
            {
                pros = new List <Lebi_ProPerty>();
            }
            ProPerty133 = Common.KeyValueToList(model.ProPerty133);
            if (tid == 0)
            {
                tid = model.Pro_Type_id;
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id     = RequestTool.RequestInt("id", 0);
            modelp = B_Lebi_Product.GetModel("Supplier_id = " + CurrentSupplier.id + " and id = " + id);
            if (modelp == null)
            {
                modelp = new Lebi_Product();
                modelp.ProPertyMain = RequestTool.RequestInt("ProPertyMain", 0);
                modelp.ProPerty131  = RequestTool.RequestString("ProPerty131");
            }
            if (!Power("supplier_product_edit", "编辑商品"))
            {
                WindowNoPower();
            }
            string property = EX_Product.ProductType_ProPertystr(modelp.Pro_Type_id);

            if (property != "")
            {
                try
                {
                    ggs = B_Lebi_ProPerty.GetList("Type_id_ProPertyType=131 and id in (lbsql{" + property + "})", "Sort desc");
                }
                catch (System.Data.SqlClient.SqlException)
                {
                    ggs = new List <Lebi_ProPerty>();
                }
            }
            if (ggs == null)
            {
                ggs = new List <Lebi_ProPerty>();
            }
            modelLan     = Language.DefaultLanguage();
            string where = "";
            where        = "Product_id=" + id + " and Product_id!=0 and (IsDel!=1 or IsDel is null)";
            models       = B_Lebi_Product.GetList(where, "");
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            pid     = RequestTool.RequestInt("pid", 0);
            tid     = RequestTool.RequestInt("tid", 0);
            randnum = RequestTool.RequestInt("randnum", 0);
            if (pid == 0 || (pid > 0 && randnum > 0))
            {
                if (!Power("supplier_product_add", "添加商品"))
                {
                    WindowNoPower();
                }
            }
            else
            {
                if (!Power("supplier_product_edit", "编辑商品"))
                {
                    WindowNoPower();
                }
            }
            if (pid > 0 && randnum > 0)
            {
                modelp = B_Lebi_Product.GetModel(randnum);
            }
            else
            {
                modelp = B_Lebi_Product.GetModel(pid);
            }
            if (modelp == null)
            {
                modelp = new Lebi_Product();
                modelp.ProPertyMain = RequestTool.RequestInt("ProPertyMain", 0);
                modelp.ProPerty131  = RequestTool.RequestString("ProPerty131");
            }
            if (tid == 0)
            {
                tid = modelp.Pro_Type_id;
            }
            string property = EX_Product.ProductType_ProPertystr(tid, CurrentSupplier.id);

            if (property != "")
            {
                try
                {
                    ggs = B_Lebi_ProPerty.GetList("Type_id_ProPertyType=131 and id in (" + property + ")", "Sort desc");
                }
                catch (System.Data.SqlClient.SqlException)
                {
                    ggs = new List <Lebi_ProPerty>();
                }
            }
            if (ggs == null)
            {
                ggs = new List <Lebi_ProPerty>();
            }
            modelLan     = Language.DefaultLanguage();
            string where = "Product_id!=0 and (IsDel!=1 or IsDel is null)";
            if (pid == 0 || (pid > 0 && randnum > 0))
            {
                where += " and Supplier_id = " + CurrentSupplier.id + " and Product_id=" + randnum + "";
            }
            else
            {
                where += " and Supplier_id = " + CurrentSupplier.id + " and Product_id=" + pid + "";
            }
            models = B_Lebi_Product.GetList(where, "");
        }
예제 #4
0
        /// <summary>
        /// 生成规格选项
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string Get_guige(Lebi_Product model)
        {
            string res = "";

            if (model.ProPerty134 != "")
            {
                List <Lebi_ProPerty> ps134 = B_Lebi_ProPerty.GetList("id in (" + model.ProPerty134 + ")", "Sort desc");
                string Msige = Language.DefaultCurrency().Msige;
                foreach (Lebi_ProPerty p in ps134)
                {
                    res += "<dl class=\"clearfix\"><dt>" + Lang(p.Name) + ":</dt><dd>";
                    res += "<input type=\"hidden\" name=\"Property134\" propertyid=\"" + p.id + "\" value=\"" + Lang(p.Name) + "\" />";
                    List <Lebi_ProPerty> ps134list = B_Lebi_ProPerty.GetList("parentid = " + p.id + "", "Sort desc");
                    if (ps134list.Count > 0)
                    {
                        Lebi_ProPerty ps134listfirst = ps134list.FirstOrDefault();
                        res += "<select id=\"Property134_" + p.id + "\" selectname=\"Property134\">";
                        foreach (Lebi_ProPerty pl in ps134list)
                        {
                            if (pl.Price > 0)
                            {
                                res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + Msige + pl.Price + "\">" + Lang(pl.Name) + " " + Msige + pl.Price + "</option>";
                            }
                            else
                            {
                                res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + "\">" + Lang(pl.Name) + "</option>";
                            }
                        }
                        res += "</select>";
                    }
                    else
                    {
                        res += "<input type=\"text\" id=\"Property134_" + p.id + "\" class=\"input\" value=\"\" />";
                    }
                    res += "</dd></dl>";
                }
            }
            //return "model.ProPerty134" + model.ProPerty134;
            List <ProductProperty> rmodels = new List <ProductProperty>();

            if (model.Product_id == 0)
            {
                //无同款子商品
                return(res);
            }
            List <Lebi_Product> pros = B_Lebi_Product.GetList("(IsDel!=1 or IsDel is null) and Product_id=" + model.Product_id + "", "");

            if (pros.Count == 0)
            {
                return(res);
            }
            Lebi_Product pmodel = B_Lebi_Product.GetModel(model.Product_id);

            if (pmodel == null)
            {
                return(res);
            }
            string property = EX_Product.ProductType_ProPertystr(model.Pro_Type_id, 131, model.Supplier_id);

            if (property == "")
            {
                return(res);
            }
            List <Lebi_ProPerty> pps = B_Lebi_ProPerty.GetList("id in (" + property + ")", "Sort desc");
            List <Lebi_ProPerty> ps  = B_Lebi_ProPerty.GetList("parentid in (" + property + ")", "Sort desc");
            //分析当前商品的规格
            //将当前商品的规格与主父规格进行对应
            List <Lebi_ProPerty> Currentpps = new List <Lebi_ProPerty>();//保存当时商品的父规则值

            string[] temps = model.ProPerty131.Split(',');
            foreach (string k in temps)
            {
                Lebi_ProPerty p = (from m in ps
                                   where m.id == Convert.ToInt32(k)
                                   select m).ToList().FirstOrDefault();
                if (p != null)
                {
                    Lebi_ProPerty kv = (from m in pps
                                        where m.id == p.parentid
                                        select m).ToList().FirstOrDefault();
                    kv.Sort = p.id;//临时征用排序字段,存放规格
                    Currentpps.Add(kv);
                }
            }

            foreach (Lebi_ProPerty pp in Currentpps)
            {
                List <Lebi_ProPerty> cps = (from m in ps
                                            where m.parentid == pp.id
                                            select m).ToList();
                if (cps.Count == 0)
                {
                    continue;
                }
                bool showimage = true;
                if (cps.FirstOrDefault().ImageUrl == "")
                {
                    showimage = false;
                }
                if (pp.id == model.ProPertyMain)
                {
                    //res += "<dl class=\"choose-image clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>";
                    if (!showimage)
                    {
                        res += "<dl class=\"choose-text clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>";
                    }
                    else
                    {
                        res += "<dl class=\"choose-image clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>";
                    }
                    foreach (Lebi_ProPerty p in cps)
                    {
                        //计算对应的商品
                        string       propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ",");
                        Lebi_Product pro         = (from m in pros
                                                    where ("," + m.ProPerty131 + ",") == propertystr
                                                    select m).ToList().FirstOrDefault();
                        if (pro == null)
                        {
                            continue;
                        }
                        if (showimage)
                        {
                            if (pro.Type_id_ProductStatus == 100 || (EX_Product.ProductStock(pro) < 1 && SYS.IsNullStockSale != "1"))//下架 无库存
                            {
                                if (pp.Sort == p.id)
                                {
                                    res += "<div><a class=\"spva-imgonout\"><img src=\"" + Image(model.ImageOriginal) + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>";
                                }
                                else
                                {
                                    res += "<div><a class=\"spva-imgout\" href=\"" + URL("P_Product", pro.id) + "\"><img src=\"" + Image(pro.ImageOriginal) + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>";
                                }
                                continue;
                            }
                            if (pp.Sort == p.id)
                            {
                                res += "<div><a class=\"spva-imgon\" href=\"" + URL("P_Product", model.id) + "\"><img src=\"" + Image(model.ImageOriginal) + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>";
                            }
                            else
                            {
                                res += "<div><a class=\"spva-img\" href=\"" + URL("P_Product", pro.id) + "\"><img src=\"" + Image(pro.ImageOriginal) + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>";
                            }
                        }
                        else
                        {
                            if (pro.Type_id_ProductStatus == 100 || (EX_Product.ProductStock(pro) < 1 && SYS.IsNullStockSale != "1"))//下架 无库存
                            {
                                if (pp.Sort == p.id)
                                {
                                    res += "<div><a class=\"spvaonout\">" + Lang(p.Name) + "<span></span></a></div>";
                                }
                                else
                                {
                                    res += "<div><a class=\"spvaout\" href=\"" + URL("P_Product", pro.id) + "\">" + Lang(p.Name) + "<span></span></a></div>";
                                }
                                continue;
                            }
                            if (pp.Sort == p.id)
                            {
                                res += "<div><a class=\"spvaon\" href=\"" + URL("P_Product", model.id) + "\">" + Lang(p.Name) + "<span></span></a></div>";
                            }
                            else
                            {
                                res += "<div><a class=\"spva\" href=\"" + URL("P_Product", pro.id) + "\">" + Lang(p.Name) + "<span></span></a></div>";
                            }
                        }
                    }
                }
                else
                {
                    if (!showimage)
                    {
                        res += "<dl class=\"choose-text clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>";
                    }
                    else
                    {
                        res += "<dl class=\"choose-image clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>";
                    }
                    foreach (Lebi_ProPerty p in cps)
                    {
                        //计算对应的商品
                        string       propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ",");
                        Lebi_Product pro         = (from m in pros
                                                    where ("," + m.ProPerty131 + ",") == propertystr
                                                    select m).ToList().FirstOrDefault();
                        if (pro == null)
                        {
                            continue;
                        }
                        string tt     = "";
                        string aclass = "";
                        if (p.ImageUrl == "")
                        {
                            tt = Lang(p.Name);
                        }
                        else
                        {
                            tt = "<img src=\"" + p.ImageUrl + "\" width=\"50\"\" />";
                        }

                        if (pro.Type_id_ProductStatus == 100 || (EX_Product.ProductStock(pro) < 1 && SYS.IsNullStockSale != "1"))//下架 无库存
                        {
                            if (pp.Sort == p.id)
                            {
                                if (cps.FirstOrDefault().ImageUrl == "")
                                {
                                    aclass = "spvaonout";
                                }
                                else
                                {
                                    aclass = "spva-imgonout";
                                }
                                res += "<div><a class=\"" + aclass + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>";
                            }
                            else
                            {
                                if (cps.FirstOrDefault().ImageUrl == "")
                                {
                                    aclass = "spvaout";
                                }
                                else
                                {
                                    aclass = "spva-imgout";
                                }
                                res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", pro.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>";
                            }
                            continue;
                        }

                        if (pp.Sort == p.id)
                        {
                            if (!showimage)
                            {
                                aclass = "spvaon";
                            }
                            else
                            {
                                aclass = "spva-imgon";
                            }
                            res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", model.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>";
                        }
                        else
                        {
                            if (!showimage)
                            {
                                aclass = "spva";
                            }
                            else
                            {
                                aclass = "spva-img";
                            }
                            res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", pro.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>";
                        }
                    }
                }
                res += "</dd></dl>";
            }
            return(res);
        }
예제 #5
0
        public string Get_guigeforwap(Lebi_Product model)
        {
            string res = "";

            if (model.ProPerty134 != "")
            {
                List <Lebi_ProPerty> ps134 = B_Lebi_ProPerty.GetList("id in (" + model.ProPerty134 + ")", "Sort desc");
                string Msige = Language.DefaultCurrency().Msige;
                if (ps134.Count > 0)
                {
                    foreach (Lebi_ProPerty p in ps134)
                    {
                        res += "<dd class=\"clearfix\"><em>" + Lang(p.Name) + ":</em><em><input type=\"hidden\" name=\"Property134\" propertyid=\"" + p.id + "\" value=\"" + Lang(p.Name) + Msige + p.Price + ":\" />";
                        List <Lebi_ProPerty> ps134list = B_Lebi_ProPerty.GetList("parentid = " + p.id + "", "Sort desc");
                        if (ps134list.Count > 0)
                        {
                            res += "<select id=\"Property134_" + p.id + "\" >";
                            foreach (Lebi_ProPerty pl in ps134list)
                            {
                                if (pl.Price > 0)
                                {
                                    res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + Msige + pl.Price + "\">" + Lang(pl.Name) + " " + Msige + pl.Price + "</option>";
                                }
                                else
                                {
                                    res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + "\">" + Lang(pl.Name) + "</option>";
                                }
                            }
                            res += "</select>";
                        }
                        else
                        {
                            res += "<input type=\"text\" id=\"Property134_" + p.id + "\" class=\"input\" value=\"\" />";
                        }
                        res += "</em></dd>";
                    }
                }
            }
            List <ProductProperty> rmodels = new List <ProductProperty>();

            if (model.Product_id == 0)
            {
                //无同款子商品
                return(res);
            }
            List <Lebi_Product> pros = B_Lebi_Product.GetList("(IsDel!=1 or IsDel is null) and Product_id=" + model.Product_id + "", "");

            if (pros.Count == 0)
            {
                return(res);
            }
            Lebi_Product pmodel = B_Lebi_Product.GetModel(model.Product_id);

            if (pmodel == null)
            {
                return(res);
            }
            string property = EX_Product.ProductType_ProPertystr(model.Pro_Type_id, 131);

            if (property == "")
            {
                return(res);
            }
            List <Lebi_ProPerty> pps = B_Lebi_ProPerty.GetList("id in (" + property + ")", "Sort desc");
            List <Lebi_ProPerty> ps  = B_Lebi_ProPerty.GetList("parentid in (" + property + ")", "Sort desc");
            //分析当前商品的规格
            //将当前商品的规格与主父规格进行对应
            List <Lebi_ProPerty> Currentpps = new List <Lebi_ProPerty>();//保存当前商品的父规则值

            string[] temps = model.ProPerty131.Split(',');
            foreach (string k in temps)
            {
                Lebi_ProPerty p = (from m in ps
                                   where m.id == Convert.ToInt32(k)
                                   select m).ToList().FirstOrDefault();
                if (p != null)
                {
                    Lebi_ProPerty kv = (from m in pps
                                        where m.id == p.parentid
                                        select m).ToList().FirstOrDefault();
                    kv.Sort = p.id;//临时征用排序字段,存放规格
                    Currentpps.Add(kv);
                }
            }
            foreach (Lebi_ProPerty pp in Currentpps)
            {
                List <Lebi_ProPerty> cps = (from m in ps
                                            where m.parentid == pp.id
                                            select m).ToList();
                if (cps.Count == 0)
                {
                    continue;
                }


                res += "<dd class=\"cartOption\"><em>" + Lang(pp.Name) + ":</em><em><select name=\"select_same_goods_\" onChange=\"window.location=$(this).val();\">";

                foreach (Lebi_ProPerty p in cps)
                {
                    //计算对应的商品
                    string       propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ",");
                    Lebi_Product pro         = (from m in pros
                                                where ("," + m.ProPerty131 + ",") == propertystr
                                                select m).ToList().FirstOrDefault();
                    if (pro == null)
                    {
                        continue;
                    }
                    if (pp.Sort == p.id)
                    {
                        res += " <option value=\"" + URL("P_Product", pro.id) + "\" selected>" + Lang(p.Name) + "</option>";
                    }
                    else
                    {
                        res += " <option value=\"" + URL("P_Product", pro.id) + "\">" + Lang(p.Name) + "</option>";
                    }
                }

                res += "</select></em><em></em></dd>";
            }
            return(res);
        }