コード例 #1
0
        protected override void OnStart()
        {
            base.OnStart();
            var rutine = new Rutina();

            rutinas      = rutine.all(this);
            list.Adapter = new RutinaAdapter(this, Resource.Layout.itemRutine, rutinas);
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.pacientRutine);

            pacient.id = Intent.GetIntExtra("Pacient", 0);
            pacient.findAndLoad(this, pacient.id);
            authLevel = Intent.GetIntExtra("Auth", 4);
            rutine.findAndLoad(this, pacient.paciente.idRutina);

            nameET = FindViewById <EditText>(Resource.Id.rutineNameDetailsET);
            kcal   = FindViewById <EditText>(Resource.Id.rutineKcalDetailsET);


            name        = FindViewById <Spinner>(Resource.Id.rutineNameDetailsSP);
            description = FindViewById <EditText>(Resource.Id.rutineDescriptionDetailsET);
            var rutina = new Rutina();

            rutinas     = rutina.all(this);
            nameET.Text = rutine.name;
            kcal.Text   = rutine.kcal.ToString();
            ArrayAdapter <Rutina> adapter = new ArrayAdapter <Rutina>(this, Resource.Layout.support_simple_spinner_dropdown_item, rutinas);

            name.Adapter = adapter;

            if (pacient.paciente.idRutina == 0)
            {
                pacient.paciente.idRutina = rutinas[rutinas.FindIndex(a => a.name == "Sin Rutina")].id;
            }

            name.SetSelection(rutinas.FindIndex(a => a.id == pacient.paciente.idRutina));
            name.ItemSelected += rutineSelectionChange;

            changePacientRutinePB        = FindViewById <Button>(Resource.Id.changePacientRutinePB);
            changePacientRutinePB.Click += changePacientRutine;

            if (authLevel == 4 || authLevel == 2)
            {
                changePacientRutinePB.Visibility = ViewStates.Invisible;
            }

            cancelPacientRutineUpdatePB        = FindViewById <Button>(Resource.Id.cancelPacientRutineUpdatePB);
            cancelPacientRutineUpdatePB.Click += cancelPacientRutineUpdate;

            savePacientRutineUpdatePB        = FindViewById <Button>(Resource.Id.savePacientRutineUpdatePB);
            savePacientRutineUpdatePB.Click += savePacientRutineUpdate;



            // Create your application here
        }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.reportMain);
            pacient.id = Intent.GetIntExtra("Pacient", 0);
            pacient.findAndLoad(this, pacient.id);

            var dietasList  = dietas.all(this);
            var rutinasList = rutinas.all(this);

            Dictionary <int, int> diets   = new Dictionary <int, int>();
            Dictionary <int, int> rutines = new Dictionary <int, int>();

            diets   = pacient.paciente.getKcalTot(this);
            rutines = pacient.paciente.getKcalBurn(this);

            dietDays   = FindViewById <TextView>(Resource.Id.dietDays);
            rutineDays = FindViewById <TextView>(Resource.Id.rutineDays);
            kcalTot    = FindViewById <TextView>(Resource.Id.kcal);
            kcalBurn   = FindViewById <TextView>(Resource.Id.kcalRutina);
            int auxiliar = 0;
            int days     = 0;

            foreach (var x in rutines)
            {
                auxiliar += rutinasList[rutinasList.FindIndex(a => a.id == x.Key)].kcal * x.Value;
                days++;
            }

            rutineDays.Text = days.ToString();
            kcalBurn.Text   = auxiliar.ToString();
            auxiliar        = 0;
            days            = 0;
            foreach (var x in diets)
            {
                auxiliar += dietasList[dietasList.FindIndex(a => a.id == x.Key)].kcal * x.Value;
                days++;
            }
            kcalTot.Text  = auxiliar.ToString();
            dietDays.Text = days.ToString();

            var historyPB = FindViewById <Button>(Resource.Id.historyPB);

            historyPB.Click += history;


            // Create your application here
        }