Esempio 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.ArticleBll bll = new BLL.ArticleBll();
     Entity.Article model = bll.GetEntity(id);
     switch (e.CommandName.ToLower())
     {
         case "ibtnred":
             if (model.IsRecommend == 1)
                 bll.UpdateField(id, "IsRecommend=0");
             else
                 bll.UpdateField(id, "IsRecommend=1");
             break;
         case "ibtnhot":
             if (model.IsHot == 1)
                 bll.UpdateField(id, "IsHot=0");
             else
                 bll.UpdateField(id, "IsHot=1");
             break;
     }
     this.RptBind("ID>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "SortID asc,AddTime desc");
 }
        private void ShowInfo(int _id)
        {
            BLL.ArticleBll bll = new BLL.ArticleBll();
            Entity.Article model = bll.GetEntity(_id);

            //ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtTitle.Text = model.Title;
            //txtCallIndex.Text = model.i; //~~~~~~~~~~~~~~~~~~~~~~调用别名
            //txtForm.Text = model.From;
            //txtZhaiyao.Text = model.Summary;// .zhaiyao;
            txtImgUrl.Text = model.ImageURL;// .img_url;
            txtLinkUrl.Text = model.LinkURL;// .link_url;
            if (model.IsRecommend == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.IsHot == 1)
            {
                cblItem.Items[1].Selected = true;
            }

            txtSortId.Text = model.SortID.ToString();
            txtClick.Text = model.ClickCount.ToString();

            txtContent.Value = model.Content;
        }
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.ArticleBll bll = new BLL.ArticleBll();
            Entity.Article model = bll.GetEntity(_id);

            model.ChannelID = this.channel_id;
            model.Title = txtTitle.Text.Trim();

            model.LinkURL = txtLinkUrl.Text.Trim();
            model.ImageURL = txtImgUrl.Text.Trim();
            //model.Author = txtAuthor.Text.Trim();
            //model.From = txtForm.Text.Trim();
            //model.Summary = Utils.DropHTML(txtZhaiyao.Text, 250);
            model.SortID = int.Parse(txtSortId.Text.Trim());
            model.ClickCount = int.Parse(txtClick.Text.Trim());
            model.Content = txtContent.Value;

            model.IsRecommend = 0;

            if (cblItem.Items[0].Selected == true)
            {
                model.IsRecommend = 1;
            }

            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }
        private void ShowInfo(int _id)
        {
            BLL.ArticleBll bll = new BLL.ArticleBll();
            Entity.Article model = bll.GetEntity(_id);

            ddlCategoryId.SelectedValue = model.CategoryID.ToString();
            txtTitle.Text = model.Title;

            //txtImgUrl.Text = model.ImageURL;// .img_url;
            txtLinkUrl.Text = model.LinkURL;// .link_url;
            if (model.IsRecommend == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.IsHot == 1)
            {
                cblItem.Items[1].Selected = true;
            }

            txtSortId.Text = model.SortID.ToString();
            txtClick.Text = model.ClickCount.ToString();

            txtContent.Value = model.Content;
        }
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.ArticleBll bll = new BLL.ArticleBll();
            Entity.Article model = bll.GetEntity(_id);

            model.ChannelID = this.channel_id;
            model.Title = txtTitle.Text.Trim();

            model.LinkURL = txtLinkUrl.Text.Trim();
            //model.ImageURL = txtImgUrl.Text.Trim();
            model.SortID = int.Parse(txtSortId.Text.Trim());
            model.ClickCount = int.Parse(txtClick.Text.Trim());
            model.Content = txtContent.Value;
            model.CategoryID = int.Parse(ddlCategoryId.SelectedValue);
            model.IsRecommend = 0;
            model.IsHot = 0;

            if (cblItem.Items[0].Selected == true)
            {
                model.IsRecommend = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.IsHot = 1;
            }

            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }
        private void ShowInfo(int _id)
        {
            BLL.ArticleBll bll = new BLL.ArticleBll();
            Entity.Article model = bll.GetEntity(_id);

            //ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtTitle.Text = model.Title;
            txtAuthor.Text = model.Author;
            txtForm.Text = model.From;
            txtZhaiyao.Text = model.Summary;// .zhaiyao;
            txtImgUrl.Text = model.ImageURL;// .img_url;
            txtLinkUrl.Text = model.LinkURL;// .link_url;
            if (model.IsRecommend == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.IsHot == 1)
            {
                cblItem.Items[1].Selected = true;
            }

            txtSortId.Text = model.SortID.ToString();
            txtClick.Text = model.ClickCount.ToString();

            txtContent.Value = model.Content;
            /* seo options
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeywords.Text = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;*/
        }