public void Validate()
        {
            var errorMsg = "";

            if (user.Text.Length == 0 && pass.Text.Length == 0)
            {
                if (user.Text.Length == 0 || pass.Text.Length == 0)
                {
                    errorMsg = "Please Enter User Name ";
                }
                if (pass.Text.Length == 0 || pass.Text.Length == 0)
                {
                    errorMsg = errorMsg + "Please Enter Password";
                }

                Toast.MakeText(this, errorMsg, ToastLength.Long).Show();
                return;
            }
            else
            {
                cpd = new CustomProgressDialog(this);
                cpd.SetCancelable(false);
                cpd.Show();
                DoLogin(user.Text, pass.Text);
            }
        }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
            StrictMode.SetVmPolicy(builder.Build());
            StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll();
            StrictMode.SetThreadPolicy(builder1.Build());

            base.OnCreate(savedInstanceState);

            progress = new ProgressDialog(this);
            progress.Indeterminate = true;
            progress.SetProgressStyle(ProgressDialogStyle.Spinner);
            progress.SetCancelable(false);
            progress.SetMessage("Please wait...");

            con         = new InternetConnection();
            dba         = new DBHelper();
            restService = new ServiceHelper();
            SetContentView(Resource.Layout.Registration_Layout);
            other_email       = Intent.GetStringExtra("email");
            other_user        = Intent.GetStringExtra("username");
            pref              = GetSharedPreferences("login", FileCreationMode.Private);
            edit              = pref.Edit();
            U_Name            = FindViewById <TextView>(Resource.Id.user);
            M_obile           = FindViewById <TextInputEditText>(Resource.Id.mobile);
            email_add         = FindViewById <TextView>(Resource.Id.email);
            pass_word         = FindViewById <TextInputEditText>(Resource.Id.pass);
            confrirm_password = FindViewById <TextInputEditText>(Resource.Id.confirmpassword);
            Registration      = FindViewById <Button>(Resource.Id.submit);
            U_Name.Text       = other_user;
            email_add.Text    = other_email;
            Dateofbirth       = FindViewById <TextInputEditText>(Resource.Id.birth);
            Gender            = FindViewById <TextInputEditText>(Resource.Id.gender);



            //U_Name.Text = GoogleAuth_Activity.user_Name;
            //U_Name.SetCursorVisible(false);
            //U_Name.SetFadingEdgeLength(10);
            //U_Name.Enabled = false;


            //email_add.Text = GoogleAuth_Activity.alreadyregistered;

            //email_add.SetCursorVisible(false);
            //email_add.SetFadingEdgeLength(10);
            //email_add.Enabled = false;


            Dateofbirth.Click += DateSelect_OnClick;;



            Registration.Click += async delegate
            {
                other_user        = U_Name.Text.ToString();
                other_mobile      = M_obile.Text.ToString();
                other_email       = email_add.Text.ToString();
                other_pass        = pass_word.Text.ToString();
                otherconfirm_pass = confrirm_password.Text.ToString();
                var hasNumber       = new Regex(@"[0-9]+");
                var hasUpperChar    = new Regex(@"[A-Z]+");
                var hasMiniMaxChars = new Regex(@".{6,25}");
                var hasLowerChar    = new Regex(@"[a-z]+");
                var hasSymbols      = new Regex(@"[!@#$%^&*()_+=\[{\]};:<>|./?,-]");
                if (other_user.Equals(""))
                {
                    Toast.MakeText(this, "Please Enter UserName", ToastLength.Short).Show();
                    return;
                }
                if (other_mobile.Equals("") || other_mobile.Length < 10)
                {
                    Toast.MakeText(this, "Please Enter 10 digit Mobile Number", ToastLength.Short).Show();
                    return;
                }
                if (other_email.Equals("") || !other_email.Contains("@"))
                {
                    Toast.MakeText(this, "Please Enter valid email address", ToastLength.Short).Show();
                    return;
                }
                if (other_pass.Equals("") || !hasNumber.IsMatch(other_pass) || !hasUpperChar.IsMatch(other_pass) || !hasMiniMaxChars.IsMatch(other_pass) || !hasLowerChar.IsMatch(other_pass) || !hasSymbols.IsMatch(other_pass))
                {
                    Toast.MakeText(this, "Password Should have minimum 6 character, minumum one special char, one uppercase letter,one lowercase letter", ToastLength.Short).Show();
                    return;
                }
                if (other_mobile.Length < 6)
                {
                    Toast.MakeText(this, "Please Enter minimum 6 digit password", ToastLength.Short).Show();
                    return;
                }
                if (!other_pass.Equals(otherconfirm_pass))
                {
                    Toast.MakeText(this, "Password and confirm password should be same", ToastLength.Short).Show();
                    return;
                }

                //if (con.connectivity())
                //{
                //    RegistrationData();
                //}

                else
                {
                    cpd = new CustomProgressDialog(this);
                    cpd.SetCancelable(false);
                    cpd.Show();
                    DoRegistration(other_user, other_pass, other_mobile, other_email);
                }
            };
        }