//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("sys_usermanage", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.manager bll = new BLL.manager(); StringBuilder sb = new StringBuilder(); Model.manager manager = GetAdminInfo(); string result = string.Empty; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { result = bll.Delete(id, manager); if (string.IsNullOrEmpty(result)) { sucCount += 1; } else { errorCount += 1; sb.Append(result + "<br/>"); } } } JscriptMsg("共选择" + (sucCount + errorCount) + "条记录,成功" + sucCount + "条,失败" + errorCount + "条<br/>" + sb.ToString(), "manager_list.aspx", ""); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("manager_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.manager bll = new BLL.manager(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除管理员" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords)); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("sys_manager", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.manager bll = new BLL.manager(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked && GetAdminInfo().id != id) { bll.Delete(id); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords), "Success"); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("manager_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.wx_userweixin wBll = new BLL.wx_userweixin(); int sucCount = 0; int errorCount = 0; BLL.manager bll = new BLL.manager(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { int hasNum = wBll.GetUserWxNumCount(id); if (hasNum > 0) { JscriptMsg("该用户已经添加微信号,无法删除!", "back", "Error"); return; } } } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { int hasNum = wBll.GetUserWxNumCount(id); if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords), "Success"); }
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); }
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; }
private bool DoEdit(int _id) { int oldMaxNum = MyCommFun.Str2Int(hidOldMaxNum.Value); int newMaxNum = MyCommFun.Str2Int(ddlMaxNum.SelectedItem.Value); int addNewNum = newMaxNum - oldMaxNum; //新增的帐号 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 * addNewNum) { JscriptMsg("余额不足,请联系管理员充值!", "", "Error"); return(false); } } //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); bool result = false; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); 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 (txtPassword.Text.Trim() != "") { //获取用户已生成的salt作为密钥加密 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.wxNum = int.Parse(ddlMaxNum.SelectedItem.Value); model.qq = txtqq.Text; model.email = txtEmail.Text; model.province = prov; model.city = city; model.county = dist; model.sort_id = MyCommFun.Str2Int(txtSortid.Text); model.remark = txtRemark.Text; bool updateRet = bll.Update(model); if (updateRet && isAgent && addNewNum > 0) { int xfjine = addNewNum * agent.agentPrice.Value;//消费金额 agent.remainMony -= xfjine; agent.wcodeNum += newMaxNum; bool updateRet2 = aBll.Update(agent); if (updateRet2) { 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 = "原用户" + model.user_name + "新增了" + addNewNum + "个微帐号"; bill.moneyType = "扣减"; int addBillId = bBll.Add(bill); } else { bll.Delete(_id); updateRet = false; } } if (updateRet) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改用户:" + model.user_name); //记录日志 result = true; } return(result); }
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 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); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("manager_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限 bool isAgent = false; BLL.wx_agent_info aBll = new BLL.wx_agent_info(); Model.manager adminEntity = GetAdminInfo(); //取得管理员信息 Model.wx_agent_info agent = new Model.wx_agent_info(); if (adminEntity.agentLevel > 0) { isAgent = true; agent = aBll.GetAgentModel(adminEntity.id); } BLL.wx_userweixin wBll = new BLL.wx_userweixin(); int sucCount = 0; int errorCount = 0; BLL.manager bll = new BLL.manager(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { int hasNum = wBll.GetUserWxNumCount(id); if (hasNum > 0) { JscriptMsg("该用户已经添加微信号,无法删除!", "back", "Error"); return; } } } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { int hasNum = wBll.GetUserWxNumCount(id); if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } if (isAgent && agent != null) { //如果为代理商,则将起用户数量减掉 agent.userNum -= sucCount; aBll.Update(agent); } AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords), "Success"); }