//验证名称 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; }
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"); } } }