private bool DoAdd() { //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); string agentArea = txtagentArea.Text.Trim(); Model.manager model = new Model.manager(); model.role_id = 3; //代理商的角色id model.role_type = 2; //系统用户,有区别与admin if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } //检测用户名是否重复 if (mBll.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.agentId = GetAdminInfo().id; model.agentLevel = 1;//说明为代理商 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.remark = txtRemark.Text; //代理商的基本信息 Model.wx_agent_info agentinfo = new Model.wx_agent_info(); int managerId = mBll.Add(model); if (managerId > 0) { agentinfo.managerId = managerId; agentinfo.agentPrice = MyCommFun.Str2Int(txtagentPrice.Text.Trim()); agentinfo.sqJine = MyCommFun.Str2Int(txtsqJine.Text.Trim()); agentinfo.czTotMoney = 0; agentinfo.remainMony = 0; agentinfo.companyInfo = txtcompanyName.Text; agentinfo.agentType = MyCommFun.Str2Int(ddlagentType.SelectedItem.Value); agentinfo.agentLevel = ddlagentLevel.SelectedItem.Value; agentinfo.agentArea = agentArea; agentinfo.industry = txtindustry.Text.Trim(); agentinfo.userNum = 0; agentinfo.wcodeNum = 0; agentinfo.createDate = DateTime.Now; agentinfo.expiryDate = DateTime.Parse("2100-12-1"); int agentid = aBll.Add(agentinfo); if (agentid > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加代理商基本信息:" + model.user_name); //记录日志 return(true); } else { mBll.Delete(managerId); } } return(false); }