/// <summary> /// 保存操作 /// </summary> protected void btnSend_Click(object sender, EventArgs e) { Test_BUL.sys_admin bulAdmin = new Test_BUL.sys_admin(); Test_Model.sys_admin modeladmin = new Test_Model.sys_admin(); string tempCount = this.txtcount.Value.Trim(); DataSet temds = common.GetList(" select [count] FROM tb_sys_admin where [count]='" + tempCount + "' "); if (Tools.Validator.CheckDataSet(temds, 0)) { FinalMessage("此账号已经存在,请更换!", "Add_SysUser.aspx", 1); } modeladmin.count = tempCount; modeladmin.password = EncryptAdmin(this.txtPwd.Text.Trim()); modeladmin.loginIP = GetUserIp; modeladmin.loginTime = null; modeladmin.telephone = this.txtTelephone.Value.Trim(); modeladmin.email = this.txtEmail.Value.Trim(); modeladmin.sex = Tools.StringHelp.GetInt(this.rbSex.SelectedValue) == 1 ? true : false; modeladmin.birthday = Tools.StringHelp.GetDateTime(this.txtBirthday.Value.Trim()); modeladmin.createTime = DateTime.Now; modeladmin.roleid = Tools.StringHelp.GetInt(this.ddlRole.SelectedValue); modeladmin.AccountState = 10; modeladmin.PowerLeave = this.ddlPowerLeave.SelectedValue; //判断超管标记 if (adminGetadminTag == Test_BUL.sysParam.AdministratorTagH) { if (this.Page.FindControl("chkIsAdmin") != null && this.chkIsAdmin.Checked == true) { modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagH);//符合条件 } else { modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagN);//普通的系统用户 } } else { modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagN);//当前用户不具有添加超管的权限 } if (bulAdmin.Add(modeladmin) > 0) { Response.Redirect("Manage_SysUser.aspx"); } else { FinalMessage("新增用户失败!", "Add_SysUser.aspx", 1); } }
/// <summary> /// 绑定页面数据 /// </summary> private void BindData() { if (!Tools.Validator.IsPositiveInt(q("id")) || Tools.RequestCheck.CheckKeyWord(q("id"))) FinalMessage("UTL解析错误,请勿在Url中添加非法关键词!", "Manage_Page.aspx", 1); modeladmin = bulAdmin.GetModel(int.Parse(q("id"))); if (modeladmin != null) { this.chkIsAdmin.Checked = (modeladmin.adminTag == int.Parse(Test_BUL.sysParam.AdministratorTagH)) ? true : false;//超管选中标记 this.txtcount.Value = modeladmin.count; Tools.WebControl.SetSelectedList(this.ddlRole, modeladmin.roleid.ToString()); Tools.WebControl.SetSelectedList(this.ddlPowerLeave, modeladmin.PowerLeave.ToString()); this.txtTelephone.Value = modeladmin.telephone; Tools.WebControl.SeRadioButtonList(this.rbSex, (modeladmin.sex == true ? "1" : "0")); this.txtBirthday.Value = Tools.StringHelp.GetDateTime(modeladmin.birthday).ToString("yyyy-MM-dd"); this.txtEmail.Value = modeladmin.email; } }
/// <summary> /// 绑定页面数据 /// </summary> private void BindData() { if (!Tools.Validator.IsPositiveInt(q("id")) || Tools.RequestCheck.CheckKeyWord(q("id"))) { FinalMessage("UTL解析错误,请勿在Url中添加非法关键词!", "Manage_Page.aspx", 1); } modeladmin = bulAdmin.GetModel(int.Parse(q("id"))); if (modeladmin != null) { this.chkIsAdmin.Checked = (modeladmin.adminTag == int.Parse(Test_BUL.sysParam.AdministratorTagH)) ? true : false;//超管选中标记 this.txtcount.Value = modeladmin.count; Tools.WebControl.SetSelectedList(this.ddlRole, modeladmin.roleid.ToString()); Tools.WebControl.SetSelectedList(this.ddlPowerLeave, modeladmin.PowerLeave.ToString()); this.txtTelephone.Value = modeladmin.telephone; Tools.WebControl.SeRadioButtonList(this.rbSex, (modeladmin.sex == true ? "1" : "0")); this.txtBirthday.Value = Tools.StringHelp.GetDateTime(modeladmin.birthday).ToString("yyyy-MM-dd"); this.txtEmail.Value = modeladmin.email; } }
/// <summary> /// 保存操作 /// </summary> protected void btnSend_Click(object sender, EventArgs e) { Test_BUL.sys_admin bulAdmin = new Test_BUL.sys_admin(); Test_Model.sys_admin modeladmin = new Test_Model.sys_admin(); string tempCount = this.txtcount.Value.Trim(); DataSet temds = common.GetList(" select [count] FROM tb_sys_admin where [count]='" + tempCount + "' "); if (Tools.Validator.CheckDataSet(temds, 0)) FinalMessage("此账号已经存在,请更换!", "Add_SysUser.aspx", 1); modeladmin.count = tempCount; modeladmin.password = EncryptAdmin(this.txtPwd.Text.Trim()); modeladmin.loginIP = GetUserIp; modeladmin.loginTime = null; modeladmin.telephone = this.txtTelephone.Value.Trim(); modeladmin.email = this.txtEmail.Value.Trim(); modeladmin.sex = Tools.StringHelp.GetInt(this.rbSex.SelectedValue) == 1 ? true : false; modeladmin.birthday = Tools.StringHelp.GetDateTime(this.txtBirthday.Value.Trim()); modeladmin.createTime = DateTime.Now; modeladmin.roleid = Tools.StringHelp.GetInt(this.ddlRole.SelectedValue); modeladmin.AccountState = 10; modeladmin.PowerLeave = this.ddlPowerLeave.SelectedValue; //判断超管标记 if (adminGetadminTag == Test_BUL.sysParam.AdministratorTagH) { if (this.Page.FindControl("chkIsAdmin") != null && this.chkIsAdmin.Checked == true) modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagH);//符合条件 else modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagN);//普通的系统用户 } else modeladmin.adminTag = int.Parse(Test_BUL.sysParam.AdministratorTagN);//当前用户不具有添加超管的权限 if (bulAdmin.Add(modeladmin) > 0) Response.Redirect("Manage_SysUser.aspx"); else FinalMessage("新增用户失败!", "Add_SysUser.aspx", 1); }