protected virtual void OnSignIn(SignInArgs e)
 {
     if (SignIn != null)
     {
         SignIn(this, e);
     }
 }
 private void btnSignIn_Click(object sender, EventArgs e)
 {
     try
     {
         string userName = txtUserName.Text.Trim();
         string password = txtPassword.Text.Trim();
         if (userName == string.Empty)
         {
             // Show Message
             MessageBox.Show(Common.GetMessage("INF0050"), Common.GetMessage("5007"),
                             MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else if (password == string.Empty)
         {
             // Show Message
             MessageBox.Show(Common.GetMessage("INF0051"), Common.GetMessage("5007"),
                             MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             //Sign in
             SignInArgs sArgs = new SignInArgs();
             if (AuthenticationComponent.BusinessObjects.Authenticate.LogInUser(userName, password, CoreComponent.Core.BusinessObjects.Common.LocationCode))
             {
                 sArgs.IsSuccess = true;
                 OnSignIn(sArgs);
                 this.Close();
             }
             else
             {
                 MessageBox.Show(Common.GetMessage("INF0018"), Common.GetMessage("5008"),
                                 MessageBoxButtons.OK, MessageBoxIcon.Information);
                 sArgs.IsSuccess = false;
                 txtPassword.SelectAll();
                 OnSignIn(sArgs);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(Common.GetMessage("10002"), Common.GetMessage("30007"), MessageBoxButtons.OK, MessageBoxIcon.Error);
         Common.LogException(ex);
     }
 }
Beispiel #3
0
 private void SaveUserData()
 {
     try
     {
         //Sign in
         SignInArgs sArgs = new SignInArgs();
         if (AuthenticationComponent.BusinessObjects.Authenticate.CheckUserIsValid(AuthenticationComponent.BusinessObjects.Authenticate.LoggedInUser.UserName, txtOldPassword.Text, CoreComponent.Core.BusinessObjects.Common.LocationCode))
         {
             User m_objUser = new User();
             m_objUser.UserId   = m_userId;
             m_objUser.Password = m_objUser.EncryptPassword(txtNewPassword.Text.Trim());
             m_objUser.PasswordModifiedTrueFalse = 1;
             m_objUser.UserId = m_userId; // Global variable
             string errMsg = string.Empty;
             bool   retVal = m_objUser.UserSave(Common.ToXml(m_objUser), User.USER_SAVE, ref errMsg);
             if (retVal)
             {
                 MessageBox.Show(Common.GetMessage("INF0004"), Common.GetMessage("10001"), MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else if (!errMsg.Trim().Equals(string.Empty))
             {
                 if (errMsg.Trim().IndexOf("30001") >= 0)
                 {
                     MessageBox.Show(Common.GetMessage("10002"), Common.GetMessage("30007"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                     Common.LogException(new Exception(errMsg));
                 }
                 else
                 {
                     MessageBox.Show(Common.GetMessage(errMsg.Trim()), Common.GetMessage("10001"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
         }
         else
         {
             MessageBox.Show(Common.GetMessage("INF0005"), Common.GetMessage("5008"),
                             MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }