Beispiel #1
0
        public listView <Entity> ListTemplates(string version, QueryDisplayParams query)
        {
            DisableCaching();
            var result = new listView <Entity>();

            try
            {
                result.page = new pager <Entity>();
                var service = new RosterDataService();
                var content = service.ListTemplates().ToList();
                result.total = content.Count();
                content.Take(query.currentPageSize).Skip(query.currentPageNum * query.currentPageSize).ToList().ForEach(item =>
                {
                    result.page.pageItems.Add(new Entity
                    {
                        Key    = item.FindValue("Id").ToSafeString(),
                        Fields = item.ExpandoToNamed()
                    });
                });
            }
            catch (Exception ex)
            {
                //HandleException(ex);
            }
            return(result);
        }
Beispiel #2
0
        public listView <Entity> MetadataList(string version, QueryDisplayParams query)
        {
            DisableCaching();
            var result = new listView <Entity>();

            try
            {
                result.page = new pager <Entity>();
                var service = new RosterConfigService();
                var content = service.GetLists();
                result.total = content.Count();
                content.Take(query.currentPageSize).Skip(query.currentPageNum * query.currentPageSize).ToList().ForEach(item =>
                {
                    result.page.pageItems.Add(new Entity
                    {
                        Key    = item.Id.ToSafeString(),
                        Name   = item.Name,
                        Fields = item.ToNamed()
                    });
                });
            }
            catch (Exception ex)
            {
                result.message.message      = ex.Message;
                result.message.messageLevel = messageLevelEnum.critical;
                //HandleException(ex);
            }
            return(result);
        }
Beispiel #3
0
        public listView <Entity> RosterEventList(string version, ICollection <abstractSearch> filter, QueryDisplayParams query)
        {
            DisableCaching();
            var result = new listView <Entity>();

            try
            {
                var listId = filter.filterTextValue("listId").ToGuid();
                result.page = new pager <Entity>();
                var service = new RosterDataService();
                var content = service.ListRosterEvents(listId).ToList();
                result.total = content.Count();
                content.Take(query.currentPageSize).Skip(query.currentPageNum * query.currentPageSize).ToList().ForEach(item =>
                {
                    result.page.pageItems.Add(new Entity
                    {
                        Key    = item.Id.ToSafeString(),
                        Fields = item.RosterEventProperties.ExpandoToNamed()
                    });
                });
            }
            catch (Exception ex)
            {
                result.message.message      = ex.Message;
                result.message.messageLevel = messageLevelEnum.critical;
                //HandleException(ex);
            }
            return(result);
        }
Beispiel #4
0
        public listView <Entity> DictionaryList(string version, ICollection <abstractSearch> filter, QueryDisplayParams query)
        {
            DisableCaching();
            var result = new listView <Entity>();

            try
            {
                var source    = filter.filterTextValue("source");
                var key       = filter.filterTextValue("key");
                var fields    = filter.filterTextValue("fields");
                var type      = filter.filterIntValue("type");
                var queryTerm = filter.filterTextValue("queryTerm");

                result.page = new pager <Entity>();

                var content = BLExtensions.SourceContent(source, key, fields, type)
                              .Where(i => i.Item2.ToSeparatedString().Contains(queryTerm)).ToList();
                result.total = content.Count();
                content.Take(query.currentPageSize).Skip(query.currentPageNum * query.currentPageSize).ToList().ForEach(item =>
                {
                    result.page.pageItems.Add(new Entity
                    {
                        Key    = item.Item1.ToSafeString(),
                        Name   = item.Item2.FirstValue(),
                        Fields = new List <named>()
                    });
                });
            }
            catch (Exception ex)
            {
                result.message.message      = ex.Message;
                result.message.messageLevel = messageLevelEnum.critical;
                //HandleException(ex);
            }
            return(result);
        }
Beispiel #5
0
 public static pager <TTarget> GetPage <TTarget>(this IQueryable <TTarget> query, QueryDisplayParams settings)
 {
     if (settings.pageSize == 0)
     {
         settings.pageSize = 10;
     }
     return(GetPage(query, settings.pageNum, settings.pageSize, false, string.Format("{0} {1}", settings.sortColumn, settings.sortDirection)));
 }