示例#1
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.plugin_lable bll   = new BLL.plugin_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);
            }
        }
示例#2
0
        // 批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("plugin_lable", DTEnums.ActionEnum.Delete.ToString());
            BLL.plugin_lable bll = new BLL.plugin_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.Delete.ToString(), "删除标签内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("成功删除 " + sucCount + " 条,失败 " + errorCount + " 条!", Utils.CombUrlTxt("index.aspx", "keywords={0}", this.keywords));
        }
示例#3
0
        //赋值操作
        private void ShowInfo(int _id)
        {
            BLL.plugin_lable   bll   = new BLL.plugin_lable();
            Model.plugin_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();
            txtSort.Text          = model.sort_id.ToString();
            rblHide.SelectedValue = model.is_lock.ToString();
            ddlType.SelectedValue = model.type.ToString();
            txtContent.Value      = model.content;

            contentType = model.type;
        }
示例#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.plugin_lable bll = new BLL.plugin_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));
 }
示例#5
0
 //修改操作
 private bool DoEdit(int _id)
 {
     BLL.plugin_lable   bll   = new BLL.plugin_lable();
     Model.plugin_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);
 }
示例#6
0
 //增加操作
 private bool DoAdd()
 {
     BLL.plugin_lable   bll   = new BLL.plugin_lable();
     Model.plugin_lable model = new Model.plugin_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;
     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);
 }
示例#7
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",
                    info   = "名称不可为空!"
                });
                return;
            }
            if (lable_name.ToLower() == old_lable_name.ToLower())
            {
                JsonHelper.WriteJson(context, new
                {
                    status = "y",
                    info   = "该名称可使用!"
                });
                return;
            }
            BLL.plugin_lable bll = new BLL.plugin_lable();
            if (bll.Exists(lable_name))
            {
                JsonHelper.WriteJson(context, new
                {
                    status = "n",
                    info   = "该名称已被占用,请更换!"
                });
                return;
            }
            JsonHelper.WriteJson(context, new
            {
                status = "y",
                info   = "该名称可使用!"
            });
            return;
        }