コード例 #1
0
ファイル: ShopTemplateMgr.cs プロジェクト: PageCard/WeChat
        /// <summary>
        /// 商品列表
        /// </summary>
        public void ProductCategoryList()
        {
            int category_id = MyCommFun.RequestInt("cid");

            //--=====begin: 将这个列表(文章类别)的基本信息展示出来 ====--
            DAL.wx_shop_category   cateBll  = new DAL.wx_shop_category();
            Model.wx_shop_category category = cateBll.GetCategoryByWid(wid, category_id);
            this.Document.SetValue("category", category);
            this.Document.SetValue("wid", wid);
            //--=====end: 将这个列表(文章类别)的基本信息展示出来 ====--
        }
コード例 #2
0
        /// <summary>
        /// 获得wid的用户分类信息
        /// </summary>
        /// <returns></returns>
        public IList <Model.wx_shop_category> getCategory()
        {
            Tag tag = this.Document.CurrentRenderingTag;

            ///classlayer表示取类别深度,如果为-1,则取所有分类的深度,如果为1,则取第一层目录,如果为2,则去第2层目录
            var classlayer  = tag.Attributes["classlayer"];
            var parentidObj = tag.Attributes["parentid"];
            var attribute   = tag.Attributes["rows"];
            int rows        = -1;//若为-1,则不做限制条件
            IList <Model.wx_shop_category> categorylist = null;
            int parentid = -1;

            if (parentidObj != null && MyCommFun.isNumber(parentidObj.Value.GetValue()))
            {
                parentid = MyCommFun.Obj2Int(parentidObj.Value.GetValue());
            }
            int class_layer = -1;

            if (classlayer != null && MyCommFun.isNumber(classlayer.Value.GetValue()))
            {
                class_layer = MyCommFun.Obj2Int(classlayer.Value.GetValue());
            }
            DAL.wx_shop_category cateBll = new DAL.wx_shop_category();
            if (attribute != null && MyCommFun.isNumber(attribute.Value.GetValue()))
            {
                rows         = MyCommFun.Obj2Int(attribute.Value.GetValue());
                categorylist = cateBll.GetCategoryListByWid(wid, rows, parentid, class_layer);
            }
            else
            {
                categorylist = cateBll.GetCategoryListByWid(wid, -1, parentid, class_layer);
            }
            if (categorylist != null && categorylist.Count > 0)
            {
                Model.wx_shop_category cat = new Model.wx_shop_category();

                for (int i = 0; i < categorylist.Count; i++)
                {
                    cat = categorylist[i];
                    if (cat.link_url == null || cat.link_url.Trim() == "")
                    {  //如果link_url为空,则直接调用本系统的信息
                        cat.link_url = MyCommFun.urlAddOpenid("/shop/list.aspx?wid=" + wid + "&cid=" + cat.id + "", openid);
                    }
                    else
                    {
                        cat.link_url = MyCommFun.urlAddOpenid(cat.link_url, openid);
                    }
                }
            }

            return(categorylist);
        }
コード例 #3
0
ファイル: ShopTemplateMgr.cs プロジェクト: PageCard/WeChat
        /// <summary>
        /// 获取类别列表
        /// </summary>
        /// <returns></returns>
        public DataTable getclasslist()
        {
            Tag tag         = this.Document.CurrentRenderingTag;
            var parentidObj = tag.Attributes["parentid"];
            int parentid    = 0;

            if (parentidObj != null && MyCommFun.isNumber(parentidObj.Value.GetValue()))
            {
                parentid = MyCommFun.Obj2Int(parentidObj.Value.GetValue());
            }
            var topNumObj = tag.Attributes["top"];
            int topNum    = 0;

            if (topNumObj != null && MyCommFun.isNumber(topNumObj.Value.GetValue()))
            {
                topNum = MyCommFun.Obj2Int(topNumObj.Value.GetValue());
            }
            DAL.wx_shop_category classlist = new DAL.wx_shop_category();
            return(classlist.GetWCodeList(wid, parentid, topNum));
        }
コード例 #4
0
        public void ProductClassPage()
        {
            int category_id = MyCommFun.RequestInt("cid");

            //--=====begin: 将这个列表(文章类别)的基本信息展示出来 ====--
            DAL.wx_shop_category   cateBll  = new DAL.wx_shop_category();
            Model.wx_shop_category category = cateBll.GetCategoryByWid(wid, category_id);
            this.Document.SetValue("category", category);
            this.Document.SetValue("wid", wid);
            //--=====end: 将这个列表(文章类别)的基本信息展示出来 ====--

            Tag    orderByTag = this.Document.GetChildTagById("norderby");
            string orderby    = orderByTag.Attributes["value"].Value.ToString();

            Tag    pagesizeTag = this.Document.GetChildTagById("npagesize");
            string pagesizeStr = pagesizeTag.Attributes["value"].Value.ToString();

            int currPage    = 1;                              //当前页面
            int recordCount = 0;                              //总记录数
            int totPage     = 1;                              //总页数
            int pageSize    = MyCommFun.Str2Int(pagesizeStr); //每页的记录数

            if (pageSize <= 0)
            {
                pageSize = 10;
            }
            if (MyCommFun.RequestInt("page") > 0)
            {
                currPage = MyCommFun.RequestInt("page");
            }

            DataSet productlist = new DataSet();

            if (category_id != 0)
            {
                DAL.wx_shop_product artDal = new DAL.wx_shop_product();
                productlist = artDal.GetList(wid, category_id, pageSize, currPage, "upselling=1", orderby, out recordCount);
                if (productlist != null && productlist.Tables.Count > 0 && productlist.Tables[0].Rows.Count > 0)
                {
                    DataRow dr;
                    for (int i = 0; i < productlist.Tables[0].Rows.Count; i++)
                    {
                        dr = productlist.Tables[0].Rows[i];
                        if (dr["link_url"] != null && dr["link_url"].ToString().Trim().Length > 0)
                        {
                            dr["link_url"] = MyCommFun.urlAddOpenid(dr["link_url"].ToString().Trim(), openid);
                        }
                        else
                        {
                            dr["link_url"] = MyCommFun.urlAddOpenid("detail.aspx?wid=" + wid + "&pid=" + dr["id"].ToString(), openid);
                        }
                        productlist.AcceptChanges();
                    }

                    totPage = recordCount / pageSize;
                    int yushu = recordCount % pageSize;
                    if (yushu > 0)
                    {
                        totPage += 1;
                    }
                    if (totPage < 1)
                    {
                        totPage = 1;
                    }
                }
                if (currPage > totPage)
                {
                    currPage = totPage;
                }
            }
            else
            {
                currPage    = 1;
                recordCount = 0;
                totPage     = 1;
            }
            this.Document.SetValue("totPage", totPage);         //总页数
            this.Document.SetValue("currPage", currPage);       //当前页
            this.Document.SetValue("productlist", productlist); //文章列表

            string beforePageStr = "";                          //上一页
            string nextPageStr   = "";                          //下一页
            string bgrey         = "c-p-grey";
            string ngrey         = "c-p-grey";

            if (currPage <= 1)
            {
                beforePageStr = "";
                bgrey         = "c-p-grey";
            }
            else
            {
                beforePageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage - 1));
                beforePageStr = "href=\"" + beforePageStr + "\"";
                bgrey         = "";
            }

            if (currPage >= totPage)
            {
                nextPageStr = "";
                ngrey       = " c-p-grey";
            }
            else
            {
                nextPageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage + 1));
                nextPageStr = "href=\"" + nextPageStr + "\"";
                ngrey       = "";
            }
            this.Document.SetValue("bpage", beforePageStr); //上一页
            this.Document.SetValue("npage", nextPageStr);   //下一页
            this.Document.SetValue("bgrey", bgrey);         //上一页灰色的样式
            this.Document.SetValue("ngrey", ngrey);         //下一页灰色的样式
        }
コード例 #5
0
ファイル: ShopTemplateMgr.cs プロジェクト: yi724926089/MyWx
        public void ProductClassPage()
        {
            int category_id = MyCommFun.RequestInt("cid");
            //--=====begin: 将这个列表(文章类别)的基本信息展示出来 ====--
            DAL.wx_shop_category cateBll = new DAL.wx_shop_category();
            Model.wx_shop_category category = cateBll.GetCategoryByWid(wid, category_id);
            this.Document.SetValue("category", category);
            this.Document.SetValue("wid", wid);
            //--=====end: 将这个列表(文章类别)的基本信息展示出来 ====--

            Tag orderByTag = this.Document.GetChildTagById("norderby");
            string orderby = orderByTag.Attributes["value"].Value.ToString();

            Tag pagesizeTag = this.Document.GetChildTagById("npagesize");
            string pagesizeStr = pagesizeTag.Attributes["value"].Value.ToString();

            int currPage = 1;//当前页面
            int recordCount = 0;//总记录数
            int totPage = 1;//总页数
            int pageSize = MyCommFun.Str2Int(pagesizeStr);//每页的记录数
            if (pageSize <= 0)
            {
                pageSize = 10;
            }
            if (MyCommFun.RequestInt("page") > 0)
            {
                currPage = MyCommFun.RequestInt("page");
            }

            DataSet productlist = new DataSet();
            if (category_id != 0)
            {

                DAL.wx_shop_product artDal = new DAL.wx_shop_product();
                productlist = artDal.GetList(wid, category_id, pageSize, currPage, "upselling=1", orderby, out recordCount);
                if (productlist != null && productlist.Tables.Count > 0 && productlist.Tables[0].Rows.Count > 0)
                {
                    DataRow dr;
                    for (int i = 0; i < productlist.Tables[0].Rows.Count; i++)
                    {
                        dr = productlist.Tables[0].Rows[i];
                        if (dr["link_url"] != null && dr["link_url"].ToString().Trim().Length > 0)
                        {
                            dr["link_url"] = MyCommFun.urlAddOpenid(dr["link_url"].ToString().Trim(), openid);
                        }
                        else
                        {
                            dr["link_url"] = MyCommFun.urlAddOpenid("detail.aspx?wid=" + wid + "&pid=" + dr["id"].ToString(), openid);
                        }
                        productlist.AcceptChanges();
                    }

                    totPage = recordCount / pageSize;
                    int yushu = recordCount % pageSize;
                    if (yushu > 0)
                    {
                        totPage += 1;
                    }
                    if (totPage < 1)
                    {
                        totPage = 1;
                    }
                }
                if (currPage > totPage)
                {
                    currPage = totPage;
                }
            }
            else
            {
                currPage = 1;
                recordCount = 0;
                totPage = 1;
            }
            this.Document.SetValue("totPage", totPage);//总页数
            this.Document.SetValue("currPage", currPage);//当前页
            this.Document.SetValue("productlist", productlist);//文章列表

            string beforePageStr = ""; //上一页
            string nextPageStr = ""; //下一页
            string bgrey = "c-p-grey";
            string ngrey = "c-p-grey";
            if (currPage <= 1)
            {
                beforePageStr = "";
                bgrey = "c-p-grey";
            }
            else
            {
                beforePageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage - 1));
                beforePageStr = "href=\"" + beforePageStr + "\"";
                bgrey = "";
            }

            if (currPage >= totPage)
            {
                nextPageStr = "";
                ngrey = " c-p-grey";
            }
            else
            {
                nextPageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage + 1));
                nextPageStr = "href=\"" + nextPageStr + "\"";
                ngrey = "";
            }
            this.Document.SetValue("bpage", beforePageStr);//上一页
            this.Document.SetValue("npage", nextPageStr);//下一页
            this.Document.SetValue("bgrey", bgrey);//上一页灰色的样式
            this.Document.SetValue("ngrey", ngrey);//下一页灰色的样式
        }
コード例 #6
0
ファイル: ShopTemplateMgr.cs プロジェクト: yi724926089/MyWx
        /// <summary>
        /// 获得wid的用户分类信息 
        /// </summary>
        /// <returns></returns>
        public IList<Model.wx_shop_category> getCategory()
        {
            Tag tag = this.Document.CurrentRenderingTag;

            ///classlayer表示取类别深度,如果为-1,则取所有分类的深度,如果为1,则取第一层目录,如果为2,则去第2层目录
            var classlayer = tag.Attributes["classlayer"];
            var parentidObj = tag.Attributes["parentid"];
            int parentid = -1;
            if (parentidObj != null && MyCommFun.isNumber(parentidObj.Value.GetValue()))
            {
                parentid = MyCommFun.Obj2Int(parentidObj.Value.GetValue());
            }
            int class_layer = -1;
            if (classlayer != null && MyCommFun.isNumber(classlayer.Value.GetValue()))
            {
                class_layer = MyCommFun.Obj2Int(classlayer.Value.GetValue());
            }
            DAL.wx_shop_category cateBll = new DAL.wx_shop_category();
            IList<Model.wx_shop_category> categorylist = cateBll.GetCategoryListByWid(wid, -1, parentid, class_layer);
            if (categorylist != null && categorylist.Count > 0)
            {
                Model.wx_shop_category cat = new Model.wx_shop_category();
                for (int i = 0; i < categorylist.Count; i++)
                {
                    cat = categorylist[i];
                    if (cat.link_url == null || cat.link_url.Trim() == "")
                    {  //如果link_url为空,则直接调用本系统的信息
                        cat.link_url = MyCommFun.urlAddOpenid("/shop/list.aspx?wid=" + wid + "&cid=" + cat.id, openid);

                    }
                    else
                    {
                        cat.link_url = MyCommFun.urlAddOpenid(cat.link_url, openid);
                    }
                }
            }

            return categorylist;
        }