Beispiel #1
0
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            //检查权限
            ChkAdminLevel("plugin_lable", DTEnums.ActionEnum.Delete.ToString());
            BLL.lable bll = new BLL.lable();

            int      sucCount   = 0; //成功数量
            int      errorCount = 0; //失败数量
            Repeater rptList    = new Repeater();

            rptList = this.rptList;
            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)
                {
                    if (bll.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除标签内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("成功删除 " + sucCount + " 条,失败 " + errorCount + " 条!", Utils.CombUrlTxt("index.aspx", "keywords={0}", this.keywords));
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.keywords = DTRequest.GetQueryString("keywords", true);
            this.id       = DTRequest.GetQueryIntValue("id", 0);
            this.page     = DTRequest.GetQueryIntValue("page", 1);
            this.pageSize = GetPageSize(10); //每页数量

            if (!Page.IsPostBack)
            {
                //读取用户
                DTcms.Model.manager model = GetAdminInfo();

                //检查权限
                ChkAdminLevel("plugin_lable", DTEnums.ActionEnum.Show.ToString());

                //绑定数据
                BLL.lable bll   = new BLL.lable();
                DataSet   _list = bll.GetList(pageSize, page, CombSqlTxt(this.keywords), "sort_id asc,id asc", out totalCount);
                this.rptList.DataSource = _list;
                this.rptList.DataBind();

                //插入关键词
                this.txtKeywords.Text = Utils.Htmls(this.keywords);

                //绑定页码
                this.txtPageNum.Text = pageSize.ToString();
                string pageUrl = Utils.CombUrlTxt("index.aspx", "keywords={0}&page={1}", keywords, "__id__");
                PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
            }
        }
Beispiel #3
0
        private void ShowInfo(int _id)
        {
            BLL.lable   bll   = new BLL.lable();
            Model.lable model = bll.GetModel(_id);
            txtTitle.Text = model.title;
            txtName.Text  = model.call_index;
            txtName.Attributes.Add("ajaxurl", "../tools/ajax.ashx?action=validate&old_name=" + Utils.UrlEncode(model.call_index));
            txtName.Focus(); //设置焦点,防止JS无法提交
            txtSort.Text          = model.sort_id.ToString();
            rblHide.SelectedValue = model.is_lock.ToString();
            ddlType.SelectedValue = model.type.ToString();
            txtContent.Value      = model.content;

            contentType = model.type;
        }
Beispiel #4
0
 /// <summary>
 /// 保存排序
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("plugin_lable", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.lable bll = new BLL.lable();
     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("index.aspx", "keywords={0}", this.keywords));
 }
Beispiel #5
0
 private bool DoEdit(int _id)
 {
     BLL.lable   bll   = new BLL.lable();
     Model.lable model = bll.GetModel(_id);
     model.title      = txtTitle.Text;
     model.call_index = txtName.Text;
     model.is_lock    = int.Parse(rblHide.SelectedValue);
     model.sort_id    = int.Parse(txtSort.Text);
     model.type       = int.Parse(ddlType.SelectedValue);
     model.content    = txtContent.Value;
     if (bll.Update(model))
     {
         AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改标签内容:" + model.title); //记录日志
         return(true);
     }
     return(false);
 }
Beispiel #6
0
        //验证名称
        private void validate(HttpContext context)
        {
            string lable_name     = DTRequest.GetString("param");
            string old_lable_name = DTRequest.GetString("old_name");

            if (string.IsNullOrEmpty(lable_name))
            {
                JsonHelper.WriteJson(context, new
                {
                    status = "n",
                    msg    = "名称不可为空!"
                });
                return;
            }
            if (lable_name.ToLower() == old_lable_name.ToLower())
            {
                JsonHelper.WriteJson(context, new
                {
                    status = "y",
                    msg    = "该名称可使用!"
                });
                return;
            }
            BLL.lable bll = new BLL.lable();
            if (bll.Exists(lable_name))
            {
                JsonHelper.WriteJson(context, new
                {
                    status = "y",
                    msg    = "该名称已被占用,请更换!"
                });
                return;
            }
            JsonHelper.WriteJson(context, new
            {
                status = "y",
                msg    = "该名称可使用!"
            });
            return;
        }
Beispiel #7
0
        private bool DoAdd()
        {
            BLL.lable   bll   = new BLL.lable();
            Model.lable model = new Model.lable();

            model.title      = txtTitle.Text;
            model.call_index = txtName.Text;
            model.is_lock    = int.Parse(rblHide.SelectedValue);
            model.sort_id    = int.Parse(txtSort.Text);
            model.type       = Utils.StrToInt(ddlType.SelectedValue, 0);
            model.content    = txtContent.Value;
            model.add_time   = DateTime.Now;
            //管理员
            DTcms.Model.manager adminModel = GetAdminInfo();
            model.user_name = adminModel.real_name;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "添加标签内容:" + model.title); //记录日志
                return(true);
            }
            return(false);
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BLL.lable bll     = new BLL.lable();
            string    _action = DTRequest.GetQueryString("action");

            if (!string.IsNullOrEmpty(_action) && _action == DTEnums.ActionEnum.Edit.ToString())
            {
                this.id     = DTRequest.GetQueryInt("id");
                this.action = DTEnums.ActionEnum.Edit.ToString();//修改类型

                if (id == 0)
                {
                    JscriptMsg("传输参数不正确!", "back");
                    return;
                }

                if (!bll.Exists(this.id))
                {
                    JscriptMsg("记录不存在或已被删除!", "back");
                    return;
                }
            }
            if (!Page.IsPostBack)
            {
                //检查权限
                ChkAdminLevel("plugin_lable", DTEnums.ActionEnum.Show.ToString());

                if (action == DTEnums.ActionEnum.Edit.ToString()) //修改
                {
                    ShowInfo(this.id);
                }
                else
                {
                    txtName.Attributes.Add("ajaxurl", "../tools/ajax.ashx?action=validate");
                }
            }
        }