From b30fe3549497455452856fd9c43b2a7912fd0559 Mon Sep 17 00:00:00 2001 From: sebastiancc27 Date: Mon, 22 Apr 2024 08:40:59 -0600 Subject: [PATCH] Registro de doctores --- app/src/main/AndroidManifest.xml | 3 + .../medicalhealth/MainActivity.kt | 4 + .../medicalhealth/RegistrarDActivity.kt | 35 +++++++ .../layout/activity_registrar_dactivity.xml | 95 +++++++++++++++++++ app/src/main/res/values/strings.xml | 9 ++ 5 files changed, 146 insertions(+) create mode 100644 app/src/main/java/com/terratenientes/medicalhealth/RegistrarDActivity.kt create mode 100644 app/src/main/res/layout/activity_registrar_dactivity.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index be5d478..b9a0973 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -12,6 +12,9 @@ android:supportsRtl="true" android:theme="@style/Theme.MedicalHealth" tools:targetApi="31"> + diff --git a/app/src/main/java/com/terratenientes/medicalhealth/MainActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/MainActivity.kt index ba1d83f..60ce44a 100644 --- a/app/src/main/java/com/terratenientes/medicalhealth/MainActivity.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/MainActivity.kt @@ -37,6 +37,10 @@ class MainActivity : AppCompatActivity() { val intent = Intent(this@MainActivity, ConsultarPacientesActivity::class.java) startActivity(intent) } + binding.tvRegistrarme.setOnClickListener{ + val intent = Intent(this@MainActivity, RegistrarDActivity::class.java) + startActivity(intent) + } } @SuppressLint("SuspiciousIndentation") private fun cargarDatos(){ diff --git a/app/src/main/java/com/terratenientes/medicalhealth/RegistrarDActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/RegistrarDActivity.kt new file mode 100644 index 0000000..2e0c2e0 --- /dev/null +++ b/app/src/main/java/com/terratenientes/medicalhealth/RegistrarDActivity.kt @@ -0,0 +1,35 @@ +package com.terratenientes.medicalhealth + +import android.os.Bundle +import android.widget.Toast +import androidx.activity.enableEdgeToEdge +import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat +import com.terratenientes.medicalhealth.databinding.ActivityRegistrarDactivityBinding + +class RegistrarDActivity : AppCompatActivity() { + private lateinit var binding : ActivityRegistrarDactivityBinding + private lateinit var db : DoctorDataBaseHelper + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityRegistrarDactivityBinding.inflate(layoutInflater) + val view = binding.root + setContentView(view) + db= DoctorDataBaseHelper(this@RegistrarDActivity) + binding.btnRegistrar.setOnClickListener { + registrarUsuario() + } + } + private fun registrarUsuario(){ + val cedula=binding.etCedelaRegistro.text.toString() + val nombre=binding.etNombreRegistro.text.toString() + val apellido=binding.etApellidoRegistro.text.toString() + val telefono=binding.etTelefonoRegisto.text.toString() + val domicilio = binding.etDomicilio.text.toString() + val contrasena= binding.etContrasenaRegistro.text.toString() + val usuario=Doctor(cedula,nombre,apellido,telefono,domicilio.toInt()) + db.agregarDoctores(usuario,contrasena) + Toast.makeText(this@RegistrarDActivity,"USUARIO AGREGADO",Toast.LENGTH_LONG).show() + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_registrar_dactivity.xml b/app/src/main/res/layout/activity_registrar_dactivity.xml new file mode 100644 index 0000000..346913b --- /dev/null +++ b/app/src/main/res/layout/activity_registrar_dactivity.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + +