예제 #1
0
        public DataTable SelectLikeRPDM(byte opcionLike, string texto)
        {
            DataTable res   = new DataTable();
            string    query = @"SELECT * FROM VwListaRPDM WHERE [Nombre completo] like @texto  ";

            switch (opcionLike)
            {
            case 0:
                query = query + " AND Reserva =1 ";
                break;

            case 1:
                query = query + " AND Reserva =2";
                break;
            }
            query = query + " order by 7 desc";
            try
            {
                SqlCommand cmd = OperacionesSQL.CreateBasicCommand(query);
                cmd.Parameters.AddWithValue("@texto", "%" + texto + "%");
                res = OperacionesSQL.ExcecuteDataTableCommand(cmd);
            }
            catch (Exception)
            {
                throw;
            }
            return(res);
        }
예제 #2
0
        public DataTable SelectLikeFullLibro(string texto)
        {
            DataTable res   = new DataTable();
            string    query = @"SELECT * FROM VwfullLibro WHERE Nombre LIKE @texto ORDER BY 2";

            try
            {
                SqlCommand cmd = OperacionesSQL.CreateBasicCommand(query);
                cmd.Parameters.AddWithValue("@texto", "%" + texto + "%");
                res = OperacionesSQL.ExcecuteDataTableCommand(cmd);
            }
            catch (Exception)
            {
                throw;
            }
            return(res);
        }
        public DataTable SelectReservaLibro(int id)
        {
            DataTable res   = new DataTable();
            string    query = @"  SELECT * FROM VwReserbaPersona WHERE [Id Persona]=@id ORDER BY 5";

            try
            {
                SqlCommand cmd = OperacionesSQL.CreateBasicCommand(query);
                cmd.Parameters.AddWithValue("@id", id);
                res = OperacionesSQL.ExcecuteDataTableCommand(cmd);
            }
            catch (Exception)
            {
                throw;
            }
            return(res);
        }
예제 #4
0
        public DataTable SelectLikeActualizarFecha(string texto)
        {
            DataTable res   = new DataTable();
            string    query = @" SELECT * FROM VwActualizarFecha WHERE Reserva=2 AND [Nombre completo] like @texto  ";

            try
            {
                SqlCommand cmd = OperacionesSQL.CreateBasicCommand(query);
                cmd.Parameters.AddWithValue("@texto", "%" + texto + "%");
                res = OperacionesSQL.ExcecuteDataTableCommand(cmd);
            }
            catch (Exception)
            {
                throw;
            }
            return(res);
        }
        public DataTable Contar(int id)
        {
            DataTable dt    = new DataTable();
            string    query = "SELECT COUNT (reserva) FROM Prestamo WHERE idUsuario=@id AND reserva=1";

            try
            {
                SqlCommand cmd = OperacionesSQL.CreateBasicCommand(query);
                cmd.Parameters.AddWithValue("@id", id);
                dt = OperacionesSQL.ExcecuteDataTableCommand(cmd);
            }
            catch (Exception err)
            {
                MessageBox.Show("Error al insertar el cliente" + err);
                throw err;
            }
            return(dt);
        }