Пример #1
0
    //=====================================================================
    //  FunctionName : Page_Load
    /// <summary>
    /// Page_Load
    /// </summary>
    //=====================================================================
    protected override void Page_Load(object sender, EventArgs e)
    {
        MessageContent = string.Empty;
        if (IsPostBack != true)
        {
            Password_Area.Visible              = false;
            btnChangePassword.Visible          = false;
            btnSendChangePasswordEmail.Visible = false;
            // 初始化界面
            Password.TextMode        = TextBoxMode.Password;
            PasswordConfirm.TextMode = TextBoxMode.Password;
            // 界面控件状态
            ObjectID_Area.Visible = false;

            var vcode = Request.QueryString["vcode"];
            if (vcode.IsHtmlNullOrWiteSpace() || !DataValidateManager.ValidateUniqueIdentifierFormat(vcode))
            {
                UserLoginName.Text                 = Server.UrlDecode(Request.Cookies[ConstantsManager.COOKIE_USER_LOGIN_NAME].Value);
                Password_Area.Visible              = false;
                btnChangePassword.Visible          = false;
                btnSendChangePasswordEmail.Visible = true;
            }
            else
            {
                T_PM_UserInfoApplicationLogic userInfoApplicationLogic = new T_PM_UserInfoApplicationLogic();
                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)
                {
                    ObjectID.Text                      = GetValue(appData.ResultSet.Tables[0].Rows[0]["ObjectID"]);
                    UserLoginName.Text                 = GetValue(appData.ResultSet.Tables[0].Rows[0]["UserLoginName"]);
                    UserLoginName.Enabled              = false;
                    Password_Area.Visible              = true;
                    btnChangePassword.Visible          = true;
                    btnSendChangePasswordEmail.Visible = false;
                    MessageContent                     = "请修改密码。";
                }
                else
                {
                    Password_Area.Visible              = false;
                    btnChangePassword.Visible          = false;
                    btnSendChangePasswordEmail.Visible = true;
                    MessageContent = "修改密码链接已过期,请重新提交。";
                }
            }
        }
        base.Page_Load(sender, e);
    }
Пример #2
0
 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 virtual ValidateData ValidateObjectID(object objValidateData, bool boolNullable, bool boolExist)
        {
            ValidateData validateData = new ValidateData();

            try
            {
                // 初始化参数
                validateData.Result     = true;
                validateData.Message    = string.Empty;
                validateData.Parameters = new string[5];
                validateData.IsNull     = false;
                validateData.IsExist    = false;

                // 传入参数赋值
                validateData.Value         = objValidateData;
                validateData.Nullable      = boolNullable;
                validateData.Exist         = boolExist;
                validateData.Parameters[0] = "";
                validateData.Parameters[1] = "null";
                validateData.Parameters[2] = "null";

                // 空验证
                if (DataValidateManager.ValidateIsNull(validateData.Value) == false)
                {
                    // 数值格式验证
                    if (DataValidateManager.ValidateUniqueIdentifierFormat(validateData.Value, null, null) == false)
                    {
                        validateData.Message = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0012, validateData.Parameters);
                        validateData.Result  = false;
                    }
                    else
                    {
                        // 数据存在验证
                        if (validateData.Exist == true)
                        {
                            if (AJAX_IsExist("ObjectID", validateData.Value.ToString()) == true)
                            {
                                validateData.IsExist = true;
                                validateData.Message = @"已存在,请再换一个。";
                                validateData.Result  = false;
                            }
                            else
                            {
                                validateData.Message = @"不存在,可以使用。";
                                validateData.Result  = true;
                            }
                        }
                        else
                        {
                            validateData.Result = true;
                        }
                    }
                }
                else
                {
                    validateData.IsNull = true;
                    if (validateData.Nullable == false)
                    {
                        validateData.Message = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0002, validateData.Parameters);
                        validateData.Result  = false;
                    }
                }
            }
            catch (Exception)
            {
                validateData.Result = false;
            }
            return(validateData);
        }