protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.pacientUser);
            user.id = Intent.GetIntExtra("User", 0);
            user.findAndLoad(this, user.id);

            userName        = FindViewById <EditText>(Resource.Id.userNameDetails);
            password        = FindViewById <EditText>(Resource.Id.passwordUserDetailsET);
            confirmPassword = FindViewById <EditText>(Resource.Id.passwordConfirmDetailsET);

            changeUserPB        = FindViewById <Button>(Resource.Id.changeUserPB);
            changeUserPB.Click += changeUser;

            saveUserUpdatePB        = FindViewById <Button>(Resource.Id.saveUserUpdatePB);
            saveUserUpdatePB.Click += saveUserUpdate;

            cancelUserUpdatePB        = FindViewById <Button>(Resource.Id.cancelUserUpdatePB);
            cancelUserUpdatePB.Click += cacelUserUpdate;

            userName.Text        = user.userName;
            password.Text        = user.password;
            confirmPassword.Text = user.password;
            // Create your application here
        }
Esempio n. 2
0
        private void Agregar(object sender, EventArgs e)
        {
            Usuario user    = new Usuario();
            var     usuario = FindViewById <EditText>(Resource.Id.usernameAgregarPaciente);

            user.userName = usuario.Text;
            var password = FindViewById <EditText>(Resource.Id.passwordAgregarPaciente);

            user.password = password.Text;
            var confirmation = FindViewById <EditText>(Resource.Id.passwordConfirm);

            if (!(user.password.Trim() != "" && user.password == confirmation.Text))
            {
                Toast.MakeText(this, "Las claves no coinciden o son nulas", ToastLength.Short).Show();
                return;
            }
            if (user.findAndLoad(this, user.userName))
            {
                Toast.MakeText(this, "El usuario ya esta registrado", ToastLength.Short).Show();
            }
            else
            {
                user.rol = "paciente";
                user.save(this);
                usuario.Text      = "";
                password.Text     = "";
                confirmation.Text = "";
                Finish();
            }
        }
        protected override void OnStart()
        {
            base.OnStart();
            pacient.findAndLoad(this, pacient.id);

            diet.findAndLoad(this, pacient.paciente.idDieta);
            rutine.findAndLoad(this, pacient.paciente.idRutina);

            var userName = FindViewById <EditText>(Resource.Id.userNameDetailsET);

            userName.Text = pacient.userName;



            var pacientNameDetails = FindViewById <EditText>(Resource.Id.pacientNameDetails);

            pacientNameDetails.Text = pacient.paciente.name;

            var pacientNameRecordDetails = FindViewById <EditText>(Resource.Id.pacientNameRecordDetails);

            pacientNameRecordDetails.Text = pacient.paciente.name;

            var pacientNameDietDetails = FindViewById <EditText>(Resource.Id.dietNameDetailsET);

            pacientNameDietDetails.Text = diet.name;

            var pacientNameRutineDetails = FindViewById <EditText>(Resource.Id.rutineNameDetailsET);

            pacientNameRutineDetails.Text = rutine.name;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.pacientPersonalData);

            name     = FindViewById <EditText>(Resource.Id.pacientNameDetailsET);
            age      = FindViewById <EditText>(Resource.Id.pacientAgeDetailsET);
            gender   = FindViewById <EditText>(Resource.Id.pacientGenderDetailsET);
            genderSP = FindViewById <Spinner>(Resource.Id.pacientGenderDetailsSP);
            job      = FindViewById <EditText>(Resource.Id.pacientJobDetailsET);
            address  = FindViewById <EditText>(Resource.Id.pacientAddressDetailsET);
            phone    = FindViewById <EditText>(Resource.Id.pacientPhoneDetailsET);



            user.id = Intent.GetIntExtra("Pacient", 0);
            user.findAndLoad(this, user.id);

            name.Text = user.paciente.name;
            age.Text  = user.paciente.edad.ToString();

            genders.Add("Hombre");
            genders.Add("Mujer");
            genders.Add("No definido");

            ArrayAdapter <string> adapter = new ArrayAdapter <string>(this, Resource.Layout.support_simple_spinner_dropdown_item, genders);

            genderSP.Adapter = adapter;

            if (user.paciente.sexo == "M")
            {
                genderSP.SetSelection(1);
                gender.Text = "Mujer";
            }
            else if (user.paciente.sexo == "H")
            {
                genderSP.SetSelection(0);
                gender.Text = "Hombre";
            }
            else
            {
                genderSP.SetSelection(2);
                gender.Text = "No definido";
            }

            job.Text     = user.paciente.ocupacion;
            address.Text = user.paciente.domicilio;
            phone.Text   = user.paciente.telefono;

            changePersonalDataPB        = FindViewById <Button>(Resource.Id.changePersonalData);
            changePersonalDataPB.Click += changePersonalData;

            cancelPersonalDataUpdatePB        = FindViewById <Button>(Resource.Id.cancelUpdatePersonalDataPB);
            cancelPersonalDataUpdatePB.Click += cancelPersonalDataUpdate;

            savePersonalDataUpdatePB        = FindViewById <Button>(Resource.Id.savePersonalDataUpdatePB);
            savePersonalDataUpdatePB.Click += savePersonalDataUpdate;
            // Create your application here
        }
Esempio n. 5
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.reportHistory);
     pacient.id = Intent.GetIntExtra("Pacient", 0);
     pacient.findAndLoad(this, pacient.id);
     list            = FindViewById <ListView>(Resource.Id.listHistory);
     list.ItemClick += itemHistoryClick;
     // Create your application here
 }
Esempio n. 6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activityRegister);
            pacient.id = Intent.GetIntExtra("Pacient", 0);
            fecha      = Intent.GetStringExtra("Date");
            pacient.findAndLoad(this, pacient.id);
            diet                  = FindViewById <CheckBox>(Resource.Id.dietCheck);
            rutine                = FindViewById <CheckBox>(Resource.Id.rutineCheck);
            date                  = FindViewById <TextView>(Resource.Id.dateActivityRegister);
            saveActivityPB        = FindViewById <Button>(Resource.Id.saveActivity);
            saveActivityPB.Click += saveActivity;

            if (fecha == "")
            {
                if (pacient.paciente.existDietActivity(this, DateTime.Today.ToString("dd-MM-yyyy")))
                {
                    diet.Checked           = true;
                    diet.Enabled           = false;
                    rutine.Enabled         = false;
                    saveActivityPB.Enabled = false;
                }
                if (pacient.paciente.existRutineActivity(this, DateTime.Today.ToString("dd-MM-yyyy")))
                {
                    rutine.Checked         = true;
                    diet.Enabled           = false;
                    rutine.Enabled         = false;
                    saveActivityPB.Enabled = false;
                }
                date.Text = DateTime.Today.ToString("dd-MM-yyyy");
            }
            else
            {
                if (pacient.paciente.existDietActivity(this, fecha))
                {
                    diet.Checked           = true;
                    saveActivityPB.Enabled = false;
                }
                if (pacient.paciente.existRutineActivity(this, fecha))
                {
                    rutine.Checked         = true;
                    saveActivityPB.Enabled = false;
                }
                diet.Enabled              = false;
                rutine.Enabled            = false;
                saveActivityPB.Visibility = ViewStates.Invisible;
                date.Text = fecha;
            }



            // Create your application here
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.pacientDiet);

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

            nameET = FindViewById <EditText>(Resource.Id.dietNameDetailsET);
            kcal   = FindViewById <EditText>(Resource.Id.dietKcalDetailsET);



            name        = FindViewById <Spinner>(Resource.Id.dietNameDetailsSP);
            description = FindViewById <EditText>(Resource.Id.dietDescriptionDetailsET);
            var dieta = new Dieta();

            dietas      = dieta.all(this);
            nameET.Text = diet.name;
            kcal.Text   = diet.kcal.ToString();
            ArrayAdapter <Dieta> adapter = new ArrayAdapter <Dieta>(this, Resource.Layout.support_simple_spinner_dropdown_item, dietas);

            name.Adapter = adapter;

            if (pacient.paciente.idDieta == 0)
            {
                pacient.paciente.idDieta = dietas[dietas.FindIndex(a => a.name == "Sin dieta")].id;
            }

            name.SetSelection(dietas.FindIndex(a => a.id == pacient.paciente.idDieta));
            name.ItemSelected += dietSelectionChange;

            changePacientDietPB        = FindViewById <Button>(Resource.Id.changePacientDietPB);
            changePacientDietPB.Click += changePacientDiet;

            if (authLevel == 4 || authLevel == 3)
            {
                changePacientDietPB.Visibility = ViewStates.Invisible;
            }

            cancelPacientDietUpdatePB        = FindViewById <Button>(Resource.Id.cancelPacientDietUpdatePB);
            cancelPacientDietUpdatePB.Click += cancelPacientDietUpdate;

            savePacientDietUpdatePB        = FindViewById <Button>(Resource.Id.savePacientDietUpdatePB);
            savePacientDietUpdatePB.Click += savePacientDietUpdate;



            // Create your application here
        }
Esempio n. 8
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
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.pacientRecord);
            user.id   = Intent.GetIntExtra("Pacient", 0);
            authLevel = Intent.GetIntExtra("Auth", 4);
            user.findAndLoad(this, user.id);
            name            = FindViewById <EditText>(Resource.Id.pacientNameRecordDetailsET);
            weight          = FindViewById <EditText>(Resource.Id.pacientWeightDetailsET);
            size            = FindViewById <EditText>(Resource.Id.pacientSizeDetailsET);
            imc             = FindViewById <EditText>(Resource.Id.pacientImcDetailsET);
            waist           = FindViewById <EditText>(Resource.Id.pacientWaistDetailsET);
            abdomen         = FindViewById <EditText>(Resource.Id.pacientAbdomenDetailsET);
            hip             = FindViewById <EditText>(Resource.Id.pacientHipDetailsET);
            fat             = FindViewById <EditText>(Resource.Id.pacientFatDetailsET);
            visceralFat     = FindViewById <EditText>(Resource.Id.pacientVisceralFatDetailsET);
            muscle          = FindViewById <EditText>(Resource.Id.pacientMuscleDetailsET);
            waterPercentage = FindViewById <EditText>(Resource.Id.pacientWaterPercentageDetailsET);

            name.Text            = user.paciente.name;
            weight.Text          = user.expediente.peso.ToString();
            size.Text            = user.expediente.talla.ToString();
            imc.Text             = user.expediente.imc.ToString();
            waist.Text           = user.expediente.cintura.ToString();
            abdomen.Text         = user.expediente.abdomen.ToString();
            hip.Text             = user.expediente.cadera.ToString();
            fat.Text             = user.expediente.grasa.ToString();
            visceralFat.Text     = user.expediente.grasaVisceral.ToString();
            muscle.Text          = user.expediente.musculo.ToString();
            waterPercentage.Text = user.expediente.aguaPorcentaje.ToString();

            saveRecordUpdatePB        = FindViewById <Button>(Resource.Id.saveRecordUpdatePB);
            saveRecordUpdatePB.Click += saveRecordUpdate;

            cancelRecordUpdatePB        = FindViewById <Button>(Resource.Id.cancelUpdateRecordPB);
            cancelRecordUpdatePB.Click += cancelRecordUpdate;

            changeRecordPB        = FindViewById <Button>(Resource.Id.changeRecordData);
            changeRecordPB.Click += changeRecord;

            if (authLevel == 4)
            {
                changeRecordPB.Visibility = ViewStates.Invisible;
            }
            // Create your application here
        }
Esempio n. 10
0
        public void Ingresar(object sender, EventArgs e)
        {
            var     user     = FindViewById <Android.Support.V7.Widget.AppCompatEditText>(Resource.Id.username);
            var     password = FindViewById <Android.Support.V7.Widget.AppCompatEditText>(Resource.Id.password);
            Usuario u        = new Usuario();

            u.findAndLoad(this, user.Text);
            if (user.Text == u.userName && password.Text == u.password)
            {
                userLogged.id       = u.id;
                userLogged.userName = u.userName;
                userLogged.password = u.userName;
                userLogged.rol      = u.rol;
                if (userLogged.rol == "admin")
                {
                    authLevel = 1;
                }
                else if (userLogged.rol == "nutriologo")
                {
                    authLevel = 2;
                }
                else if (userLogged.rol == "especialista")
                {
                    authLevel = 3;
                }
                else
                {
                    authLevel = 4;
                }

                Toast.MakeText(Application.Context, "Hola", ToastLength.Short).Show();

                setAllPagesInvisible();
                homePage.Visibility = ViewStates.Visible;

                navLogin.SetVisible(false);
                navLogout.SetVisible(true);
                navUser.SetVisible(true);
                navMensajes.SetVisible(true);

                //opciones para usuarios administradores
                if (userLogged.rol == "nutriologo" || userLogged.rol == "especialista" || userLogged.rol == "admin")
                {
                    navDietas.SetVisible(true);
                    navRutinas.SetVisible(true);
                    navPacientes.SetVisible(true);
                }
                else
                {
                    navDietas.SetVisible(true);
                    navRutinas.SetVisible(true);
                    navReporte.SetVisible(true);
                    navActivityRegister.SetVisible(true);
                }
            }
            else
            {
                Toast.MakeText(Application.Context, "Usuario o contrasena incorrectos", ToastLength.Short).Show();
            }
            user.Text     = "";
            password.Text = "";
        }