예제 #1
0
        public listView <Entity> MetadataView(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 RosterConfigService();
                var content = service.GetViews(listId);
                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);
        }
예제 #2
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);
        }
예제 #3
0
        public listView <Entity> TimesheetList(string version, ICollection <abstractSearch> filter, QueryDisplayParams query)
        {
            DisableCaching();
            var result = new listView <Entity>();

            try
            {
                var viewId   = filter.filterTextValue("viewId").ToGuid();
                var dateFrom = filter.filterDateTimeValue("from");
                var dateTo   = filter.filterDateTimeValue("to");
                var period   = new Tuple <DateTime, DateTime>(dateFrom, dateTo);
                result.page = new pager <Entity>();
                var service = new RosterDataService();
                var content = service.ViewTimesheetEvents(viewId, null, period).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);
        }
예제 #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);
        }