public ActionResult Index(int?userId, string date, string sortBy, string sortOrder)
        {
            var model = new FeedIndexModel();

            model.Tab = "Feed";

            model.Users           = DataHelper.GetUserList();
            model.UserId          = userId ?? 0;
            model.UserName        = DataHelper.ToString(model.Users, model.UserId, "any user");
            model.UserDisplayName = DataHelper.Clip(model.UserName, 20);

            model.Date = date ?? string.Empty;

            model.SortBy    = sortBy ?? "CreatedDate";
            model.SortOrder = sortOrder ?? "DESC";
            model.SortableColumns.Add("CreatedDate", "Date");
            model.SortableColumns.Add("Type", "Type");
            model.SortableColumns.Add("UserName", "User");

            var criteria = new FeedCriteria()
            {
                CreatedBy   = userId,
                CreatedDate = new DateRangeCriteria(model.Date)
            };

            var feeds = FeedService.FeedFetchInfoList(criteria)
                        .AsQueryable();

            feeds = feeds.OrderBy(string.Format("{0} {1}", model.SortBy, model.SortOrder));

            model.Feeds = feeds;

            return(this.View(model));
        }
        public ActionResult Index(string dashboard)
        {
            var model = new HomeIndexModel();

            model.Tab       = "Home";
            model.Dashboard = dashboard ?? "My";
            model.StartDate = DateTime.Today.ToStartOfWeek();
            model.EndDate   = DateTime.Today.ToEndOfWeek();

            if (model.Dashboard == "Team")
            {
                model.Tasks = TaskService.TaskFetchInfoList(
                    new TaskCriteria
                {
                    IsArchived = false
                });
                model.Hours = HourService.HourFetchInfoList(model.StartDate, model.EndDate);
                model.Feeds = FeedService.FeedFetchInfoList(5);
            }
            else
            {
                model.Tasks = MyService.TaskFetchInfoList();
                model.Hours = MyService.HourFetchInfoList(model.StartDate, model.EndDate);
                model.Feeds = MyService.FeedFetchInfoList(5);
            }

            return(this.View(model));
        }
Exemple #3
0
 public static FeedInfoList FeedFetchInfoList(int maximumRecords)
 {
     return(FeedService.FeedFetchInfoList(
                new FeedCriteria
     {
         CreatedBy = BusinessPrincipal.GetCurrentIdentity().UserId,
         SortBy = "CreatedDate",
         SortOrder = ListSortDirection.Descending,
         MaximumRecords = maximumRecords
     }));
 }
Exemple #4
0
        public void Feed_Fetch_List()
        {
            var feed = FeedService.FeedNew();

            feed.Data = DataHelper.RandomString(1000);

            feed = FeedService.FeedSave(feed);

            feed.Type = DataHelper.RandomString(30);
            feed.Data = DataHelper.RandomString(1000);

            FeedService.FeedSave(feed);

            var feeds = FeedService.FeedFetchInfoList();

            Assert.IsTrue(feeds.Count > 1, "Feeds should be greater than one");
        }