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 UpdatePresence(object sender, EventArgs e)
        {
            DatabaseZorgmoment dbz = new DatabaseZorgmoment(context);

            DateTime     utc      = DateTime.UtcNow;
            TimeZoneInfo west     = TimeZoneInfo.FindSystemTimeZoneById("Europe/Amsterdam");
            DateTime     tijdstip = TimeZoneInfo.ConvertTimeFromUtc(utc, west);

            if (zorgmoment.aanwezigheid_begin != "" && zorgmoment.aanwezigheid_eind == "")
            {
                new AlertDialog.Builder(context)
                .SetTitle("Afmelden")
                .SetMessage("Wilt u zich afmelden bij deze cliënt?")
                .SetPositiveButton("Ja", (sender, args) =>
                {
                    dbz.UpdateAanwezigheid(zorgmoment.id.ToString(), "eind", tijdstip.ToString());
                    ZorgmomentRecord moment_record = dbz.GetZorgmomentById(zorgmoment.id.ToString());
                    Global.zorgmoment = moment_record;

                    aanwezigheid.SetBackgroundColor(Color.ParseColor("#aa00ca"));
                    aanwezigheid.SetTextColor(Color.ParseColor("#FFFFFF"));
                    aanwezigheid.Text = res.GetString(Resource.String.aanwezigheid_uit);
                })
                .SetNegativeButton("Nee", (sender, args) => { })
                .Show();
            }
            else if (zorgmoment.aanwezigheid_begin == "")
            {
                new AlertDialog.Builder(context)
                .SetTitle("Aanmelden")
                .SetMessage("Wilt u zich aanwezig melden bij deze cliënt?")
                .SetPositiveButton("Ja", (sender, args) =>
                {
                    dbz.UpdateAanwezigheid(zorgmoment.id.ToString(), "begin", tijdstip.ToString());
                    ZorgmomentRecord moment_record = dbz.GetZorgmomentById(zorgmoment.id.ToString());
                    Global.zorgmoment = moment_record;
                    aanwezigheid.SetBackgroundColor(Color.ParseColor("#00c000"));
                    aanwezigheid.Text = res.GetString(Resource.String.aanwezigheid_aan);
                })
                .SetNegativeButton("Nee", (sender, args) => { })
                .Show();
            }
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            dbz           = new DatabaseZorgmoment(this);
            result        = dbz.GetAllZorgmomenten();
            momentRecords = new List <ListZorgmomentRecord>();

            foreach (ZorgmomentRecord value in result)
            {
                ListZorgmomentRecord row = new ListZorgmomentRecord(value.id.ToString(), value.client_id.ToString(), Convert.ToString(value.datum_tijd), value.opmerkingen, Convert.ToString(value.aanwezigheid_begin), Convert.ToString(value.aanwezigheid_eind), value.nieuw.ToString());
                momentRecords.Add(row);
            }

            SetContentView(Resource.Layout.Home);
            listview            = FindViewById <ListView>(Resource.Id.ZorgmomentOverview);
            listview.Adapter    = new HomeListViewAdapter(this, momentRecords);
            listview.ItemClick += OnListItemClick;

            logout        = FindViewById <Button>(Resource.Id.Logout);
            logout.Click += Logout;
        }
Esempio n. 4
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));
            }
        }
Esempio n. 5
0
        public void DownloadData(string id)
        {
            var webClient = new WebClient()
            {
                Encoding = Encoding.UTF8
            };

            string personalisedUrl = url + id;

            try
            {
                byte[] myDataBuffer = webClient.DownloadData(personalisedUrl);

                string    download = Encoding.ASCII.GetString(myDataBuffer);
                JsonValue value    = JsonValue.Parse(download);

                foreach (JsonObject result in value)
                {
                    DatabaseClient dbc          = new DatabaseClient(context);
                    ClientRecord   clientRecord = new ClientRecord(result);
                    dbc.InsertClientData(clientRecord);

                    DatabaseZorgmoment dbz          = new DatabaseZorgmoment(context);
                    ZorgmomentRecord   momentRecord = new ZorgmomentRecord(result);
                    dbz.InsertZorgmomenten(momentRecord);

                    DatabaseTaak dbt = new DatabaseTaak(context);
                    foreach (JsonObject taak in result["taken"])
                    {
                        TaakRecord taakRecord = new TaakRecord(taak);
                        dbt.InsertTaken(taakRecord);
                    }
                }
            }
            catch (WebException e)
            {
                Console.WriteLine("exception: " + e.Message);
            }
        }