Esempio n. 1
0
        public async void PostData(object sender, object e)
        {
            string gebruikersnaam = FindViewById <EditText>(Resource.Id.Username).Text;
            string wachtwoord     = FindViewById <EditText>(Resource.Id.Password).Text;

            HttpClient  client  = new HttpClient();
            HttpContent content = new FormUrlEncodedContent(new[] {
                new KeyValuePair <string, string>("gebruikersnaam", gebruikersnaam),
                new KeyValuePair <string, string>("wachtwoord", wachtwoord),
            });
            HttpResponseMessage response = await client.PostAsync(url, content);

            string result = await response.Content.ReadAsStringAsync();

            if (result != "-1" && result != null)
            {
                DatabaseLogin dbl = new DatabaseLogin(this);
                dbl.Login(result);
                DatabaseZorgmoment dbz = new DatabaseZorgmoment(this);
                dbz.UpdateZorgmomenten();
                Database db = new Database(this);
                db.DownloadData(result);
                StartActivity(typeof(Home));
            }
            else
            {
                FindViewById <TextView>(Resource.Id.FlashText).Text = "Foutieve gebruikersnaam en/of wachtwoord";
                FindViewById <EditText>(Resource.Id.Username).Text  = "";
                FindViewById <EditText>(Resource.Id.Password).Text  = "";
            }
        }
Esempio n. 2
0
        public void Logout(object sender, EventArgs e)
        {
            DatabaseLogin dbl = new DatabaseLogin(this);

            dbl.Logout();
            StartActivity(typeof(Login));
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Database db = new Database(this);

            db.CreateDatabase();

            DatabaseLogin      dbl = new DatabaseLogin(this);
            DatabaseZorgmoment dbz = new DatabaseZorgmoment(this);

            if (dbl.CheckLogin())
            {
                gebruiker = dbl.GetGebruiker();
                dbz.UpdateZorgmomenten();
                db.DownloadData(gebruiker.id.ToString());
                StartActivity(typeof(Home));
            }
            else
            {
                StartActivity(typeof(Login));
            }
        }