Пример #1
0
        static public int Turno_Registrar(int Matricula, int Cod_Especialidad, int Cod_Afiliado, DateTime Fecha)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlCommand cmd = new SqlCommand("ORACLE_FANS.Turno_Registrar", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Matricula", Matricula));
                cmd.Parameters.Add(new SqlParameter("@Cod_Especialidad", Cod_Especialidad));
                cmd.Parameters.Add(new SqlParameter("@Cod_Afiliado", Cod_Afiliado));
                cmd.Parameters.Add(new SqlParameter("@Fecha", Fecha));


                SqlParameter ValorDeRetorno = cmd.Parameters.Add("returnParameter", SqlDbType.Int);
                ValorDeRetorno.Direction = ParameterDirection.ReturnValue;
                try
                {
                    cmd.ExecuteNonQuery();
                    return(Convert.ToInt32(ValorDeRetorno.SqlValue.ToString()));
                }
                catch (SqlException e)
                {
                    MessageBox.Show("[SQL_Methods] - " + e.ToString());
                    return(-1);

                    throw;
                }
            }
            return(-1);
        }
Пример #2
0
        static public bool Afiliado_DarBajaTurno(int Cod_Turno, DateTime FechaActual, string TipoCancelacion, string Descripcion)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.Afiliado_DarBajaTurno", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Cod_Turno", Cod_Turno));
                cmd.Parameters.Add(new SqlParameter("@Fecha", FechaActual));
                cmd.Parameters.Add(new SqlParameter("@TipoCancelacion", TipoCancelacion.Trim()));
                cmd.Parameters.Add(new SqlParameter("@Descripcion", Descripcion));
                try
                {
                    reader = cmd.ExecuteReader();
                }
                catch (SqlException e)
                {
                    MessageBox.Show("[SQL_Methods] - " + e.ToString());
                    return(false);

                    throw;
                }
            }
            return(true);
        }
Пример #3
0
        static public bool Profesional_CancelarTurno(int Matricula, DateTime FechaDesde, DateTime FechaHasta,
                                                     string TipoCancelacion, string Descripcion)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.Profesional_CancelarTurno", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Matricula", Matricula));
                cmd.Parameters.Add(new SqlParameter("@FechaDesde", FechaDesde));
                cmd.Parameters.Add(new SqlParameter("@FechaHasta", FechaHasta));
                cmd.Parameters.Add(new SqlParameter("@TipoCancelacion", TipoCancelacion));
                cmd.Parameters.Add(new SqlParameter("@Descripcion", Descripcion));
                cmd.Parameters.Add(new SqlParameter("@FechaHoy", @Clinica_Frba.Properties.Settings.Default.Fecha));
                try
                {
                    reader = cmd.ExecuteReader();
                }
                catch (SqlException e)
                {
                    MessageBox.Show("[SQL_Methods] - " + e.ToString());
                    return(false);

                    throw;
                }
            }
            return(true);
        }
Пример #4
0
        static public int Rol_DarAlta(String Nombre)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlCommand cmd = new SqlCommand("ORACLE_FANS.agregar_Un_Rol", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@unRol", Nombre));
                SqlParameter ValorDeRetorno = cmd.Parameters.Add("returnParameter", SqlDbType.Int);
                ValorDeRetorno.Direction = ParameterDirection.ReturnValue;
                try
                {
                    cmd.ExecuteNonQuery();
                    return(Convert.ToInt32(ValorDeRetorno.SqlValue.ToString()));
                }
                catch (SqlException)
                {
                    MessageBox.Show("El Rol que usted está intentado crear ya existe");
                    return(-1);

                    throw;
                }
            }
            return(-1);
        }
Пример #5
0
        static public bool Rol_Habilitar(int idRol)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.modificarRol_HabilitarRol", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@id_Rol", idRol));
                try
                {
                    reader = cmd.ExecuteReader();
                }
                catch (SqlException)
                {
                    MessageBox.Show("Error inesperado");
                    return(false);

                    throw;
                }
            }
            return(true);
        }
Пример #6
0
        static public bool Profesional_AgregarAgenda(int Matricula, DateTime Hora, int Dia)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.AgregarAAgenda", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Matricula", Matricula));
                cmd.Parameters.Add(new SqlParameter("@dia", Dia));
                cmd.Parameters.Add(new SqlParameter("@hora", Hora));
                try
                {
                    reader = cmd.ExecuteReader();
                }
                catch (SqlException e)
                {
                    MessageBox.Show("[SQL_Methods] - " + e.ToString());
                    return(false);

                    throw;
                }
            }
            return(true);
        }
Пример #7
0
        static public bool Rol_DarBaja(int idRol)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.dar_BajaRol", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@id_Rol", idRol));
                try
                {
                    reader = cmd.ExecuteReader();
                }
                catch (SqlException)
                {
                    MessageBox.Show("El Rol ya está dado de baja");
                    return(false);

                    throw;
                }
            }
            return(true);
        }
Пример #8
0
        static public bool Afiliado_ModificarPlanMedico(int Cod_Afiliado, int Cod_PlanMedicoAnt, int Cod_PlanMedicoActual, string Motivo)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.insertar_Historico", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Cod_Afiliado", Cod_Afiliado));
                cmd.Parameters.Add(new SqlParameter("@Cod_PlanMedico_Nuevo", Cod_PlanMedicoActual));
                cmd.Parameters.Add(new SqlParameter("@Cod_PlanMedico_Anterior", Cod_PlanMedicoAnt));
                cmd.Parameters.Add(new SqlParameter("@FechaModificacion", @Clinica_Frba.Properties.Settings.Default.Fecha));
                cmd.Parameters.Add(new SqlParameter("@Motivo", Motivo));
                try
                {
                    reader = cmd.ExecuteReader();
                }
                catch (SqlException e)
                {
                    MessageBox.Show("[SQL_Methods] - " + e.ToString());
                    return(false);

                    throw;
                }
            }
            return(true);
        }
Пример #9
0
        static public int Profesional_AgregarCartilla(int Matricula, DateTime FechaDesde, DateTime FechaHasta)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.AgregarCartilla", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Matricula", Matricula));
                cmd.Parameters.Add(new SqlParameter("@FechaDesde", FechaDesde));
                cmd.Parameters.Add(new SqlParameter("@FechaHasta", FechaHasta));

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

                try
                {
                    reader = cmd.ExecuteReader();
                    return(Convert.ToInt32(ValorDeRetorno.SqlValue.ToString()));
                }
                catch (SqlException e)
                {
                    MessageBox.Show("[SQL_Methods] - " + e.ToString());
                    return(-1);

                    throw;
                }
            }
            return(-1);
        }
Пример #10
0
        static public bool Afiliado_ModificarDatos(Afiliado.Afiliado NuevoAfiliado)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.modificar_Afiliado", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Cod_Afiliado", NuevoAfiliado.Cod_Afiliado));
                cmd.Parameters.Add(new SqlParameter("@Tipo_Documento", NuevoAfiliado.Tipo_Documento));
                cmd.Parameters.Add(new SqlParameter("@Direccion", NuevoAfiliado.Direccion));
                cmd.Parameters.Add(new SqlParameter("@Telefono", NuevoAfiliado.Telefono));
                cmd.Parameters.Add(new SqlParameter("@Mail", NuevoAfiliado.Mail));
                cmd.Parameters.Add(new SqlParameter("@Sexo", NuevoAfiliado.Sexo));
                cmd.Parameters.Add(new SqlParameter("@Estado_Civil", NuevoAfiliado.Estado_Civil));
                try
                {
                    reader = cmd.ExecuteReader();
                }
                catch (SqlException e)
                {
                    MessageBox.Show("[SQL_Methods] - " + e.Message.ToString());
                    return(false);

                    throw;
                }
            }
            return(true);
        }
Пример #11
0
        static public bool Afiliado_DarBaja(int idAfiliado, DateTime Fecha)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.baja_Afiliado", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Cod_Afiliado", idAfiliado));
                cmd.Parameters.Add(new SqlParameter("@Fecha_Baja", Fecha));
                try
                {
                    reader = cmd.ExecuteReader();
                }
                catch (SqlException e)
                {
                    MessageBox.Show("[SQL_Methods] - " + e.Message.ToString());
                    return(false);

                    throw;
                }
            }
            return(true);
        }
Пример #12
0
        private void CargarFuncionalidades()
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();

            string myQuery = "SELECT F.id_funcionalidad " +
                             "FROM ORACLE_FANS.Roles R, ORACLE_FANS.Roles_Funcionalidad RF, ORACLE_FANS.Funcionalidades F " +
                             "WHERE R.id_Rol = RF.id_Rol " +
                             "AND RF.id_Funcionalidad = F.id_funcionalidad " +
                             "AND R.id_Rol = " + idRol.ToString();


            if (SQL_Methods.DBConnectStatus)
            {
                DataTable Tabla = SQL_Methods.EjecutarProcedure(myConnection, myQuery);

                foreach (DataRow Row in Tabla.Rows)
                {
                    Funcionalidades.Add(Convert.ToInt32(Row[0].ToString()));
                }
            }

            MostratMenus();
        }
Пример #13
0
        static public bool Usuario_Crear(int idRol, string username)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.Usuario_Crear", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@username", username));
                cmd.Parameters.Add(new SqlParameter("@id_Rol", idRol));
                try
                {
                    reader = cmd.ExecuteReader();
                }
                catch (SqlException e)
                {
                    MessageBox.Show("[SQL_Methods] - " + e.ToString());
                    return(false);

                    throw;
                }
            }
            return(true);
        }
Пример #14
0
        static public bool Rol_AgregarFuncionalidad(int idRol, int idFuncionalidad)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.agregar_Una_Funcionalidad", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@id_Funcionalidad", idFuncionalidad));
                cmd.Parameters.Add(new SqlParameter("@id_Rol", idRol));
                try
                {
                    reader = cmd.ExecuteReader();
                }
                catch (SqlException e)
                {
                    MessageBox.Show(e.ToString());
                    return(false);

                    throw;
                }
            }
            return(true);
        }
Пример #15
0
        static public DataTable Afiliado_ListarTurnos(int Cod_Afiliado, DateTime FechaTurno)
        {
            SqlConnection myConnection;
            DataTable     unaDataTable = new DataTable();

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.Afiliado_ListarTurnos", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Cod_Afiliado", Cod_Afiliado));
                cmd.Parameters.Add(new SqlParameter("@FechaTurno", FechaTurno));
                reader = cmd.ExecuteReader();
                unaDataTable.Load(reader);
            }
            return(unaDataTable);
        }
Пример #16
0
        private void setProfesional(int numeroDocumento)
        {
            string myQuery = "SELECT * FROM ORACLE_FANS.Profesionales " +
                             "WHERE Numero_Documento = " + numeroDocumento.ToString() + "";

            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                DataTable AuxTabla = SQL_Methods.EjecutarProcedure(myConnection, myQuery);
                Matricula     = Convert.ToInt32(AuxTabla.Rows[0]["Matricula"].ToString());
                Medico_Nombre = AuxTabla.Rows[0]["Apellido"].ToString() + " " + AuxTabla.Rows[0]["Nombre"].ToString();
            }
            else
            {
                MessageBox.Show("Se perdio la conexion con la Base de Datos");
            }
        }
Пример #17
0
        static public DataTable Profesional_ListarTurnosDisponibles(int Matricula, DateTime FechaTurno)
        {
            SqlConnection myConnection;
            DataTable     unaDataTable = new DataTable();

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.ListarTurnosDisponibles", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Matricula", Matricula));
                cmd.Parameters.Add(new SqlParameter("@Fecha", FechaTurno));
                reader = cmd.ExecuteReader();
                unaDataTable.Load(reader);
            }
            return(unaDataTable);
        }
Пример #18
0
        static public DataTable Listado_Top10Afiliados(int Anio, int mes)
        {
            SqlConnection myConnection;
            DataTable     unaDataTable = new DataTable();

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.ListadoDeBonosCompradosYUsadosPorDistintoAfiliado", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Anio", Anio));
                cmd.Parameters.Add(new SqlParameter("@mes", mes));
                reader = cmd.ExecuteReader();
                unaDataTable.Load(reader);
            }
            return(unaDataTable);
        }
Пример #19
0
        static public DataTable Listado_Top5Cancelaciones(int Anio, int mes, int idRol)
        {
            SqlConnection myConnection;
            DataTable     unaDataTable = new DataTable();

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.ListadoDeCancelaciones", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Anio", Anio));
                cmd.Parameters.Add(new SqlParameter("@mes", mes));
                cmd.Parameters.Add(new SqlParameter("@idRol", idRol));
                reader = cmd.ExecuteReader();
                unaDataTable.Load(reader);
            }
            return(unaDataTable);
        }
Пример #20
0
        static public int Afiliado_DarAlta(Afiliado.Afiliado NuevoAfiliado)
        {
            SqlConnection myConnection;

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlCommand cmd = new SqlCommand("ORACLE_FANS.alta_Afiliado", myConnection);



                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Cod_PlanMedico", NuevoAfiliado.Cod_PlanMedico));
                cmd.Parameters.Add(new SqlParameter("@Nombre", NuevoAfiliado.Nombre));
                cmd.Parameters.Add(new SqlParameter("@Apellido", NuevoAfiliado.Apellido));
                cmd.Parameters.Add(new SqlParameter("@Tipo_Documento", NuevoAfiliado.Tipo_Documento));
                cmd.Parameters.Add(new SqlParameter("@Numero_Documento", NuevoAfiliado.Numero_Documento));
                cmd.Parameters.Add(new SqlParameter("@Direccion", NuevoAfiliado.Direccion));
                cmd.Parameters.Add(new SqlParameter("@Telefono", NuevoAfiliado.Telefono));
                cmd.Parameters.Add(new SqlParameter("@Mail", NuevoAfiliado.Mail));
                cmd.Parameters.Add(new SqlParameter("@Fecha_Nac", NuevoAfiliado.Fecha_Nac));
                cmd.Parameters.Add(new SqlParameter("@Sexo", NuevoAfiliado.Sexo));
                cmd.Parameters.Add(new SqlParameter("@Estado_Civil", NuevoAfiliado.Estado_Civil));

                SqlParameter ValorDeRetorno = cmd.Parameters.Add("returnParameter", SqlDbType.Int);
                ValorDeRetorno.Direction = ParameterDirection.ReturnValue;
                try
                {
                    cmd.ExecuteNonQuery();
                    return(Convert.ToInt32(ValorDeRetorno.SqlValue.ToString()));
                }
                catch (SqlException e)
                {
                    MessageBox.Show("[SQL_Methods] - " + e.Message.ToString());
                    return(-1);

                    throw;
                }
            }
            return(-1);
        }
Пример #21
0
        static public DataTable Profesional_Listar(int Matricula, string Nombre, string Apellido, string Especialidad, DateTime FechaTurno)
        {
            SqlConnection myConnection;
            DataTable     unaDataTable = new DataTable();

            myConnection = SQL_Methods.IniciarConnection();
            if (SQL_Methods.DBConnectStatus)
            {
                SqlDataReader reader = null;
                SqlCommand    cmd    = new SqlCommand("ORACLE_FANS.ListarMedicos", myConnection);

                cmd.CommandType = CommandType.StoredProcedure;
                if (Matricula == -1)
                {
                    cmd.Parameters.Add(new SqlParameter("@Matricula", DBNull.Value));
                }
                else
                {
                    cmd.Parameters.Add(new SqlParameter("@Matricula", Matricula));
                }

                cmd.Parameters.Add(new SqlParameter("@Nombre", Nombre));
                cmd.Parameters.Add(new SqlParameter("@Apellido", Apellido));

                if (Especialidad.Equals(""))
                {
                    cmd.Parameters.Add(new SqlParameter("@Especialidad", DBNull.Value));
                }
                else
                {
                    cmd.Parameters.Add(new SqlParameter("@Especialidad", Especialidad));
                }



                cmd.Parameters.Add(new SqlParameter("@Fecha", FechaTurno));
                reader = cmd.ExecuteReader();
                unaDataTable.Load(reader);
            }
            return(unaDataTable);
        }