Esempio n. 1
0
        async private void Next1_click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(firstnameEntry.Text) && !string.IsNullOrWhiteSpace(lastnameEntry.Text) && !string.IsNullOrWhiteSpace(passwordEntry.Text) && !string.IsNullOrWhiteSpace(emailEntry.Text) && PlacePicker.SelectedIndex != -1 && GenderPicker.SelectedIndex != -1)
            {
                validationMsgLb.Text = "";
                player           = new User();
                player.firstName = firstnameEntry.Text;
                player.lastName  = lastnameEntry.Text;
                player.email     = emailEntry.Text;
                player.password  = passwordEntry.Text;
                player.gender    = userGenderList.Find(g => GenderPicker.SelectedItem.ToString() == g.value).id;
                player.mobile    = mobileEntry.Text;
                player.place     = userpreferedPlaceList.Find(p => PlacePicker.SelectedItem.ToString() == p.value).id.ToString();
                player.userName  = firstnameEntry.Text + lastnameEntry.Text;


                SignUpValidation checkValidationObj = new SignUpValidation();
                checkValidationObj = SignUpValidation.CheckPage1Validation(player);
                System.Diagnostics.Debug.WriteLine("validation : " + player.firstName + " ," + player.lastName + " ," + player.mobile + " ," + player.password + " , " + player.email);
                if (SignUpValidation.isNotValid == true)
                {
                    validationMsgLb.Text = "Please Enter Valid info";
                    //show a validation msg for each field
                }


                else
                {
                    Request requestObj        = new Request();
                    var     mailExistResponse = await requestObj.callService("userServices/isMailExist?userEmail=" + player.email.ToString(), "", "GET");

                    if (mailExistResponse.status == true && mailExistResponse.content == "true")
                    {
                        emailEntry.Focus();
                        await DisplayAlert("Not Completed!!", "this Email is already used please sign up with another email address", "OK");
                    }

                    else if (mailExistResponse.status == true && mailExistResponse.content == "false")
                    {
                        await Navigation.PushAsync(new SignUp2(player, userPreferedActivityList));
                    }

                    else
                    {
                        await DisplayAlert("Error!", "Network Error, Please try again later", "OK");
                    }
                }
            }


            else
            {
                //await Navigation.PushAsync(new SignUp2(player , userPreferedActivityList)); //to be deleted
                validationMsgLb.Text = "Please Fill all the required fields!";
            }
        }
Esempio n. 2
0
        // true means validation failed
        public static SignUpValidation CheckPage1Validation(User playerObj)
        {
            SignUpValidation validationObj = new SignUpValidation();

            if (playerObj.firstName.Length < 2 || playerObj.firstName.Length > 13)
            {
                validationObj.firstNameVal = true;
                isNotValid = true;
            }

            if (playerObj.lastName.Length < 2 || playerObj.firstName.Length > 13)
            {
                validationObj.lastNameVal = true;
                isNotValid = true;
            }

            if (playerObj.email.Length > 2)
            {
                emailVal   = Regex.IsMatch(playerObj.email, MatchEmailPattern) == true ? false : true;
                isNotValid = emailVal == true?  true : false;
            }
            else
            {
                emailVal   = true;
                isNotValid = true;
            }


            if (playerObj.mobile.Length <= 10 || playerObj.mobile.Length >= 15 || IsDigitsOnly(playerObj.mobile) == false)
            {
                mobileVal = false;
            }
            //    mobileVal = Regex.IsMatch(playerObj.mobile,matchMobilePattern ) == true ? false : true;
            isNotValid = mobileVal == true ? true : false;

            if (playerObj.password.Length <= 7)
            {
                passwordVal = false;
            }
            //passwordVal = Regex.IsMatch(playerObj.password, matchpasswordPattern) == true ? false : true;
            isNotValid = passwordVal == true ? true : false;

            return(validationObj);
        }