public static PaginadoRelacion selectData(int skip, int take)
 {
     try
     {
         var data = new PaginadoRelacion();
         data = clsVistaRelaciones.SelectAll(skip, take);
         return data;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 2
0
        public Entidades.Helpers.PaginadoRelacion selectAll(int skip, int take)
        {
            try
            {
                var data            = new Entidades.Helpers.PaginadoRelacion();
                List <Relaciones> t = new List <Relaciones>();
                using (var context = new BarandillasEntities())
                {
                    var query = (from p in context.RelacionesDeTablas
                                 group p by new { p.TablaID, p.Nombre } into i
                                 select new
                    {
                        TablaID = i.Key.TablaID,
                        NombreTabla = i.Key.Nombre,
                        Count = i.Count()
                    })
                                .OrderBy(i => i.TablaID)
                                .Skip(skip)
                                .Take(take)
                                .ToList().Distinct();
                    foreach (var i in query)
                    {
                        t.Add(new Relaciones {
                            TablaID = i.TablaID, NombreTabla = i.NombreTabla, Count = i.Count
                        });
                    }

                    data.Customers    = t;
                    data.TotalRecords = t.Count();
                    return(data);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 3
0
        public Entidades.Helpers.PaginadoRelacion selectAll(int skip, int take)
        {
            try
            {
                var data = new Entidades.Helpers.PaginadoRelacion();
                List<Relaciones> t = new List<Relaciones>();
                using (var context = new BarandillasEntities())
                {

                    var query = (from p in context.RelacionesDeTablas
                                 group p by new { p.TablaID, p.Nombre } into i
                                 select new
                                 {
                                     TablaID = i.Key.TablaID,
                                     NombreTabla = i.Key.Nombre,
                                     Count = i.Count()
                                 })
                                 .OrderBy(i => i.TablaID)
                                .Skip(skip)
                                .Take(take)
                                .ToList().Distinct();
                    foreach (var i in query)
                    {
                        t.Add(new Relaciones { TablaID = i.TablaID, NombreTabla = i.NombreTabla, Count = i.Count});
                    }

                    data.Customers = t;
                    data.TotalRecords = t.Count();
                    return data;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }