Beispiel #1
0
 /// <summary>
 /// Login user action
 /// </summary>
 /// <param name="param"></param>
 public void LoginUser(object param)
 {
     if (!string.IsNullOrEmpty(Email) && !string.IsNullOrEmpty(Password))
     {
         var logic = new LoginLogic();
         IsEnableLogin = false;
         var status = SingletonLicense.Instance.IsNetworkAvilable;
         if (status)
         {
             status = logic.AuthenticateUser(Email, Password);
         }
         else
         {
             MessageBox.Show("Network Not available");
             return;
         }
         if (status)
         {
             SingletonLicense.Instance.IsUserLoggedIn = true;
             NavigateNextPage?.Invoke(null, null);
             IsEnableLogin = true;
         }
         else
         {
             MessageBox.Show(logic.ErrorMessage);
             logic.ErrorMessage = String.Empty;
             IsEnableLogin      = true;
         }
     }
 }
 /// <summary>
 /// Login user action
 /// </summary>
 /// <param name="param"></param>
 public void LoginUser(object param)
 {
     if (!string.IsNullOrEmpty(Email) && !string.IsNullOrEmpty(Password))
     {
         LoginLogic logic = new LoginLogic();
         IsEnableLogin = false;
         Model.User user = null;
         if (AppState.Instance.IsNetworkAvilable())
         {
             user = logic.AuthenticateOnline(Email, Password);
         }
         else if (AppState.Instance.IsCredentialFileExist())
         {
             user = logic.AuthenticateUser(Email, Password);
         }
         else
         {
             MessageBox.Show("Need to be online for first time login");
             IsEnableLogin = true;
             return;
         }
         if (user == null)
         {
             MessageBox.Show(logic.ErrorMessage);
             IsEnableLogin = true;
             return;
         }
         AppState.Instance.User           = user;
         AppState.Instance.IsUserLoggedIn = true;
         if (AppState.Instance.IsNetworkAvilable())
         {
             LoadTeams();
         }
         IsEnableLogin = true;
     }
 }