Exemplo n.º 1
0
        public static List <Horarios> BuscarHorarios(string dias, string hora)
        {
            List <Horarios> List = new List <Horarios>();

            using (SqlConnection conexion = DBcomun.ObetenerConexion())
            {
                SqlCommand comando = new SqlCommand(string.Format("Select * from Horarios where Hora like '{0}%' and Dias like '{1}%'", hora, dias), conexion);

                SqlDataReader reader = comando.ExecuteReader();

                while (reader.Read())
                {
                    Horarios pH = new Horarios();

                    pH.ID   = reader.GetInt32(0);
                    pH.Hora = reader.GetString(1);
                    pH.Dias = reader.GetString(2);

                    List.Add(pH);
                }
                conexion.Close();
            }
            return(List);
        }
Exemplo n.º 2
0
        public static List <Horarios> TodosLosHorarios()
        {
            List <Horarios> List = new List <Horarios>();

            using (SqlConnection conexion = DBcomun.ObetenerConexion())
            {
                SqlCommand comando = new SqlCommand(string.Format("Select * from Horarios"), conexion);

                SqlDataReader reader = comando.ExecuteReader();

                while (reader.Read())
                {
                    Horarios pH = new Horarios();

                    pH.ID   = reader.GetInt32(0);
                    pH.Hora = reader.GetString(1);
                    pH.Dias = reader.GetString(2);

                    List.Add(pH);
                }
                conexion.Close();
            }
            return(List);
        }