예제 #1
0
파일: category.cs 프로젝트: hui3694/forcomp
        protected Model.channel channelModel   = new Model.channel();          //分类的实体

        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            category_id = DTRequest.GetQueryInt("category_id");
            call_index  = Utils.SafeXXS(DTRequest.GetQueryString("call_index"));

            BLL.article_category bll = new BLL.article_category();
            model.title = "所有类别";
            if (category_id > 0) //如果ID获取到,将使用ID
            {
                if (!bll.Exists(category_id))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error"));
                    return;
                }
                model = bll.GetModel(category_id);
            }
            else if (!string.IsNullOrEmpty(call_index)) //否则检查设置的别名
            {
                if (!bll.Exists(call_index))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error"));
                    return;
                }
                model = bll.GetModel(call_index);
                //赋值类别ID
                category_id = model.id;
            }
            //判断SEO标题
            if (string.IsNullOrEmpty(model.seo_title) || "" == model.seo_title)
            {
                model.seo_title = model.title;
            }
            //获取频道内容
            channelModel = new BLL.channel().GetModel(model.channel_id);
        }
예제 #2
0
        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            BLL.article_category cbll = new BLL.article_category();
            categoryid = DTRequest.GetQueryInt("category_id", 0);
            if (categoryid > 0)
            {
                categorymodel = cbll.GetModel(categoryid);
            }

            category_dt = get_category_list("hezuomingqi", 0);

            int j = 0;
            int k = 0;
            foreach (DataRow dr in category_dt.Rows)
            {
                if (categoryid == 0 && k == 0)
                {
                    int.TryParse(dr["id"].ToString(), out categoryid);
                    categorymodel = cbll.GetModel(categoryid);
                }
                if (j == 1)
                {
                    int.TryParse(dr["id"].ToString(), out next_categoryid);
                    break;
                }
                if (dr["id"].ToString() == categoryid.ToString())
                    j++;
            }
            if (next_categoryid > 0)
            {
                next_categorymodel = cbll.GetModel(next_categoryid);
            }
            hezuoqy_dt = get_article_list("hezuomingqi", 25, "category_id=" + categoryid);
            next_hezuoqy_dt = get_article_list("hezuomingqi", 25, "category_id=" + next_categoryid);
        }
예제 #3
0
        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            page        = DTRequest.GetQueryInt("page", 1);
            category_id = DTRequest.GetQueryInt("category_id");
            strorder    = DTRequest.GetQueryString("strorder");
            keyword     = DTRequest.GetQueryString("keyword");
            flag        = DTRequest.GetQueryString("flag");
            if (string.IsNullOrEmpty(flag))
            {
                flag = "default";
            }

            if (string.IsNullOrEmpty(strorder) || strorder == "default")
            {
                strorder  = "default";
                str_order = "sort_id asc,add_time desc";
            }
            else
            {
                switch (strorder)
                {
                case "moneya":
                    str_order = "sell_price asc";
                    break;

                case "moneyd":
                    str_order = "sell_price desc";
                    break;
                }
            }

            BLL.article_category bll = new BLL.article_category();
            model.title = "所有信息";
            if (category_id > 0) //如果ID获取到,将使用ID
            {
                if (bll.Exists(category_id))
                {
                    model = bll.GetModel(category_id);
                }
                parent_category_id = model.parent_id;

                if (bll.Exists(parent_category_id))
                {
                    parent_category_title = bll.GetModel(parent_category_id).title;
                }
            }



            //if (hot_search.Contains(","))
            //{
            //    for (int i = 0; i < hot_search.Split(',').Length; i++)
            //    {

            //    }
            //}
        }
예제 #4
0
 /// <summary>
 /// 验证频道列表数据
 /// </summary>
 /// <param name="channel_name"></param>
 public void validate_channel_data(string channel_name)
 {
     BLL.article_category bll = new BLL.article_category();
     channelModel = new BLL.site_channel().GetModel(channel_name);
     if (model == null)
     {
         Response.Redirect(linkurl("error"));
         return;
     }
     if (category_id > 0)
     {
         model = bll.GetModel(channelModel.id, category_id);
         if (model == null)
         {
             Response.Redirect(linkurl("error"));
             return;
         }
     }
     else if (!string.IsNullOrEmpty(call_index)) //否则检查设置的别名
     {
         model = bll.GetModel(channelModel.id, call_index);
         if (model == null)
         {
             Response.Redirect(linkurl("error"));
             return;
         }
         category_id = model.id;
     }
     //判断是否是链接
     if (!string.IsNullOrEmpty(model.link_url))
     {
         Response.Redirect(model.link_url);
         return;
     }
     //判断SEO标题
     if (string.IsNullOrEmpty(model.seo_title))
     {
         model.seo_title = site.seo_title;
     }
     if (string.IsNullOrEmpty(model.seo_keywords))
     {
         model.seo_keywords = site.seo_keywords;
     }
     if (string.IsNullOrEmpty(model.seo_description))
     {
         model.seo_description = site.seo_description;
     }
     //分页参数
     if (!string.IsNullOrEmpty(model.call_index))
     {
         paramString = model.call_index;
     }
     else if (category_id > 0)
     {
         paramString = category_id.ToString();
     }
 }
예제 #5
0
        protected int totalcount; //OUT数据总数

        #endregion Fields

        #region Methods

        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            page = DTRequest.GetQueryInt("page", 1);
            category_id = DTRequest.GetQueryInt("category_id");
            strorder = DTRequest.GetQueryString("strorder");
            keyword = DTRequest.GetQueryString("keyword");
            flag = DTRequest.GetQueryString("flag");
            if (string.IsNullOrEmpty(flag))
            {
                flag = "default";
            }

            if (string.IsNullOrEmpty(strorder) || strorder == "default")
            {
                strorder = "default";
                str_order = "sort_id asc,add_time desc";
            }
            else
            {
                switch (strorder)
                {
                    case "moneya":
                        str_order = "sell_price asc";
                        break;
                    case "moneyd":
                        str_order = "sell_price desc";
                        break;
                }
            }

            BLL.article_category bll = new BLL.article_category();
            model.title = "所有信息";
            if (category_id > 0) //如果ID获取到,将使用ID
            {
                if (bll.Exists(category_id))
                    model = bll.GetModel(category_id);
                parent_category_id = model.parent_id;

                if (bll.Exists(parent_category_id))
                {
                    parent_category_title = bll.GetModel(parent_category_id).title;
                }
            }

            //if (hot_search.Contains(","))
            //{
            //    for (int i = 0; i < hot_search.Split(',').Length; i++)
            //    {

            //    }
            //}
        }
예제 #6
0
        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            page         = DTRequest.GetQueryInt("page", 1);
            category_id  = DTRequest.GetQueryInt("category_id");
            category_ids = DTRequest.GetQueryString("category_ids");
            if (category_id > 0) //如果ID获取到,将使用ID
            {
                var bll = new BLL.article_category();
                if (bll.Exists(category_id))
                {
                    category = bll.GetModel(category_id);
                }
            }
            else if (!string.IsNullOrWhiteSpace(category_ids))
            {
                var firstCategoryId = Convert.ToInt32(category_ids.Split(',')[0]);
                var bll             = new BLL.article_category();
                if (bll.Exists(firstCategoryId))
                {
                    category = bll.GetModel(firstCategoryId);
                }
            }

            var articleId = DTRequest.GetQueryInt("articleId");

            if (articleId != 0)
            {
                var context = new Agp2pDataContext();
                article        = context.dt_article.Single(a => a.id == articleId);
                article.click += 1;
                context.SubmitChanges();
            }
        }
예제 #7
0
        private void ShowInfo(int _id)
        {
            BLL.article_category   bll   = new BLL.article_category();
            Model.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text         = model.call_index;
            txtTitle.Text             = model.title;
            txtSortId.Text            = model.sort_id.ToString();
            txtSeoTitle.Text          = model.seo_title;
            txtSeoKeywords.Text       = model.seo_keywords;
            txtSeoDescription.Text    = model.seo_description;
            txtLinkUrl.Text           = model.link_url;
            txtImgUrl.Text            = model.img_url;
            if (model.img_url != null && model.img_url.Trim() != "")
            {
                imgUrl.ImageUrl = model.img_url;
            }
            txtContent.Value = model.content;
            txtImgICO.Text   = model.ico_url;
            if (model.ico_url != null && model.ico_url.Trim() != "")
            {
                if (model.ico_url.Contains("/"))
                {
                    imgIco.ImageUrl = model.ico_url;
                }
                else
                {
                    imgIco.Style.Add("display", "none");
                    litImgIco.Text = "<span class=\"" + model.ico_url + "\"></span>";
                }
            }
        }
예제 #8
0
 /// <summary>
 /// 返回指定类别同级列表
 /// </summary>
 /// <param name="channel_name">频道名称</param>
 /// <param name="category_id">当前类别ID</param>
 /// <returns>DataTable</returns>
 public DataTable get_category_current_list(string channel_name, int category_id)
 {
     BLL.article_category   bll   = new BLL.article_category();
     Model.article_category model = new Model.article_category();
     model = bll.GetModel(category_id);
     return(new BLL.article_category().GetChildList(model.parent_id, channel_name));
 }
예제 #9
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.article_category   bll   = new BLL.article_category();
                Model.article_category model = bll.GetModel(_id);

                int parentId = int.Parse(ddlParentId.SelectedValue);
                model.channel_id = this.channel_id;
                model.call_index = txtCallIndex.Text.Trim();
                model.title      = txtTitle.Text.Trim();
                //如果选择的父ID不是自己,则更改
                if (parentId != model.id)
                {
                    model.parent_id = parentId;
                }
                model.sort_id         = int.Parse(txtSortId.Text.Trim());
                model.seo_title       = txtSeoTitle.Text;
                model.seo_keywords    = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.link_url        = txtLinkUrl.Text.Trim();
                model.img_url         = txtImgUrl.Text.Trim();
                model.content         = txtContent.Value;
                if (bll.Update(model))
                {
                    AddAdminLog(AXEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道栏目分类:" + model.title); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
예제 #10
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.article_category   bll   = new BLL.article_category();
                Model.article_category model = bll.GetModel(_id);

                int parentId = int.Parse(ddlParentId.SelectedValue);
                model.channel_id = this.channel_id;
                model.call_index = txtCallIndex.Text.Trim();
                model.title      = txtTitle.Text.Trim();
                //如果选择的父ID不是自己,则更改
                if (parentId != model.id)
                {
                    model.parent_id = parentId;
                }
                model.sort_id         = int.Parse(txtSortId.Text.Trim());
                model.seo_title       = txtSeoTitle.Text;
                model.seo_keywords    = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.content         = txtContent.Value;
                model.is_page         = int.Parse(rblPage.SelectedValue);
                model.is_lock         = int.Parse(rblStatus.SelectedValue);
                //判断上传图片
                if (this.imgUpload.HasFile)
                {
                    //上传前先删除原图片
                    if (!string.IsNullOrEmpty(model.img_url))
                    {
                        Utils.DeleteFile(model.img_url);
                    }
                    Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false);
                    if (upfile.status > 0)
                    {
                        model.img_url = upfile.path;
                    }
                }
                else
                {
                    //判断是否需要删除原图
                    if (!string.IsNullOrEmpty(model.img_url))
                    {
                        Utils.DeleteFile(model.img_url);
                    }
                    model.img_url = txtImgUrl.Text.Trim();
                }
                if (bll.Update(model))
                {
                    AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道栏目分类:" + model.title); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
예제 #11
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.article_category   bll   = new BLL.article_category();
                Model.article_category model = bll.GetModel(_id);

                int parentId = int.Parse(ddlParentId.SelectedValue);
                model.site_id    = channelModel.site_id;
                model.channel_id = this.channel_id;
                model.call_index = txtCallIndex.Text.Trim();
                model.title      = txtTitle.Text.Trim();
                //如果选择的父ID不是自己,则更改
                if (parentId != model.id)
                {
                    model.parent_id = parentId;
                }
                model.sort_id         = int.Parse(txtSortId.Text.Trim());
                model.seo_title       = txtSeoTitle.Text;
                model.seo_keywords    = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.link_url        = txtLinkUrl.Text.Trim();
                model.img_url         = txtImgUrl.Text.Trim();
                model.content         = txtContent.Value;

                #region 保存规格====================
                if (model.category_specs != null)
                {
                    model.category_specs.Clear();
                }
                string[] specIdArr = Request.Form.GetValues("hide_spec_id");
                if (specIdArr != null && specIdArr.Length > 0)
                {
                    List <Model.article_category_spec> ls = new List <Model.article_category_spec>();
                    for (int i = 0; i < specIdArr.Length; i++)
                    {
                        int specId = Utils.StrToInt(specIdArr[i], 0);
                        ls.Add(new Model.article_category_spec {
                            category_id = model.id, spec_id = specId
                        });
                    }
                    model.category_specs = ls;
                }
                #endregion

                if (bll.Update(model))
                {
                    AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改" + channelModel.name + "频道栏目分类:" + model.title); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
예제 #12
0
        private void GetModel()
        {
            BLL.article_category bll = new BLL.article_category();
            model = bll.GetModel(category_id);

            RepBindType.DataSource = bll.GetList(81, 11);
            RepBindType.DataBind();

            RepBindType2.DataSource = bll.GetList(81, 11);
            RepBindType2.DataBind();
        }
예제 #13
0
        protected int totalcount; //OUT数据总数

        #endregion Fields

        #region Methods

        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            page = MXRequest.GetQueryInt("page", 1);
            category_id = MXRequest.GetQueryInt("category_id");
            BLL.article_category bll = new BLL.article_category();
            model.title = "所有信息";
            if (category_id > 0) //如果ID获取到,将使用ID
            {
                if (bll.Exists(category_id))
                    model = bll.GetModel(category_id);
            }
        }
예제 #14
0
        public Model.site_channel channelModel = new Model.site_channel();     //分类的实体

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);
            category_id = DTRequest.GetQueryInt("category_id");
            call_index  = Utils.SafeXXS(DTRequest.GetQueryString("call_index"));
            action      = DTRequest.GetQueryString("action");

            BLL.article_category bll = new BLL.article_category();
            model.title = "所有类别";
            if (category_id > 0) //如果ID获取到,将使用ID
            {
                if (!bll.Exists(category_id))
                {
                    Response.Redirect(linkurl("error"));
                    return;
                }
                model = bll.GetModel(category_id);
            }
            else if (!string.IsNullOrEmpty(call_index)) //否则检查设置的别名
            {
                if (!bll.Exists(call_index))
                {
                    Response.Redirect(linkurl("error"));
                    return;
                }
                model = bll.GetModel(call_index);
                //赋值类别ID
                category_id = model.id;
            }
            //判断SEO标题
            if (string.IsNullOrEmpty(model.seo_title) || "" == model.seo_title)
            {
                model.seo_title = model.title;
            }
            //获取频道内容
            channelModel = new BLL.site_channel().GetModel(model.channel_id);

            ViewBag.ChannelModel = channelModel;
            ViewBag.model        = model;
        }
예제 #15
0
        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            BLL.article_category cbll = new BLL.article_category();
            categoryid = DTRequest.GetQueryInt("category_id", 0);
            if (categoryid > 0)
            {
                categorymodel = cbll.GetModel(categoryid);
            }

            category_dt = get_category_list("hezuomingqi", 0);

            int j = 0;
            int k = 0;

            foreach (DataRow dr in category_dt.Rows)
            {
                if (categoryid == 0 && k == 0)
                {
                    int.TryParse(dr["id"].ToString(), out categoryid);
                    categorymodel = cbll.GetModel(categoryid);
                }
                if (j == 1)
                {
                    int.TryParse(dr["id"].ToString(), out next_categoryid);
                    break;
                }
                if (dr["id"].ToString() == categoryid.ToString())
                {
                    j++;
                }
            }
            if (next_categoryid > 0)
            {
                next_categorymodel = cbll.GetModel(next_categoryid);
            }
            hezuoqy_dt      = get_article_list("hezuomingqi", 25, "category_id=" + categoryid);
            next_hezuoqy_dt = get_article_list("hezuomingqi", 25, "category_id=" + next_categoryid);
        }
예제 #16
0
        private void ShowInfo(int _id)
        {
            BLL.article_category   bll   = new BLL.article_category();
            Model.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text         = model.call_index;
            txtTitle.Text             = model.title;
            txtSortId.Text            = model.sort_id.ToString();

            txtLinkUrl.Text  = model.link_url;
            txtImgUrl.Text   = model.img_url;
            txtContent.Value = model.content;
        }
예제 #17
0
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     page        = MXRequest.GetQueryInt("page", 1);
     category_id = MXRequest.GetQueryInt("category_id");
     BLL.article_category bll = new BLL.article_category();
     model.title = "所有信息";
     if (category_id > 0) //如果ID获取到,将使用ID
     {
         if (bll.Exists(category_id))
         {
             model = bll.GetModel(category_id);
         }
     }
 }
예제 #18
0
        /// <summary>
        /// 频道,即二级分类
        /// </summary>
        public void CategoryPage()
        {
            int parentId = MyCommFun.RequestInt("cid");

            this.Document.SetValue("parentid", parentId);//父级id
            BLL.article_category   cateBll   = new BLL.article_category();
            Model.article_category pCategory = cateBll.GetModel(parentId);
            if (pCategory == null)
            {
                return;
            }
            this.Document.SetValue("pcategory", pCategory);//父级分类基本信息

            this.Document.SetValue("fxTitle", pCategory.title);
            this.Document.SetValue("fxDesc", pCategory.content);
            this.Document.SetValue("fxPic", MyCommFun.ImgAddHttp(pCategory.img_url));


            //去二级分类
            IList <Model.article_category> categorylist = tDal.GetCategoryListByWid(wid, -1, parentId, 2);

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

                this.Document.SetValue("clist", categorylist);//二级分类列表
            }
        }
예제 #19
0
        private void ShowInfo(int _id)
        {
            BLL.article_category   bll   = new BLL.article_category();
            Model.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text         = model.call_index;
            txtTitle.Text             = model.title;
            txtSortId.Text            = model.sort_id.ToString();
            txtSeoTitle.Text          = model.seo_title;
            txtSeoKeywords.Text       = model.seo_keywords;
            txtSeoDescription.Text    = model.seo_description;
            txtLinkUrl.Text           = model.link_url;
            txtImgUrl.Text            = model.img_url;
            txtContent.Value          = model.content;
            rblPageType.SelectedValue = model.page_type.ToString();
        }
예제 #20
0
 /// <summary>
 /// OnInit事件,让频道名称变量先赋值
 /// </summary>
 void article_list_Init(object sender, EventArgs e)
 {
     page        = DTRequest.GetQueryInt("page", 1);
     category_id = DTRequest.GetQueryInt("category_id");
     BLL.article_category bll = new BLL.article_category();
     model.title = "所有分类";
     if (category_id > 0) //如果ID获取到,将使用ID
     {
         if (bll.Exists(category_id))
         {
             model = bll.GetModel(category_id);
             if (!string.IsNullOrEmpty(model.link_url))
             {
                 HttpContext.Current.Response.Redirect(model.link_url);
             }
         }
     }
 }
예제 #21
0
 /// <summary>
 /// 返回指定类别的父节点ID
 /// </summary>
 /// <param name="category_id">类别ID</param>
 /// <returns>DataTable</returns>
 public int get_category_parent_first_id(int category_id)
 {
     BLL.article_category   bll   = new BLL.article_category();
     Model.article_category model = bll.GetModel(category_id);
     string[] res = model.class_list.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
     if (model.parent_id == 0)
     {
         return(model.id);
     }
     else if (model.parent_id == int.Parse(res[0]))
     {
         return(model.parent_id);
     }
     else
     {
         return(int.Parse(res[0]));
     }
 }
예제 #22
0
        private void ShowInfo(int _id)
        {
            BLL.article_category   bll   = new BLL.article_category();
            Model.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            if (model.call_index == "1")
            {
                cbIsLock.Checked = true;
            }
            txtTitle.Text          = model.title;
            txtSortId.Text         = model.sort_id.ToString();
            txtSeoTitle.Text       = model.seo_title;
            txtSeoKeywords.Text    = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            txtLinkUrl.Text        = model.link_url;
            txtImgUrl.Text         = model.img_url;
            txtContent.Value       = model.content;
        }
예제 #23
0
        private void ShowInfo(int _id)
        {
            BLL.article_category   bll   = new BLL.article_category();
            Model.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text         = model.call_index;
            txtTitle.Text             = model.title;
            txtSortId.Text            = model.sort_id.ToString();
            txtSeoTitle.Text          = model.seo_title;
            txtSeoKeywords.Text       = model.seo_keywords;
            txtSeoDescription.Text    = model.seo_description;
            txtLinkUrl.Text           = model.link_url;
            txtImgUrl.Text            = model.img_url;
            txtContent.Value          = model.content;

            //绑定类别规格
            rptSpecList.DataSource = new BLL.article_spec().GetCategorySpecList(model.id);
            rptSpecList.DataBind();
        }
예제 #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            wid    = MXRequest.GetQueryInt("wid");
            openid = MXRequest.GetQueryString("openid");
            if (!IsPostBack)
            {
                BLL.wx_wq_wzlx   wzBll   = new BLL.wx_wq_wzlx();
                Model.wx_wq_wzlx wzModel = wzBll.GetModelList("wid=" + wid)[0];

                BLL.article_category acBll = new BLL.article_category();
                DataTable            ds    = acBll.GetList(" wid=" + wid + " and id=" + wzModel.cxid);
                if (ds.Rows.Count > 0)
                {
                    acModel = acBll.GetModel(MyCommFun.Obj2Int(wzModel.cxid));
                }

                BLL.article aBll = new BLL.article();
                this.rptList.DataSource = aBll.GetList(" category_id=" + acModel.id);
                this.rptList.DataBind();
            }
        }
예제 #25
0
파일: category.cs 프로젝트: xuxiaolei/DTCMS
        /// <summary>
        /// 递归找到父节点
        /// </summary>
        private void LoopChannelMenu(StringBuilder strTxt, string urlKey, int category_id)
        {
            BLL.article_category   bll   = new BLL.article_category();
            Model.article_category model = bll.GetModel(category_id);
            int parentId = model.parent_id;

            if (parentId > 0)
            {
                this.LoopChannelMenu(strTxt, urlKey, parentId);
            }
            string url = null;

            if (model.call_index != "")
            {
                url = linkurl(urlKey, model.call_index);
            }
            else
            {
                url = linkurl(urlKey, category_id);
            }
            strTxt.Append("&nbsp;&gt;&nbsp;<a href=\"" + url + "\">" + bll.GetTitle(category_id) + "</a>");
        }
예제 #26
0
        private void ShowInfo(int _id)
        {
            BLL.article_category   bll   = new BLL.article_category();
            Model.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text         = model.call_index;
            txtTitle.Text             = model.title;
            txtSortId.Text            = model.sort_id.ToString();
            txtSeoTitle.Text          = model.seo_title;
            txtSeoKeywords.Text       = model.seo_keywords;
            txtSeoDescription.Text    = model.seo_description;
            txtLinkUrl.Text           = model.link_url;
            txtContent.Value          = model.content;
            rblPage.SelectedValue     = model.is_page.ToString();
            rblStatus.SelectedValue   = model.is_lock.ToString();
            //图片
            txtImgUrl.Text = model.img_url;
            if (!string.IsNullOrEmpty(model.img_url))
            {
                ImgDiv.Visible  = true;
                ImgUrl.ImageUrl = model.img_url;
            }
        }
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.article_category bll = new BLL.article_category();
                Model.article_category model = bll.GetModel(_id);

                int parentId = int.Parse(ddlParentId.SelectedValue);
                model.channel_id = this.channel_id;
                model.call_index = txtCallIndex.Text.Trim();
                model.title = txtTitle.Text.Trim();
                //如果选择的父ID不是自己,则更改
                if (parentId != model.id)
                {
                    model.parent_id = parentId;
                }
                model.sort_id = int.Parse(txtSortId.Text.Trim());
                model.seo_title = txtSeoTitle.Text;
                model.seo_keywords = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.link_url = txtLinkUrl.Text.Trim();
                model.img_url = txtImgUrl.Text.Trim();
                model.content = txtContent.Value;
                model.ico_url = Request.Form["txtImgICO"].Trim();// txtImgICO.Text;
                if (bll.Update(model))
                {
                    AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "微网站分类分类:" + model.title); //记录日志
                    return true;
                }
            }
            catch
            {
                return false;
            }
            return false;
        }
예제 #28
0
 private void GetAboutModel()
 {
     BLL.article_category bll = new BLL.article_category();
     modelabout = bll.GetModel(107);
 }
예제 #29
0
        private void get_good_list(HttpContext context)
        {
            int page = DTRequest.GetQueryInt("page", 1);
            string flag = DTRequest.GetQueryString("flag");
            int pagesize = DTRequest.GetQueryInt("pagesize", 12);
            string order = DTRequest.GetQueryString("order");
            string keyword = DTRequest.GetQueryString("keyword");
            int category = DTRequest.GetQueryInt("category");
            string property = DTRequest.GetQueryString("property");

            string strwhere = " is_put=1 ";
            string strorder = "sort_id asc ,add_time desc";
            int totalcount = 0;

            DataSet ds = new DataSet();

            if (!string.IsNullOrEmpty(property))
            {
                //strwhere += " and id in ( select good_id from td_property_good where property_value_id in (" + property + ")) ";
                string where_pro = "";
                string[] str_arr = property.Split(',');
                for (int i = 0; i < str_arr.Length; i++)
                {
                    if (i == 0)
                    {
                        where_pro += " select good_id from td_property_good where property_value_id in(" + str_arr[i] + ") ";
                    }
                    else
                    {
                        where_pro = "select good_id from td_property_good where good_id in (" + where_pro + ") and   property_value_id=" + str_arr[i];
                    }
                }

                strwhere += " and id in (" + where_pro + ")";
            }

            if (!string.IsNullOrEmpty(keyword))
            {
                strwhere += " and (id in (select good_id from td_property_good where property_value_id in ( select id from td_property_value where value like '%" + keyword + "%')) or id in (select good_id from td_tag_good where tag_id in( select id from td_tag where title like '%" + keyword + "%')) or id in (select good_id from td_alias_good where alias_id in( select id from td_alias where title like '%" + keyword + "%'))or title like '%" + keyword + "%') ";
            }

            if (order == "moneya")
            {
                strorder = "sell_price asc";
            }
            if (order == "moneyd")
            {
                strorder = "sell_price desc";
            }

            BLL.article bll = new BLL.article();
            DataTable dt = bll.GetList("goods", category, pagesize, page, strwhere, strorder, out totalcount).Tables[0];

            DataTable dt_goods = new DataTable();
            dt_goods.Columns.Add("id");
            dt_goods.Columns.Add("title");
            dt_goods.Columns.Add("sell_price");
            dt_goods.Columns.Add("img_url");
            dt_goods.Columns.Add("standard");

            foreach (DataRow dr in dt.Rows)
            {
                DataRow new_dr = dt_goods.NewRow();
                new_dr["id"] = dr["id"];
                new_dr["title"] = dr["title"];
                new_dr["sell_price"] = dr["sell_price"];
                new_dr["img_url"] = dr["img_url"];

                BLL.standard_price bll_standard_price = new BLL.standard_price();
                DataTable dt_standard_price = bll_standard_price.GetList("good_id=" + Convert.ToInt32(dr["id"])).Tables[0];
                if (dt_standard_price != null && dt_standard_price.Rows.Count > 0)
                {
                    //有库存
                    new_dr["standard"] = 1;
                }
                else
                {
                    //没库存
                    new_dr["standard"] = 2;
                }

                dt_goods.Rows.Add(new_dr);
            }

            dt_goods.TableName = "dt_good";
            if (dt_goods != null && dt_goods.Rows.Count > 0)
            {
                ds.Tables.Add(dt_goods.Copy());
            }
            //刷新属性列表  单个类别绑定属性
            if (flag == "default" || flag == "self_category" || flag == "self")
            {
                DataTable dt_property = new DataTable();
                dt_property.Columns.Add("id");
                dt_property.Columns.Add("title");
                dt_property.Columns.Add("parent_id");

                dt_property.TableName = "dt_property";

                BLL.property bll_property = new BLL.property();
                DataTable old_dt_property = bll_property.GetList(0, "category_id in (select id from dt_article_category where class_list like '%," + category + ",%')", "add_time desc").Tables[0];
                foreach (DataRow dr in old_dt_property.Rows)
                {
                    DataRow new_dr = dt_property.NewRow();
                    new_dr["id"] = 0;
                    new_dr["title"] = dr["title"];
                    new_dr["parent_id"] = 0;

                    dt_property.Rows.Add(new_dr);
                    BLL.property_value bll_value = new BLL.property_value();
                    DataTable dt_property_value = bll_value.GetList(0, "property_id=" + dr["id"].ToString(), "add_time desc").Tables[0];
                    foreach (DataRow dr_value in dt_property_value.Rows)
                    {
                        DataRow new_dr_value = dt_property.NewRow();
                        new_dr_value["id"] = dr_value["id"];
                        new_dr_value["title"] = dr_value["value"];
                        new_dr_value["parent_id"] = dr["id"];
                        dt_property.Rows.Add(new_dr_value);
                    }
                }

                if (dt_property != null && dt_property.Rows.Count > 0)
                {
                    ds.Tables.Add(dt_property.Copy());
                }
            }
            //多个类别绑定属性
            if (flag == "other")
            {

                DataTable dt_good = bll.GetList(0, " id in (select good_id from td_property_good where property_value_id in ( select id from td_property_value where value like '%" + keyword + "%')) or id in (select good_id from td_tag_good where tag_id in( select id from td_tag where title like '%" + keyword + "%')) or id in (select good_id from td_alias_good where alias_id in( select id from td_alias where title like '%" + keyword + "%'))or title like '%" + keyword + "%' ", "sort_id asc,add_time desc").Tables[0];

                DataTable dt_category = new DataTable();
                dt_category.Columns.Add("id");
                dt_category.Columns.Add("title");
                BLL.article_category bll_category = new BLL.article_category();
                Model.article_category model_category;
                string category_ids = ",";
                foreach (DataRow dr in dt_good.Rows)
                {
                    if (category_ids.IndexOf("," + dr["category_id"].ToString() + ",") <= -1)
                    {
                        category_ids += dr["category_id"].ToString() + ",";
                        model_category = bll_category.GetModel(Convert.ToInt32(dr["category_id"]));
                        if (model_category != null)
                        {
                            DataRow new_dr = dt_category.NewRow();
                            new_dr["id"] = model_category.id;
                            new_dr["title"] = model_category.title;
                            dt_category.Rows.Add(new_dr);
                        }
                    }
                }
                if (dt_category != null && dt_category.Rows.Count > 0)
                {
                    dt_category.TableName = "dt_category";
                    ds.Tables.Add(dt_category.Copy());
                }

                if (!string.IsNullOrEmpty(category_ids.Trim(',')))
                {
                    DataTable dt_property = new DataTable();
                    dt_property.Columns.Add("id");
                    dt_property.Columns.Add("title");
                    dt_property.Columns.Add("parent_id");

                    dt_property.TableName = "dt_property";

                    BLL.property bll_property = new BLL.property();
                    DataTable old_dt_property = bll_property.GetList(0, "category_id in (" + category_ids.Substring(1, category_ids.Length - 2) + ")", "add_time desc").Tables[0];

                    foreach (DataRow dr in old_dt_property.Rows)
                    {
                        DataRow new_dr = dt_property.NewRow();
                        new_dr["id"] = 0;
                        new_dr["title"] = dr["title"];
                        new_dr["parent_id"] = 0;

                        dt_property.Rows.Add(new_dr);
                        BLL.property_value bll_value = new BLL.property_value();
                        DataTable dt_property_value = bll_value.GetList(0, "property_id=" + dr["id"].ToString(), "add_time desc").Tables[0];
                        foreach (DataRow dr_value in dt_property_value.Rows)
                        {
                            DataRow new_dr_value = dt_property.NewRow();
                            new_dr_value["id"] = dr_value["id"];
                            new_dr_value["title"] = dr_value["value"];
                            new_dr_value["parent_id"] = dr["id"];
                            dt_property.Rows.Add(new_dr_value);
                        }
                    }

                    if (dt_property != null && dt_property.Rows.Count > 0)
                    {
                        ds.Tables.Add(dt_property.Copy());
                    }

                }
            }

            DataTable dt_page = new DataTable();
            dt_page.Columns.Add("page");
            dt_page.TableName = "dt_page";
            BasePage _basepage = new BasePage();//(page, pagesize, category, property, order, keyword, flag)
            DataRow dr_page = dt_page.NewRow();
            dr_page["page"] = myJson.String2Json(_basepage.get_page_links(pagesize, page, totalcount, "javascript:get_good_list(__id__,12,'" + category + "','" + property + "','" + order + "','" + keyword + "','" + flag + "')"));
            dt_page.Rows.Add(dr_page);

            if (dt_page != null && dt_page.Rows.Count > 0)
            {
                ds.Tables.Add(dt_page);
            }

            if (ds != null && ds.Tables.Count > 0)
            {
                context.Response.Write(myJson.getJson(ds));
                return;
            }
            else
            {
                context.Response.Write("Null");
                return;
            }
        }
예제 #30
0
 private void GetModel()
 {
     BLL.article_category bll = new BLL.article_category();
     model = bll.GetModel(category_id);
 }
        private void ShowInfo(int _id)
        {
            BLL.article_category bll = new BLL.article_category();
            Model.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text = model.call_index;
            txtTitle.Text = model.title;
            txtSortId.Text = model.sort_id.ToString();
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeywords.Text = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            txtLinkUrl.Text = model.link_url;
            txtImgUrl.Text = model.img_url;
            if (model.img_url != null && model.img_url.Trim() != "")
            {
                imgUrl.ImageUrl = model.img_url;
            }
            txtContent.Value = model.content;
            txtImgICO.Text = model.ico_url;
            if (model.ico_url != null && model.ico_url.Trim() != "")
            {
                if (model.ico_url.Contains("/"))
                {
                    imgIco.ImageUrl = model.ico_url;
                }
                else
                {
                    imgIco.Style.Add("display", "none");
                    litImgIco.Text = "<span class=\"" + model.ico_url + "\"></span>";
                }
            }



        }
예제 #32
0
        private void ShowInfo(int _id)
        {
            BLL.article_category bll = new BLL.article_category();
            Model.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text = model.call_index;
            txtTitle.Text = model.title;
            txtSortId.Text = model.sort_id.ToString();
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeywords.Text = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            txtLinkUrl.Text = model.link_url;
            txtImgUrl.Text = model.img_url;
            txtContent.Value = model.content;
        }
예제 #33
0
        /// <summary>
        /// 频道,即二级分类
        /// </summary>
        public void CategoryPage()
        {

            int parentId = MyCommFun.RequestInt("cid");
            this.Document.SetValue("parentid", parentId);//父级id
            BLL.article_category cateBll = new BLL.article_category();
            Model.article_category pCategory = cateBll.GetModel(parentId);
            if (pCategory == null)
            {
                return;
            }
            this.Document.SetValue("pcategory", pCategory);//父级分类基本信息
            //去二级分类
            IList<Model.article_category> categorylist = tDal.GetCategoryListByWid(wid, -1, parentId, 2);
            if (categorylist != null && categorylist.Count > 0)
            {
                Model.article_category cat = new Model.article_category();
                for (int i = 0; i < categorylist.Count; i++)
                {
                    cat = categorylist[i];
                    if (cat.hasSun)
                    {  //有子分类
                        cat.link_url = MyCommFun.urlAddOpenid("/category.aspx?wid=" + wid + "&cid=" + cat.id, openid);
                    }
                    else
                    {
                        if (cat.link_url == null || cat.link_url.Trim() == "")
                        {  //如果link_url为空,则直接调用本系统的信息
                            cat.link_url = MyCommFun.urlAddOpenid("/list.aspx?wid=" + wid + "&cid=" + cat.id, openid);

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

                }

                this.Document.SetValue("clist", categorylist);//二级分类列表
            }

        }