private void manager_validate(HttpContext context) { string user_name = OSRequest.GetString("param"); if (string.IsNullOrEmpty(user_name)) { context.Response.Write("{ \"info\":\"请输入用户名\", \"status\":\"n\" }"); return; } BLL.managers.manager bll = new BLL.managers.manager(); if (bll.Exists(user_name)) { context.Response.Write("{ \"info\":\"用户名已被占用,请更换!\", \"status\":\"n\" }"); return; } context.Response.Write("{ \"info\":\"用户名可使用\", \"status\":\"y\" }"); return; }
private bool DoAdd() { Model.managers.manager model = new Model.managers.manager(); BLL.managers.manager bll = new BLL.managers.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.managers.manager_role().GetModel(model.role_id).role_type; if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return(false); } model.user_name = txtUserName.Text.Trim(); //获得6位的salt加密字符串 model.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; if (bll.Add(model) > 0) { AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志 return(true); } return(false); }
private void manager_validate(HttpContext context) { string user_name = OSRequest.GetString("param"); if (string.IsNullOrEmpty(user_name)) { context.Response.Write("{ \"info\":\"请输入用户名\", \"status\":\"n\" }"); return; } BLL.managers.manager bll = new BLL.managers.manager(); if (bll.Exists(user_name)) { context.Response.Write("{ \"info\":\"用户名已被占用,请更换!\", \"status\":\"n\" }"); return; } context.Response.Write("{ \"info\":\"用户名可使用\", \"status\":\"y\" }"); return; }
private bool DoAdd() { Model.managers.manager model = new Model.managers.manager(); BLL.managers.manager bll = new BLL.managers.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.managers.manager_role().GetModel(model.role_id).role_type; if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return false; } model.user_name = txtUserName.Text.Trim(); //获得6位的salt加密字符串 model.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; if (bll.Add(model) > 0) { AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志 return true; } return false; }