Beispiel #1
0
        public static Models.MobileRegister Register(System.Json.JsonValue json)
        {
            // Extract the array of name/value results for the field name "weatherObservation".
            System.Json.JsonValue jsonR = json;
            var u = new Models.MobileRegister();

            u.AccountCreated = bool.Parse(jsonR["AccountCreated"].ToString());
            u.UnValid        = jsonR["UnValid"];
            return(u);
        }
Beispiel #2
0
        protected async Task OnClickAsync()
        {
            if (TextUtils.IsEmpty(email.Text) || TextUtils.IsEmpty(password.Text))
            {
                if (TextUtils.IsEmpty(email.Text))
                {
                    email.RequestFocus();
                    email.SetError("Pole nie może być puste!", null);
                    return;
                }
                if (TextUtils.IsEmpty(password.Text))
                {
                    password.RequestFocus();
                    password.SetError("Pole nie może być puste!", null);
                    return;
                }
            }
            else if (!TextUtils.IsEmpty(email.Text) || !TextUtils.IsEmpty(password.Text))
            {
                if (password.Text != passwordconfirm.Text)
                {
                    passwordconfirm.RequestFocus();
                    passwordconfirm.SetError("Hasła są niezgodne!", null);
                    password.RequestFocus();
                    password.SetError("Hasła są niezgodne!", null);
                    return;
                }
                else
                {
                    String userType = null;
                    if (uczestnik.Checked)
                    {
                        userType = "User";
                    }
                    if (wystawca.Checked)
                    {
                        userType = "Company";
                    }
                    Models.MobileRegister mr = await DbConnection.FetchRegisterAsync(email.Text, password.Text, userType);

                    if (mr.AccountCreated == true)
                    {
                        var NxtAct = new Intent(this, typeof(EditMyProfileActivity));
                        if (uczestnik.Checked)
                        {
                            NxtAct.PutExtra("Typ", "uczestnik");
                            NxtAct.PutExtra("Email", email.Text);
                            NxtAct.PutExtra("Action", "Register");
                        }
                        else if (wystawca.Checked)
                        {
                            NxtAct.PutExtra("Typ", "wystawca");
                            NxtAct.PutExtra("Email", email.Text);
                            NxtAct.PutExtra("Action", "Register");
                        }
                        StartActivity(NxtAct);
                    }
                    else
                    {
                        if (mr.UnValid == "Email")
                        {
                            Toast.MakeText(this, "Konto o takim Emailu istnieje", ToastLength.Long).Show();
                        }
                    }
                }
            }
        }