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

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

            case "lbtnIsHide":
                if (model.is_hide == 1)
                {
                    bll.UpdateField(id, "is_hide=0");
                }
                else
                {
                    bll.UpdateField(id, "is_hide=1");
                }
                break;
            }
            this.RptBind("id>0" + CombSqlTxt(this.keywords), "sort asc,time desc,id desc");
        }
Example #2
0
        private bool DoEdit(int _id)
        {
            bool result = false;

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

            model.title   = txtTitle.Text.Trim();
            model.is_hide = Convert.ToInt32(rblIsHide.SelectedValue);
            model.is_msg  = Convert.ToInt32(rblIsMsg.SelectedValue);
            model.img     = txtImg.Text;
            model.sort    = Convert.ToInt32(txtSort.Text);
            model.click   = Convert.ToInt32(txtClick.Text);
            if (string.IsNullOrEmpty(txtTime.Text))
            {
                model.time = DateTime.Now;
            }
            else
            {
                model.time = Convert.ToDateTime(txtTime.Text);
            }

            //内容摘要提取内容前255个字符
            if (string.IsNullOrEmpty(txtZhaiyao.Text.Trim()))
            {
                model.zhaiyao = Utils.DropHTML(txtContent.Value, 120);
            }
            else
            {
                model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 120);
            }

            //是否将编辑器远程图片保存到本地
            if (siteConfig.fileremote == 1)
            {
                model.cont = AutoRemoteImageSave(txtContent.Value);
            }
            else
            {
                model.cont = txtContent.Value;
            }

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改咨询内容:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }