예제 #1
0
        // Método para cargar turnos del profesional
        private void cargarTurnos()
        {
            int fecha        = 0;
            int fechaMas1    = 0;
            int minutosMas15 = @Clinica_Frba.Properties.Settings.Default.Fecha.Minute + 15;

            fecha    += @Clinica_Frba.Properties.Settings.Default.Fecha.Day;
            fecha    += @Clinica_Frba.Properties.Settings.Default.Fecha.Month * 100;
            fecha    += @Clinica_Frba.Properties.Settings.Default.Fecha.Year * 10000;
            fechaMas1 = fecha + 1;
            SqlConnection conexion = SQL_Methods.IniciarConnection();
            string        query    = "SELECT Cod_Turno, Fecha FROM ORACLE_FANS.Turnos " +
                                     "WHERE Matricula = " + matricula.Text + " " +
                                     "AND habilitado = 0 " +
                                     "AND Fecha >= '" + fecha.ToString() + " " + @Clinica_Frba.Properties.Settings.Default.Fecha.Hour.ToString() + ":" + minutosMas15.ToString() + ":" + @Clinica_Frba.Properties.Settings.Default.Fecha.Second.ToString() + "' " +
                                     "AND Fecha < '" + fechaMas1.ToString() + "'";

            turnos = SQL_Methods.EjecutarProcedure(conexion, query);
            dataGridView1.Columns.Clear();
            dataGridView1.AllowUserToAddRows = false;
            dataGridView1.DataSource         = turnos;
            dataGridView1.Visible            = true;
            DataGridViewButtonColumn boton = new DataGridViewButtonColumn();

            this.dataGridView1.Columns.Add(boton);
            boton.HeaderText = "Action";
            boton.Text       = "Ingresar Afiliado";
            boton.Name       = "row_button";
            boton.UseColumnTextForButtonValue = true;
            dataGridView1.Columns[1].Width    = 150;
            dataGridView1.Columns[2].Width    = 100;
        }
예제 #2
0
        private void ModificarAfiliado(Afiliado Paciente)
        {
            if (!SQL_Methods.Afiliado_ModificarDatos(Paciente))
            {
                MessageBox.Show(Paciente.Cod_Afiliado.ToString() + " no pudo ser modificado.");
                return;
            }

            if (PlanMedico_Familiar != -1 && PlanMedico_Familiar != Paciente.Cod_PlanMedico)
            {
                DialogForm dialogForm = new DialogForm(this,
                                                       "Ingrese Motivo Cambio de Plan",
                                                       "Por favor ingrese el motivo del cambio de plan");


                return;
            }

            if (FamiliaresACargo < Paciente.CantFamiliaresACargo)
            {
                ModificarFamiliares(Paciente);
                this.Visible = false;
                return;
            }


            MessageBox.Show(Paciente.Cod_Afiliado.ToString() + " ha sido Modificado.");
            menu.Visible = true;
            this.Dispose();
            return;
        }
예제 #3
0
        private void button_save_Click(object sender, EventArgs e)
        {
            if (this.comboBox_hora.Text.Equals(""))
            {
                this.box_medico.Text = "";
                return;
            }

            DateTime Fecha;
            DateTime Hora;

            //Fecha = this.Combo_fecha.Value;
            Fecha = Convert.ToDateTime(this.Combo_fecha.Value.ToShortDateString());

            Hora = Convert.ToDateTime(this.comboBox_hora.Text);
            TimeSpan Hour       = new TimeSpan(Hora.Hour, Hora.Minute, 0);
            DateTime FechaTurno = Fecha.Add(Hour);

            if (Cod_Afiliado == -1)
            {
                Cod_Afiliado = elAfiliado.Cod_Afiliado;
            }

            if (SQL_Methods.Turno_Registrar(Matricula, Cod_Especialidad, Cod_Afiliado, FechaTurno) == -1)
            {
                MessageBox.Show("No se pudo agregar el turno.");
                return;
            }

            menu.Visible = true;
            this.Dispose();
            return;
        }
예제 #4
0
        // Método para botón realizar compra
        private void button1_Click(object sender, EventArgs e)
        {
            int importeTotal = 0;

            for (int i = 0; i < Convert.ToInt32(cantBonos.Value); i++)
            {
                SqlConnection conexion = SQL_Methods.IniciarConnection();
                SqlCommand    comando  = new SqlCommand("ORACLE_FANS.darAltaBonoFarmacia", conexion);

                SqlParameter ValorDeRetorno = comando.Parameters.Add("returnParameter", SqlDbType.Int);
                ValorDeRetorno.Direction = ParameterDirection.ReturnValue;

                comando.CommandType = CommandType.StoredProcedure;
                comando.Parameters.Add("@Cod_PlanMedico", SqlDbType.Int).Value = Convert.ToInt32(planMedico.Text);
                comando.Parameters.Add("@Cod_Afiliado", SqlDbType.Int).Value   = Convert.ToInt32(codigoAfiliado.Text);
                comando.Parameters.Add("@fec_imp", SqlDbType.DateTime).Value   = @Clinica_Frba.Properties.Settings.Default.Fecha.ToString();
                importeTotal += importeBono;
                comando.ExecuteReader();
                comando.Connection.Close();
            }
            MessageBox.Show("Compra realizada. Importe total: $" + Convert.ToString(importeTotal));
            SqlConnection conexion2 = SQL_Methods.IniciarConnection();
            SqlCommand    comando2  = new SqlCommand("ORACLE_FANS.agregar_compra", conexion2);

            comando2.CommandType = CommandType.StoredProcedure;
            comando2.Parameters.Add("@tipo", SqlDbType.Char).Value      = 'F';
            comando2.Parameters.Add("@cod_afi", SqlDbType.Int).Value    = Convert.ToInt32(codigoAfiliado.Text);
            comando2.Parameters.Add("@cant_bonos", SqlDbType.Int).Value = Convert.ToInt32(cantBonos.Value);
            comando2.Parameters.Add("@importe", SqlDbType.Int).Value    = importeTotal;
            comando2.Parameters.Add("@fecha", SqlDbType.DateTime).Value = @Clinica_Frba.Properties.Settings.Default.Fecha;
            comando2.ExecuteReader();
            comando2.Connection.Close();
        }
예제 #5
0
        // Método para comprobar turno ingresado
        private bool comprobarTurno()
        {
            bool retorno = true;

            if (horaTurno.Text.Trim() == "" || minutosTurno.Text.Trim() == "")
            {
                retorno = false;
                return(retorno);
            }
            int           añoTurno = Convert.ToDateTime(fechaTurno.Text).Year;
            int           mesTurno = Convert.ToDateTime(fechaTurno.Text).Month;
            int           diaTurno = Convert.ToDateTime(fechaTurno.Text).Day;
            DateTime      fecha    = new DateTime(añoTurno, mesTurno, diaTurno);
            SqlConnection conexion = SQL_Methods.IniciarConnection();
            string        query    = "SELECT * FROM ORACLE_FANS.Turnos " +
                                     "WHERE Cod_Afiliado = " + afiliado.Text + " " +
                                     "AND Fecha = '" + fecha.ToString() + " " + horaTurno.Text + ":" + minutosTurno.Text + ":00' " +
                                     "AND habilitado = 1";

            turno = SQL_Methods.EjecutarProcedure(conexion, query);
            if (turno.Rows.Count == 0)
            {
                retorno = false;
                MessageBox.Show("La fecha del turno ingresada no es válida. Ingrese nuevamente los campos fecha, hora y minutos.");
            }
            return(retorno);
        }
예제 #6
0
        private void CargarTurnos()
        {
            DateTime Fecha = @Clinica_Frba.Properties.Settings.Default.Fecha;

            Fecha       = @Clinica_Frba.Properties.Settings.Default.Fecha.AddDays(1);
            TablaTurnos = SQL_Methods.Afiliado_ListarTurnos(Cod_Afiliado, Fecha);
        }
예제 #7
0
        private void CargarUsuarios()
        {
            TablaUsuario.Rows.Clear();


            if (this.box_nombre.Text.Trim().Equals("") &&
                this.box_apellido.Text.Trim().Equals("") &&
                this.box_codafiliado.Text.Trim().Equals("") &&
                this.box_dni.Text.Trim().Equals("")
                )
            {
                MessageBox.Show("Debe introducir al menos un criterio de búsqueda");
                return;
            }

            string myQuery = "SELECT * FROM ORACLE_FANS.Afiliados " +
                             "WHERE Nombre LIKE '%" + this.box_nombre.Text.Trim() + "%' " +
                             "AND Apellido LIKE '%" + this.box_apellido.Text.Trim() + "%' " +
                             "AND Cod_Afiliado LIKE '%" + this.box_codafiliado.Text.Trim() + "%' " +
                             "AND Numero_Documento LIKE '%" + this.box_dni.Text.Trim() + "%' " +
                             " AND Activo = 1";

            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                TablaUsuario = SQL_Methods.EjecutarProcedure(myConnection, myQuery);
            }
        }
예제 #8
0
        // Método para cargar profesionales en la tabla
        private void cargarProfesionales()
        {
            // Conexion al server
            SqlConnection myConnection = SQL_Methods.IniciarConnection();
            string        myQuery;

            if (this.comboBox1.Text.Trim().Equals(""))
            {
                myQuery = "SELECT Matricula, Nombre, Apellido, Tipo_Documento, Numero_Documento, Direccion, Mail, Telefono, Fecha_Nac, Sexo FROM ORACLE_FANS.Profesionales " +
                          "WHERE Nombre LIKE '%" + this.box_nombre.Text.Trim() + "%' " +
                          "AND Activo = 1 " +
                          "AND Apellido LIKE '%" + this.box_apellido.Text.Trim() + "%' " +
                          "AND Matricula LIKE '%" + this.box_matricula.Text.Trim() + "%'";
            }
            else
            {
                myQuery = "SELECT P.Matricula, P.Nombre, P.Apellido, P.Tipo_Documento, P.Numero_Documento, P.Direccion, P.Mail, P.Telefono, P.Fecha_Nac, P.Sexo FROM ORACLE_FANS.Profesionales P " +
                          "JOIN ORACLE_FANS.Medico_Especialidad ME on P.Matricula = ME.Matricula " +
                          "JOIN ORACLE_FANS.Especialidades E on E.Cod_Especialidad = ME.Cod_Especialidad " +
                          "WHERE P.Nombre LIKE '%" + this.box_nombre.Text.Trim() + "%' " +
                          "AND P.Activo = 1 " +
                          "AND P.Apellido LIKE '%" + this.box_apellido.Text.Trim() + "%' " +
                          "AND P.Matricula LIKE '%" + this.box_matricula.Text.Trim() + "%' " +
                          "AND E.Descripcion = '" + this.comboBox1.Text + "'";
            }

            if (SQL_Methods.DBConnectStatus)
            {
                TablaProfesionales = SQL_Methods.EjecutarProcedure(myConnection, myQuery);
            }
        }
예제 #9
0
        // Método para boton Aceptar
        private void button1_Click(object sender, EventArgs e)
        {
            if (afiliado.Text.Trim() == "")
            {
                MessageBox.Show("Debe ingresar un número de afiliado.");
                afiliado.Select();
                return;
            }
            if (bono.Text.Trim() == "")
            {
                MessageBox.Show("Debe ingresar un número de bono.");
                bono.Select();
                return;
            }
            SqlConnection conexion = SQL_Methods.IniciarConnection();
            string        query    = "SELECT * FROM ORACLE_FANS.Turnos " +
                                     "WHERE Cod_Afiliado = " + afiliado.Text + " " +
                                     "AND Cod_Turno = " + codigo_turno;

            turno = SQL_Methods.EjecutarProcedure(conexion, query);
            if (turno.Rows.Count == 0)
            {
                MessageBox.Show("El afiliado ingresado no tenía el turno ingresado anteriormente. Ingrese nuevamente el número de afiliado o vuelva e ingrese nuevamente el turno.");
                return;
            }
            else
            {
                MessageBox.Show("El afiliado ingresado es correcto.");
                string query2 = "SELECT * FROM ORACLE_FANS.Bono_Consulta " +
                                "WHERE Cod_Afiliado = " + afiliado.Text + " " +
                                "AND Numero = " + bono.Text +
                                "AND Numero_Consulta is null ";
                bonoIngresado = SQL_Methods.EjecutarProcedure(conexion, query2);
                if (bonoIngresado.Rows.Count == 0)
                {
                    MessageBox.Show("El bono ingresado es incorrecto. Ingrese nuevamente el bono.");
                    return;
                }
                else
                {
                    MessageBox.Show("El bono ingresado es correcto.");
                    SqlCommand comando = new SqlCommand("ORACLE_FANS.ActualizarConsulta", conexion);
                    comando.CommandType = CommandType.StoredProcedure;
                    comando.Parameters.Add("@Numero_Bono", SqlDbType.Int).Value  = Convert.ToInt32(bono.Text);
                    comando.Parameters.Add("@Cod_Afiliado", SqlDbType.Int).Value = Convert.ToInt32(afiliado.Text);
                    comando.Parameters.Add("@Cod_Turno", SqlDbType.Int).Value    = Convert.ToInt32(turno.Rows[0][0].ToString());
                    comando.ExecuteReader();
                    menuAnt.cerrarForm();
                    this.Dispose();
                    return;
                }
            }
        }
예제 #10
0
        private void ListTop10Afiliados()
        {
            DataTable TablaBonos;

            TablaBonos = SQL_Methods.Listado_Top10Afiliados(Convert.ToInt32(box_anio.Text),
                                                            box_from.SelectedIndex + 1);


            this.dataGridView1.Columns.Clear();
            this.dataGridView1.AllowUserToAddRows = false;
            this.dataGridView1.DataSource         = TablaBonos;
            this.dataGridView1.Visible            = true;
            this.dataGridView1.RowHeadersVisible  = false;
        }
예제 #11
0
        // Método para corroborar bono
        private void corroborarBono()
        {
            SqlConnection conexion = SQL_Methods.IniciarConnection();
            string        query    = "SELECT * FROM ORACLE_FANS.Bono_Consulta " +
                                     "WHERE Cod_Afiliado = " + afiliado.Text + " " +
                                     "AND Numero = " + bono.Text +
                                     "AND Numero_Consulta is null ";

            bonoIngresado = SQL_Methods.EjecutarProcedure(conexion, query);
            if (bonoIngresado.Rows.Count == 0)
            {
                MessageBox.Show("El bono ingresado es incorrecto. Ingrese nuevamente el bono.");
                return;
            }
        }
예제 #12
0
        private void cargarComboBox()
        {
            string        myQuery = "SELECT Descripcion FROM ORACLE_FANS.Especialidades ORDER BY 1";
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                TablaEspecialidades = SQL_Methods.EjecutarProcedure(myConnection, myQuery);
            }
            for (int i = 0; i < Convert.ToInt32(TablaEspecialidades.Rows.Count.ToString()); i++)
            {
                this.comboBox1.Items.Add(TablaEspecialidades.Rows[i][0]);
            }
        }
예제 #13
0
        public void CargarFuncionalidades() // Método para llenar Tabla de Funcionalidades
        {
            string        myQuery = "SELECT * FROM ORACLE_FANS.Funcionalidades";
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                TablaFuncionalidades = SQL_Methods.EjecutarProcedure(myConnection, myQuery);

                foreach (DataRow Row in TablaFuncionalidades.Rows)
                {
                    this.FuncionalidadesCheckList.Items.Add(Row[1].ToString().Trim());
                }
            }
        }
예제 #14
0
        private void CargarPlanesMedicos() // Método para llenar Tabla de Planes Medicos
        {
            string        myQuery = "SELECT * FROM ORACLE_FANS.Planes_Medicos";
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                TablaPlanesMedicos = SQL_Methods.EjecutarProcedure(myConnection, myQuery);

                foreach (DataRow Row in TablaPlanesMedicos.Rows)
                {
                    this.Box_PlanMed.Items.Add(Row[1].ToString());
                }
            }
        }
예제 #15
0
 private bool AgregarFuncionalidades(int idRol)
 {
     foreach (var item in this.FuncionalidadesCheckList.CheckedItems)
     {
         DataRow[] Rows = TablaFuncionalidades.Select("Descripcion = '" + item.ToString().Trim() + "'");
         if (Rows.Length > 0)
         {
             int IdFuncionalidad = Convert.ToInt32(Rows[0][0].ToString().Trim());
             if (!SQL_Methods.Rol_AgregarFuncionalidad(idRol, IdFuncionalidad))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
예제 #16
0
        // Método para cargar medicamentos
        private void cargarMedicamentos()
        {
            SqlConnection conexion          = SQL_Methods.IniciarConnection();
            string        query             = "SELECT Descripcion FROM ORACLE_FANS.Medicamentos_Acomodados";
            DataTable     tablaMedicamentos = new DataTable();

            tablaMedicamentos = SQL_Methods.EjecutarProcedure(conexion, query);
            for (int i = 0; i < Convert.ToInt32(tablaMedicamentos.Rows.Count.ToString()); i++)
            {
                med1.Items.Add(tablaMedicamentos.Rows[i][0]);
                med2.Items.Add(tablaMedicamentos.Rows[i][0]);
                med3.Items.Add(tablaMedicamentos.Rows[i][0]);
                med4.Items.Add(tablaMedicamentos.Rows[i][0]);
                med5.Items.Add(tablaMedicamentos.Rows[i][0]);
            }
        }
예제 #17
0
        private void CargarHorarios()
        {
            DataTable TurnosOcupados    = new DataTable();
            DataTable TurnosDisponibles = new DataTable();



            if (Cod_Afiliado == -1)
            {
                Cod_Afiliado = elAfiliado.Cod_Afiliado;
            }

            this.comboBox_hora.Items.Clear();

            TurnosDisponibles = SQL_Methods.Profesional_ListarTurnosDisponibles(Matricula, this.Combo_fecha.Value);

            foreach (DataRow Row in TurnosDisponibles.Rows)
            {
                this.comboBox_hora.Items.Add(Row[0].ToString().Substring(0, 5));
            }

            TurnosOcupados = SQL_Methods.Afiliado_ListarTurnosOcupados(Cod_Afiliado, this.Combo_fecha.Value);

            foreach (DataRow Row in TurnosOcupados.Rows)
            {
                this.comboBox_hora.Items.Remove(Row[0].ToString().Substring(0, 5));
            }

            TurnosOcupados.Rows.Clear();

            TurnosOcupados = SQL_Methods.Profesional_ListarTurnosOcupados(Matricula, this.Combo_fecha.Value);

            foreach (DataRow Row in TurnosOcupados.Rows)
            {
                this.comboBox_hora.Items.Remove(Row[0].ToString().Substring(0, 5));
            }

            if (this.comboBox_hora.Items.Count == 0)
            {
                MessageBox.Show("No hay turnos disponibles");
                this.box_medico.Text = "";

                this.comboBox_hora.Visible = false;
                this.button_Clean.Visible  = false;
                this.button_save.Visible   = false;
            }
        }
예제 #18
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (this.dataGridView1.Columns[e.ColumnIndex].HeaderText.Equals("Action"))
            {
                int Cod_Turno = Convert.ToInt32(TablaTurnos.Rows[e.RowIndex][0].ToString());
                if (!SQL_Methods.Afiliado_DarBajaTurno(Cod_Turno, @Clinica_Frba.Properties.Settings.Default.Fecha,
                                                       box_tipoCancelacion.Text.Trim(), box_descripcion.Text.Trim()))
                {
                    MessageBox.Show("El turno no pudo ser eliminado.");
                    return;
                }

                menu.Visible = true;
                this.Dispose();
                return;
            }
        }
예제 #19
0
        public CompraBonoFarmacia(MenuPrincipal sender, int codAfi, int planMed)
        {
            InitializeComponent();
            codigoAfiliado.Text = Convert.ToString(codAfi);
            planMedico.Text     = Convert.ToString(planMed);
            menu         = sender;
            menu.Visible = false;
            this.Visible = true;
            SqlConnection conexion = SQL_Methods.IniciarConnection();
            string        myQuery  = "SELECT Precio_Bono_Farmacia FROM ORACLE_FANS.Planes_Medicos WHERE Cod_PlanMedico = " + planMedico.Text;

            if (SQL_Methods.DBConnectStatus)
            {
                Precio = SQL_Methods.EjecutarProcedure(conexion, myQuery);
            }
            importeBono = Convert.ToInt32(Precio.Rows[0][0].ToString());
        }
예제 #20
0
        private void CargarEspecialidades()
        {
            string myQuery = "SELECT * FROM ORACLE_FANS.Especialidades ORDER BY 3";

            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                TablaEspecialidades = SQL_Methods.EjecutarProcedure(myConnection, myQuery);
            }

            for (int i = 0; i < Convert.ToInt32(TablaEspecialidades.Rows.Count.ToString()); i++)
            {
                this.box_especialidad.Items.Add(TablaEspecialidades.Rows[i][2]);
            }
        }
예제 #21
0
        // Metodo para cargar afiliados en la tabla
        private void CargarAfiliados()
        {
            TablaAfiliados.Rows.Clear();

            string myQuery = "SELECT * FROM ORACLE_FANS.Afiliados " +
                             "WHERE Nombre LIKE '%" + this.box_nombre.Text.Trim() + "%' " +
                             "AND Apellido LIKE '%" + this.box_apellido.Text.Trim() + "%' " +
                             "AND Cod_Afiliado LIKE '%" + this.box_codigo.Text.Trim() + "%' " +
                             "AND Numero_Documento LIKE '%" + this.box_documento.Text.Trim() + "%' ";

            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                TablaAfiliados = SQL_Methods.EjecutarProcedure(myConnection, myQuery);
            }
        }
예제 #22
0
        // Método para mostrar planes médicos
        private void cargarPlanes()
        {
            string myQuery = "SELECT Descripcion, Precio_Bono_Consulta, Precio_Bono_Farmacia " +
                             "FROM ORACLE_FANS.Planes_Medicos " +
                             "ORDER by 1";
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                TablaPlanes = SQL_Methods.EjecutarProcedure(myConnection, myQuery);

                foreach (DataRow Row in TablaPlanes.Rows)
                {
                    this.dataGridView1.Rows.Add(Row[0].ToString(), Row[1].ToString(), Row[2].ToString());
                }
            }
        }
예제 #23
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Afiliado paciente = new Afiliado();

            paciente = CargarDatosAfiliado(e.RowIndex);

            if (e.ColumnIndex == 15 && e.RowIndex > -1)
            {
                int idAfiliado = Convert.ToInt32(TablaUsuario.Rows[e.RowIndex][0].ToString());

                if (Flag_Turno)
                {
                    menuPedirTurno.SetAfiliado(paciente);
                    menuPedirTurno.Visible = true;
                    this.Dispose();
                    return;
                }

                if (Flag_CancelarTurno)
                {
                    menuCancelarTurnoAfiliado.SetAfiliado(paciente);
                    menuCancelarTurnoAfiliado.Visible = true;
                    this.Dispose();
                    return;
                }

                if (Flag_deletion)
                {
                    if (!SQL_Methods.Afiliado_DarBaja(idAfiliado, @Clinica_Frba.Properties.Settings.Default.Fecha))
                    {
                        MessageBox.Show(idAfiliado.ToString() + "no pudo ser eliminado.");
                        return;
                    }

                    MessageBox.Show(TablaUsuario.Rows[e.RowIndex][0].ToString() + " ha sido eliminado.");
                    menu.Visible = true;
                    this.Dispose();
                    return;
                }

                new AddModAfiliado(menu, paciente);
                this.Dispose();
            }
        }
예제 #24
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 10)
     {
         if (flagMenuPpal == 1)
         {
             //new CancelacionProfesionalForm(menuPpal, TablaProfesionales.Rows[e.RowIndex][0].ToString(), TablaProfesionales.Rows[e.RowIndex][1].ToString(), TablaProfesionales.Rows[e.RowIndex][2].ToString());
             this.Dispose();
             return;
         }
         ProfesionalClass prof = new ProfesionalClass();
         prof.apellido        = TablaProfesionales.Rows[e.RowIndex][2].ToString();
         prof.nombre          = TablaProfesionales.Rows[e.RowIndex][1].ToString();
         prof.numeroDocumento = Convert.ToInt32(TablaProfesionales.Rows[e.RowIndex][4].ToString());
         prof.matricula       = Convert.ToInt32(TablaProfesionales.Rows[e.RowIndex][0].ToString());
         prof.direccion       = TablaProfesionales.Rows[e.RowIndex][5].ToString();
         prof.numeroTelefono  = Convert.ToInt32(TablaProfesionales.Rows[e.RowIndex][7].ToString());
         prof.mail            = TablaProfesionales.Rows[e.RowIndex][6].ToString();
         prof.fechaNacimiento = Convert.ToDateTime(TablaProfesionales.Rows[e.RowIndex][8].ToString());
         prof.tipoDocumento   = TablaProfesionales.Rows[e.RowIndex][3].ToString();
         prof.sexo            = Convert.ToChar(TablaProfesionales.Rows[e.RowIndex][9].ToString());
         if (eliminar)
         {
             // Se quiere eliminar Profesional
             // Conexion al server
             SqlConnection myConnection = SQL_Methods.IniciarConnection();
             SqlCommand    comando      = new SqlCommand("ORACLE_FANS.baja_profesional", myConnection);
             comando.CommandType = CommandType.StoredProcedure;
             comando.Parameters.Add("@mat", SqlDbType.Int).Value = Convert.ToInt32(TablaProfesionales.Rows[e.RowIndex][0].ToString());
             comando.ExecuteReader();
             MessageBox.Show(TablaProfesionales.Rows[e.RowIndex][2].ToString() + " " + TablaProfesionales.Rows[e.RowIndex][1].ToString() + " ha sido eliminado.");
             menu.Visible = true;
             this.Dispose();
         }
         else
         {
             // Se quiere modificar un Profesional
             new AddModProfesional(menu, true, prof);
             this.Dispose();
         }
     }
 }
예제 #25
0
        // Método para llenar la tabla de especialidades
        private void cargarEspecialidades()
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            string myQuery = "SELECT Descripcion FROM ORACLE_FANS.Especialidades " +
                             "ORDER BY 1";
            DataTable TablaEspecialidades2 = new DataTable();
            int       cantEspMedico        = 0;

            if (modificar)
            {
                string query2 = "SELECT E.Descripcion FROM ORACLE_FANS.Especialidades E " +
                                "JOIN ORACLE_FANS.Medico_Especialidad ME on ME.Cod_Especialidad = E.Cod_Especialidad " +
                                "JOIN ORACLE_FANS.Profesionales P ON P.Matricula = ME.Matricula " +
                                "WHERE P.Matricula = " + matricula.Text;
                TablaEspecialidades2 = SQL_Methods.EjecutarProcedure(myConnection, query2);
                cantEspMedico        = Convert.ToInt32(TablaEspecialidades2.Rows.Count.ToString());
            }
            if (SQL_Methods.DBConnectStatus)
            {
                TablaEspecialidades = SQL_Methods.EjecutarProcedure(myConnection, myQuery);
                foreach (DataRow Row in TablaEspecialidades.Rows)
                {
                    this.EspecialidadesCheckList.Items.Add(Row[0].ToString().Trim());
                    if (modificar)
                    {
                        string    id_Especialidad = Row[0].ToString();
                        DataRow[] Rows            = TablaEspecialidades.Select("Descripcion = '" + id_Especialidad.Trim() + "'");
                        String    Descripcion     = Rows[0][0].ToString().Trim();
                        for (int i = 0; i < cantEspMedico; i++)
                        {
                            if (Descripcion == TablaEspecialidades2.Rows[i][0].ToString())
                            {
                                int index = this.EspecialidadesCheckList.Items.IndexOf(Descripcion);
                                this.EspecialidadesCheckList.SetItemChecked(index, true);
                            }
                        }
                    }
                }
            }
        }
예제 #26
0
        // Método para mostrar especialidades
        private void cargarEspecialidades()
        {
            string myQuery = "SELECT T.Descripcion, E.Descripcion " +
                             "FROM ORACLE_FANS.Especialidades E " +
                             "JOIN ORACLE_FANS.Tipo_Especialidad T on E.Cod_Tipo_Especialidad = T.Cod_Tipo_Especialidad " +
                             "ORDER BY 1, 2";

            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                TablaEspecialidades = SQL_Methods.EjecutarProcedure(myConnection, myQuery);

                foreach (DataRow Row in TablaEspecialidades.Rows)
                {
                    this.dataGridView1.Rows.Add(Row[0].ToString(), Row[1].ToString());
                }
            }
        }
예제 #27
0
        // Método para corroborar el número de bono
        private bool corroborarNumBono()
        {
            bool retorno = true;

            if (numBono.Text.Trim() == "")
            {
                retorno = false;
            }
            if (numBono.Text.Trim() == "")
            {
                MessageBox.Show("No ingresó ningún número de bono. Ingrese un número de bono para su verificación.");
                retorno = false;
                return(retorno);
            }
            int fechaActual = 0;

            fechaActual += @Clinica_Frba.Properties.Settings.Default.Fecha.Day;
            fechaActual += @Clinica_Frba.Properties.Settings.Default.Fecha.Month * 100;
            fechaActual += @Clinica_Frba.Properties.Settings.Default.Fecha.Year * 10000;
            SqlConnection conexion = SQL_Methods.IniciarConnection();
            string        query    = "SELECT * FROM ORACLE_FANS.Bono_Farmacia " +
                                     "WHERE Numero = " + numBono.Text + " " +
                                     "AND Activo = 1 " +
                                     "AND Fecha_Impresion <= '" + fechaActual.ToString() + "' " +
                                     "AND Fecha_Vencimiento > '" + fechaActual.ToString() + "' ";

            DataTable bonos = new DataTable();

            bonos = SQL_Methods.EjecutarProcedure(conexion, query);
            if (bonos.Rows.Count != 0)
            {
                MessageBox.Show("El bono ingresado es correcto.");
            }
            else
            {
                MessageBox.Show("El bono ingresado es incorrecto o ya venció.");
                retorno = false;
                return(retorno);
            }
            return(retorno);
        }
예제 #28
0
        private void button_save_Click(object sender, EventArgs e)
        {
            TimeSpan Hour       = new TimeSpan(23, 59, 59);
            TimeSpan diffResult = box_fechaDesde.Value.Subtract(@Clinica_Frba.Properties.Settings.Default.Fecha);

            DateTime FechaDesde;
            DateTime FechaHasta;

            FechaDesde = Convert.ToDateTime(this.box_fechaDesde.Value.ToShortDateString());

            if (diffResult.Days <= 1)
            {
                MessageBox.Show("No se pueden cancelar turnos con anticipación menor a 24 horas");
                return;
            }

            if (box_fecha.Text.Equals("Fecha en Particular"))
            {
                this.Box_FechaHasta.Value = FechaDesde;
            }
            else
            {
                this.Box_FechaHasta.Value = Convert.ToDateTime(this.Box_FechaHasta.Value.ToShortDateString());
            }

            FechaHasta = this.Box_FechaHasta.Value.Add(Hour);

            if (!SQL_Methods.Profesional_CancelarTurno(Matricula,
                                                       FechaDesde,
                                                       FechaHasta,
                                                       this.box_tipoCancelacion.Text.Trim(),
                                                       this.box_descripcion.Text.Trim()))
            {
                MessageBox.Show("No se pudieron Cancelar los Turnos en Cuestion.");
                return;
            }
            menu.Visible = true;
            this.Dispose();
            return;
        }
예제 #29
0
        private void DataGrid_Roles_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 3)
            {
                if (Flag_deletion)
                {
                    int id_Rol = Convert.ToInt32(TablaRoles.Rows[e.RowIndex]["id_Rol"].ToString());

                    switch (id_Rol)
                    {
                    case 1:
                        MessageBox.Show("El Rol Afiliado no debe ser modificado");
                        return;

                    case 2:
                        MessageBox.Show("El Rol Administrativo no debe ser modificado");
                        return;

                    case 3:
                        MessageBox.Show("El Rol Profesional no debe ser modificado");
                        return;
                    }

                    if (SQL_Methods.Rol_DarBaja(id_Rol))
                    {
                        MessageBox.Show(TablaRoles.Rows[e.RowIndex]["Nombre"].ToString() + " ha sido eliminado.");
                    }

                    FormularioRol.Visible = true;
                    this.Dispose();
                }
                else
                {
                    int id_Rol = Convert.ToInt32(TablaRoles.Rows[e.RowIndex]["id_Rol"].ToString());
                    new AddModRol(FormularioRol, id_Rol);
                    this.Dispose();
                }
            }
        }
예제 #30
0
        public void ModificarPlanMedico(string unMotivo)
        {
            MotivoCambioPlan = unMotivo;



            DataRow[] Rows = TablaPlanesMedicos.Select("Descripcion = '" + this.Box_PlanMed.Text + "'");
            if (Rows.Length <= 0)
            {
                MessageBox.Show("Error en la Tabla Planes Medicos");
                return;
            }

            int Cod_PlanMedicoActual = Convert.ToInt32(Rows[0][0].ToString().Trim());

            if (!SQL_Methods.Afiliado_ModificarPlanMedico(Cod_Afiliado_Principal,
                                                          PlanMedico_Familiar,
                                                          Cod_PlanMedicoActual,
                                                          MotivoCambioPlan))
            {
                MessageBox.Show(Cod_Afiliado_Principal.ToString() + " no pudo ser modificado.");
                return;
            }

            Afiliado Paciente = CargarFormEnPaciente(Cod_PlanMedicoActual);

            if (FamiliaresACargo < Paciente.CantFamiliaresACargo)
            {
                ModificarFamiliares(Paciente);
                this.Visible = false;
                return;
            }

            MessageBox.Show(Cod_Afiliado_Principal.ToString() + " ha sido Modificado.");
            menu.Visible = true;
            this.Dispose();
            return;
        }