예제 #1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            //int contador = 0;

            // Paciente paciente = ObtenerPacienteFormulario();

            // Paciente.AgregarPaciente(paciente);


            //            LimpiarFormulario();
            if (modo == "I")
            {
                Paciente paciente = ObtenerPacienteFormulario();

                Paciente.AgregarPaciente(paciente);
            }
            else if (modo == "E")
            {
                int index = lstPaciente.SelectedIndex;

                Paciente paciente = ObtenerPacienteFormulario();
                Paciente.EditarPaciente(index, paciente);
            }

            ActualizarListaPacientes();
            LimpiarFormulario();
            BloquearFormulario();
        }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Paciente paciente = new Paciente(cedula.Text, nombres.Text, Apellidos.Text, sexo, dateTimePicker1.Value);

            Console.WriteLine(paciente.AgregarPaciente());
            int anios = paciente.CalculoEdad(dateTimePicker1.Value);

            edad.Text = anios.ToString();
        }
예제 #3
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            //if (modo == "I")
            //{
            //    Paciente paciente = ObtenerPacienteFormulario();



            //        Paciente.AgregarPaciente(paciente);



            //}
            //else if (modo == "E")
            //{
            //    int index = lstPaciente.SelectedIndex;

            //    Paciente paciente = ObtenerPacienteFormulario();
            //    Paciente.EditarPaciente(index, paciente);

            //}

            //ActualizarListaPacientes();
            //LimpiarFormulario();
            //BloquearFormulario();

            string Valoringresado = "";

            if (txtNombrePaciente.Text.Trim() == "")
            {
                MessageBox.Show("Favor ingrese el nombre", "ADVERTENCIA");
                txtNombrePaciente.SelectAll();
                txtNombrePaciente.Focus();
                Valoringresado = "-1";
                return;
            }

            if (txtApellidoPaciente.Text.Trim() == "")
            {
                MessageBox.Show("Favor ingrese el apellido", "ADVERTENCIA");
                txtApellidoPaciente.SelectAll();
                txtApellidoPaciente.Focus();
                Valoringresado = "-1";
                return;
            }

            if (txtEdad.Text.Trim() == "")
            {
                MessageBox.Show("Favor ingrese la edad", "ADVERTENCIA");
                txtEdad.SelectAll();
                txtEdad.Focus();
                Valoringresado = "-1";
                return;
            }
            if (txtTelefono.Text.Trim() == "")
            {
                MessageBox.Show("Favor ingrese el Telefono", "ADVERTENCIA");
                txtTelefono.SelectAll();
                txtTelefono.Focus();
                Valoringresado = "-1";
                return;
            }
            if (dtpFechaNacimiento.Value < System.DateTime.Today)
            {
                MessageBox.Show("La fecha de Nacimiento. no puede ser mayor a la Fecha de Hoy", "ADVERTENCIA");
                dtpFechaNacimiento.Focus();
                Valoringresado = "-1";
                return;
            }

            if (cmbEstadoCivil.Text.Trim() == "")
            {
                MessageBox.Show("Favor seleccione el estado civil", "ADVERTENCIA");
                cmbEstadoCivil.Focus();
                Valoringresado = "-1";
                return;
            }

            else
            if (modo == "I")
            {
                Paciente paciente = ObtenerPacienteFormulario();

                Paciente.AgregarPaciente(paciente);
            }
            else if (modo == "E")
            {
                int index = lstPaciente.SelectedIndex;

                Paciente paciente = ObtenerPacienteFormulario();
                Paciente.EditarPaciente(index, paciente);
            }

            ActualizarListaPacientes();
            LimpiarFormulario();
            BloquearFormulario();
        }