protected void Page_Load(object sender, EventArgs e) { string _action = MXRequest.GetQueryString("action"); if (!string.IsNullOrEmpty(_action) && _action == MXEnums.ActionEnum.Edit.ToString()) { this.action = MXEnums.ActionEnum.Edit.ToString();//修改类型 id = MyCommFun.RequestInt("id"); if (id <= 0) { JscriptMsg("传输参数不正确!", "back", "Error"); return; } if (!mBll.Exists(this.id)) { JscriptMsg("记录不存在或已被删除!", "back", "Error"); return; } } if (!Page.IsPostBack) { BindDdlProvince(ddlProvince); BindDdlCity(ddlCity); ChkAdminLevel("agent_list", MXEnums.ActionEnum.View.ToString()); //检查权限 Model.manager model = GetAdminInfo(); //取得管理员信息 if (action == MXEnums.ActionEnum.Edit.ToString()) //修改 { ShowInfo(this.id); } } }
private void Username_validate(HttpContext context) { StreamReader stream = new StreamReader(context.Request.InputStream); string payload = stream.ReadToEnd(); JObject jo = JObject.Parse(payload); if (jo == null) { context.Response.Write("{\"status\": 0, \"msg\": \"ParameterIsNull\"}"); return; } string username = jo["username"].ToString(); //如果为Null,退出 if (string.IsNullOrEmpty(username)) { context.Response.Write("{\"status\": 0, \"msg\": \"UsernameIsNull\"}"); return; } BLL.manager bll = new BLL.manager(); //查询数据库 if (!bll.Exists(username.Trim())) { context.Response.Write("{\"status\": 0, \"msg\": \"UsernameNotExist\"}"); return; } context.Response.Write("{\"status\": 1, \"msg\": \"Success\"}"); return; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; BLL.manager mBll = new BLL.manager(); string action = context.Request.QueryString["action"]; switch (action) { case "adminusername": if (mBll.Exists(context.Request.QueryString["username"])) { context.Response.Write("{\"info\":\"该姓名已存在!\",\"status\":\"n\"}"); } else { context.Response.Write("{\"info\":\"验证通过!\",\"status\":\"y\"}"); } break; case "mobile": if (mBll.ExistsMobile(context.Request.Form["param"])) { context.Response.Write("{\"info\":\"该手机已存在!\",\"status\":\"n\"}"); } else { context.Response.Write("{\"info\":\"验证通过!\",\"status\":\"y\"}"); } break; } }
private bool DoAdd() { bool result = true; Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); if (bll.Exists(txtUserName.Text.Trim())) { JscriptMsg("该登录名已存在!", "", "Error"); return false; } model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; model.is_lock = int.Parse(rblIsLock.SelectedValue); model.user_name = txtUserName.Text.Trim(); model.user_pwd = DESEncrypt.Encrypt(txtUserPwd.Text.Trim()); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; model.start_date = txtStartDate.Text.Trim(); model.end_date = txtEndDate.Text.Trim(); if (bll.Add(model) < 1) { result = false; } return result; }
private bool DoAdd() { Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.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; var categoryList = new BLL.article_category().GetAllList(0); CheckBoxList cblControl = FindControl("field_control_category") as CheckBoxList; if (cblControl != null) { StringBuilder tempStr = new StringBuilder(); for (int i = 0; i < cblControl.Items.Count; i++) { if (cblControl.Items[i].Selected) { tempStr.Append(cblControl.Items[i].Value.Replace(',', ',') + ","); } } model.categorys = Utils.DelLastComma(tempStr.ToString()); } if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志 return(true); } return(false); }
private bool DoAdd() { //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.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; model.wxNum = int.Parse(txtMaxNum.Text); model.agentId = GetAdminInfo().id; model.qq = txtqq.Text; model.email = txtEmail.Text; model.reg_ip = MXRequest.GetIP(); model.province = prov; model.city = city; model.county = dist; model.sort_id = MyCommFun.Obj2Int(txtSortid.Text); if (bll.Add(model) > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志 return(true); } return(false); }
private bool DoAdd() { bool result = false; Model.teacher model = new Model.teacher(); BLL.teacher bll = new BLL.teacher(); model.no = txtNo.Text.Trim(); model.name = txtName.Text.Trim(); model.quota = txtQuota.Text.Trim(); model.email = txtEmail.Text.Trim(); model.direction = txtDirection.Text.Trim(); model.major = txtMajor.Text.Trim(); model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); model.is_aca = Utils.ObjectToStr(rblIsAca.SelectedValue); model.is_pro = Utils.ObjectToStr(rblIsPro.SelectedValue); model.pro_quota = txtProQuota.Text.Trim();; model.resquota = model.quota; model.pro_resquota = model.pro_quota; //该导师已经存在 if (bll.Exists(model.no)) { JscriptMsg("工号不能重复!", string.Empty); return(result); } if (bll.Add(model) > 0) { Model.manager manModel = new Model.manager(); BLL.manager manBll = new BLL.manager(); //不存在用户则进行提前加 if (!manBll.Exists(model.no)) { manModel.role_id = 3; manModel.role_type = new BLL.manager_role().GetModel(manModel.role_id).role_type; manModel.is_lock = 0; manModel.user_name = model.no; manModel.real_name = model.name; //获得6位的salt加密字符串 manModel.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 manModel.password = DESEncrypt.Encrypt(model.no + "123", manModel.salt); manModel.real_name = model.name; manModel.add_time = DateTime.Now; manBll.Add(manModel); } AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加导师" + model.name); //记录日志 result = true; } return(result); }
private bool DoAdd() { bool result = false; Model.student model = new Model.student(); BLL.student bll = new BLL.student(); model.no = txtNo.Text.Trim(); model.name = txtName.Text.Trim(); model.school = txtSchool.Text.Trim(); model.score = txtScore.Text.Trim(); model.re_score = txtReScore.Text.Trim(); model.attach = txtAttach.Text.Trim(); model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); model.is_aca = Utils.ObjectToStr(rblIsAca.SelectedValue); //该研究生已经存在 if (bll.Exists(model.no)) { JscriptMsg("编号不能重复!", string.Empty); return(result); } if (bll.Add(model) > 0) { Model.manager manModel = new Model.manager(); BLL.manager manBll = new BLL.manager(); //不存在用户则进行提前加 if (!manBll.Exists(model.no)) { manModel.role_id = 2; manModel.role_type = new BLL.manager_role().GetModel(manModel.role_id).role_type; manModel.is_lock = 0; manModel.user_name = model.no; manModel.real_name = model.name; //获得6位的salt加密字符串 manModel.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 manModel.password = DESEncrypt.Encrypt(model.no + "123", manModel.salt); manModel.real_name = model.name; manModel.add_time = DateTime.Now; manBll.Add(manModel); } AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加研究生" + model.name); //记录日志 result = true; } return(result); }
private bool DoAdd() { //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = ""; Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = 2; model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; model.is_lock = 0; //检测用户名是否重复 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 = ""; model.add_time = DateTime.Now; model.wxNum = 3; model.agentId = 1; model.qq = txtqq.Text; model.email = ""; model.reg_ip = MXRequest.GetIP(); model.province = prov; model.city = city; model.county = dist; model.sort_id = 99; if (bll.Add(model) > 0) { // mp.AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "注册用户:" + model.user_name); //记录日志 return(true); } return(false); }
private bool DoAdd() { Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } if (cbIsAudit.Checked == true) { model.is_audit = 1; } else { model.is_audit = 0; } //检测用户名是否重复 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.avatar = txtAvatar.Text.Trim(); 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(DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志 return(true); } return(false); }
private void manager_validate(HttpContext context) { string user_name = DTRequest.GetString("param"); if (string.IsNullOrEmpty(user_name)) { context.Response.Write("{ \"info\":\"请输入用户名\", \"status\":\"n\" }"); return; } BLL.manager bll = new BLL.manager(); if (bll.Exists(user_name)) { context.Response.Write("{ \"info\":\"用户名已被占用,请更换!\", \"status\":\"n\" }"); return; } context.Response.Write("{ \"info\":\"用户名可使用\", \"status\":\"y\" }"); return; }
private bool DoAdd() { Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.department_id = int.Parse(ddlDepartment.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; model.is_lock = cbIsLock.Checked ? 0 : 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 (!string.IsNullOrWhiteSpace(ddlLeader.SelectedValue)) { model.parent_id = Convert.ToInt32(ddlLeader.SelectedValue); } else { model.parent_id = null; } if (ddlDepartment.SelectedValue != "0") { model.is_default = 1; } if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志 SaveNotifictionSettings(context.dt_manager.Single(ma => ma.user_name == model.user_name).id); return(true); } return(false); }
protected void btnSubmit_Click(object sender, EventArgs e) { Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = 2;//普通用户 model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return; } 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; model.wxNum = 0; model.agentId = 1; if (model.user_name.Contains("admin")) { lblError.Text = "登录包含非法字符"; return; } lblError.Text = ""; if (bll.Add(model) > 0) { //成功 lblError.Text = ""; MessageBox.Show(this, "注册成功!请登录!"); // MessageBox.ShowAndRedirect(this,"注册成功!将跳转到登录页面。。。","/admin/login.aspx"); } else { //失败 MessageBox.Show(this, "注册失败!请重新注册,或者联系管理员!"); } }
private bool DoAdd() { Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.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(TWEnums.ActionEnum.Add.ToString(), "添加管理員:" + model.user_name); //記錄日誌 return(true); } return(false); }
protected void btnSubmit_Click(object sender, EventArgs e) { Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); string logName = txtUserName.Text.Trim(); string email = txtEmail.Text.Trim(); if (logName.Length == 0 || email.Length == 0 || logName.Contains("'") || email.Contains("'")) { MessageBox.Show(this, "登录名或者邮箱是非法的!"); return; } //检测用户名是否重复 if (!bll.Exists(logName, email)) { MessageBox.Show(this, "登录名或者邮箱输入错误!"); return; } model.user_name = logName; model.email = email; lblError.Text = ""; }
private bool DoAdd() { Model.manager adminEntity = GetAdminInfo(); //取得管理员信息 Model.wx_agent_info agent = new Model.wx_agent_info(); bool isAgent = false; if (adminEntity.agentLevel < 0) { return(false); } if (adminEntity.agentLevel > 0) { agent = aBll.GetAgentModel(adminEntity.id); isAgent = true; if (agent.remainMony < agent.agentPrice) { JscriptMsg("余额不足,请联系管理员充值!", "", "Error"); return(false); } } else { } //int oldMaxNum = MyCommFun.Str2Int(hidOldMaxNum.Value); int newMaxNum = MyCommFun.Str2Int(ddlMaxNum.SelectedItem.Value); //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.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; model.wxNum = newMaxNum; model.agentId = GetAdminInfo().id; model.qq = txtqq.Text; model.email = txtEmail.Text; model.reg_ip = MXRequest.GetIP(); model.province = prov; model.city = city; model.county = dist; model.sort_id = MyCommFun.Obj2Int(txtSortid.Text); model.agentLevel = -1; model.remark = txtRemark.Text; model.agentId = adminEntity.id; int addId = bll.Add(model); if (addId > 0 && isAgent) { int xfjine = newMaxNum * agent.agentPrice.Value;//消费金额 //是代理商 :缴费,扣除金额,增加消费记录 agent.remainMony -= xfjine; agent.userNum += 1; agent.wcodeNum += newMaxNum; bool updateRet = aBll.Update(agent); if (updateRet) { BLL.wx_manager_bill bBll = new BLL.wx_manager_bill(); Model.wx_manager_bill bill = new Model.wx_manager_bill(); bill.billMoney = xfjine; bill.managerId = agent.managerId; bill.operPersonId = agent.managerId; bill.operDate = DateTime.Now; bill.billUsed = "开通1个用户" + model.user_name + "的" + newMaxNum + "个微帐号"; bill.moneyType = "扣减"; int addBillId = bBll.Add(bill); } else { bll.Delete(addId); addId = 0; } } if (addId > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志 return(true); } return(false); }
private void manager_validate(HttpContext context) { string user_name = MXRequest.GetString("param"); if (string.IsNullOrEmpty(user_name)) { context.Response.Write("{ \"info\":\"请输入用户名\", \"status\":\"n\" }"); return; } BLL.manager bll = new BLL.manager(); if (bll.Exists(user_name)) { context.Response.Write("{ \"info\":\"用户名已被占用,请更换!\", \"status\":\"n\" }"); return; } context.Response.Write("{ \"info\":\"用户名可使用\", \"status\":\"y\" }"); return; }
private bool DoAdd() { Model.manager adminEntity = GetAdminInfo(); //取得管理员信息 Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); //固定为餐饮管理员的角色 model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; model.is_lock = MyCommFun.Str2Int(rblIsLock.SelectedValue); //检测用户名是否重复 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; model.wxNum = 0; model.agentId = GetAdminInfo().id; model.qq = string.Empty; model.email = txtEmail.Text; model.reg_ip = MXRequest.GetIP(); model.agentLevel = -1; model.remark = txtRemark.Text; model.agentId = adminEntity.id; int addId = bll.Add(model); if (addId > 0) { //添加商铺与管理人员的关联 BLL.wx_hotel_user hotelUserBll = new BLL.wx_hotel_user(); Model.wx_hotel_user hotelUser = new Model.wx_hotel_user(); hotelUser.ManagerId = addId; hotelUser.HotelId = hotelid; hotelUser.AdminId = GetAdminInfo().id; int addhotelAdminId = hotelUserBll.Add(hotelUser); if (addhotelAdminId <= 0) { bll.Delete(addId); addId = 0; } } if (addId > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加酒店管理员:" + model.user_name); //记录日志 return(true); } return(false); }
protected void btnImport_Click(object sender, EventArgs e) { StringBuilder errorMsg = new StringBuilder(); // 错误信息 try { #region 1.获取Excel文件并转换为一个List集合 // 1.1存放Excel文件到本地服务器 string filePath = Server.MapPath(txtImgUrl.Text.Trim()); // 保存文件并获取文件路径 // 单元格抬头 // key:实体对象属性名称,可通过反射获取值 // value:属性对应的中文注解 Dictionary <string, string> cellheader = new Dictionary <string, string> { { "No", "导师工号" }, { "Name", "姓名" }, { "IsAca", "是否为学术型导师" }, { "Quota", "学硕分配指标" }, { "IsPro", "是否为专业性导师" }, { "ProQuota", "专硕分配指标" }, { "Email", "邮箱" }, { "Direction", "研究方向" }, { "Major", "专业" }, { "Password", "密码" }, }; // 1.2解析文件,存放到一个List集合里 List <TeacherEntity> enlist = ExcelHelper.ExcelToEntityList <TeacherEntity>(cellheader, filePath, out errorMsg); #endregion var sucCount = 0; for (int i = 0; i < enlist.Count; i++) { TeacherEntity en = enlist[i]; string errorMsgStr = "第" + (i + 1) + "行数据检测异常:"; //未填写研究生编号 if (string.IsNullOrWhiteSpace(en.No)) { continue; } Model.teacher model = new Model.teacher(); BLL.teacher bll = new BLL.teacher(); //该研究生已经存在 if (bll.Exists(en.No)) { continue; } model.no = en.No; model.name = en.Name; model.quota = en.Quota; model.resquota = en.Quota; model.email = en.Email; model.direction = en.Direction; model.major = en.Major; model.is_aca = en.IsAca; model.is_pro = en.IsPro; model.pro_quota = en.ProQuota; model.pro_resquota = en.ProQuota; model.add_time = DateTime.Now; bll.Add(model); sucCount++; Model.manager manModel = new Model.manager(); BLL.manager manBll = new BLL.manager(); //该用户已经存在 if (manBll.Exists(en.No)) { continue; } manModel.role_id = 3; manModel.role_type = new BLL.manager_role().GetModel(manModel.role_id).role_type; manModel.is_lock = 0; manModel.user_name = en.No; manModel.real_name = en.Name; //获得6位的salt加密字符串 manModel.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 manModel.password = DESEncrypt.Encrypt(en.Password, manModel.salt); manModel.real_name = en.Name; manModel.add_time = DateTime.Now; manBll.Add(manModel); } //context.Response.Write("{\"status\": 1, \"msg\": \"导入成功!\"}"); JscriptMsg("导入成功" + sucCount + "条", Utils.CombUrlTxt("teacher_list.aspx", "keywords={0}&property={1}", this.keywords, this.property)); } catch (Exception ex) { throw ex; } }
private bool DoAdd() { //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.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; model.wxNum = int.Parse(txtMaxNum.Text); model.agentId = GetAdminInfo().id; model.qq = txtqq.Text; model.email = txtEmail.Text; model.reg_ip = MXRequest.GetIP(); model.province = prov; model.city = city; model.county = dist; model.sort_id=MyCommFun.Obj2Int(txtSortid.Text); if (bll.Add(model) > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志 return true; } return false; }
private bool DoAdd() { Model.manager adminEntity = GetAdminInfo(); //取得管理员信息 Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); //固定为餐饮管理员的角色 model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; model.is_lock = MyCommFun.Str2Int(rblIsLock.SelectedValue); //检测用户名是否重复 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; model.wxNum = 0; model.agentId = GetAdminInfo().id; model.qq = string.Empty; model.email = txtEmail.Text; model.reg_ip = MXRequest.GetIP(); model.agentLevel = -1; model.remark = txtRemark.Text; model.agentId = adminEntity.id; int addId = bll.Add(model); if (addId > 0) { //添加商铺与管理人员的关联 BLL.wx_hotel_user hotelUserBll = new BLL.wx_hotel_user(); Model.wx_hotel_user hotelUser = new Model.wx_hotel_user(); hotelUser.ManagerId = addId; hotelUser.HotelId = hotelid; hotelUser.AdminId = GetAdminInfo().id; int addhotelAdminId = hotelUserBll.Add(hotelUser); if (addhotelAdminId <= 0) { bll.Delete(addId); addId = 0; } } if (addId > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加酒店管理员:" + model.user_name); //记录日志 return true; } return false; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; BLL.users userBll = new BLL.users(); BLL.manager mBll = new BLL.manager(); Model.users user = null; string action = context.Request.QueryString["action"]; DataTable dt = null; BLL.BarCode bllBar = null; switch (action) { case "username": if (userBll.Exists(context.Request.QueryString["username"])) { context.Response.Write("false"); } else { context.Response.Write("true"); } break; case "adminusername": if (mBll.Exists(context.Request.QueryString["username"])) { context.Response.Write("false"); } else { context.Response.Write("true"); } break; case "tel": if (userBll.ExistsMobile(context.Request.Form["param"])) { context.Response.Write("{\"info\":\"该手机已存在!\",\"status\":\"n\"}"); } else { context.Response.Write("{\"info\":\"" + context.Request.Form["param"] + "为新用户,成功累计积分后系统自动注册为正式会员,默认密码为123456\",\"status\":\"y\"}"); } break; case "tel2": if (userBll.ExistsMobile(context.Request.QueryString["tel"])) { context.Response.Write("false"); } else { context.Response.Write("true"); } break; case "IntegralCode": bllBar = new BLL.BarCode(); DataSet ds = null; ds = bllBar.QueryIntegralCode(context.Request.Form["param"]); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && Convert.ToInt32(ds.Tables[0].Rows[0]["state"]) < 4) { context.Response.Write("{\"info\":\"验证通过!\",\"status\":\"y\"}"); } else { context.Response.Write("{\"info\":\"该积分码不存在或已兑换!\",\"status\":\"n\"}"); } break; case "UserIntegralCode": bllBar = new BLL.BarCode(); ds = bllBar.QueryIntegralCode(context.Request.QueryString["IntegralCode"]); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && Convert.ToInt32(ds.Tables[0].Rows[0]["state"]) < 4) { context.Response.Write("true"); } else { context.Response.Write("false"); } break; case "Username": BLL.users bll = new BLL.users(); //查询数据库 if (!bll.Exists(context.Request.QueryString["Username"])) { context.Response.Write("true"); } else { context.Response.Write("false"); } break; case "Exit": context.Session[DTKeys.SESSION_USER_INFO] = null; break; case "SearchLogisticsCode": bllBar = new BLL.BarCode(); dt = bllBar.GetBarCodeByLogisticsCode(context.Request.QueryString["LogisticsCode"]); if (dt != null) { IsoDateTimeConverter timeFormat2 = new IsoDateTimeConverter(); timeFormat2.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; context.Response.Write(JsonConvert.SerializeObject(dt, timeFormat2)); } else { context.Response.Write("false"); } break; case "SearchIntegralCode": bllBar = new BLL.BarCode(); dt = bllBar.GetBarCodeByIntegralCode(context.Request.QueryString["IntegralCode"]); if (dt != null) { IsoDateTimeConverter timeFormat2 = new IsoDateTimeConverter(); timeFormat2.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; context.Response.Write(JsonConvert.SerializeObject(dt, timeFormat2)); } else { context.Response.Write("false"); } break; case "State": context.Response.Write(Convert.ToInt32(context.Request.QueryString["State"]).ToEnumDescriptionString(typeof(EnumList.StateList))); break; case "OrderState": context.Response.Write(Convert.ToInt32(context.Request.QueryString["State"]).ToEnumDescriptionString(typeof(EnumList.OrderState))); break; //更换头像之后替换用户信息session case "Avatar": user = context.Session[DTKeys.SESSION_USER_INFO] as Model.users; user = userBll.GetModel(user.user_name); context.Session[DTKeys.SESSION_USER_INFO] = user; break; } }
private bool DoAdd() { //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = ""; Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = 2; model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; model.is_lock = 0; //检测用户名是否重复 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 =""; model.add_time = DateTime.Now; model.wxNum = 3; model.agentId = 1; model.qq = txtqq.Text; model.email = ""; model.reg_ip = MXRequest.GetIP(); model.province = prov; model.city = city; model.county = dist; model.sort_id = 99; if (bll.Add(model) > 0) { // mp.AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "注册用户:" + model.user_name); //记录日志 return true; } return false; }
private bool DoAdd() { Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.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(DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志 return true; } return false; }
protected void btnImport_Click(object sender, EventArgs e) { StringBuilder errorMsg = new StringBuilder(); // 错误信息 try { #region 1.获取Excel文件并转换为一个List集合 // 1.1存放Excel文件到本地服务器 string filePath = Server.MapPath(txtImgUrl.Text.Trim()); // 保存文件并获取文件路径 // 单元格抬头 // key:实体对象属性名称,可通过反射获取值 // value:属性对应的中文注解 Dictionary <string, string> cellheader = new Dictionary <string, string> { { "No", "编号" }, { "Name", "姓名" }, { "School", "本科毕业院校" }, { "Score", "笔试成绩" }, { "ReScore", "复试成绩" }, { "IsAca", "是否为学术型研究生" }, }; // 1.2解析文件,存放到一个List集合里 List <StudentEntity> enlist = ExcelHelper.ExcelToEntityList <StudentEntity>(cellheader, filePath, out errorMsg); #endregion var sucCount = 0; for (int i = 0; i < enlist.Count; i++) { StudentEntity en = enlist[i]; string errorMsgStr = "第" + (i + 1) + "行数据检测异常:"; //未填写研究生编号 if (string.IsNullOrWhiteSpace(en.No)) { continue; } Model.student model = new Model.student(); BLL.student bll = new BLL.student(); //该研究生已经存在 if (bll.Exists(en.No)) { continue; } model.no = en.No; model.name = en.Name; model.school = en.School; model.score = en.Score; model.re_score = en.ReScore; model.is_aca = en.IsAca; model.add_time = DateTime.Now; bll.Add(model); sucCount++; Model.manager manModel = new Model.manager(); BLL.manager manBll = new BLL.manager(); //该用户已经存在 if (manBll.Exists(en.No)) { continue; } manModel.role_id = 2; manModel.role_type = new BLL.manager_role().GetModel(manModel.role_id).role_type; manModel.is_lock = 0; manModel.user_name = en.No; manModel.real_name = en.Name; //获得6位的salt加密字符串 manModel.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 manModel.password = DESEncrypt.Encrypt(en.No + "123", manModel.salt); manModel.real_name = en.Name; manModel.add_time = DateTime.Now; manBll.Add(manModel); } //context.Response.Write("{\"status\": 1, \"msg\": \"导入成功!\"}"); JscriptMsg("导入成功" + sucCount + "条", Utils.CombUrlTxt("student_list.aspx", "keywords={0}&property={1}", this.keywords, this.property)); } catch (Exception ex) { throw ex; } }
private bool DoAdd() { Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.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 = Vincent._DTcms.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 (model.role_id == 3)//酒厂 { model.brand_id = int.Parse(ddlBrandId.SelectedValue); } model.str_code = this.provinces1.Value; model.str_code_rage = this.city1.Value; //else if (model.role_id == 4)//经销商 //{ // model.str_code = txtStrCode.Text; // model.str_code_rage = txtCodeRage.Text; // model.winery_id=int.Parse(ddlWineryId.SelectedValue); // BuysingooShop.Model.manager manModel = new BuysingooShop.BLL.manager().GetModel(model.winery_id); // if (manModel != null) // { // model.brand_id = manModel.brand_id; // } //} //else if(model.role_id==5)//设计师 //{ // model.age = int.Parse(txtAge.Text); // model.workAge = int.Parse(txtWorkAge.Text); // model.img_url = txtImgUrl.Text; // model.remark = txtRemark.Text; // model.QQ = txtQQ.Text; // if (txtStyle.Text != "") // { // model.style = txtStyle.Text; // } //} if (bll.Add(model) > 0) { AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志 return(true); } return(false); }