Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtApellido.Text == "" || txtedad.Text == "" || txtCedula.Text == "" ||
                txtNombre.Text == "" || txtTel.Text == "")
            {
                Notification.Show("Los campos cedula, nombres, apellidos, telefono y edad son requeridos", AlertType.warm);
                return;
            }
            if (!UtilController.VerificarCedula(txtCedula.Text))
            {
                Notification.Show("La cedula especificada es invalida", AlertType.warm);
                return;
            }
            if (pc.exist(txtCedula.Text))
            {
                Notification.Show("Ya existe un registro con esta cedula", AlertType.info);
                return;
            }
            Persona per = new Persona();

            per.nombre    = txtNombre.Text;
            per.apellido  = txtApellido.Text;
            per.edad      = int.Parse(txtedad.Text);
            per.email     = txtEmail.Text;
            per.telefono  = txtTel.Text;
            per.dni       = txtCedula.Text;
            per.direccion = txtDireccion.Text;
            per.status    = 1;
            per.tipo      = 3; // paciente
            string validate = pc.validate(per);

            if (validate == "")
            {
                pc.store(per);
                _clearRegisterInputs();
                Notification.Show("Los datos fueron registrados con exito", AlertType.ok);
            }
            else
            {
                Notification.Show(validate, AlertType.warm);
            }
        }
Beispiel #2
0
        private void txtCedulaPac_Leave_1(object sender, EventArgs e)
        {
            if (txtCedulaPac.Text == "")
            {
                return;
            }

            if (pc.exist(txtCedulaPac.Text))
            {
                Persona p = pc.Get(txtCedulaPac.Text);
                txtCedulaPac.Text    = p.dni;
                txtNombrePac.Text    = p.nombre;
                txtApellidosPac.Text = p.apellido;
                txtEdadPac.Text      = p.edad + "";
                txtTelPac.Text       = p.telefono;
                id_pacient           = Convert.ToInt32(p.id_person);
            }
        }