Пример #1
0
        private void ShowInfo(int _id)
        {
            BLL.article            bll   = new BLL.article();
            Model.article_download model = bll.GetDownloadModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            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();
            txtDiggBad.Text        = model.digg_bad.ToString();
            txtContent.Value       = model.content;
            txtSeoTitle.Text       = model.seo_title;
            txtSeoKeywords.Text    = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            //绑定附件
            rptAttach.DataSource = model.download_attachs;
            rptAttach.DataBind();
        }
Пример #2
0
        private void ShowInfo(int _id)
        {
            BLL.article bll = new BLL.article();
            Model.article_download model = bll.GetDownloadModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            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();
            txtDiggBad.Text = model.digg_bad.ToString();
            txtContent.Value = model.content;
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeywords.Text = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            //绑定附件
            rptAttach.DataSource = model.download_attachs;
            rptAttach.DataBind();
        }
Пример #3
0
        //設置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ChkAdminLevel(channel_id, DTEnums.ActionEnum.Edit.ToString()); //檢查許可權
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

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

            case "ibtnred":
                if (model.is_red == 1)
                {
                    bll.UpdateDownloadField(id, "is_red=0");
                }
                else
                {
                    bll.UpdateDownloadField(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");
        }
Пример #4
0
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.article bll = new BLL.article();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"));
         return;
     }
     model = bll.GetDownloadModel(id);
     //浏览数+1
     bll.UpdateField(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);
     }
 }
Пример #5
0
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.article bll = new BLL.article();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"));
         return;
     }
     model = bll.GetDownloadModel(id);
     //浏览数+1
     bll.UpdateField(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);
     }
 }
Пример #6
0
        private bool DoEdit(int _id)
        {
            bool result = true;

            BLL.article            bll   = new BLL.article();
            Model.article_download model = bll.GetDownloadModel(_id);

            model.channel_id      = this.channel_id;
            model.title           = txtTitle.Text.Trim();
            model.category_id     = int.Parse(ddlCategoryId.SelectedValue);
            model.link_url        = txtLinkUrl.Text.Trim();
            model.img_url         = txtImgUrl.Text.Trim();
            model.content         = txtContent.Value;
            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.digg_good       = int.Parse(txtDiggGood.Text.Trim());
            model.digg_bad        = int.Parse(txtDiggBad.Text.Trim());
            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 (model.download_attachs != null)
            {
                model.download_attachs.Clear();
            }
            string hidFileList = Request.Params["hidFileName"];

            string[] pointArr = Request.Form.GetValues("txtPoint");
            if (!string.IsNullOrEmpty(hidFileList))
            {
                string[] fileListArr            = hidFileList.Split(',');
                List <Model.download_attach> ls = new List <Model.download_attach>();
                for (int i = 0; i < fileListArr.Length; i++)
                {
                    string[] fileArr = fileListArr[i].Split('|');
                    if (fileArr.Length == 3)
                    {
                        int    attach_id = int.Parse(fileArr[0]);
                        int    fileSize  = Utils.GetFileSize(fileArr[2]);
                        string fileExt   = Utils.GetFileExt(fileArr[2]);
                        int    _point    = int.Parse(pointArr[i]);
                        //删除旧文件
                        if (attach_id > 0)
                        {
                            new BLL.download_attach().DeleteFile(attach_id, fileArr[2]);
                        }
                        ls.Add(new Model.download_attach {
                            id = attach_id, article_id = _id, title = fileArr[1], file_path = fileArr[2], file_size = fileSize, file_ext = fileExt, point = _point
                        });
                    }
                }
                model.download_attachs = ls;
            }

            if (!bll.Update(model))
            {
                result = false;
            }
            return(result);
        }
Пример #7
0
 //设置操作
 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     ChkAdminLevel(channel_id, DTEnums.ActionEnum.Edit.ToString()); //检查权限
     int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);
     BLL.article bll = new BLL.article();
     Model.article_download model = bll.GetDownloadModel(id);
     switch (e.CommandName.ToLower())
     {
         case "ibtnmsg":
             if (model.is_msg == 1)
                 bll.UpdateDownloadField(id, "is_msg=0");
             else
                 bll.UpdateDownloadField(id, "is_msg=1");
             break;
         case "ibtnred":
             if (model.is_red == 1)
                 bll.UpdateDownloadField(id, "is_red=0");
             else
                 bll.UpdateDownloadField(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");
 }
Пример #8
0
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.article bll = new BLL.article();
            Model.article_download model = bll.GetDownloadModel(_id);

            model.channel_id = this.channel_id;
            model.title = txtTitle.Text.Trim();
            model.category_id = int.Parse(ddlCategoryId.SelectedValue);
            model.link_url = txtLinkUrl.Text.Trim();
            model.img_url = txtImgUrl.Text.Trim();
            model.content = txtContent.Value;
            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.digg_good = int.Parse(txtDiggGood.Text.Trim());
            model.digg_bad = int.Parse(txtDiggBad.Text.Trim());
            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 (model.download_attachs != null)
            {
                model.download_attachs.Clear();
            }
            string hidFileList = Request.Params["hidFileName"];
            string[] pointArr = Request.Form.GetValues("txtPoint");
            if (!string.IsNullOrEmpty(hidFileList))
            {
                string[] fileListArr = hidFileList.Split(',');
                List<Model.download_attach> ls = new List<Model.download_attach>();
                for (int i = 0; i < fileListArr.Length; i++)
                {
                    string[] fileArr = fileListArr[i].Split('|');
                    if (fileArr.Length == 3)
                    {
                        int attach_id = int.Parse(fileArr[0]);
                        int fileSize = Utils.GetFileSize(fileArr[2]);
                        string fileExt = Utils.GetFileExt(fileArr[2]);
                        int _point = int.Parse(pointArr[i]);
                        //删除旧文件
                        if (attach_id > 0)
                        {
                            new BLL.download_attach().DeleteFile(attach_id, fileArr[2]);
                        }
                        ls.Add(new Model.download_attach { id = attach_id, article_id = _id, title = fileArr[1], file_path = fileArr[2], file_size = fileSize, file_ext = fileExt, point = _point });
                    }
                }
                model.download_attachs = ls;
            }

            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }