Ejemplo n.º 1
0
        public FromMeModel GetFromMe(int userId, MessageSort sortedBy, bool des, PagerModel pager, int? projectId = null, int? addresseeId = null)
        {
            FromMeModel model = new FromMeModel();

            model.Messages = new List<FromMeItemModel>
            {
                new FromMeItemModel
                {
                    Id=11,
                    PublishTime=new DateTime(2015,1,13,12,11,0),
                    Project=getProject(1),
                    Task=new ViewModel.Task.LiteItemModel{ Id=3, Title="引入留言功能" },
                    Addressee=new UserModel{Id=14, Name="叶子" },
                    Content="人口结构失调为代价的,后者带来的问题"
                },
                new FromMeItemModel
                {
                    Id=21,
                    PublishTime=new DateTime(2015,1,12,12,31,0),
                    Project=getProject(2),
                    Task=new ViewModel.Task.LiteItemModel{ Id=23, Title="在BuildDatabase中准备好数据" },
                    Addressee=new UserModel{ Id=24,Name="叶子" },
                    Content="2010年,第六次人口普查显示:0—14岁儿童占总人口的16.60%。"
                },
                new FromMeItemModel
                {
                    Id=31,
                    PublishTime=new DateTime(2015,1,11,1,11,0),
                    ReadTime=new DateTime(2015,1,11,11,12,10),
                    Project=getProject(3),
                    Task=new ViewModel.Task.LiteItemModel{ Id=33, Title="准备数据" },
                    Addressee=new UserModel{ Id=34,Name="自由飞" },
                    Content="重心明显移后,劳动人口的绝对数量开始步入下降通道"
                },
                new FromMeItemModel
                {
                    Id=41,
                    PublishTime=new DateTime(2015,1,11,1,11,0),
                    ReadTime=new DateTime(2015,1,11,1,13,0),
                    Project=getProject(4),
                    Task=new ViewModel.Task.LiteItemModel{ Id=43, Title="实现统计的NHQuery方法" },
                    Addressee=new UserModel{ Id=44,Name="心情" },
                    Content="农村“一孩半”生育政策恰是出生性别比失调的主要原因"
                }
            };
            model.Addressees = model.Messages.Select(m => m.Addressee).Distinct().ToList();
            model.Projects = model.Messages.Select(m => m.Project).ToList();

            return model;
        }
Ejemplo n.º 2
0
        public FromMeModel GetFromMe(int userId,
            MessageSort sortedBy, bool des,
            PagerModel pager,
            int? projectId = null, int? addresseeId = null)
        {
            FromMeModel model = new FromMeModel();

            model.Addressees = getCommunicators(userId, MessageFor.Addresser);
            model.Projects = getProjects(userId, MessageFor.Addresser);

            var messages = _querySource.Get(userId, addresseeId, projectId, MessageFor.Addresser)
                .Sort(sortedBy, des)
                .Paged(pager)
                .ToList();

            model.Messages = new List<FromMeItemModel>();
            model.Messages.FilledBy(messages);

            return model;
        }