Beispiel #1
0
        //GetEventCategories
        public object GetEventCategories(string sidx, string sord, int page, int rows, long event_id, int maincat_id, long?cat_id, string title)
        {
            int?totalrecords = 0;
            int pageindex    = (page > 0) ? page - 1 : 0;

            dataContext.CommandTimeout = 600000;
            var res = dataContext.spCategory_View_CategoryByMCandE(event_id, maincat_id, cat_id, String.IsNullOrEmpty(title) ? String.Empty : title.Replace(" ", "%"), sidx.ToLower(), sord == "desc", pageindex, rows, ref totalrecords);

            if (totalrecords.GetValueOrDefault(0) == 0)
            {
                return new { total = 0, page = page, records = 0 }
            }
            ;
            return(new
            {
                total = (int)Math.Ceiling((float)totalrecords.GetValueOrDefault(0) / (float)rows),
                page = page,
                records = totalrecords.GetValueOrDefault(0),
                rows = (
                    from query in res
                    select new
                {
                    i = query.Category_ID,
                    cell = new string[] {
                        query.Category_ID.ToString(),
                        query.CategoryTitle
                    }
                }).ToArray()
            });
        }