コード例 #1
0
        public void RegistrarPacienteTest()
        {
            //Arrange
            Paciente paciente           = new Paciente("98585", "Santiago", "Gómez", "2001-05-19", "calle 80", "5085005", "*****@*****.**", "2020-04-13");
            int      resultado_esperado = 1;
            //Act
            int resultado = ips.RegistrarPaciente(paciente);

            //Assert

            Assert.AreEqual(resultado_esperado, resultado);
        }
コード例 #2
0
        private void Btn_Registro_click(object sender, EventArgs e)
        {   //campos vacios
            if (txt_Identificacion.Text.Equals("") ||
                txt_Nombres.Text.Equals("") ||
                txt_Apellidos.Text.Equals(""))
            {
                MessageBox.Show("Campos vacios, Ingrese datos");
            }
            if (txt_Direccion.Enabled == true &&
                txt_Email.Enabled == true &&
                txt_Telefono.Enabled == true)
            {
                if (txt_Direccion.Text.Equals("") ||
                    txt_Telefono.Text.Equals("") ||
                    txt_Email.Text.Equals(""))
                {
                    MessageBox.Show("Campos vacios, Ingrese datos");
                }
            }

            if (Grupo_Registro.Text.Equals("Registro Paciente"))
            {
                try
                {
                    string identificacionPaciente = txt_Identificacion.Text;
                    string nombres         = txt_Nombres.Text;
                    string apellidos       = txt_Apellidos.Text;
                    string fechaNacimiento = DatoFechaNacimiento.Text;
                    string direccion       = txt_Direccion.Text;
                    string telefono        = txt_Telefono.Text;
                    string email           = txt_Email.Text;
                    string fechaRegistro   = DatoFechaRegistro.Text;


                    Paciente paciente = new Paciente(identificacionPaciente, nombres, apellidos, fechaNacimiento, direccion, telefono, email, fechaRegistro);
                    verificacion = ips.RegistrarPaciente(paciente);

                    if (verificacion == 1)
                    {
                        MessageBox.Show("Paciente Registrado Correctamente");
                        txt_Identificacion.Clear();
                        txt_Nombres.Clear();
                        txt_Apellidos.Clear();
                        txt_Direccion.Clear();
                        txt_Telefono.Clear();
                        txt_Email.Clear();
                    }
                    else
                    {
                        throw new RegistroNoExitosoException("¡ERROR! Registro no efectuado, verifica nuevamente");
                    }
                }
                catch (RegistroNoExitosoException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                catch (SqlException)
                {
                    MessageBox.Show("UPS! Ocurrio un error");
                }
                DataSet BuscarTodosPacientes = new DataSet();
                BuscarTodosPacientes    = ips.BuscarTodosPacientes();
                DataGriwView.DataSource = BuscarTodosPacientes.Tables["Pacientes registrados en la IPS"];
            }
            if (Grupo_Registro.Text.Equals("Registro Medico"))
            {     //campos vacios
                if (txt_Salario.Text.Equals(""))
                {
                    MessageBox.Show("ingrese Salario");
                }
                //procedimiento
                try
                {
                    string identificacionMedico = txt_Identificacion.Text;
                    string nombres          = txt_Nombres.Text;
                    string apellidos        = txt_Apellidos.Text;
                    string especialidad     = ComboEspecialidades.Text;
                    int    salario_cita     = Int32.Parse(txt_Salario.Text);
                    int    años_experiencia = Int32.Parse(Txt_Años.Text);

                    Medico medico = new Medico(identificacionMedico, nombres, apellidos, especialidad, salario_cita, años_experiencia);
                    verificacion = ips.RegistrarMedico(medico);

                    if (verificacion == 1)
                    {
                        MessageBox.Show("Medico Registrado Correctamente");
                        txt_Identificacion.Clear();
                        txt_Nombres.Clear();
                        txt_Apellidos.Clear();
                        ComboEspecialidades.Text = "";
                        txt_Salario.Clear();
                        Txt_Años.Value = 0;
                    }
                    else
                    {
                        throw new RegistroNoExitosoException("¡ERROR! Registro no efectuado, verifica nuevamente");
                    }
                }
                catch (RegistroNoExitosoException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                catch (SqlException)
                {
                    MessageBox.Show("UPS! Ocurrio un error");
                }
                DataSet BuscarTodosMedicos = new DataSet();
                BuscarTodosMedicos      = ips.BuscarTodosMedicos();
                DataGriwView.DataSource = BuscarTodosMedicos.Tables["Medicos registrados en la IPS"];
            }
            if (Grupo_Registro.Text.Equals("Registro Cita"))
            {
            }
        }