Ejemplo n.º 1
0
        async void btnSignIn_Clicked(object sender, EventArgs e)
        {
            var             email    = entryEmail.Text;
            var             password = entryPassword.Text;
            FormValidations login    = new FormValidations();

            loginResult = login.LoginValidation(email, password);

            if (loginResult["Result"].ToString() == "Success")
            {
                if (Application.Current.Properties.ContainsKey("Email") && Application.Current.Properties.ContainsKey("Password"))
                {
                    if ((Application.Current.Properties["Email"].ToString() == email.ToLower()) && (Application.Current.Properties["Password"].ToString() == password.ToLower()))
                    {
                        await Navigation.PushAsync(new WelcomePage());
                    }
                    else
                    {
                        await DisplayAlert(Message.LOGIN_ERROR_MSG_TITLE, Message.VALID_CREDENTIALS_MESSAGE, Message.ALERT_BOX_BUTTON);
                    }
                }
                else
                {
                    await DisplayAlert(Message.LOGIN_ERROR_MSG_TITLE, Message.VALID_CREDENTIALS_MESSAGE, Message.ALERT_BOX_BUTTON);
                }
            }
            else
            {
                await DisplayAlert(Message.LOGIN_ERROR_MSG_TITLE, loginResult["Message"], Message.ALERT_BOX_BUTTON);
            }
        }
Ejemplo n.º 2
0
        async void btnSignUp_Clicked(object sender, EventArgs e)
        {
            var             email           = entryEmail.Text;
            var             password        = entryPassword.Text;
            var             username        = entryUsername.Text;
            var             confirmPassword = entryConfirmPassword.Text;
            FormValidations signup          = new FormValidations();

            signupResult = signup.signUpValidation(username, email, password, confirmPassword);

            if (signupResult["Result"].ToString() == "Success")
            {
                Application.Current.Properties["Username"] = username.ToLower();
                Application.Current.Properties["Email"]    = email.ToLower();
                Application.Current.Properties["Password"] = password;
                await Application.Current.SavePropertiesAsync();

                await Navigation.PopAsync(true);
            }
            else
            {
                await DisplayAlert(Message.SIGNUP_ERROR_MSG_TITLE, signupResult["Message"], Message.ALERT_BOX_BUTTON);
            }
        }