示例#1
0
文件: UserForm.cs 项目: tslekwadi/CDS
 private void btnResetPassword_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         ValidateLayout();
         using (ResetPasswordDialogue dialogue = new ResetPasswordDialogue())
         {
             if (dialogue.ShowDialog() == DialogResult.OK)
             {
                 ((DB.SEC_User)BindingSource.DataSource).Password = dialogue.Password;
                 txtPassword.Text = dialogue.Password;
             }
         }
     }
     catch (Exception ex)
     {
         if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
         {
             throw ex;
         }
     }
 }
示例#2
0
文件: UserForm.cs 项目: tslekwadi/CDS
        private bool IsPasswordValid()
        {
            try
            {
                bool isValid = true;

                if (((DB.SEC_User)BindingSource.DataSource).Password == null || ((DB.SEC_User)BindingSource.DataSource).Password == string.Empty)
                {
                    using (ResetPasswordDialogue dialogue = new ResetPasswordDialogue())
                    {
                        if (dialogue.ShowDialog() == DialogResult.OK)
                        {
                            ((DB.SEC_User)BindingSource.DataSource).Password = dialogue.Password;
                            txtPassword.Text = dialogue.Password;
                        }
                        else
                        {
                            isValid = false;
                        }
                    }
                }

                if (!isValid)
                {
                    Essential.BaseAlert.ShowAlert("Invalid Password", "The user needs to have a password to be able to save.", Essential.BaseAlert.Buttons.Ok, Essential.BaseAlert.Icons.Error);
                }

                return(isValid);
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
                return(false);
            }
        }