Ejemplo n.º 1
0
        //设置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ChkAdminLevel(channel_id, ActionEnum.Edit.ToString()); //检查权限
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            BLL.contents   bll   = new BLL.contents();
            Model.contents model = bll.GetModel(id);
            switch (e.CommandName.ToLower())
            {
            case "ibtnmsg":
                if (model.is_msg == 1)
                {
                    bll.UpdateField(id, "is_msg=0");
                }
                else
                {
                    bll.UpdateField(id, "is_msg=1");
                }
                break;

            case "ibtnred":
                if (model.is_red == 1)
                {
                    bll.UpdateField(id, "is_red=0");
                }
                else
                {
                    bll.UpdateField(id, "is_red=1");
                }
                break;
            }
            this.RptBind("id>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "sort_id asc,add_time desc");
        }
Ejemplo n.º 2
0
        private void ShowInfo(int _id)
        {
            BLL.contents   bll   = new BLL.contents();
            Model.contents model = bll.GetModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtCallIndex.Text           = model.call_index;
            txtTitle.Text   = model.title;
            txtImgUrl.Text  = model.img_url;
            txtLinkUrl.Text = model.link_url;
            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_lock == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            txtSortId.Text         = model.sort_id.ToString();
            txtClick.Text          = model.click.ToString();
            txtDiggGood.Text       = model.digg_good.ToString();
            txtDiggAct.Text        = model.digg_act.ToString();
            txtContent.Value       = model.content;
            txtSeoTitle.Text       = model.seo_title;
            txtSeoKeywords.Text    = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
        }
Ejemplo n.º 3
0
        //内容模块
        private void digg_content_add(HttpContext context)
        {
            string channel_type = DTRequest.GetFormString("channel_type");
            string digg_type    = DTRequest.GetFormString("digg_type");
            int    id           = DTRequest.GetFormInt("id");

            BLL.contents bll = new BLL.contents();
            if (!bll.Exists(id))
            {
                context.Response.Write("{msg:0, msgbox:\"信息不存在或已删除!\"}");
                return;
            }
            if (digg_type == "good")
            {
                bll.UpdateField(id, "digg_good=digg_good+1");
            }
            else
            {
                bll.UpdateField(id, "digg_act=digg_act+1");
            }
            Model.contents model = bll.GetModel(id);
            context.Response.Write("{msg:1, digggood:" + model.digg_good + ", diggact:" + model.digg_act + ", msgbox:\"成功顶或踩了一下!\"}");
            Utils.WriteCookie(DTKeys.COOKIE_DIGG_KEY, channel_type + id.ToString(), id.ToString(), 8640);
            return;
        }
Ejemplo n.º 4
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BLL.contents bll = new BLL.contents();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
         this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
 }
Ejemplo n.º 5
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel(channel_id, ActionEnum.Delete.ToString()); //检查权限
     BLL.contents bll = new BLL.contents();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             bll.Delete(this.channel_id, id);
         }
     }
     JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
         this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
 }
Ejemplo n.º 6
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel(channel_id, ActionEnum.Delete.ToString()); //检查权限
     BLL.contents bll = new BLL.contents();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             bll.Delete(this.channel_id, id);
         }
     }
     JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
                                             this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
 }
Ejemplo n.º 7
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BLL.contents bll = new BLL.contents();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
                                             this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 内容列表
        /// </summary>
        /// <param name="channel_id">频道ID</param>
        /// <param name="top">显示条数</param>
        /// <param name="strwhere">查询条件</param>
        /// <returns>DataTable</returns>
        protected DataTable get_content_list(int channel_id, int category_id, int top, string strwhere, string orderby)
        {
            DataTable dt = new DataTable();

            if (channel_id > 0)
            {
                string _where = "channel_id=" + channel_id;
                if (category_id > 0)
                {
                    _where += " and category_id in(select id from dt_category where id=" + category_id + " and class_list like '%," + category_id + ",%')";
                }
                if (!string.IsNullOrEmpty(strwhere))
                {
                    _where += " and " + strwhere;
                }
                dt = new BLL.contents().GetList(top, _where, orderby).Tables[0];
            }
            return(dt);
        }
Ejemplo n.º 9
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            if (this.category_id > 0)
            {
                this.ddlCategoryId.SelectedValue = this.category_id.ToString();
            }
            this.ddlProperty.SelectedValue = this.property;
            this.txtKeywords.Text          = this.keywords;
            BLL.contents bll = new BLL.contents();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}",
                                              this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Ejemplo n.º 10
0
        private bool DoEdit(int _id)
        {
            bool result = true;

            DTcms.BLL.contents   bll   = new BLL.contents();
            DTcms.Model.contents model = bll.GetModel(_id);

            model.channel_id      = this.channel_id;
            model.title           = txtTitle.Text.Trim();
            model.call_index      = txtCallIndex.Text.Trim();
            model.category_id     = int.Parse(ddlCategoryId.SelectedValue);
            model.link_url        = txtLinkUrl.Text.Trim();
            model.img_url         = txtImgUrl.Text.Trim();
            model.seo_title       = txtSeoTitle.Text.Trim();
            model.seo_keywords    = txtSeoKeywords.Text.Trim();
            model.seo_description = txtSeoDescription.Text.Trim();
            model.sort_id         = int.Parse(txtSortId.Text.Trim());
            model.click           = int.Parse(txtClick.Text.Trim());
            model.content         = txtContent.Value;
            model.is_msg          = 0;
            model.is_red          = 0;
            model.is_lock         = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_msg = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_red = 1;
            }
            if (cblItem.Items[2].Selected == true)
            {
                model.is_lock = 1;
            }

            if (!bll.Update(model))
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     id   = DTRequest.GetQueryInt("id");
     page = DTRequest.GetQueryString("page");
     BLL.contents bll = new BLL.contents();
     if (id > 0)
     {
         if (!bll.Exists(id))
         {
             HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"));
             return;
         }
         model = bll.GetModel(id);
     }
     else if (!string.IsNullOrEmpty(page))
     {
         if (!bll.Exists(page))
         {
             HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"));
             return;
         }
         model = bll.GetModel(page);
     }
     else
     {
         Server.Transfer("error.aspx");
         return;
     }
     //浏览数+1
     bll.UpdateField(model.id, "click=click+1");
     //跳转URL
     if (model.link_url != null)
     {
         model.link_url = model.link_url.Trim();
     }
     if (!string.IsNullOrEmpty(model.link_url))
     {
         HttpContext.Current.Response.Redirect(model.link_url);
     }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     id = DTRequest.GetQueryInt("id");
     page = DTRequest.GetQueryString("page");
     BLL.contents bll = new BLL.contents();
     if (id > 0)
     {
         if (!bll.Exists(id))
         {
             HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"));
             return;
         }
         model = bll.GetModel(id);
     }
     else if (!string.IsNullOrEmpty(page))
     {
         if (!bll.Exists(page))
         {
             HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"));
             return;
         }
         model = bll.GetModel(page);
     }
     else
     {
         Server.Transfer("error.aspx");
         return;
     }
     //浏览数+1
     bll.UpdateField(model.id, "click=click+1");
     //跳转URL
     if (model.link_url != null)
         model.link_url = model.link_url.Trim();
     if (!string.IsNullOrEmpty(model.link_url))
     {
         HttpContext.Current.Response.Redirect(model.link_url);
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        /// 内容分页列表
        /// </summary>
        /// <param name="channel_id">频道ID</param>
        /// <param name="page_size">页面大小</param>
        /// <param name="page_index">当前页码</param>
        /// <param name="strwhere">查询条件</param>
        /// <param name="totalcount">总记录数</param>
        /// <returns>DateTable</returns>
        protected DataTable get_content_list(int channel_id, int category_id, int page_size, int page_index, string strwhere, out int totalcount)
        {
            DataTable dt = new DataTable();

            if (channel_id > 0)
            {
                string _where = "channel_id=" + channel_id;
                if (category_id > 0)
                {
                    _where += " and category_id in(select id from dt_category where id=" + category_id + " and class_list like '%," + category_id + ",%')";
                }
                if (!string.IsNullOrEmpty(strwhere))
                {
                    _where += " and " + strwhere;
                }
                dt = new BLL.contents().GetList(page_size, page_index, _where, "sort_id asc,add_time desc", out totalcount).Tables[0];
            }
            else
            {
                totalcount = 0;
            }
            return(dt);
        }
Ejemplo n.º 14
0
        private bool DoAdd()
        {
            bool result = true;
            DTcms.Model.contents model = new Model.contents();
            DTcms.BLL.contents bll = new BLL.contents();

            model.channel_id = this.channel_id;
            model.title = txtTitle.Text.Trim();
            model.call_index = txtCallIndex.Text.Trim();
            model.category_id = int.Parse(ddlCategoryId.SelectedValue);
            model.link_url = txtLinkUrl.Text.Trim();
            model.img_url = txtImgUrl.Text.Trim();
            model.seo_title = txtSeoTitle.Text.Trim();
            model.seo_keywords = txtSeoKeywords.Text.Trim();
            model.seo_description = txtSeoDescription.Text.Trim();
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.click = int.Parse(txtClick.Text.Trim());
            model.content = txtContent.Value;
            model.is_msg = 0;
            model.is_red = 0;
            model.is_lock = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_msg = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_red = 1;
            }
            if (cblItem.Items[2].Selected == true)
            {
                model.is_lock = 1;
            }
            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return result;
        }
Ejemplo n.º 15
0
        private void ShowInfo(int _id)
        {
            BLL.contents bll = new BLL.contents();
            Model.contents model = bll.GetModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtCallIndex.Text = model.call_index;
            txtTitle.Text = model.title;
            txtImgUrl.Text = model.img_url;
            txtLinkUrl.Text = model.link_url;
            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_lock == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            txtSortId.Text = model.sort_id.ToString();
            txtClick.Text = model.click.ToString();
            txtDiggGood.Text = model.digg_good.ToString();
            txtDiggAct.Text = model.digg_act.ToString();
            txtContent.Value = model.content;
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeywords.Text = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
        }
Ejemplo n.º 16
0
 //内容模块
 private void digg_content_add(HttpContext context)
 {
     string channel_type = DTRequest.GetFormString("channel_type");
     string digg_type = DTRequest.GetFormString("digg_type");
     int id = DTRequest.GetFormInt("id");
     BLL.contents bll = new BLL.contents();
     if (!bll.Exists(id))
     {
         context.Response.Write("{msg:0, msgbox:\"信息不存在或已删除!\"}");
         return;
     }
     if (digg_type == "good")
     {
         bll.UpdateField(id, "digg_good=digg_good+1");
     }
     else
     {
         bll.UpdateField(id, "digg_act=digg_act+1");
     }
     Model.contents model = bll.GetModel(id);
     context.Response.Write("{msg:1, digggood:" + model.digg_good + ", diggact:" + model.digg_act + ", msgbox:\"成功顶或踩了一下!\"}");
     Utils.WriteCookie(DTKeys.COOKIE_DIGG_KEY, channel_type + id.ToString(), id.ToString(), 8640);
     return;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// 内容分页列表
 /// </summary>
 /// <param name="channel_id">频道ID</param>
 /// <param name="page_size">页面大小</param>
 /// <param name="page_index">当前页码</param>
 /// <param name="strwhere">查询条件</param>
 /// <param name="totalcount">总记录数</param>
 /// <returns>DateTable</returns>
 protected DataTable get_content_list(int channel_id, int category_id, int page_size, int page_index, string strwhere, out int totalcount)
 {
     DataTable dt = new DataTable();
     if (channel_id > 0)
     {
         string _where = "channel_id=" + channel_id;
         if (category_id > 0)
         {
             _where += " and category_id in(select id from dt_category where id=" + category_id + " and class_list like '%," + category_id + ",%')";
         }
         if (!string.IsNullOrEmpty(strwhere))
         {
             _where += " and " + strwhere;
         }
         dt = new BLL.contents().GetList(page_size, page_index, _where, "sort_id asc,add_time desc", out totalcount).Tables[0];
     }
     else
     {
         totalcount = 0;
     }
     return dt;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// 内容列表
 /// </summary>
 /// <param name="channel_id">频道ID</param>
 /// <param name="top">显示条数</param>
 /// <param name="strwhere">查询条件</param>
 /// <returns>DataTable</returns>
 protected DataTable get_content_list(int channel_id, int category_id, int top, string strwhere, string orderby)
 {
     DataTable dt = new DataTable();
     if (channel_id > 0)
     {
         string _where = "channel_id=" + channel_id;
         if (category_id > 0)
         {
             _where += " and category_id in(select id from dt_category where id=" + category_id + " and class_list like '%," + category_id + ",%')";
         }
         if (!string.IsNullOrEmpty(strwhere))
         {
             _where += " and " + strwhere;
         }
         dt = new BLL.contents().GetList(top, _where, orderby).Tables[0];
     }
     return dt;
 }
Ejemplo n.º 19
0
 //设置操作
 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     ChkAdminLevel(channel_id, ActionEnum.Edit.ToString()); //检查权限
     int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);
     BLL.contents bll = new BLL.contents();
     Model.contents model = bll.GetModel(id);
     switch (e.CommandName.ToLower())
     {
         case "ibtnmsg":
             if (model.is_msg == 1)
                 bll.UpdateField(id, "is_msg=0");
             else
                 bll.UpdateField(id, "is_msg=1");
             break;
         case "ibtnred":
             if (model.is_red == 1)
                 bll.UpdateField(id, "is_red=0");
             else
                 bll.UpdateField(id, "is_red=1");
             break;
     }
     this.RptBind("id>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "sort_id asc,add_time desc");
 }
Ejemplo n.º 20
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            if (this.category_id > 0)
            {
                this.ddlCategoryId.SelectedValue = this.category_id.ToString();
            }
            this.ddlProperty.SelectedValue = this.property;
            this.txtKeywords.Text = this.keywords;
            BLL.contents bll = new BLL.contents();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}",
                this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }