protected void btnSendChangePasswordEmail_Click(object sender, EventArgs e) { bool boolReturn = true; ValidateData validateData = new ValidateData(); T_PM_UserInfoApplicationLogic userInfoApplicationLogic = new T_PM_UserInfoApplicationLogic(); validateData = ValidateUserLoginName(UserLoginName.Text, false, false); if (validateData.Result) { UserLoginName.BackColor = System.Drawing.Color.Empty; if (!validateData.IsNull) { if (UserLoginName.Text.IsValidEmail()) { T_PM_UserInfoApplicationData existAppData = new T_PM_UserInfoApplicationData(); existAppData.UserLoginName = UserLoginName.Text.HtmlDecodeWithTrim(); existAppData.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.ALL; existAppData.PageSize = 1; existAppData.CurrentPage = 1; existAppData = userInfoApplicationLogic.Query(existAppData); if (existAppData.RecordCount == 0) { validateData.Message = "登录用户名不存在,请检查后再次提交。"; UserLoginName.BackColor = System.Drawing.Color.YellowGreen; MessageContent += @"<font color=""red"">" + validateData.Message + "</font>"; boolReturn = false; } else { appData = T_PM_UserInfoBusinessEntity.GetDataByObjectID(((Guid)existAppData.ResultSet.Tables[0].Rows[0]["ObjectID"]).ToString()); if (appData != null) { appData.vcode = Guid.NewGuid().ToString(); appData.OPCode = ApplicationDataBase.OPType.ID; userInfoApplicationLogic.Modify(appData); // 发送Email SendChangePasswordMail(appData.UserLoginName, appData.UserNickName, DomainUrl, appData.vcode); MessageContent += "修改密码链接已发送到您的邮箱,请检查邮箱并进行密码修改。"; btnSendChangePasswordEmail.Enabled = false; Page.CloseWindow(true); } } } else { validateData.Message = "登录用户名格式错误。"; UserLoginName.BackColor = System.Drawing.Color.YellowGreen; MessageContent += @"<font color=""red"">" + validateData.Message + "</font>"; boolReturn = false; } } } else { UserLoginName.BackColor = System.Drawing.Color.YellowGreen; MessageContent += @"<font color=""red"">" + validateData.Message + "</font>"; boolReturn = validateData.Result; } }
protected void Page_Load(object sender, EventArgs e) { if (!DataValidateManager.ValidateIsNull(Request.Cookies[ConstantsManager.COOKIE_SAVE_LOGIN_STATUS]) && !DataValidateManager.ValidateIsNull(Request.Cookies[ConstantsManager.COOKIE_USER_LOGIN_NAME]) && !DataValidateManager.ValidateIsNull(Request.Cookies[ConstantsManager.COOKIE_PASSWORD])) { txtUserLoginName.Text = Server.UrlDecode(Request.Cookies[ConstantsManager.COOKIE_USER_LOGIN_NAME].Value); txtPassword.Text = Server.UrlDecode(Request.Cookies[ConstantsManager.COOKIE_PASSWORD].Value); chkSaveLoginStatus.Checked = true; ValidateUserLogin(); } imgIdentifyCode.ImageUrl = ConstantsManager.WEBSITE_VIRTUAL_ROOT_DIR + "/Page/IdentifyCode.aspx"; if (!IsPostBack) { var vcode = Request.QueryString["vcode"]; if (vcode.IsHtmlNullOrWiteSpace() || !DataValidateManager.ValidateUniqueIdentifierFormat(vcode)) { if (!DataValidateManager.ValidateIsNull(Request.Cookies[ConstantsManager.COOKIE_USER_LOGIN_NAME])) { txtUserLoginName.Text = Server.UrlDecode(Request.Cookies[ConstantsManager.COOKIE_USER_LOGIN_NAME].Value); } } else { T_PM_UserInfoApplicationLogic userInfoApplicationLogic = new T_PM_UserInfoApplicationLogic(); T_PM_UserInfoApplicationData appData = new T_PM_UserInfoApplicationData(); appData.vcode = vcode; appData.CurrentPage = 1; appData.PageSize = 1; appData.OPCode = ApplicationDataBase.OPType.ALL; userInfoApplicationLogic.Query(appData); if (appData.RecordCount > 0) { appData = T_PM_UserInfoBusinessEntity.GetDataByObjectID(((Guid)appData.ResultSet.Tables[0].Rows[0]["ObjectID"]).ToString()); appData.UserStatus = "02"; appData.vcode = null; appData.OPCode = ApplicationDataBase.OPType.ID; userInfoApplicationLogic.Modify(appData); txtUserLoginName.Text = appData.UserLoginName; MessageLabel.Text = "邮箱通过验证,请登录开始使用系统。"; } else { MessageLabel.Text = "邮箱验证信息有误。"; } } } txtIdentifyCode.Attributes.Add("onfocus", "document.getElementById('txtIdentifyCode').value = GetCookie('IdentifyCode');"); }
protected void btnChangePassword_Click(object sender, EventArgs e) { bool boolReturn = true; ValidateData validateData = new ValidateData(); appData = T_PM_UserInfoBusinessEntity.GetDataByObjectID(ObjectID.Text); if (Password.Text == PasswordConfirm.Text) { validateData = ValidatePassword(Password.Text, false, false); if (validateData.Result == true) { if (validateData.IsNull == false) { appData.Password = RICH.Common.SecurityManager.MD5(Convert.ToString(validateData.Value.ToString()), 32); Password_Note.InnerHtml = @"<font color=""gray"">输入正确。</font>"; } Password.BackColor = System.Drawing.Color.Empty; } else { Password.BackColor = System.Drawing.Color.YellowGreen; MessageContent += @"<font color=""red"">" + validateData.Message + "</font>"; boolReturn = validateData.Result; } } else { Password.BackColor = System.Drawing.Color.YellowGreen; PasswordConfirm.BackColor = System.Drawing.Color.YellowGreen; MessageContent += @"<font color=""red"">两次输入不一致,请重新输入。</font>"; boolReturn = false; } if (boolReturn) { T_PM_UserInfoApplicationLogic userInfoApplicationLogic = new T_PM_UserInfoApplicationLogic(); appData.vcode = null; appData.OPCode = ApplicationDataBase.OPType.ID; userInfoApplicationLogic.Modify(appData); Response.Redirect("login.aspx"); } }
protected void btnInfoFromDS_Click(object sender, EventArgs e) { int totalCount = 0; int importCount = 0; int updateCount = 0; try { var appDatas = T_PM_UserInfoApplicationData.GetDataFromDataFile <T_PM_UserInfoApplicationData>(InfoFromDoc.Text, true, true, recordStartLine: T_PM_UserInfoContants.ImportDataSetStartLineNum); T_PM_UserInfoApplicationLogic instanceT_PM_UserInfoApplicationLogic = (T_PM_UserInfoApplicationLogic)CreateApplicationLogicInstance(typeof(T_PM_UserInfoApplicationLogic)); totalCount = appDatas.Count; foreach (var app in appDatas) { app.UserID = instanceT_PM_UserInfoApplicationLogic.AutoGenerateUserID(app); if (!UserLoginName.Text.IsHtmlNullOrWiteSpace()) { app.UserLoginName = Convert.ToString(UserLoginName.Text); } string strUserGroupID = GetValue(new RICH.Common.BM.T_PM_UserGroupInfo.T_PM_UserGroupInfoApplicationLogicBase().GetValueByFixCondition("UserGroupName", app.UserGroupID, "UserGroupID")); if (!DataValidateManager.ValidateIsNull(strUserGroupID)) { app.UserGroupID = strUserGroupID; } if (!UserGroupID.SelectedValues.IsHtmlNullOrWiteSpace()) { app.UserGroupID = Convert.ToString(UserGroupID.SelectedValues); } string strSubjectID = GetValue(new RICH.Common.BM.T_BM_DWXX.T_BM_DWXXApplicationLogicBase().GetValueByFixCondition("DWMC", app.SubjectID, "DWBH")); if (!DataValidateManager.ValidateIsNull(strSubjectID)) { app.SubjectID = strSubjectID; } if (!SubjectID.SelectedValue.IsHtmlNullOrWiteSpace()) { app.SubjectID = Convert.ToString(SubjectID.SelectedValue); } if (!UserNickName.Text.IsHtmlNullOrWiteSpace()) { app.UserNickName = Convert.ToString(UserNickName.Text); } if (!Password.Text.IsHtmlNullOrWiteSpace()) { app.Password = Convert.ToString(Password.Text); } string strXB = GetValue(new RICH.Common.BM.Dictionary.DictionaryApplicationLogicBase().GetValueByFixCondition("MC", app.XB, "DM")); if (!DataValidateManager.ValidateIsNull(strXB)) { app.XB = strXB; } if (!XB.SelectedValue.IsHtmlNullOrWiteSpace()) { app.XB = Convert.ToString(XB.SelectedValue); } string strMZ = GetValue(new RICH.Common.BM.Dictionary.DictionaryApplicationLogicBase().GetValueByFixCondition("MC", app.MZ, "DM")); if (!DataValidateManager.ValidateIsNull(strMZ)) { app.MZ = strMZ; } if (!MZ.SelectedValue.IsHtmlNullOrWiteSpace()) { app.MZ = Convert.ToString(MZ.SelectedValue); } string strZZMM = GetValue(new RICH.Common.BM.Dictionary.DictionaryApplicationLogicBase().GetValueByFixCondition("MC", app.ZZMM, "DM")); if (!DataValidateManager.ValidateIsNull(strZZMM)) { app.ZZMM = strZZMM; } if (!ZZMM.SelectedValue.IsHtmlNullOrWiteSpace()) { app.ZZMM = Convert.ToString(ZZMM.SelectedValue); } if (!SFZH.Text.IsHtmlNullOrWiteSpace()) { app.SFZH = Convert.ToString(SFZH.Text); } if (!SJH.Text.IsHtmlNullOrWiteSpace()) { app.SJH = Convert.ToString(SJH.Text); } if (!BGDH.Text.IsHtmlNullOrWiteSpace()) { app.BGDH = Convert.ToString(BGDH.Text); } if (!JTDH.Text.IsHtmlNullOrWiteSpace()) { app.JTDH = Convert.ToString(JTDH.Text); } if (!Email.Text.IsHtmlNullOrWiteSpace()) { app.Email = Convert.ToString(Email.Text); } if (!QQH.Text.IsHtmlNullOrWiteSpace()) { app.QQH = Convert.ToString(QQH.Text); } string strUserStatus = GetValue(new RICH.Common.BM.Dictionary.DictionaryApplicationLogicBase().GetValueByFixCondition("MC", app.UserStatus, "DM")); if (!DataValidateManager.ValidateIsNull(strUserStatus)) { app.UserStatus = strUserStatus; } if (!UserStatus.SelectedValue.IsHtmlNullOrWiteSpace()) { app.UserStatus = Convert.ToString(UserStatus.SelectedValue); } if (!vcode.Text.IsHtmlNullOrWiteSpace()) { app.vcode = Convert.ToString(vcode.Text); } instanceT_PM_UserInfoApplicationLogic.Add(app); if (app.ResultCode == RICH.Common.Base.ApplicationData.ApplicationDataBase.ResultState.Succeed) { importCount++; } else { app.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.PK; instanceT_PM_UserInfoApplicationLogic.Modify(app); if (app.ResultCode == RICH.Common.Base.ApplicationData.ApplicationDataBase.ResultState.Succeed) { updateCount++; } } } MessageContent += @"<font color=""green"">共{0}条数据,导入数据{1}条,更新数据{2}条。</font>".FormatInvariantCulture(totalCount, importCount, updateCount); } catch (Exception ex) { MessageContent += @"<font color=""red"">导入数据过程出错:{0}<br/>共{1}条数据,已导入数据{2}条,已更新数据{3}条。</font>".FormatInvariantCulture(ex.Message, totalCount, importCount, updateCount); } }