protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.rutineDetails); name = FindViewById <EditText>(Resource.Id.rutineNameDetails); description = FindViewById <EditText>(Resource.Id.rutineDescriptionDetails); kcal = FindViewById <EditText>(Resource.Id.rutineKcalDetails); rutine.id = Intent.GetIntExtra("Rutine", 0); rutine.findAndLoad(this, rutine.id); name.Text = rutine.name; description.Text = rutine.content; kcal.Text = rutine.kcal.ToString(); changeRutinePB = FindViewById <Button>(Resource.Id.changeRutinePB); changeRutinePB.Click += changeRutine; cancelRutineUpdatePB = FindViewById <Button>(Resource.Id.cancelRutineUpdatePB); cancelRutineUpdatePB.Click += cancelRutineUpdate; saveRutineUpdatePB = FindViewById <Button>(Resource.Id.saveRutineUpdatePB); saveRutineUpdatePB.Click += saveRutineUpdate; // Create your application here }
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.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 }
private void AgregarRutina(object sender, EventArgs e) { Rutina rutine = new Rutina(); var name = FindViewById <EditText>(Resource.Id.rutineNameAdd); rutine.name = name.Text; var content = FindViewById <EditText>(Resource.Id.rutineDescriptionAdd); rutine.content = content.Text; var kcal = FindViewById <EditText>(Resource.Id.rutineKcalAdd); if (kcal.Text != "") { rutine.kcal = int.Parse(kcal.Text); } else { rutine.kcal = 0; } if (!(rutine.name.Trim() != "" && rutine.content.Trim() != "")) { Toast.MakeText(this, "Debe llenar todos los campos", ToastLength.Short).Show(); return; } if (rutine.findAndLoad(this, rutine.name)) { Toast.MakeText(this, "La rutina ya esta registrada", ToastLength.Short).Show(); } else { rutine.save(this); name.Text = ""; content.Text = ""; kcal.Text = ""; Finish(); } }