protected void btnSave_Click(object sender, EventArgs e) { Model.Users userInfo = UsersManager.GetModel(CurrUser.iUserID); Model.UserPipelineColumns userPipelineCols = UserPipelineColsManager.GetModel(CurrUser.iUserID); Model.UserProspectColumns userProspectCols = UserProspectColsManager.GetModel(CurrUser.iUserID); Model.UserHomePref userHomePref = UserHomePrefManager.GetModel(CurrUser.iUserID); try { if (null == userInfo) { LPLog.LogMessage(LogType.Logerror, string.Format("User Personalization: User with id {0} does not exist.", CurrUser.iUserID)); ClientFun("unknowerrmsg2", "ShowMsg('unknowerror');"); return; } if (!GetUserInfo(ref userInfo)) { ClientFun("invalidinputmsg", "ShowMsg('invalidInput');"); return; } UsersManager.Update(userInfo); if (null == userPipelineCols) { userPipelineCols = new Model.UserPipelineColumns(); userPipelineCols.UserId = CurrUser.iUserID; GetUserPipelineColumnsInfo(ref userPipelineCols); UserPipelineColsManager.Add(userPipelineCols); } else { GetUserPipelineColumnsInfo(ref userPipelineCols); UserPipelineColsManager.Update(userPipelineCols); } if (null == userProspectCols) { userProspectCols = new Model.UserProspectColumns(); userProspectCols.UserId = CurrUser.iUserID; GetUserProspectColumnsInfo(ref userProspectCols); UserProspectColsManager.Add(userProspectCols); } else { GetUserProspectColumnsInfo(ref userProspectCols); UserProspectColsManager.Update(userProspectCols); } if (null == userHomePref) { userHomePref = new Model.UserHomePref(); userHomePref.UserId = CurrUser.iUserID; GetUserHomePrefInfo(ref userHomePref); UserHomePrefManager.Add(userHomePref); } else { GetUserHomePrefInfo(ref userHomePref); UserHomePrefManager.Update(userHomePref); } if (!string.IsNullOrEmpty(this.tbPWD.Text)) { try { ServiceManager sm = new ServiceManager(); using (LP2ServiceClient service = sm.StartServiceClient()) { ReqHdr hdr; UpdateADUserRequest uReq = new UpdateADUserRequest(); hdr = new ReqHdr(); hdr.UserId = CurrUser.iUserID; uReq.hdr = hdr; uReq.Command = UserMgrCommandType.ChangePassword; uReq.AD_OU_Filter = this.hiPrefix.Value; uReq.AD_User = new LP_Service.User(); uReq.AD_User.Password = this.tbPWD.Text; uReq.AD_User.Username = this.hiUsername.Value; uReq.AD_User.Firstname = this.hiFirstName.Value; uReq.AD_User.Lastname = this.hiLastName.Value; uReq.AD_User.Email = this.lbEmail.Text; UpdateADUserResponse uResponse; uResponse = service.UpdateADUser(uReq); if (!uResponse.hdr.Successful) { PageCommon.AlertMsg(this, "Failed to change password in AD, error info: " + uResponse.hdr.StatusInfo); LPLog.LogMessage(LogType.Logerror, "Failed to change password in AD, username="******"Failed to change password in AD, reason: User Manager is not running."); return; } catch (Exception ex) { PageCommon.AlertMsg(this, "Failed to change password in AD, exception info: " + ex.Message); LPLog.LogMessage(LogType.Logerror, "Failed to change password in AD, username="******", Exception:" + ex.Message); return; } } ClientFun("sucsmsg", "ShowMsg('savesuccess');"); } catch (Exception ex) { PageCommon.AlertMsg(this, "Failed to save user personalization info, reason:" + ex.Message); LPLog.LogMessage(LogType.Logerror, "Failed to save user personalization info: " + ex.Message); return; } }
protected void btnSave_Click(object sender, EventArgs e) { Model.Users userInfo = UsersManager.GetModel(CurrUser.iUserID); Model.UserPipelineColumns userPipelineCols = UserPipelineColsManager.GetModel(CurrUser.iUserID); Model.UserProspectColumns userProspectCols = UserProspectColsManager.GetModel(CurrUser.iUserID); Model.UserHomePref userHomePref = UserHomePrefManager.GetModel(CurrUser.iUserID); try { if (null == userInfo) { LPLog.LogMessage(LogType.Logerror, string.Format("User Personalization - Preferences: User with id {0} does not exist.", CurrUser.iUserID)); ClientFun("unknowerrmsg2", "alert('User does not exists, unknow error.');"); } if (!GetUserInfo(ref userInfo)) { ClientFun("invalidinputmsg", "alert('Invalid input!');"); return; } UsersManager.Update(userInfo); if (null == userPipelineCols) { userPipelineCols = new Model.UserPipelineColumns(); userPipelineCols.UserId = CurrUser.iUserID; GetUserPipelineColumnsInfo(ref userPipelineCols); UserPipelineColsManager.Add(userPipelineCols); } else { GetUserPipelineColumnsInfo(ref userPipelineCols); UserPipelineColsManager.Update(userPipelineCols); } if (null == userProspectCols) { userProspectCols = new Model.UserProspectColumns(); userProspectCols.UserId = CurrUser.iUserID; GetUserProspectColumnsInfo(ref userProspectCols); UserProspectColsManager.Add(userProspectCols); } else { GetUserProspectColumnsInfo(ref userProspectCols); UserProspectColsManager.Update(userProspectCols); } if (null == userHomePref) { userHomePref = new Model.UserHomePref(); userHomePref.UserId = CurrUser.iUserID; GetUserHomePrefInfo(ref userHomePref); UserHomePrefManager.Add(userHomePref); } else { GetUserHomePrefInfo(ref userHomePref); UserHomePrefManager.Update(userHomePref); } ClientFun("sucsmsg", "alert('Saved!');"); } catch (Exception ex) { PageCommon.AlertMsg(this, "Failed to save user personalization preferences info, reason:" + ex.Message); LPLog.LogMessage(LogType.Logerror, "Failed to save user personalization preferences info: " + ex.Message); return; } }
public void ProcessRequest(HttpContext context) { string action = context.Request["action"]; switch (action) { case "newUserName": #region 修改名称 if (string.IsNullOrEmpty(context.Request["newNickName"].Trim())) { context.Response.Write("no:不能为空"); return; } if (bllUsers.GetModel(context.Request["newNickName"].Trim()) != null) { context.Response.Write("no:昵称已被占用"); return; } if (bllSensitiveLexicon.WordPattern(context.Request["newNickName"].Trim())) { context.Response.Write("no:敏感词"); return; } modelUsers = bllUsers.ExGetModel(context.Request["pastNickname"].Trim()); modelUsers.UserName = context.Request["newNickName"]; if (bllUsers.Update(modelUsers)) { context.Response.Write("ok:完成"); } else { context.Response.Write("no:更改失败"); } break; #endregion case "APPUserName": if (string.IsNullOrEmpty(context.Request["newNickName"].Trim())) { context.Response.Write("0"); return; } if (bllUsers.GetModel(context.Request["newNickName"].Trim()) != null) { context.Response.Write("0"); return; } if (bllSensitiveLexicon.WordPattern(context.Request["newNickName"].Trim())) { context.Response.Write("0"); return; } modelUsers = bllUsers.ExGetModel(context.Request["pastNickname"].Trim()); modelUsers.UserName = context.Request["newNickName"]; if (bllUsers.Update(modelUsers)) { context.Response.Write("1"); } else { context.Response.Write("0"); } break; case "NetName": try { BLL.Config bllConfig = new BLL.Config(); context.Response.Write(fastJSON.JSON.Instance.ToJSON(bllConfig.ExGetConfigValue("网站名称"))); } catch (Exception ex) { context.Response.Write("0"); } break; default: context.Response.Write("错误!13"); break; } }
public void ProcessRequest(HttpContext context) { action = context.Request["action"]; string reg = @"^[A-Za-z\d]+([-_.][A-Za-zd]+)*@([A-Za-z\d]+[-_.])+[A-Za-z\d]{2,5}$"; switch (action) { case "OKVerify": if (string.IsNullOrEmpty(context.Request["UserAccount"].Trim())) { context.Response.Write("onAccount:*账户不能为空"); return; } if (string.IsNullOrEmpty(context.Request["UserMail"].Trim())) { context.Response.Write("onMail:*邮箱不能为空"); return; } if (!Regex.IsMatch(context.Request["UserMail"].Trim(), reg)) { context.Response.Write("onMail:*输入有效的邮箱"); return; } if (string.IsNullOrEmpty(context.Request["Code"].Trim())) { context.Response.Write("onCode:*验证不能为空"); return; } if (string.IsNullOrEmpty(context.Request["ResetUserPassWord"].Trim())) { context.Response.Write("onWord:*密码不能为空"); return; } if ((string)context.Session["numberCode"] != common.MD5(common.MD5(context.Request["Code"]))) { context.Response.Write("onCode:*验证码不正确"); return; } if (!bllUsers.ExAccount(context.Request["UserAccount"])) { context.Response.Write("onAccount:*没有次用户"); return; } modelUsers = bllUsers.GetModel(context.Request["UserAccount"]); modelUsers.UserPassWord = common.MD5(common.MD5(context.Request["ResetUserPassWord"])); if (bllUsers.Update(modelUsers)) { context.Response.Write("okUrl:/Login.aspx"); } break; case "APPwrod": try { if (!Regex.IsMatch(context.Request["UserMail"].Trim(), reg)) { context.Response.Write("0"); return; } if (!bllUsers.ExAccount(context.Request["UserAccount"])) { context.Response.Write("2"); return; } modelUsers = bllUsers.GetModel(context.Request["UserAccount"]); modelUsers.UserPassWord = common.MD5(common.MD5(context.Request["ResetUserPassWord"])); if (bllUsers.Update(modelUsers)) { context.Response.Write("1"); } } catch (Exception ex) { context.Response.Write("0"); } break; case "NetName": try { BLL.Config bllConfig = new BLL.Config(); context.Response.Write(JsonConvert.SerializeObject(bllConfig.ExGetConfigValue("网站名称"))); } catch (Exception ex) { context.Response.Write("0"); } break; case "sendCode": #region 邮箱发送 string number = ""; System.Random random = new Random(); for (int i = 0; i < 5; i++) { number += (random.Next() % 10); } context.Session["numberCode"] = common.MD5(common.MD5(number)); if (bllUsers.SendCode(context.Request["UserMail"], number)) { context.Response.Write("ok"); } else { context.Response.Write("on"); } break; #endregion default: context.Response.Redirect("/Error.aspx?webPage=忘记页"); break; } }
protected void btnSave_Click(object sender, EventArgs e) { Model.Users userInfo = UsersManager.GetModel(CurrUser.iUserID); try { if (null == userInfo) { LPLog.LogMessage(LogType.Logerror, string.Format("User Personalization - Settings: User with id {0} does not exist.", CurrUser.iUserID)); ClientFun("unknowerrmsg2", "alert('User does not exists, unknow error.');"); return; } if (!GetUserInfo(ref userInfo)) { ClientFun("invalidinputmsg", "alert('Invalid input!');"); return; } if (this.FileUpload1.HasFile) { string strMsg = ""; bool bIsValid = PageCommon.ValidateUpload(this, this.FileUpload1, 1024 * 1024 * 15, out strMsg, ".jpg", ".bmp", ".png", ".gif"); if (!bIsValid) { ClientFun("userPicInvalid", string.Format("alert('{0}');", strMsg)); return; } } string phone = this.txbPhone.Text.Trim(); userInfo.Phone = phone; userInfo.Fax = this.txbFax.Text.Trim(); userInfo.Cell = this.txbCell.Text.Trim(); userInfo.LicenseNumber = this.txbLicense.Text.Trim(); userInfo.NMLS = this.txbNMLS.Text.Trim(); userInfo.ExchangePassword = this.txbExchangPwd.Text.Trim(); if (userInfo.ExchangePassword == "" && !string.IsNullOrEmpty(this.tbPWD.Text)) { userInfo.ExchangePassword = this.tbPWD.Text.Trim(); } UsersManager.Update(userInfo); #region Save as UserLicense gdc CR43 if (!string.IsNullOrEmpty(hidLicenseNumberList.Value.Trim())) { try { List <Model.UserLicenses> ulList = new List <Model.UserLicenses>(); foreach (var item in hidLicenseNumberList.Value.Split(',')) { if (string.IsNullOrEmpty(item)) { continue; } Model.UserLicenses model = new Model.UserLicenses(); model.LicenseNumber = item; model.UserId = CurrUser.iUserID; ulList.Add(model); } BLL.UserLicenses ulBll = new BLL.UserLicenses(); ulBll.UpdatebatchByUserID(ulList); BindLicensesList(); } catch (Exception ex) { LPLog.LogMessage(ex.Message); PageCommon.AlertMsg(this, "Failed to Save User Licenses:" + ex.Message); return; } } #endregion if (!string.IsNullOrEmpty(this.tbPWD.Text)) { try { ServiceManager sm = new ServiceManager(); using (LP2ServiceClient service = sm.StartServiceClient()) { ReqHdr hdr; UpdateADUserRequest uReq = new UpdateADUserRequest(); hdr = new ReqHdr(); hdr.UserId = CurrUser.iUserID; uReq.hdr = hdr; uReq.Command = UserMgrCommandType.ChangePassword; uReq.AD_OU_Filter = this.hiPrefix.Value; uReq.AD_User = new LP_Service.User(); uReq.AD_User.Password = this.tbPWD.Text; uReq.AD_User.Username = this.hiUsername.Value; uReq.AD_User.Firstname = this.hiFirstName.Value; uReq.AD_User.Lastname = this.hiLastName.Value; uReq.AD_User.Email = this.lbEmail.Text; UpdateADUserResponse uResponse; uResponse = service.UpdateADUser(uReq); if (!uResponse.hdr.Successful) { PageCommon.AlertMsg(this, "Failed to update your password. Please make sure your new password meets the password policy requirements."); LPLog.LogMessage(LogType.Logerror, "Failed to change password in AD, username="******"Failed to change password in AD, reason: User Manager is not running."); return; } catch (Exception ex) { PageCommon.AlertMsg(this, "Failed to change password in AD, exception info: " + ex.Message); LPLog.LogMessage(LogType.Logerror, "Failed to change password in AD, username="******", Exception:" + ex.Message); return; } } ClientFun("sucsmsg", "alert('Saved!');"); } catch (Exception ex) { PageCommon.AlertMsg(this, "Failed to save user Personalization - Settings info, reason:" + ex.Message); LPLog.LogMessage(LogType.Logerror, "Failed to save user Personalization - Settings info: " + ex.Message); return; } }
public void ProcessRequest(HttpContext context) { action = context.Request["action"]; switch (action) { case "CreateUsersDetail": #region 创建会员 try { UserName = common.SQLFilter(context.Request["UserName"]); UserAccount = common.SQLFilter(context.Request["UserAccount"]); UserPassWord = common.MD5(common.MD5(common.SQLFilter(context.Request["UserPassWord"]))); UserMail = common.SQLFilter(context.Request["UserMail"]); UsersState = common.SQLFilter(context.Request["UsersState"]); modelUsers.GUID = Guid.NewGuid().ToString(); modelUsers.UserName = UserName; modelUsers.UserAccount = UserAccount; modelUsers.UserMail = UserMail; modelUsers.UserPassWord = UserPassWord; modelUsers.UsersState = Convert.ToInt32(UsersState); modelUsers.LoginTime = DateTime.Now; modelUsers.RegisterTime = DateTime.Now; if (bllUsers.Add(modelUsers) > 0) { modelPlayRight.GUID = modelUsers.GUID; modelPlayRight.UserAccount = context.Request["UserAccount"]; modelPlayRight.ExpireTime = DateTime.Now; modelPlayRight.WatchRecord = "暂无信息"; modelPlayRight.HeadPortrait = "b614d3bf0d897dd651f1b937b957ac8a.jpg"; bllPlayRight.Add(modelPlayRight); context.Response.Write("添加成功"); } else { context.Response.Write("添加失败"); } } catch (Exception) { context.Response.Write("错误:02"); } break; #endregion case "UsersPasswordEdit": #region 修改密码 GUID = context.Request["GUID"]; UserPassWord = common.MD5(common.MD5(common.SQLFilter(context.Request["UserPassWord"]))); modelUsers = bllUsers.ExGetModelGUID(GUID); modelUsers.UserPassWord = UserPassWord; if (bllUsers.Update(modelUsers)) { context.Response.Write("操作成功"); } else { context.Response.Write("错误:03"); } break; #endregion case "UsersUserNameMailEdit": #region 修改昵称和邮箱 GUID = context.Request["GUID"]; modelUsers = bllUsers.ExGetModelGUID(GUID); if (context.Request["UsersName"] != null && context.Request["UsersName"] != "") { modelUsers.UserName = common.SQLFilter(context.Request["UsersName"]); } if (context.Request["UsersMail"] != null && context.Request["UsersMail"] != "") { modelUsers.UserMail = common.SQLFilter(context.Request["UsersMail"]); } if (bllUsers.Update(modelUsers)) { context.Response.Write("操作成功"); } else { context.Response.Write("操作失败"); } break; #endregion case "UsersStateEdit": #region 修改用户状态 GUID = context.Request["GUID"]; UsersState = context.Request["UsersState"]; modelUsers = bllUsers.ExGetModelGUID(GUID); modelUsers.UsersState = Convert.ToInt32(UsersState); if (bllUsers.Update(modelUsers)) { context.Response.Write("操作成功"); } else { context.Response.Write("操作失败"); } break; #endregion case "EditUsersStateAttr": #region 修改多个用户状态 try { UsersGUIDList = common.SQLFilter(context.Request["GUID"]); UsersState = context.Request["UserState"]; context.Response.Write(bllUsers.ExEditUsersStateAttr(UsersGUIDList, Convert.ToInt32(UsersState))); } catch (Exception) { context.Response.Write("错误:08"); } break; #endregion case "DeleteUsers": #region 除用户 try { GUID = common.SQLFilter(context.Request["GUID"]); if (bllUsers.ExDelete(GUID)) { bllPlayRight.ExDelete(GUID); context.Response.Write("操作成功"); } else { context.Response.Write("操作失败"); } } catch (Exception ex) { context.Response.Write("错误:03"); } break; #endregion case "GetUsersListSearch": #region 获取用户搜索列表 UserName = common.SQLFilter(context.Request["UserName"]); UserAccount = common.SQLFilter(context.Request["UserAccount"]); UserMail = common.SQLFilter(context.Request["UserMail"]); UsersState = common.SQLFilter(context.Request["UserState"]); context.Response.Redirect("/VidoAdmin/UsersList.aspx?Clear=" + context.Request["Clear"] + "&UserName="******"&UserAccount=" + UserAccount + "&UserMail=" + UserMail + "&UsersState=" + UsersState); break; #endregion default: context.Response.Write("错误:01"); break; } }
protected void btnSave_Click(object sender, EventArgs e) { Model.Users userInfo = UsersManager.GetModel(CurrUser.iUserID); try { if (null == userInfo) { LPLog.LogMessage(LogType.Logerror, string.Format("User Personalization - Marketing: User with id {0} does not exist.", CurrUser.iUserID)); ClientFun("unknowerrmsg2", "alert('User does not exists, unknow error.');"); } if (!GetUserInfo(ref userInfo)) { ClientFun("invalidinputmsg", "alert('Invalid input!');"); return; } UsersManager.Update(userInfo); DataTable dtAc = new DataTable(); DataColumn col = new DataColumn("ID"); dtAc.Columns.Add(col); col = new DataColumn("LoanType"); dtAc.Columns.Add(col); col = new DataColumn("TemplStageId"); dtAc.Columns.Add(col); col = new DataColumn("Enabled"); dtAc.Columns.Add(col); DataRow drNew = null; foreach (GridViewRow gvr in gridList.Rows) { DropDownList ddlLoanType = gvr.FindControl("ddlLoanType") as DropDownList; TextBox tbTeplStageId = gvr.FindControl("tbTeplStageId") as TextBox; CheckBox ckbEnabled = gvr.FindControl("ckbEnabled") as CheckBox; if (ddlLoanType != null && tbTeplStageId != null && null != ckbEnabled) { int nId = 0; if (!int.TryParse(string.Format("{0}", gridList.DataKeys[gvr.RowIndex].Value), out nId)) { nId = 0; } if (nId > 0) { string strLoanType = ddlLoanType.SelectedValue; if ("Active" == strLoanType || "Archived" == strLoanType || "Opportunities" == strLoanType) { } else { strLoanType = null; } int nTemplId = 0; if (!int.TryParse(tbTeplStageId.Text, out nTemplId)) { nTemplId = 0; } drNew = dtAc.NewRow(); dtAc.Rows.Add(drNew); drNew["ID"] = nId; drNew["LoanType"] = strLoanType; if (0 == nTemplId) { drNew["TemplStageId"] = null; } else { drNew["TemplStageId"] = nTemplId; } drNew["Enabled"] = ckbEnabled.Checked ? 1 : 0; } } } if (dtAc.Rows.Count > 0) { MarketingCampaignsManager.SaveAutoCampaigns(dtAc); BindGrid(); } ClientFun("sucsmsg", "alert('Saved successfully.');"); } catch (Exception ex) { PageCommon.AlertMsg(this, "Failed to save user personalization preferences info, reason:" + ex.Message); LPLog.LogMessage(LogType.Logerror, "Failed to save user personalization preferences info: " + ex.Message); return; } }