From a92c145e0a1df8d3f2eaa5b0f3bcec91d0209585 Mon Sep 17 00:00:00 2001 From: AngelSuarez03 Date: Mon, 22 Apr 2024 08:24:58 -0600 Subject: [PATCH] =?UTF-8?q?Modificaci=C3=B3n=20Pacientes=20Completo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../medicalhealth/ConsultarPacientesActivity.kt | 1 + .../terratenientes/medicalhealth/ModificarActivity.kt | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/terratenientes/medicalhealth/ConsultarPacientesActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/ConsultarPacientesActivity.kt index b050c8e..a2e7593 100644 --- a/app/src/main/java/com/terratenientes/medicalhealth/ConsultarPacientesActivity.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/ConsultarPacientesActivity.kt @@ -34,6 +34,7 @@ class ConsultarPacientesActivity : AppCompatActivity() { intent.putExtra("Edad", pacienteSeleccionado!!.edad) intent.putExtra("Sexo", pacienteSeleccionado!!.sexo) startActivity(intent) + finish() } } diff --git a/app/src/main/java/com/terratenientes/medicalhealth/ModificarActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/ModificarActivity.kt index cd1cc9e..c394423 100644 --- a/app/src/main/java/com/terratenientes/medicalhealth/ModificarActivity.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/ModificarActivity.kt @@ -1,5 +1,6 @@ package com.terratenientes.medicalhealth +import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.widget.Toast @@ -17,7 +18,7 @@ class ModificarActivity : AppCompatActivity() { val view = binding.root setContentView(view) db = DoctorDataBaseHelper(this@ModificarActivity) - paciente = Paciente(intent.getIntExtra("Id",0),intent.getStringExtra("Nombre Paciente").toString(),intent.getStringExtra("Apellido Paterno").toString(), intent.getStringExtra("Apellido Materno").toString(), intent.getIntExtra("Edad", 20), intent.getStringExtra("Sexo").toString(), intent.getStringExtra("Domicilio").toString()) + paciente = Paciente(intent.getIntExtra("Id",2),intent.getStringExtra("Nombre Paciente").toString(),intent.getStringExtra("Apellido Paterno").toString(), intent.getStringExtra("Apellido Materno").toString(), intent.getIntExtra("Edad", 20), intent.getStringExtra("Sexo").toString(), intent.getStringExtra("Domicilio").toString()) llenarCampos() binding.btnModificar.setOnClickListener { actualizarPaciente(paciente) @@ -25,8 +26,14 @@ class ModificarActivity : AppCompatActivity() { } private fun actualizarPaciente(paciente : Paciente) : Unit { + paciente.nombre = binding.etNombre.text.toString() + paciente.apellidoPaterno = binding.etApellidoPaterno.text.toString() + paciente.apellidoMaterno = binding.etApellidoMaterno.text.toString() + paciente.domicilio = binding.etDomicilio.text.toString() db.modificarPaciente(paciente) finish() + intent = Intent(this@ModificarActivity, ConsultarPacientesActivity::class.java) + startActivity(intent) Toast.makeText(this@ModificarActivity, "InformaciĆ³n Actualizada UwU", Toast.LENGTH_LONG).show() }