Esempio n. 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            DatabaseTaak dbt = new DatabaseTaak(this);

            taken       = dbt.GetTakenByZorgmoment(Global.zorgmoment.id.ToString());
            taakRecords = new List <ListTaakRecord>();
            foreach (TaakRecord taak in taken)
            {
                ListTaakRecord row = new ListTaakRecord(taak.id.ToString(), taak.zorgmoment_id.ToString(), taak.stap.ToString(), taak.omschrijving, taak.voltooid.ToString());
                taakRecords.Add(row);
            }

            SetContentView(Resource.Layout.DetailTaken);
            ListView listview = FindViewById <ListView>(Resource.Id.Takenlijst);

            listview.Adapter = new DetailListViewAdapter(this, taakRecords);
            ListView aanwezigbtn = FindViewById <ListView>(Resource.Id.AanwezigButton);

            aanwezigbtn.Adapter = new PresentButtonAdapter(this);
            FindViewById <TextView>(Resource.Id.Opmerkingen).Text = Global.zorgmoment.opmerkingen;


            Button homebtn = FindViewById <Button>(Resource.Id.HomeButton);

            homebtn.Click += (object sender, EventArgs e) =>
            {
                StartActivity(typeof(Home));
            };
            Button adresbtn = FindViewById <Button>(Resource.Id.AdresButton);

            adresbtn.Click += (object sender, EventArgs e) =>
            {
                StartActivity(typeof(DetailAdres));
                OverridePendingTransition(0, 0);
            };
            Button kaartbtn = FindViewById <Button>(Resource.Id.KaartButton);

            kaartbtn.Click += (object sender, EventArgs e) =>
            {
                StartActivity(typeof(DetailKaart));
                OverridePendingTransition(0, 0);
            };
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var  taak = taken[position];
            View view = convertView;

            if (view == null)
            {
                view = context.LayoutInflater.Inflate(Resource.Layout.ListRow, parent, false);
            }

            TextView description = view.FindViewById <TextView>(Resource.Id.TextLeftBig);

            description.Text = $"{taak.stap} - {taak.omschrijving}";
            TextView completion = view.FindViewById <TextView>(Resource.Id.TextRightBig);

            completion.TextSize = 30;

            switch (taak.voltooid)
            {
            case "0":
                completion.Text = "O";
                completion.SetTextColor(Color.ParseColor("#3D3D3D"));
                description.SetTextColor(Color.ParseColor("#3D3D3D"));
                break;

            case "1":
                completion.Text = "V";
                completion.SetTextColor(Color.ParseColor("#00a000"));
                description.SetTextColor(Color.ParseColor("#00a000"));
                break;
            }

            view.FindViewById <TextView>(Resource.Id.TextLeftSmall).Visibility  = ViewStates.Gone;
            view.FindViewById <TextView>(Resource.Id.TextRightSmall).Visibility = ViewStates.Gone;

            LinearLayout row = view.FindViewById <LinearLayout>(Resource.Id.ListViewRow);

            row.Click += (object sender, EventArgs e) =>
            {
                if (Global.zorgmoment.aanwezigheid_begin != "" && Global.zorgmoment.aanwezigheid_eind == "")
                {
                    DatabaseTaak dbt = new DatabaseTaak(context);
                    switch (completion.Text)
                    {
                    case "V":
                        completion.Text = "O";
                        completion.SetTextColor(Color.ParseColor("#3D3D3D"));
                        description.SetTextColor(Color.ParseColor("#3D3D3D"));
                        dbt.UpdateTaak(taak.id, "0");
                        break;

                    case "O":
                        completion.Text = "V";
                        completion.SetTextColor(Color.ParseColor("#00a000"));
                        description.SetTextColor(Color.ParseColor("#00a000"));
                        dbt.UpdateTaak(taak.id, "1");
                        break;
                    }
                }
                else
                {
                    new AlertDialog.Builder(context)
                    .SetTitle("Aanwezigheid vereist")
                    .SetMessage("U dient aanwezig gemeld te zijn bij deze cliënt om taken te kunnen afvinken.")
                    .Show();
                }
            };

            return(view);
        }