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

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtTitle.Text   = model.title;
            txtAuthor.Text  = model.author;
            txtFrom.Text    = model.from;
            txtZhaiyao.Text = model.zhaiyao;
            txtLinkUrl.Text = model.link_url;
            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_top == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_hot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_slide == 1)
            {
                cblItem.Items[4].Selected = true;
            }
            if (model.is_lock == 1)
            {
                cblItem.Items[5].Selected = true;
            }
            txtSortId.Text = model.sort_id.ToString();
            txtClick.Text  = model.click.ToString();
            //自訂圖片才綁定
            string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1);

            if (!filename.StartsWith("small_"))
            {
                txtImgUrl.Text = model.img_url;
            }
            txtDiggGood.Text       = model.digg_good.ToString();
            txtDiggBad.Text        = model.digg_bad.ToString();
            txtContent.Value       = model.content;
            txtSeoTitle.Text       = model.seo_title;
            txtTime.Text           = model.add_time.ToString();
            txtSeoKeywords.Text    = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            //賦值上傳的相冊
            focus_photo.Value = model.img_url; //封面圖片
            LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url);
            //賦值屬性清單
            LitAttributeList.Text = GetAttributeHtml(model.attribute_values, this.channel_id, _id);
        }
Пример #2
0
        private void ShowInfo(int _id)
        {
            BLL.article bll = new BLL.article();
            Model.article_news model = bll.GetNewsModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtTitle.Text = model.title;
            txtAuthor.Text = model.author;
            txtFrom.Text = model.from;
            txtZhaiyao.Text = model.zhaiyao;
            txtLinkUrl.Text = model.link_url;
            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_top == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_hot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_slide == 1)
            {
                cblItem.Items[4].Selected = true;
            }
            if (model.is_lock == 1)
            {
                cblItem.Items[5].Selected = true;
            }
            txtSortId.Text = model.sort_id.ToString();
            txtClick.Text = model.click.ToString();
            //自定义图片才绑定
            string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1);
            if (!filename.StartsWith("small_"))
            {
                txtImgUrl.Text = model.img_url;
            }
            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;
            //赋值上传的相册
            focus_photo.Value = model.img_url; //封面图片
            LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url);
            //赋值属性列表
            LitAttributeList.Text = GetAttributeHtml(model.attribute_values, this.channel_id, _id);
        }
Пример #3
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.GetNewsModel(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);
     }
 }
Пример #4
0
 private void Bind()
 {
     BLL.article        bll = new BLL.article();
     Model.article_news model;
     if (Request.QueryString["type"] != null)
     {
         model = new DAL.article().GetModel(id);
         lblDatetime.Visible = false;
     }
     else
     {
         model = bll.GetNewsModel(id);
     }
     if (model != null)
     {
         lblTitle.Text    = model.title;
         lblDatetime.Text = "發佈日期: " + model.add_time.ToString("yyyy-MM-dd");
         lblFrom.Text     = "來源:" + model.from;
         lblContent.Text  = model.content;
     }
 }
Пример #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.GetNewsModel(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_news model = bll.GetNewsModel(_id);

            model.channel_id  = this.channel_id;
            model.title       = txtTitle.Text.Trim();
            model.category_id = int.Parse(ddlCategoryId.SelectedValue);
            model.author      = txtAuthor.Text.Trim();
            model.from        = txtFrom.Text.Trim();
            model.zhaiyao     = Utils.DropHTML(txtZhaiyao.Text, 250);
            model.link_url    = txtLinkUrl.Text.Trim();
            model.add_time    = DateTime.Parse(txtTime.Text.ToString());
            //檢查是否有自訂圖片
            if (txtImgUrl.Text.Trim() != "")
            {
                model.img_url = txtImgUrl.Text;
            }
            else
            {
                model.img_url = focus_photo.Value;
            }
            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_top          = 0;
            model.is_red          = 0;
            model.is_hot          = 0;
            model.is_slide        = 0;
            model.is_lock         = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_msg = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_top = 1;
            }
            if (cblItem.Items[2].Selected == true)
            {
                model.is_red = 1;
            }
            if (cblItem.Items[3].Selected == true)
            {
                model.is_hot = 1;
            }
            if (cblItem.Items[4].Selected == true)
            {
                model.is_slide = 1;
            }
            if (cblItem.Items[5].Selected == true)
            {
                model.is_lock = 1;
            }
            //儲存相冊
            if (model.albums != null)
            {
                model.albums.Clear();
            }
            string[] albumArr  = Request.Form.GetValues("hide_photo_name");
            string[] remarkArr = Request.Form.GetValues("hide_photo_remark");
            if (albumArr != null)
            {
                List <Model.article_albums> ls = new List <Model.article_albums>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    int      img_id = int.Parse(imgArr[0]);
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.article_albums {
                                id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i]
                            });
                        }
                        else
                        {
                            ls.Add(new Model.article_albums {
                                id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2]
                            });
                        }
                    }
                }
                model.albums = ls;
            }

            //擴展屬性
            BLL.attributes bll2 = new BLL.attributes();
            DataSet        ds2  = bll2.GetList("channel_id=" + this.channel_id);

            List <Model.attribute_value> attrls = new List <Model.attribute_value>();

            foreach (DataRow dr in ds2.Tables[0].Rows)
            {
                int    attr_id            = int.Parse(dr["id"].ToString());
                string attr_title         = dr["title"].ToString();
                string attr_value_id      = Request.Form["value_" + attr_id];
                string attr_value_content = Request.Form["content_" + attr_id];
                if (!string.IsNullOrEmpty(attr_value_id) && !string.IsNullOrEmpty(attr_value_content))
                {
                    attrls.Add(new Model.attribute_value {
                        id = Convert.ToInt32(attr_value_id), article_id = _id, attribute_id = attr_id, title = attr_title, content = attr_value_content
                    });
                }
            }
            model.attribute_values = attrls;

            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_news model = bll.GetNewsModel(id);
            switch (e.CommandName.ToLower())
            {
            case "ibtnmsg":
                if (model.is_msg == 1)
                {
                    bll.UpdateNewsField(id, "is_msg=0");
                }
                else
                {
                    bll.UpdateNewsField(id, "is_msg=1");
                }
                break;

            case "ibtntop":
                if (model.is_top == 1)
                {
                    bll.UpdateNewsField(id, "is_top=0");
                }
                else
                {
                    bll.UpdateNewsField(id, "is_top=1");
                }
                break;

            case "ibtnred":
                if (model.is_red == 1)
                {
                    bll.UpdateNewsField(id, "is_red=0");
                }
                else
                {
                    bll.UpdateNewsField(id, "is_red=1");
                }
                break;

            case "ibtnhot":
                if (model.is_hot == 1)
                {
                    bll.UpdateNewsField(id, "is_hot=0");
                }
                else
                {
                    bll.UpdateNewsField(id, "is_hot=1");
                }
                break;

            case "ibtnslide":
                if (model.is_slide == 1)
                {
                    bll.UpdateNewsField(id, "is_slide=0");
                }
                else
                {
                    bll.UpdateNewsField(id, "is_slide=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
 //设置操作
 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_news model = bll.GetNewsModel(id);
     switch (e.CommandName.ToLower())
     {
         case "ibtntop":
             if (model.is_top == 1)
                 bll.UpdateNewsField(id, "is_top=0");
             else
                 bll.UpdateNewsField(id, "is_top=1");
             break;
         case "ibtnred":
             if (model.is_red == 1)
                 bll.UpdateNewsField(id, "is_red=0");
             else
                 bll.UpdateNewsField(id, "is_red=1");
             break;
         case "ibtnslide":
             if (model.is_slide == 1)
                 bll.UpdateNewsField(id, "is_slide=0");
             else
                 bll.UpdateNewsField(id, "is_slide=1");
             break;
     }
     this.RptBind("id>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "sort_id asc,add_time desc");
 }
Пример #9
0
        //批量发布
        protected void lbtnPublish_Click(object sender, EventArgs e)
        {
            try
            {
                ChkAdminLevel(channel_id, DTEnums.ActionEnum.Publish.ToString()); //检查权限
                BLL.article bll = new BLL.article();
                Repeater rptList = new Repeater();

                rptList = this.rptList1;

                Model.article_news model_new = null;
                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)
                    {
                        model_new = bll.GetNewsModel(_id);

                        Publish publish_new = new Publish();
                        //开始发布
                        string serverFileName = publish_new.Publish_News(model_new.title, model_new.content, model_new.from, model_new.add_time.ToShortDateString());
                        //修改URL字段
                        if (!string.IsNullOrEmpty(serverFileName))
                        {
                            model_new.link_url = serverFileName;
                            model_new.is_publish = 1;
                            bll.Update(model_new);
                        }
                        //bll.UpdateField(_id, "link_url='" + serverFileName + "'");
                        //bll.UpdateNewsField(_id, "is_publish=1");

                    }
                }
                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");
            }
            catch
            {
                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), "Error");
            }
        }
Пример #10
0
        /// <summary>
        /// 取消发布
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbtnEditPublish_Click(object sender, EventArgs e)
        {
            BLL.article bll = new BLL.article();
            //Repeater rptList = new Repeater();
            //rptList = this.rptList1;

            Model.article_news model_new = null;

            LinkButton lnkbtn = (LinkButton)sender;

            int _id = Convert.ToInt32(((HiddenField)lnkbtn.FindControl("hidId")).Value);

            model_new = bll.GetNewsModel(_id);
            if (model_new != null)
            {
                string temp_url = model_new.link_url;
                model_new.link_url = "";
                model_new.is_publish = 0;

                if (bll.Update(model_new))
                {
                    Utils.DeleteFile(temp_url); //删除文件
                }
                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");
            }
            else
            {
                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), "Error");
            }
        }
Пример #11
0
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.article bll = new BLL.article();
            Model.article_news model = bll.GetNewsModel(_id);

            model.channel_id = this.channel_id;
            model.title = txtTitle.Text.Trim();
            model.category_id = int.Parse(ddlCategoryId.SelectedValue);
            model.author = txtAuthor.Text.Trim();
            model.from = txtFrom.Text.Trim();
            model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 250);
            model.link_url = txtLinkUrl.Text.Trim();
            //检查是否有自定义图片
            if (txtImgUrl.Text.Trim() != "")
            {
                model.img_url = txtImgUrl.Text;
            }
            else
            {
                model.img_url = focus_photo.Value;
            }
            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_top = 0;
            model.is_red = 0;
            model.is_hot = 0;
            model.is_slide = 0;
            model.is_lock = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_msg = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_top = 1;
            }
            if (cblItem.Items[2].Selected == true)
            {
                model.is_red = 1;
            }
            if (cblItem.Items[3].Selected == true)
            {
                model.is_hot = 1;
            }
            if (cblItem.Items[4].Selected == true)
            {
                model.is_slide = 1;
            }
            if (cblItem.Items[5].Selected == true)
            {
                model.is_lock = 1;
            }
            //保存相册
            if (model.albums != null)
                model.albums.Clear();
            string[] albumArr = Request.Form.GetValues("hide_photo_name");
            string[] remarkArr = Request.Form.GetValues("hide_photo_remark");
            if (albumArr != null)
            {
                List<Model.article_albums> ls = new List<Model.article_albums>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    int img_id = int.Parse(imgArr[0]);
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] });
                        }
                        else
                        {
                            ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2] });
                        }
                    }
                }
                model.albums = ls;
            }

            //扩展属性
            BLL.attributes bll2 = new BLL.attributes();
            DataSet ds2 = bll2.GetList("channel_id=" + this.channel_id);

            List<Model.attribute_value> attrls = new List<Model.attribute_value>();
            foreach (DataRow dr in ds2.Tables[0].Rows)
            {
                int attr_id = int.Parse(dr["id"].ToString());
                string attr_title = dr["title"].ToString();
                string attr_value_id = Request.Form["value_" + attr_id];
                string attr_value_content = Request.Form["content_" + attr_id];
                if (!string.IsNullOrEmpty(attr_value_id) && !string.IsNullOrEmpty(attr_value_content))
                {
                    attrls.Add(new Model.attribute_value { id =  Convert.ToInt32(attr_value_id), article_id = _id, attribute_id = attr_id, title = attr_title, content = attr_value_content });
                }
            }
            model.attribute_values = attrls;

            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }
Пример #12
0
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.article bll = new BLL.article();
            Model.article_news model = bll.GetNewsModel(_id);

            model.channel_id = this.channel_id;
            model.title = txtTitle.Text.Trim();
            model.category_id = int.Parse(ddlCategoryId.SelectedValue);
            model.author = txtAuthor.Text.Trim();
            model.from = txtFrom.Text.Trim();
            model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 250);
            model.link_url = txtLinkUrl.Text.Trim();
            //检查是否有自定义图片
            if (txtImgUrl.Text.Trim() != "")
            {
                model.img_url = txtImgUrl.Text;
            }
            else
            {
                model.img_url = focus_photo.Value;
            }
            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_top = 0;
            model.is_red = 0;
            model.is_hot = 0;
            model.is_slide = 0;
            model.is_lock = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_top = 1;
            }
            //if (cblItem.Items[1].Selected == true)
            //{
            //    model.is_top = 1;
            //}
            //if (cblItem.Items[2].Selected == true)
            //{
            //    model.is_red = 1;
            //}
            //if (cblItem.Items[3].Selected == true)
            //{
            //    model.is_hot = 1;
            //}
            //if (cblItem.Items[4].Selected == true)
            //{
            //    model.is_slide = 1;
            //}
            //if (cblItem.Items[5].Selected == true)
            //{
            //    model.is_lock = 1;
            //}
            //保存相册
            if (model.albums != null)
                model.albums.Clear();
            string[] albumArr = Request.Form.GetValues("hide_photo_name");
            string[] remarkArr = Request.Form.GetValues("hide_photo_remark");
            if (albumArr != null)
            {
                List<Model.article_albums> ls = new List<Model.article_albums>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    int img_id = int.Parse(imgArr[0]);
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] });
                        }
                        else
                        {
                            ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2] });
                        }
                    }
                }
                model.albums = ls;
            }

            //如果为外链模型,则不需要发布过程
            if (model.category_id == (int)DTEnums.CatergoryID.ad_url)
            {
                model.is_publish = 1;
            }
            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }