private void Service_UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
        {
            LOLConnectClient service = (LOLConnectClient)sender;
            service.UserLoginCompleted -= Service_UserLoginCompleted;

            if (null == e.Error)
            {

                User loggedUser = e.Result;
                if (loggedUser.Errors.Count > 0)
                {
                    RunOnUiThread(() => GeneralUtils.Alert(c, Application.Context.GetString(Resource.String.commonError),
                                                         Application.Context.GetString(Resource.String.errorNotLoggedIn)));
                } else
                {
                    AndroidData.IsLoggedIn = true;
                    AndroidData.CurrentUser = loggedUser;
                    StartActivity(typeof(Main.HomeActivity));
                    Finish();
                }
            } else
            {
                RunOnUiThread(() => GeneralUtils.Alert(c, Application.Context.GetString(Resource.String.commonError),
                                                     Application.Context.GetString(Resource.String.errorLoginFailed)));
            }
        }
Example #2
0
 void UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         VailLogin(e.Result);
     }
 }
 void WS_UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         this.UserId = e.Result;
         // send a message to indicate that the login operation has completed
         Messenger.Default.Send(new LoginCompleteMessage());
     }
 }
Example #4
0
 void UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
 {
     //if (e.Error == null)
     //{
     VailLogin(e.Result);
     //}
     //else
     //{
     //    MessageBox.Show(e.Error.Message);
     //    VisualStateManager.GoToState(this, "loginerror", true);
     //}
 }
Example #5
0
        void client_UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
        {
            if (e.Result == null)
            {
                LoginResult = false;
                if (this.LoginedClick != null)
                {
                    this.LoginedClick(this, null);
                }
            }
            else
            {
                LoginResult = true;

                User = new T_SYS_USER();
                User = e.Result;
                client.GetUserPermissionByUserToUIAsync(User.SYSUSERID);
            }
        }
Example #6
0
        void client_UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
        {
            if (e.Result == null)
            {
                LoginResult = false;
                if (this.LoginedClick != null)
                {
                    this.LoginedClick(this, null);
                }
            }
            else
            {
                LoginResult = true;

                User = new T_SYS_USER();
                User = e.Result;
                client.GetUserPermissionByUserToUIAsync(User.SYSUSERID);
            }
        }
Example #7
0
        private void _client_UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                if (e.Result != null)
                {
                    _userLogin.EmployeeID    = e.Result.EMPLOYEEID;
                    _userLogin.IsManager     = e.Result.ISMANAGER;
                    _userLogin.LoginRecordID = e.Result.LOGINRECORDID;
                    _userLogin.SysUserID     = e.Result.SYSUSERID;

                    this.GetSystemCodes(_userLogin.SysUserID, result);
                }
                else
                {
                    if (UserLoginCompleted != null)
                    {
                        UserLoginFaild(this, EventArgs.Empty);
                    }
                }
            }
        }
Example #8
0
        private void _client_UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                if (e.Result != null)
                {
                    _userLogin.EmployeeID = e.Result.EMPLOYEEID;
                    _userLogin.IsManager = e.Result.ISMANAGER;
                    _userLogin.LoginRecordID = e.Result.LOGINRECORDID;
                    _userLogin.SysUserID = e.Result.SYSUSERID;

                    this.GetSystemCodes(_userLogin.SysUserID, result);
                }
                else 
                {
                    if (UserLoginCompleted != null)
                    {
                        UserLoginFaild(this, EventArgs.Empty);
                    }
                }

            }
        }
Example #9
0
        void learningService_UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
        {
            if (e.Result != null)
            {
                _account = e.Result as Account;
                if (_account.EmailVerified == false)
                {
                    _account = null;
                    txtError.Text = "Bạn chưa chứng thực bằng Email!"; return;
                }
                else
                    txtError.Text = "Đăng nhập thành công!";
                pesSessionService.SetPupilLoginIDAsync(_account.AccountID);
                GridAvarta.Children.Clear();
                GridAvarta.Children.Add(new AvartaUC(_account.AccountID.ToString(), _account.Username));
                CanvasLogin.Visibility = Visibility.Collapsed;
                socialNetUC.MouseLeftButtonDown += new MouseButtonEventHandler(SocialNetUC_MouseLeftButtonDown);
                parkUC.MouseLeftButtonDown += new MouseButtonEventHandler(parkControl_MouseLeftButtonDown);
                schoolControl.MouseLeftButtonDown += new MouseButtonEventHandler(SchoolControl_MouseLeftButtonDown);

                //txtError.Visibility = Visibility.Collapsed;
            }
            else { txtError.Text = "Tài khoản không đúng!"; }
        }
Example #10
0
 void UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
 {
     //if (e.Error == null)
     //{
         VailLogin(e.Result);
     //}
     //else
     //{
     //    MessageBox.Show(e.Error.Message);
     //    VisualStateManager.GoToState(this, "loginerror", true);
     //}
 }
        private void Service_UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
        {
            LOLConnectClient service = (LOLConnectClient)sender;
            service.UserLoginCompleted -= Service_UserLoginCompleted;
            if (null == e.Error)
            {
                User result = e.Result;
                if (result.Errors.Count > 0)
                {
                    string errorMessage =
                        StringUtils.CreateErrorMessageFromGeneralErrors(result.Errors);
                    parent.RunOnUiThread(delegate
                    {
                        GeneralUtils.Alert(c, Application.Context.Resources.GetString(Resource.String.errorUserLoginProblem), errorMessage, parent);
                    });
                } else
                {
                    AndroidData.IsLoggedIn = true;
                    // If it was a new user, it has already been set in UserCreate
                    if (user == UserType.ExistingUser)
                    {
                        AndroidData.CurrentUser = result;
                    }//end if

                    parent.RunOnUiThread(delegate
                    {
                        this.ShowAfterLoginScreen();
                    });
                }//end if else
            } else
            {
                parent.RunOnUiThread(delegate
                {
                    GeneralUtils.Alert(c, Application.Context.Resources.GetString(Resource.String.errorUserLoginProblem), Application.Context.Resources.GetString(Resource.String.errorUserLoginFailed), parent);
                });
            }
        }
Example #12
0
 void UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         VailLogin(e.Result);
     }
 }
        private void Service_UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
        {
            LOLConnectClient service = (LOLConnectClient)sender;
            service.UserLoginCompleted -= Service_UserLoginCompleted;

            if (null == e.Error)
            {
                User result = e.Result;

                if (result.Errors.Count > 0)
                {
                    string errorMessage =
                        StringUtils.CreateErrorMessageFromGeneralErrors(result.Errors);
                    foreach (GeneralError eachError in result.Errors)
                    {
                        ConnectServiceErrors error = StringUtils.GetErrorForErrorNumberStr(eachError.ErrorNumber);
                        string errorType = error.ToString();
                        string err = "";
                        switch (errorType)
                        {
                            case "PasswordsDontMatch":
                                err = Application.Context.Resources.GetString(Resource.String.errorCouldNotValidateEmailPassword);
                                break;
                            case "AccountInformationInvalid":
                                err = Application.Context.Resources.GetString(Resource.String.errorLoginAccountInvalid);
                                break;
                            default:
                                err = Application.Context.Resources.GetString(Resource.String.errorLoginFail);
                                break;
                        }

                        RunOnUiThread(() => GeneralUtils.Alert(c, Application.Context.Resources.GetString(Resource.String.commonError), err));

            #if(DEBUG)
                        System.Diagnostics.Debug.WriteLine("Error message: {0}--{1}--{2}--{3}",
                                          eachError.ErrorTitle,
                                          eachError.ErrorDescription,
                                          eachError.ErrorLocation,
                                          eachError.ErrorNumber);
            #endif
                    }
                } else
                {
                    AndroidData.IsLoggedIn = true;
                    AndroidData.CurrentUser = result;

                    if (AndroidData.CurrentUser.HasProfileImage &&
                        AndroidData.CurrentUser.Picture.Length == 0)
                    {

                        Task<UserImageDTO> task = service.CallAsyncMethod<UserImageDTO, UserGetImageDataCompletedEventArgs>((s, h, b) => {
                            if (b)
                            {
                                s.UserGetImageDataCompleted += h;
                            } else
                            {
                                s.UserGetImageDataCompleted -= h;
                            }//end if else
                        }, (s) => {

                            s.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID,
                                                        AndroidData.CurrentUser.AccountID,
                                                        new Guid(AndroidData.ServiceAuthToken));
                        });

                        try
                        {

                            UserImageDTO usrImage = task.Result;
                            if (usrImage.Errors.Count > 0)
                            {
            #if(DEBUG)
                                //Console.WriteLine ("Error retrieving user's image! {0}", StringUtils.CreateErrorMessageFromGeneralErrors (usrImage.Errors));
            #endif
                            } else
                            {
                                User currentUser = AndroidData.CurrentUser;
                                currentUser.Picture = usrImage.ImageData;
                                AndroidData.CurrentUser = currentUser;
                            }//end if else
                        } catch (Exception ex)
                        {
            #if(DEBUG)
                            //Console.WriteLine ("Exception retrieving user's image! {0}--{1}", ex.Message, ex.StackTrace);
            #endif
                        }//end try catch

                    }
                    if (System.Net.ServicePointManager.ServerCertificateValidationCallback == null)
                    {
                        System.Net.ServicePointManager.ServerCertificateValidationCallback = CertValidator.Validator;
                    }

                    RunOnUiThread(delegate
                    {
                        StartActivity(typeof(Main.HomeActivity));
                        Finish();
                    });
                }//end if else
            } else
                RunOnUiThread(() => GeneralUtils.Alert(c, Application.Context.Resources.GetString(Resource.String.commonError),
                                                Application.Context.Resources.GetString(Resource.String.errorLoginFailed)));
        }
 private void Service_UserLoginCompleted(object sender, UserLoginCompletedEventArgs e)
 {
     LOLConnectClient service = (LOLConnectClient)sender;
     service.UserCreateCompleted -= Service_UserCreateCompleted;
     if (null == e.Error)
     {
         User createdUser = e.Result;
         if (createdUser.Errors.Count > 0)
         {
             foreach (GeneralError eachError in createdUser.Errors)
             {
                 if (eachError.ErrorDescription.Contains("already exists"))
                 {
                     RunOnUiThread(delegate
                     {
                         if (progress != null)
                             progress.Dismiss();
                         GeneralUtils.Alert(context, Application.Context.Resources.GetString(Resource.String.commonError),
                                      Application.Context.Resources.GetString(Resource.String.alertViewMessageAccountExists));
                         EnableAll();
                     });
                     return;
                 }
             }
         } else
         {
             AndroidData.IsLoggedIn = true;
             AndroidData.CurrentUser = createdUser;
             RunOnUiThread(delegate
             {
                 if (progress != null)
                     progress.Dismiss();
                 GeneralUtils.Alert(context, Application.Context.Resources.GetString(Resource.String.commonDone),
                                                  Application.Context.Resources.GetString(Resource.String.createSuccess));
                 EnableAll();
             });
             AndroidData.user = UserType.ExistingUser;
             RunOnUiThread(delegate
             {
                 Intent i = new Intent(this, typeof(Main.HomeActivity));
                 i.AddFlags(ActivityFlags.ClearTop);
                 StartActivity(i);
             });
         }
     } else
     {
         RunOnUiThread(delegate
         {
             if (progress != null)
                 progress.Dismiss();
             GeneralUtils.Alert(context, Application.Context.Resources.GetString(Resource.String.commonError),
                                              Application.Context.Resources.GetString(Resource.String.createCommsError));
             EnableAll();
         });
     }
 }