Exemplo n.º 1
0
            /// <summary>
            /// 得到一个对象实体 by SQLpara
            /// </summary>
            public Lebi_Pro_Tag GetModel(SQLPara para)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select top 1 * from [Lebi_Pro_Tag] ");
                if (para.Where != "")
                {
                    strSql.Append(" where " + para.Where + "");
                }
                Lebi_Pro_Tag model = new Lebi_Pro_Tag();
                DataSet      ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), para.Para);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Exemplo n.º 2
0
            /// <summary>
            /// 得到一个对象实体 by where条件
            /// </summary>
            public Lebi_Pro_Tag GetModel(string strWhere)
            {
                if (strWhere.IndexOf("lbsql{") > 0)
                {
                    SQLPara para = new SQLPara(strWhere, "", "");
                    return(GetModel(para));
                }
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_Pro_Tag] ");
                strSql.Append(" where " + strWhere + "");
                Lebi_Pro_Tag model = new Lebi_Pro_Tag();
                DataSet      ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString());

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Exemplo n.º 3
0
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Lebi_Pro_Tag GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_Pro_Tag] ");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id", SqlDbType.Int, 4)
                };
                parameters[0].Value = id;

                Lebi_Pro_Tag model = new Lebi_Pro_Tag();
                DataSet      ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), parameters);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Exemplo n.º 4
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Pro_Tag model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Pro_Tag](");
                strSql.Append("Name,Sort)");
                strSql.Append(" values (");
                strSql.Append("@Name,@Sort)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@Name", model.Name),
                    new SqlParameter("@Sort", model.Sort)
                };

                object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
Exemplo n.º 5
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_Pro_Tag SafeBindForm(Lebi_Pro_Tag model)
 {
     if (HttpContext.Current.Request["Name"] != null)
     {
         model.Name = Shop.Tools.RequestTool.RequestSafeString("Name");
     }
     if (HttpContext.Current.Request["Sort"] != null)
     {
         model.Sort = Shop.Tools.RequestTool.RequestInt("Sort", 0);
     }
     return(model);
 }
Exemplo n.º 6
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Pro_Tag model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Pro_Tag] set ");
                strSql.Append("[Name]=@Name,");
                strSql.Append("[Sort]=@Sort");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name", model.Name),
                    new OleDbParameter("@Sort", model.Sort)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Exemplo n.º 7
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Pro_Tag model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Pro_Tag](");
                strSql.Append("[Name],[Sort])");
                strSql.Append(" values (");
                strSql.Append("@Name,@Sort)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name", model.Name),
                    new OleDbParameter("@Sort", model.Sort)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
Exemplo n.º 8
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_Pro_Tag ReaderBind(IDataReader dataReader)
            {
                Lebi_Pro_Tag model = new Lebi_Pro_Tag();
                object       ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                model.Name = dataReader["Name"].ToString();
                ojb        = dataReader["Sort"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Sort = (int)ojb;
                }
                return(model);
            }
Exemplo n.º 9
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Pro_Tag model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Pro_Tag] set ");
                strSql.Append("Name= @Name,");
                strSql.Append("Sort= @Sort");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",   SqlDbType.Int,        4),
                    new SqlParameter("@Name", SqlDbType.NVarChar, 500),
                    new SqlParameter("@Sort", SqlDbType.Int, 4)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.Name;
                parameters[2].Value = model.Sort;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = RequestTool.RequestInt("id", 0);

            if (id == 0)
            {
                if (!EX_Admin.Power("pro_tag_add", "添加商品标签"))
                {
                    WindowNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("pro_tag_edit", "编辑商品标签"))
                {
                    WindowNoPower();
                }
            }
            model = B_Lebi_Pro_Tag.GetModel(id);
            if (model == null)
            {
                model = new Lebi_Pro_Tag();
            }
        }
Exemplo n.º 11
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            id        = Rint_Para("0");    //商品分类
            pid       = Rint_Para("1");    //品牌
            cid       = Rstring_Para("2"); //属性
            list      = Rstring_Para("3"); //列表或网格
            sort      = Rstring_Para("4"); //排序
            tid       = Rint_Para("5");    //商品标签
            transport = Rint_Para("7");    //配送 0全部 1商城 2商家
            stock     = Rint_Para("8");    //是否有库存 1只显示有货
            pageindex = RequestTool.RequestInt("page", 1);
            pro_type  = B_Lebi_Pro_Type.GetModel(id);
            if (pro_type == null)
            {
                pro_type = new Lebi_Pro_Type();
            }
            if (Lang(pro_type.Url) != "")  //如果存在自定义URL 跳转至自定义URL by kingdge 2014-10-30
            {
                Response.Redirect(Lang(pro_type.Url));
                Response.End();
                return;
            }
            property = EX_Product.ProductType_ProPerty(pro_type);
            if (property == null)
            {
                property = new Lebi_Pro_Type(); property.ProPerty132 = "0";
            }
            if (property.ProPerty132 == "")
            {
                property.ProPerty132 = "0";
            }
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em>";
            if (pro_type.id > 0)
            {
                CategoryPath = Categorypath(id);
                for (int i = 0; i <= CategoryPath.GetUpperBound(0); i++)
                {
                    path += "<a href=\"" + URL("P_ProductCategory", "" + CategoryPath[i, 0] + "", CategoryPath[i, 2]) + "\"><span>" + CategoryPath[i, 1] + "</span></a>";
                    if (i < CategoryPath.GetUpperBound(0))
                    {
                        path += "<em>&raquo;</em>";
                    }
                }
            }
            else if (tid == 0)
            {
                path += "<a href=\"" + URL("P_ProductCategory", "0") + "\"><span>" + Tag("商品列表") + "</span></a>";
            }
            if (tid > 0)
            {
                tag   = B_Lebi_Pro_Tag.GetModel(tid);
                path += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + ",$,$,$,$," + tid + "") + "\"><span>" + Lang(tag.Name) + "</span></a>";
            }
            where = ProductWhere + " and Type_id_ProductType <> 323";
            if (pid > 0)
            {
                where += " and Brand_id=" + pid + "";
                brand  = B_Lebi_Brand.GetModel(pid);
                path  += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + ",$,$,$,$") + "\"><span>" + Lang(brand.Name) + "</span></a>";
            }
            if (cid != "")
            {
                where += " and " + Categorywhere(cid);
                string _cidlast = "";
                if (cid.IndexOf("$") > -1)
                {
                    string[] cidarr = cid.Split('$');
                    for (int i = 0; i < cidarr.Count(); i++)
                    {
                        if (cidarr[i].IndexOf("|") > -1)
                        {
                            string[] _cids = cidarr[i].Split('|');
                            _cidlast = _cids[1];
                            Lebi_ProPerty ProPerty = B_Lebi_ProPerty.GetModel(int.Parse(_cidlast));
                            if (ProPerty != null)
                            {
                                path += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + "," + ProPerty.parentid + "|" + ProPerty.id + ",$,$,$") + "\"><span>" + Lang(ProPerty.Name) + "</span></a>";
                            }
                        }
                    }
                }
                else
                {
                    if (cid.IndexOf("|") > -1)
                    {
                        string[] _cids = cid.Split('|');
                        _cidlast = _cids[1];
                        Lebi_ProPerty ProPerty = B_Lebi_ProPerty.GetModel(int.Parse(_cidlast));
                        if (ProPerty != null)
                        {
                            path += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + "," + ProPerty.parentid + "|" + ProPerty.id + ",$,$,$") + "\"><span>" + Lang(ProPerty.Name) + "</span></a>";
                        }
                    }
                }
            }
            if (id > 0)
            {
                where += " and " + CategoryWhere(id);
                //where += " and (Pro_Type_id in (" + Categorywhereforid(id) + ")";
                //if (DataBase.DBType == "sqlserver")
                //{
                //    where += " or Charindex('," + id + ",',','+Pro_Type_id_other+',')>0)";
                //}
                //if (DataBase.DBType == "access")
                //{
                //    where += " or Instr(','+Pro_Type_id_other+',','," + id + ",')>0)";
                //}
            }
            if (tid > 0)
            {
                if (DataBase.DBType == "sqlserver")
                {
                    where += " and Charindex('," + tid + ",',','+Pro_Tag_id+',')>0";
                }
                if (DataBase.DBType == "access")
                {
                    where += " and Instr(','+Pro_Tag_id+',','," + tid + ",')>0";
                }
            }
            if (transport == 1)
            {
                where += " and IsSupplierTransport  = 0";
            }
            else if (transport == 2)
            {
                where += " and IsSupplierTransport  = 1";
            }
            if (stock == 1)
            {
                where += " and Count_Stock > 0";
            }
            if (sort == "1")
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            else if (sort == "1a")
            {
                order = " Count_Sales_Show asc"; ordertmp = "";
            }
            else if (sort == "2")
            {
                order = " Price desc"; ordertmp = "a";
            }
            else if (sort == "2a")
            {
                order = " Price asc"; ordertmp = "";
            }
            else if (sort == "3")
            {
                order = " Count_Comment desc"; ordertmp = "a";
            }
            else if (sort == "3a")
            {
                order = " Count_Comment asc"; ordertmp = "";
            }
            else if (sort == "4")
            {
                order = " Time_Add desc"; ordertmp = "a";
            }
            else if (sort == "4a")
            {
                order = " Time_Add asc"; ordertmp = "";
            }
            else if (sort == "5")
            {
                order = " Count_Views_Show desc"; ordertmp = "a";
            }
            else if (sort == "5a")
            {
                order = " Count_Views_Show asc"; ordertmp = "";
            }
            else if (sort == "6")
            {
                order = " Count_Stock desc"; ordertmp = "a";
            }
            else if (sort == "6a")
            {
                order = " Count_Stock asc"; ordertmp = "";
            }
            else
            {
                order = " Sort desc,id desc"; ordertmp = "";
            }
            products    = B_Lebi_Product.GetList(where, order, PageSize, pageindex);
            recordCount = B_Lebi_Product.Counts(where);
            //id={0}&pid={1}&cid={2}&list={3}&sort={4}&tid={5}&page={6}
            string url = URL("P_ProductCategory", id + "," + pid + "," + cid + "," + list + "," + sort + "," + tid + ",{0}," + transport + "," + stock + "", Lang(pro_type.Url));

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage);
        }
Exemplo n.º 12
0
        public override string ThemePageMeta(string code, string tag)
        {
            string str           = "";
            string Page_Title    = "";
            string Page_Keywords = "";

            if (cid != "")
            {
                string _cidlast = "";
                if (cid.IndexOf("$") > -1)
                {
                    string[] cidarr = cid.Split('$');
                    for (int i = 0; i < cidarr.Count(); i++)
                    {
                        if (cidarr[i].IndexOf("|") > -1)
                        {
                            string[] _cids = cidarr[i].Split('|');
                            _cidlast = _cids[1];
                            Lebi_ProPerty ProPerty = B_Lebi_ProPerty.GetModel(int.Parse(_cidlast));
                            if (ProPerty != null)
                            {
                                Page_Title    += Lang(ProPerty.Name) + " - ";
                                Page_Keywords += Lang(ProPerty.Name) + ",";
                            }
                        }
                    }
                }
                else
                {
                    if (cid.IndexOf("|") > -1)
                    {
                        string[] _cids = cid.Split('|');
                        _cidlast = _cids[1];
                        Lebi_ProPerty ProPerty = B_Lebi_ProPerty.GetModel(int.Parse(_cidlast));
                        if (ProPerty != null)
                        {
                            Page_Title    += Lang(ProPerty.Name) + " - ";
                            Page_Keywords += Lang(ProPerty.Name) + ",";
                        }
                    }
                }
            }
            if (pid > 0)
            {
                Lebi_Brand brand = B_Lebi_Brand.GetModel(pid);
                Page_Title    += Lang(brand.Name) + " - ";
                Page_Keywords += Lang(brand.Name) + ",";
            }
            if (pro_type.id > 0)
            {
                string[,] parr = Categorypath(id);
                for (int i = parr.GetUpperBound(0); i >= 0; i--)
                {
                    Page_Title    += parr[i, 1];
                    Page_Keywords += parr[i, 1];
                    if (i < parr.GetUpperBound(0))
                    {
                        Page_Title    += " - ";
                        Page_Keywords += ",";
                    }
                }
            }
            if (tid > 0)
            {
                Lebi_Pro_Tag Tag = B_Lebi_Pro_Tag.GetModel(tid);
                Page_Title += Lang(Tag.Name) + " - ";
            }
            switch (tag.ToLower())
            {
            case "description":
                if (Lang(pro_type.SEO_Description) == "")
                {
                    str = Page_Keywords;
                }
                else
                {
                    str = Lang(pro_type.SEO_Description) + ",";
                }
                break;

            case "keywords":
                if (Lang(pro_type.SEO_Keywords) == "")
                {
                    str = Page_Keywords;
                }
                else
                {
                    str = Lang(pro_type.SEO_Keywords) + ",";
                }
                break;

            default:
                if (Lang(pro_type.SEO_Title) == "")
                {
                    str = Page_Title;
                }
                else
                {
                    str = Lang(pro_type.SEO_Title);
                }
                break;
            }
            return(ThemePageMeta(code, tag, str));
        }
Exemplo n.º 13
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Pro_Tag model)
 {
     D_Lebi_Pro_Tag.Instance.Update(model);
 }
Exemplo n.º 14
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Pro_Tag model)
 {
     return(D_Lebi_Pro_Tag.Instance.Add(model));
 }
Exemplo n.º 15
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Pro_Tag SafeBindForm(Lebi_Pro_Tag model)
 {
     return(D_Lebi_Pro_Tag.Instance.SafeBindForm(model));
 }