Esempio n. 1
0
        private void btnIniciar_Click(object sender, EventArgs e)
        {
            if (txtCedula.Text == "root" && txtPassword.Text == "root")
            {
                btnIniciar.Hide();
                lblAviso.ForeColor = Color.Green;
                lblAviso.Text      = "Iniciando....";
                Index i = new Index();
                i.Show();
                this.Hide();
                return;
            }

            if (txtCedula.Text == "" || txtPassword.Text == "")
            {
                lblAviso.Text = "Es necesario ingresar la cedula y contraseña";
                return;
            }
            if (!UtilController.VerificarCedula(txtCedula.Text))
            {
                lblAviso.Text = "La cedula ingresada no es correcta";
                return;
            }
            if (lc.isCorrect(txtCedula.Text, txtPassword.Text))
            {
                lc.startSession(txtCedula.Text);
                int st = lc.getStatus(txtCedula.Text);

                if (st == 0)
                {
                    ContaninerPasswordChange.BringToFront();
                }
                else if (st == 1)
                {
                    Index i = new Index();
                    i.Show();
                    this.Hide();
                    Notification.Show("Bienvenido, " + Session.user.Persona.nombre, AlertType.ok);
                }
                else if (st == -1)
                {
                    lblAviso.Text = "Usuario dado de baja, acceso denegado...";
                }
            }
            else
            {
                lblAviso.Text = "Usuario o Contraseña incorrectos";
            }
        }
Esempio n. 2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txteditApellido.Text == "" || txtEditEdad.Text == "" || txtEditCedula.Text == "" ||
                txteditNombre.Text == "" || txteditTel.Text == "")
            {
                Notification.Show("Los campos cedula, nombres, apellidos, telefono y edad son requeridos", AlertType.warm);
                return;
            }

            if (!UtilController.VerificarCedula(txtEditCedula.Text.Trim()))
            {
                Notification.Show("La cedula especificada es invalida", AlertType.warm);
                return;
            }

            if (oldDni != txtEditCedula.Text)
            {
                if (pc.exist(txtEditCedula.Text))
                {
                    Notification.Show("Ya existe un registro con esta cedula", AlertType.info);
                    return;
                }
            }

            Persona per = new Persona();

            per.nombre    = txteditNombre.Text;
            per.apellido  = txteditApellido.Text;
            per.edad      = int.Parse(txtEditEdad.Text);
            per.email     = txtEditEmail.Text;
            per.telefono  = txteditTel.Text;
            per.dni       = txtEditCedula.Text.Trim();
            per.direccion = txtEditDir.Text;
            per.tipo      = 3; // paciente
            string validate = pc.validate(per);

            if (validate == "")
            {
                pc.update(oldDni, per);
                _clearUpdateInputs();
                Notification.Show("Los datos fueron actualizados con exito", AlertType.ok);
            }
            else
            {
                Notification.Show(validate, AlertType.warm);
            }
        }
Esempio n. 3
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (txtNombreDoc.Text == "" && id_medic <= 0)
            {
                Notification.Show("Necesitas especificar un médico, usa el botón buscar", AlertType.warm);
                return;
            }
            if (txtNombrePac.Text == "" || txtCedulaPac.Text == "" ||
                txtApellidosPac.Text == "" || txtTelPac.Text == "" ||
                txtEdadPac.Text == "")
            {
                Notification.Show("Todos los datos del paciente son requeridos, porfavor complete el formulario.", AlertType.warm);
                return;
            }
            if (txtCosto.Text == "")
            {
                Notification.Show("El valor a cobrar por la consulta es requerido", AlertType.ok);
                return;
            }
            if (txtFecha.Text == "")
            {
                Notification.Show("Necesitas especificar una fecha", AlertType.warm);
                return;
            }
            if (!UtilController.VerificarCedula(txtCedulaPac.Text))
            {
                Notification.Show("Cedula del paciente no valida.", AlertType.warm);
                return;
            }


            //Registro del Paciente en caso de no existir
            Persona p = new Persona();

            p.dni      = txtCedulaPac.Text;
            p.nombre   = txtNombrePac.Text;
            p.apellido = txtApellidosPac.Text;
            p.telefono = txtTelPac.Text;
            try
            {
                p.edad = int.Parse(txtEdadPac.Text);
                if (p.edad < 0)
                {
                    Notification.Show("La edad no puede ser menor a 0", AlertType.warm);
                    return;
                }
            }
            catch {
                Notification.Show("Asegurese de que la edad sea un valor valido", AlertType.warm);
                return;
            }
            p.tipo = 3;

            string valid = pc.validate(p);

            if (valid == "")
            {
                if (id_pacient == 0)
                {
                    pc.store(p);
                    id_pacient = Convert.ToInt32(p.id_person);
                }
                else
                {
                    pc.update(id_pacient, p);
                }
            }
            else
            {
                Notification.Show(valid, AlertType.warm);
                return;
            }

            // creando la cita
            Cita c = new Cita();

            c.id_medico = id_medic;
            c.id_person = id_pacient;
            c.fecha     = DateTime.Parse(txtFecha.Text);
            try
            {
                c.precio    = decimal.Parse(txtCosto.Text);
                c.retencion = decimal.Parse(txtRetencion.Text);

                if (c.precio < 0)
                {
                    Notification.Show("El precio de la consulta no puede ser menor a 0", AlertType.warm);
                    return;
                }
                if (c.retencion < 0 || c.retencion > 100)
                {
                    Notification.Show("La retención en un valor porcentual entre 0 y 100", AlertType.warm);
                    return;
                }
            }
            catch {
                Notification.Show("Asegurese de ingresar valores validos para precio y retención", AlertType.warm);
                return;
            }
            // 0 No pagada, 1 pagada, 2 atendida
            c.status = (txtPendientePAgo.Checked) ? 0 : 1;

            String validate = cc.validate(c);

            if (validate == "")
            {
                cc.store(c);
                _clearRegisterInputs();
                Notification.Show("La cita se guardo con exito como : " + ((c.status == 1) ? "PAGADA" : "PENDIENTE DE PAGO"), AlertType.ok);
            }
            else
            {
                Notification.Show(validate, AlertType.warm);
            }
            // save
        }
Esempio n. 4
0
        private void btnSaveDoctor_Click(object sender, EventArgs e)
        {
            if (!UtilController.VerificarCedula(txtCedula.Text))
            {
                Notification.Show("Ingrese un numero de cedula valido", AlertType.warm);
                return;
            }

            if (mc.exist(txtCedula.Text))
            {
                Notification.Show("Ya existe una persona registrada con esta cédula", AlertType.warm);
                return;
            }

            Medico med = new Medico();

            med.Persona = new Persona();

            med.Persona.dni       = txtCedula.Text;
            med.Persona.nombre    = txtNombre.Text;
            med.Persona.apellido  = txtApellido.Text;
            med.Persona.email     = txtEmail.Text.Trim();
            med.Persona.telefono  = txtTel.Text.Trim();
            med.Persona.edad      = (txtEdad.Text == "") ? 0 : int.Parse(txtEdad.Text);
            med.Persona.peso      = (txtPeso.Text == "")? 0 : decimal.Parse(txtPeso.Text);
            med.Persona.altura    = (txtTalla.Text.Equals("")) ? 0 : decimal.Parse(txtTalla.Text);
            med.Persona.sangre    = txtSangre.Text;
            med.Persona.fnac      = (txtFNac.Text.Equals(""))?DateTime.Now:DateTime.Parse(txtFNac.Text);
            med.Persona.ecivil    = txtEstadoCiv.Text;
            med.Persona.direccion = txtDireccion.Text;
            med.Persona.status    = 1;
            if (rdDoctor.Checked)
            {
                med.Persona.tipo = 1;
            }
            else if (rdEnfermera.Checked)
            {
                med.Persona.tipo = 2;
            }
            med.status          = 1;
            med.titulo          = txtTitulo.Text;
            med.id_especialidad = txtEspecialidad.SelectedIndex + 1;


            String data = mc.validate(med);

            if (data == "")
            {
                if (!mc.exist(med.Persona.dni))
                {
                    if (mc.store(med))
                    {
                        _clearRegisterInputs();
                        Notification.Show("Registro realizado con exito.", AlertType.ok, 5000);
                    }
                    else
                    {
                        Notification.Show("Ocurrió un error al validar sus datos, intentelo de nuevo.", AlertType.error, Notification.HIGHT);
                    }
                }
                else
                {
                    Notification.Show("Ya existe un registro con la cedula proporcionada", AlertType.info);
                }
            }
            else
            {
                Notification.Show(data, AlertType.warm, 5000);
            }
        }
Esempio n. 5
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (selectedPerson == 0)
            {
                Notification.Show("Necesitas seleccionar un médico para actualizar datos", AlertType.info, Notification.NORMAL);
                return;
            }
            if (!UtilController.VerificarCedula(txteditCedula.Text))
            {
                Notification.Show("Ingrese un numero de cedula valido", AlertType.warm);
                return;
            }

            if (oldDni != txteditCedula.Text)
            {
                if (mc.exist(txteditCedula.Text))
                {
                    Notification.Show("No puedes asignar este nuevo dni, otro registro la yo esta usando", AlertType.info);
                    return;
                }
            }

            Medico med = new Medico();

            med.Persona = new Persona();

            med.Persona.dni       = txteditCedula.Text;
            med.Persona.nombre    = txteditNombre.Text;
            med.Persona.apellido  = txteditApellido.Text;
            med.Persona.email     = txteditMail.Text.Trim();
            med.Persona.telefono  = txteditTel.Text.Trim();
            med.Persona.edad      = (txteditEdad.Text == "") ? 0 : int.Parse(txteditEdad.Text);
            med.Persona.peso      = (txteditPeso.Text == "") ? 0 : decimal.Parse(txteditPeso.Text);
            med.Persona.altura    = (txteditAltura.Text.Equals("")) ? 0 : decimal.Parse(txteditAltura.Text);
            med.Persona.sangre    = txteditSangre.Text;
            med.Persona.fnac      = (txteditFNacimiento.Text.Equals("")) ? DateTime.Now : DateTime.Parse(txteditFNacimiento.Text);
            med.Persona.ecivil    = txteditEstCiv.Text;
            med.Persona.direccion = txteditDir.Text;

            int id_especialidad = sc.getByName(txteditespecialidad.SelectedItem.ToString()).id_especialidad;

            med.titulo          = txteditTitulo.Text;
            med.id_especialidad = id_especialidad;
            if (radioEditDoctor.Checked)
            {
                med.Persona.tipo = 1;
            }
            else if (radioEditEnfermera.Checked)
            {
                med.Persona.tipo = 2;
            }

            String validate = mc.validate(med);

            if (validate != "")
            {
                Notification.Show(validate, AlertType.warm, Notification.HIGHT);
                return;
            }

            mc.update(int.Parse(selectedPerson + ""), med);
            _clearEditInputs();
            Notification.Show("Actualización realizada con exito", AlertType.ok, Notification.LOW);
        }