コード例 #1
0
        protected void btnInsertarPaciente_Click(object sender, EventArgs e)
        {
            try
            {
                int tipo;
                if (DDLTipoOntograma.SelectedIndex == 0)
                {
                    tipo = 0;
                }
                else
                {
                    tipo = 1;
                }
                IPaciente ipaciente = new MPaciente();

                DATOS_ClinicaDental.Modelos.Paciente paciente = new DATOS_ClinicaDental.Modelos.Paciente
                {
                    IdPaciente      = Convert.ToInt32(txtIdPaciente.Text),
                    Nombre          = txtNombre.Text,
                    Apellido1       = txtApellido1.Text,
                    Apellido2       = txtApellido2.Text,
                    Telefono        = txtTelefono.Text,
                    Correo          = txtCorreo.Text,
                    FechaNacimiento = Convert.ToDateTime(txtFecha.Text),
                    IdTipoOntograma = tipo
                };
                ipaciente.InsertarPaciente(paciente);
                MostrarMensaje("Paciente insertado correctamente!");
                Limpiar();
            }
            catch (Exception ee)
            {
                MostrarMensajeError(ee.ToString());
            }
        }
コード例 #2
0
 private void Buscar_Cedula()
 {
     dataListado.DataSource = MPaciente.Buscar_Cedula(txtBuscar.Text);
     this.OcultarColumnas();
     lblTotal.Text = "Total Registros: " + Convert.ToString(dataListado.Rows.Count);
     Anulados();
 }
コード例 #3
0
 private void Mostrar()
 {
     dataListado.DataSource = MPaciente.Mostrar(txtBuscar.Text);
     dataListado.ClearSelection();
     this.OcultarColumnas();
     lblTotal.Text = "Total Registros: " + Convert.ToString(dataListado.Rows.Count);
     Anulados();
 }
コード例 #4
0
        private void AnularItems()
        {
            try
            {
                int          NumeroSeleccionado = 0;
                DialogResult Opcion;
                foreach (DataGridViewRow item in this.dataListado.SelectedRows)
                {
                    NumeroSeleccionado++;
                }
                if (NumeroSeleccionado > 1)
                {
                    Opcion = MessageBox.Show("¿Realmente desea anular los " + NumeroSeleccionado + " registros de pacientes?", "Laboratorio Clínico Virgen de Coromoto", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                }
                else
                {
                    Opcion = MessageBox.Show("¿Realmente desea anular el registro del paciente?", "Laboratorio Clínico Virgen de Coromoto", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                }

                if (Opcion == DialogResult.OK)
                {
                    string Rpta = "";

                    foreach (DataGridViewRow item in this.dataListado.SelectedRows)
                    {
                        Rpta = MPaciente.Anular(Convert.ToInt32(item.Cells["IdPaciente"].Value));
                    }

                    if (Rpta.Equals("OK"))
                    {
                        if (NumeroSeleccionado > 1)
                        {
                            this.MensajeOK("Se anularon correctamente los registros de pacientes");
                        }
                        else
                        {
                            this.MensajeOK("Se anuló correctamente el registro del paciente");
                        }
                    }
                    else
                    {
                        this.MensajeError(Rpta);
                    }

                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
コード例 #5
0
        private void txtCiPaciente_Leave(object sender, EventArgs e)
        {
            //buscar en la DB si ya existe esta ci

            int cant_registros;

            cant_registros = MPaciente.CedulaUnica(this.cbCedula.Text + this.txtCiPaciente.Text).Count;

            if (cant_registros != 0)
            {
                DialogResult respuesta = MessageBox.Show("Ya el Paciente C.I: " + (this.cbCedula.Text + this.txtCiPaciente.Text) + " está ingresado. \n ¿Desea cargar los datos del paciente existente? ", "Laboratorio Virgen de Coromoto", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (respuesta == DialogResult.Yes)
                {
                    this.TablaResultadosCI = new DataTable("ResultadoCI");
                    this.TablaResultadosCI.Columns.Add("Nombre", System.Type.GetType("System.String"));
                    this.TablaResultadosCI.Columns.Add("Precio1", System.Type.GetType("System.Double"));
                    this.TablaResultadosCI.Columns.Add("Precio2", System.Type.GetType("System.Double"));

                    NuevoPaciente = true;

                    txtNombre.Text   = MPaciente.CedulaUnica(this.cbCedula.Text + this.txtCiPaciente.Text)[0].Nombre;
                    txtSexo.Text     = MPaciente.CedulaUnica(this.cbCedula.Text + this.txtCiPaciente.Text)[0].Sexo;
                    txtTelefono.Text = MPaciente.CedulaUnica(this.cbCedula.Text + this.txtCiPaciente.Text)[0].Telefono;

                    this.chkFUR.Enabled            = true;
                    this.dateTimePickerFUR.Enabled = true;


                    if (Convert.ToDateTime(MPaciente.CedulaUnica(this.cbCedula.Text + this.txtCiPaciente.Text)[0].FUR) == Convert.ToDateTime(null))      // si no hay FUR
                    {
                        this.chkFUR.Checked = false;
                        this.dateTimePickerFUR.Hide();
                    }
                    else       // si hay algun valor en FUR
                    {
                        this.chkFUR.Checked = true;
                        this.dateTimePickerFUR.Show();
                        this.dateTimePickerFUR.Text = Convert.ToString(Convert.ToDateTime(MPaciente.CedulaUnica(this.cbCedula.Text + this.txtCiPaciente.Text)[0].FUR));
                    }
                }
                else if (respuesta == DialogResult.No)
                {
                    txtCiPaciente.Focus();
                }
            }
        }
コード例 #6
0
        private void Guardar()
        {
            try
            {
                string Rpta = "";

                if (this.IsNuevo)
                {
                    Rpta = MPaciente.Insertar(this.txtNombre.Text, Convert.ToDateTime(dtNacimiento.Text), this.txtSexo.Text, (this.cbCedula.Text + this.txtCiPaciente.Text), txtTelefono.Text, ValorFUR);
                }
                else
                {
                    //Vamos a modificar un Paciente
                    Rpta = MPaciente.Editar(ID, this.txtNombre.Text, Convert.ToDateTime(dtNacimiento.Text), this.txtSexo.Text, (this.cbCedula.Text + this.txtCiPaciente.Text), txtTelefono.Text, ValorFUR);
                }
                //Si la respuesta fue OK, fue porque se modificó
                //o insertó el Trabajador
                //de forma correcta
                if (Rpta.Equals("OK"))
                {
                    if (this.IsNuevo)
                    {
                        this.MensajeOK("Se insertó de forma correcta el registro");
                    }
                    else
                    {
                        this.MensajeOK("Se actualizó de forma correcta el registro");
                    }
                }
                else
                {
                    //Mostramos el mensaje de error
                    this.MensajeError(Rpta);
                }
                this.IsNuevo  = false;
                this.IsEditar = false;
                this.Botones();
                this.Limpiar();
                this.Mostrar();
                this.Deshabilitar();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
コード例 #7
0
        protected void btnModificar_Click(object sender, EventArgs e)
        {
            try
            {
                int tipo;
                if (DDLTipoOntograma.SelectedIndex == 0)
                {
                    tipo = 0;
                }
                else
                {
                    tipo = 1;
                }

                IPaciente ipaciente = new MPaciente();
                DATOS_ClinicaDental.Modelos.Paciente paciente = new DATOS_ClinicaDental.Modelos.Paciente
                {
                    IdPaciente      = Convert.ToInt32(txtIdPaciente.Text),
                    Nombre          = txtNombre.Text,
                    Apellido1       = txtApellido1.Text,
                    Apellido2       = txtApellido2.Text,
                    Telefono        = txtTelefono.Text,
                    Correo          = txtCorreo.Text,
                    FechaNacimiento = Convert.ToDateTime(txtFecha.Text),
                    IdTipoOntograma = tipo
                };


                usu.ActualizarPaciente(paciente);
                buscar.Visible           = true;
                divMantenimiento.Visible = false;
                MostrarMensaje("Paciente modificado con éxito");
                ttIdPaciente.Text = String.Empty;
                gridview.Visible  = true;
            }
            catch (Exception)
            {
                MostrarMensajeError("Ha ocurrido un error, intente mas tarde");
            }
        }
コード例 #8
0
        private void CedulaUnica()
        {
            try
            {
                if (!IsNuevo)
                {
                    return;
                }
                dataListado.DataSource = MPaciente.CedulaUnica(this.txtCiPaciente.Text);

                if (dataListado.Rows.Count != 0)
                {
                    MessageBox.Show("Ya el paciente C.I: " + (this.cbCedula.Text + this.txtCiPaciente.Text) + " está ingresado", "Laboratorio Clínico Virgen de Coromoto", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.txtCiPaciente.Text = string.Empty;
                    this.txtCiPaciente.Focus();
                }

                Mostrar();
            }
            catch (Exception)
            {
                MessageBox.Show("Error en la conexion de la BD", "Laboratorio Clínico Virgen de Coromoto", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #9
0
        private void Guardar()
        {
            CedulaCompleta = this.cbCedula.Text + this.txtCiPaciente.Text;



            try
            {
                string Rpta = "";

                if (NuevoPaciente == false)
                {
                    Rpta = MPaciente.Insertar(this.txtNombre.Text, Convert.ToDateTime(dtNacimiento.Text), this.txtSexo.Text, (this.cbCedula.Text + this.txtCiPaciente.Text), txtTelefono.Text, ValorFUR);
                }
                else
                {
                    NuevoPaciente = false;
                }



                //Si la respuesta fue OK, fue porque se modificó
                //o insertó el Trabajador
                //de forma correcta

                this.Limpiar();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }



            try
            {
                string Rpta2 = "";

                IDPacienteActual = MPaciente.CedulaUnica(CedulaCompleta)[0].IdPaciente;

                //terminar lo siguiente, cuando ya tenga todo lo de orden listo. porque hay que ingresar orden antes, para tener la IdOrden

                var lista = MTurno.Mostrar("");

                TimeSpan hora = DateTime.Now.TimeOfDay;

                bool isbetween;
                int  IDTurno = 0;

                foreach (var item in lista)
                {
                    isbetween = item.Comienzo < hora && hora < item.Final;
                    if (isbetween)
                    {
                        IDTurno = item.ID;
                        break;
                    }
                }
                if (IDTurno == 0)
                {
                    IDTurno = 1;
                }

                if (txtDescuento.Text == string.Empty)
                {
                    Descuento = 0;
                }
                else
                {
                    Descuento = Convert.ToDouble(txtDescuento.Text);
                }

                if (txtRecEmergencia.Text == string.Empty)
                {
                    RecargoEmergencia = 0;
                }
                else
                {
                    RecargoEmergencia = Convert.ToDouble(txtRecEmergencia.Text);
                }

                if (txtAbonar.Text == string.Empty)
                {
                    Abonar = 0;
                }
                else
                {
                    Abonar = Convert.ToDouble(txtAbonar.Text);
                }

                int EmpresaSeguro, IdBanco;

                EmpresaSeguro = Convert.ToInt32(cbIdEmpresa.SelectedValue);
                IdBanco       = Convert.ToInt32(this.cbIdBanco.SelectedValue);


                if (lblExoSi.Checked)
                {
                    EmpresaSeguro = 4;
                    IdBanco       = 1;
                    TipoPagoEoT   = "Exonerado";

                    TotalParcial        = 0;
                    lblPrecioTotal.Text = Convert.ToString(TotalParcial);
                }

                IDFactura = 0;

                Rpta2 = MFactura.Facturar(1, id_trabajador, Convert.ToInt32(this.cbMedico.SelectedValue), IDTurno,
                                          DateTime.Now.Date, ConjuntoDeIDExamenes, IDPacienteActual, Convert.ToInt32(this.cbTipoPaciente.SelectedValue),
                                          EmpresaSeguro, TipoPagoEoT, IdBanco,
                                          txtNumCHoT.Text, Exonerado, txtMotivo.Text, Descuento, Subtotal,
                                          RecargoEmergencia, Abonar, TotalParcial, ExamenesParaGuardar, ref IDFactura);


                if (Rpta2.Equals("OK"))
                {
                    MessageBox.Show("Factura Realizada Correctamente");

                    Imprimir();
                    //Si la respuesta fue OK, fue porque se modificó
                    //o insertó el Trabajador
                    //de forma correcta

                    this.Limpiar();
                }
                else
                {
                    MessageBox.Show("No se pudo Realizar la Factura Correctamente");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }