public void GetManagerInfo() { var managerService = new ManagerInfoService(); var model = managerService.GetModel(1); Assert.IsTrue(true); }
private void ShowInfo(int _id) { var bll = new ManagerInfoService(); var model = bll.GetModel(_id); lblUserName.Text = model.UserName; }
/// <summary> /// 判断管理员是否已经登录(解决Session超时问题) /// </summary> public bool IsAdminLogin() { //如果Session为Null if (Session[SystemKeys.SESSION_ADMIN_INFO] != null) { return true; } else { //检查Cookies var adminname = Utils.GetCookie("AdminName", "WeiXinPF"); var adminpwd = Utils.GetCookie("AdminPwd", "WeiXinPF"); if (adminname != "" && adminpwd != "") { var service = new ManagerInfoService(); var model = service.GetModel(adminname, adminpwd); if (model != null) { Session[SystemKeys.SESSION_ADMIN_INFO] = model; return true; } } } return false; }
private bool DoEdit() { int _id = MyCommFun.Str2Int(lblid.Text); //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); bool result = false; var managerService = new ManagerInfoService(); var model = managerService.GetModel(_id); model.RealName = txtRealName.Text.Trim(); model.Telephone = txtTelephone.Text.Trim(); model.Email = txtEmail.Text.Trim(); model.QQ = txtqq.Text; model.Email = txtEmail.Text; model.Province = prov; model.City = city; model.County = dist; if (managerService.Update(model)) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改个人资料:" + model.UserName); //记录日志 result = true; } return result; }
protected void Page_Load(object sender, EventArgs e) { uid = MyCommFun.RequestInt("uid", 0); //添加,则需要判断可以添加的微信号数量 if (uid == 0) { JscriptMsg("参数不正确!", "back", "Error"); return; } if (IsChaoGuoWxNum()) { JscriptMsg("该用户微账号的数量已满,无法添加!", "back", "Error"); return; } if (!Page.IsPostBack) { ChkAdminLevel("wcodemgr", MXEnums.ActionEnum.View.ToString()); //检查权限 txtEndData.Text = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd"); var mBll = new ManagerInfoService(); var user = mBll.GetModel(uid); lblUserName.Text = user.UserName + " " + user.RealName; } }
private void RptBind(string _strWhere, string _orderby) { this.page = MXRequest.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; var bll = new ManagerInfoService(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("manager_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
protected void Page_Load(object sender, EventArgs e) { #if DEBUG var bll = new ManagerInfoService(); var model = bll.GetModel("ht", "123456", true); if (model == null) { //msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } Session[SystemKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; #endif hotelid = this.GetHotelId(); wid = 1;//this.GetWeiXinCode().id; confirmnumber.CausesValidation = true; }
public void Add() { var managerInfo = new ManagerInfo { Email = "*****@*****.**", Salt = "yidane", UserName = "******", AddTime = DateTime.Now, AgentId = 1, AgentLevel = -1, City = "北京", County = "西三旗", Province = "北京" }; var managerInfoService = new ManagerInfoService(); var managerInfoId = managerInfoService.Add(managerInfo); Assert.IsTrue(managerInfoId > 0); }
private void ShowInfo(int _id) { lblid.Text = _id.ToString(); var managerService = new ManagerInfoService(); var model = managerService.GetModel(_id); lblUserName.Text = model.UserName; txtRealName.Text = model.RealName; txtTelephone.Text = model.Telephone; txtEmail.Text = model.Email; txtqq.Text = model.QQ; ddlProvince.SelectedValue = model.Province; ddlCity.SelectedValue = model.City; txtArea.Text = model.County; }
protected void Page_Load(object sender, EventArgs e) { bll = new AppInfoService(); this.keywords = MXRequest.GetQueryString("keywords"); this.uid = MyCommFun.RequestInt("id", 0); if (this.uid == 0) { JscriptMsg("传输参数不正确!", "back", "Error"); return; } this.pageSize = GetPageSize(10); //每页数量 if (!Page.IsPostBack) { var mBll = new ManagerInfoService(); var user = mBll.GetModel(uid); lblUserName.Text = "[" + user.UserName + " " + user.RealName + "]"; ChkAdminLevel("wcodemgr", MXEnums.ActionEnum.View.ToString()); //检查权限 RptBind(CombSqlTxt(keywords), "wStatus desc, createDate desc"); } }
public void AddAdmin() { var managerInfo = new ManagerInfo { Email = "*****@*****.**", RealName = "超级管理员", Salt = "28LH48", UserName = "******", Password = "******", AddTime = DateTime.Now, AgentId = 1, AgentLevel = -1, City = "北京", County = "西三旗", Province = "北京", WxNum = 100 }; var managerInfoService = new ManagerInfoService(); var managerInfoId = managerInfoService.Add(managerInfo); Assert.IsTrue(managerInfoId > 0); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { var bll = new ManagerInfoService(); var model = GetAdminInfo(); if (DESEncrypt.Encrypt(txtOldPassword.Text.Trim(), model.Salt) != model.Password) { JscriptMsg("旧密码不正确!", "", "Warning"); return; } if (txtPassword.Text.Trim() != txtPassword1.Text.Trim()) { JscriptMsg("两次密码不一致!", "", "Warning"); return; } model.Password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.Salt); if (!bll.Update(model)) { JscriptMsg("保存过程中发生错误!", "", "Error"); return; } Session[SystemKeys.SESSION_ADMIN_INFO] = null; JscriptMsg("密码修改成功!", "manager_pwd.aspx", "Success"); }
private void manager_validate(HttpContext context) { string user_name = MXRequest.GetString("param"); if (string.IsNullOrEmpty(user_name)) { context.Response.Write("{ \"info\":\"请输入用户名\", \"status\":\"n\" }"); return; } var bll = new ManagerInfoService(); if (bll.Exists(user_name)) { context.Response.Write("{ \"info\":\"用户名已被占用,请更换!\", \"status\":\"n\" }"); return; } context.Response.Write("{ \"info\":\"用户名可使用\", \"status\":\"y\" }"); return; }
/// <summary> /// 获取订单状态 /// </summary> /// <param name="order"></param> private void GetOrderStatusMsg(GetHotelOrderResponse order) { orderStatus = order.OrderStatus; //支付状态下默认退款金额为订单总额 if (orderStatus == HotelStatusManager.OrderStatus.Payed.StatusId) { var result = GetPrice(order); txtAmount.Text = result.ToString(); if (isAdmin) { hidConfirmStr.Value = "确定执行【退款】操作吗?"; // WHEN 0 THEN ''未支付'' // WHEN 1 THEN ''已支付'' // WHEN 2 THEN ''已使用'' // WHEN 3 THEN ''申请退款'' // WHEN 4 THEN ''已退款'' if (_listCode != null && _listCode.Any(c => c.Status == 2))//订单中有验证码已使用 { hidConfirmStr.Value = string.Format("{0},{1}", "订单中有验证码已使用", hidConfirmStr.Value); } } } else if (orderStatus == HotelStatusManager.OrderStatus.Refunding.StatusId || orderStatus == HotelStatusManager.OrderStatus.Refunded.StatusId) { var request = new GetRefundOrderRequest() { OrderId = order.Id, HotelId = order.HotelId }; var response = BusHelper.Send<GetRefundOrderResponse>(request); RefundOrder = response.RefundOrder; if (RefundOrder != null && RefundOrder.OperateUser > 0) { var managerInfoService = new ManagerInfoService(); var manager = managerInfoService.GetModel(RefundOrder.OperateUser); uName = manager.RealName; var managerRoleService = new ManagerRoleService(); roleName = managerRoleService.GetTitle(manager.RoleId); } } }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("manager_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限 bool isAgent = false; var aBll = new WXAgentService(new AgentRepository()); var adminEntity = GetAdminInfo(); //取得管理员信息 var agent = new AgentInfo(); if (adminEntity.AgentLevel > 0) { isAgent = true; agent = aBll.GetAgentModel(adminEntity.Id); } var wBll = new AppInfoService(); int sucCount = 0; int errorCount = 0; var bll = new ManagerInfoService(); 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"); }
private bool DoEdit(int _id) { int oldMaxNum = MyCommFun.Str2Int(hidOldMaxNum.Value); int newMaxNum = MyCommFun.Str2Int(ddlMaxNum.SelectedItem.Value); int addNewNum = newMaxNum - oldMaxNum; //新增的帐号 var adminEntity = GetAdminInfo(); //取得管理员信息 var agent = new AgentInfo(); 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; var bll = new ManagerInfoService(); var model = bll.GetModel(_id); model.RoleId = int.Parse(ddlRoleId.SelectedValue); model.RoleType = new ManagerRoleService().GetModel(model.RoleId).RoleType; if (cbIsLock.Checked == true) { model.IsLock = 0; } else { model.IsLock = 1; } //判断密码是否更改 if (txtPassword.Text.Trim() != "") { //获取用户已生成的salt作为密钥加密 model.Password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.Salt); } model.RealName = 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.SortId = 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) { var bBll = new WXManagerBillService(new ManagerBillRepository()); var bill = new ManagerBillInfo { BillMoney = xfjine, ManagerId = agent.ManagerId, OperPersonId = agent.ManagerId, OperDate = DateTime.Now, BillUsed = "原用户" + model.UserName + "新增了" + addNewNum + "个微帐号", MoneyType = "扣减" }; int addBillId = bBll.Add(bill); } else { bll.Delete(_id); updateRet=false; } } if (updateRet) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改用户:" + model.UserName); //记录日志 result = true; } return result; }
private bool DoAdd() { string strErr = ""; if (this.txtwxName.Text.Trim().Length == 0) { strErr += "公众帐号名称不能为空!"; } if (this.txtwxId.Text.Trim().Length == 0) { strErr += "公众号原始id不能为空!"; } if (this.txtweixinCode.Text.Trim().Length == 0) { strErr += "微信号不能为空!"; } if (this.txtwxToken.Text.Trim().Length == 0) { strErr += "TOKEN值不能为空!"; } if (this.txtEndData.Text.Trim().Length == 0) { strErr += "到期时间不能为空!"; } if (strErr != "") { JscriptMsg(strErr, "back", "Error"); return false; } var manager = GetAdminInfo(); int uId = manager.Id; string wxName = this.txtwxName.Text; string wxId = this.txtwxId.Text; string weixinCode = this.txtweixinCode.Text; string wxPwd = ""; string headerpic = this.txtImgUrl.Text; string apiurl = ""; string wxToken = this.txtwxToken.Text; string wxProvince = ""; string wxCity = ""; string AppId = this.txtAppId.Text; string AppSecret = this.txtAppSecret.Text; DateTime createDate = DateTime.Now; DateTime endDate = MyCommFun.Obj2DateTime(txtEndData.Text); var model = new AppInfo { UId = this.uid, WxName = wxName, WxId = wxId, YixinId = "", WxCode = weixinCode, WxPwd = wxPwd, Headerpic = headerpic, Apiurl = apiurl, WxToken = wxToken, WxProvince = wxProvince, WxCity = wxCity, AppId = AppId, AppSecret = AppSecret, AccessToken = "", OpenIdStr = "", CreateDate = createDate, EndDate = endDate, WenziMaxNum = -1, TuwenMaxNum = -1, YuyinMaxNum = -1, WenziDefineNum = 0, TuwenDefineNum = 0, YuyinDefineNum = 0, RequestTtNum = 0, RequestUsedNum = 0, SmsTtNum = 0, SmsUsedNum = 0, IsDelete = false, WStatus = true, Remark = "", Seq = 99 }; //-1为无限制 if (IsChaoGuoWxNum()) { return false; } int wId = bll.Add(model); if (wId > 0) { Object obj = ConfigurationManager.AppSettings["industry_defaultAdd"]; if (obj != null && obj.ToString() == "true") { //为微账户添加行业默认模块 var mBll = new ManagerInfoService(); var idBll = new IndustryDefaultModuleService(new IndustryDefaultModuleRepository()); var user = mBll.GetModel(uid); int roleid = user.RoleId; idBll.addMouduleByRoleid(roleid, wId, new ArticleCategoryRepository(siteConfig.sysdatabaseprefix)); } AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加微信号,主键为:" + model.Id + ",微信号为:" + model.WxCode); //记录日志 return true; } return false; }
private bool DoAdd() { var adminEntity = GetAdminInfo(); //取得管理员信息 var agent = new AgentInfo(); 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(); var model = new ManagerInfo(); var bll = new ManagerInfoService(); model.RoleId = int.Parse(ddlRoleId.SelectedValue); model.RoleType = new ManagerRoleService().GetModel(model.RoleId).RoleType; if (cbIsLock.Checked == true) { model.IsLock = 0; } else { model.IsLock = 1; } //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return false; } model.UserName = txtUserName.Text.Trim(); //获得6位的salt加密字符串 model.Salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.Password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.Salt); model.RealName = txtRealName.Text.Trim(); model.Telephone = txtTelephone.Text.Trim(); model.Email = txtEmail.Text.Trim(); model.AddTime = DateTime.Now; model.WxNum = newMaxNum; model.AgentId = GetAdminInfo().Id; model.QQ = txtqq.Text; model.Email = txtEmail.Text; model.RegIp = MXRequest.GetIP(); model.Province = prov; model.City = city; model.County = dist; model.SortId=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) { var bBll = new WXManagerBillService(new ManagerBillRepository()); var bill = new ManagerBillInfo { BillMoney = xfjine, ManagerId = agent.ManagerId, OperPersonId = agent.ManagerId, OperDate = DateTime.Now, BillUsed = "开通1个用户" + model.UserName + "的" + newMaxNum + "个微帐号", MoneyType = "扣减" }; int addBillId= bBll.Add(bill); } else { bll.Delete(addId); addId = 0; } } if (addId> 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.UserName); //记录日志 return true; } return false; }
/// <summary> /// 判断已经有的微信个数,若超过,则不能添加 /// </summary> /// <returns>超过为true,未超过为false</returns> private bool IsChaoGuoWxNum() { var mBll = new ManagerInfoService(); var manager = mBll.GetModel(this.uid); int hasNum = bll.GetUserWxNumCount(this.uid); if (hasNum >= manager.WxNum) { JscriptMsg("该用户只能添加" + manager.WxNum + "个微信公众帐号,若想添加多个,请联系管理员!", "weixin_list.aspx?id=" + uid, "Error"); return true; } else { return false; } }
private void ShowInfo(int _id) { litpwdtip.Text = "不填则不修改密码"; var bll = new ManagerInfoService(); var model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.RoleId.ToString(); if (model.IsLock == 0) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } txtUserName.Text = model.UserName; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); txtRealName.Text = model.RealName; txtTelephone.Text = model.Telephone; txtEmail.Text = model.Email; ddlMaxNum.SelectedValue = model.WxNum.ToString(); hidOldMaxNum.Value = model.WxNum.ToString(); ddlProvince.SelectedValue = model.Province; ddlCity.SelectedValue = model.City; txtArea.Text = model.County; txtqq.Text = model.QQ; txtEmail.Text = model.Email; txtSortid.Text = MyCommFun.ObjToStr(model.SortId); // model.sort_id; txtRemark.Text = model.Remark; }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Value.Trim(); string userPwd = txtPassword.Value.Trim(); if (userName.Equals("") || userPwd.Equals("")) { msgtip.InnerHtml = "请输入用户名或密码"; return; } if (Session["AdminLoginSun"] == null) { Session["AdminLoginSun"] = 1; } else { Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1; } //判断登录错误次数 if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 5) { msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!"; return; } var managerService = new ManagerInfoService(); var model = managerService.GetModel(userName, userPwd, true); //BLL.manager bll = new BLL.manager(); //Model.manager model = bll.GetModel(userName, userPwd, true); if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } Session[SystemKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 //Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (this.siteConfig.logstatus > 0) { new ManagerLogService().Add(model.Id, Session.SessionID, model.UserName, MXEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Utils.WriteCookie("DTRememberName", model.UserName, 14400); // if (chkRemember.Checked) // { // Utils.WriteCookie("DTRememberPwd", model.password, 14400); // } Utils.WriteCookie("AdminName", "WeiXinPF", model.UserName); Utils.WriteCookie("AdminPwd", "WeiXinPF", model.Password); if (model.AgentLevel > 0) { //说明为代理商 Response.Redirect("index.aspx"); } else { //餐饮||酒店管理员 if (IsShopAdmin(model.Id) || IsHotelAdmin(model.Id)) { Response.Redirect("index.aspx"); } Response.Redirect("wxIndex.aspx"); } }