示例#1
0
        private string GetAdminTileFilterInfo(string userName, string teamGuid, bool isAdmin)
        {
            JavaScriptSerializer jss = new JavaScriptSerializer();
            // TileManager tm = new TileManager();

            TileFilterListViewModel filterViewModel = new TileFilterListViewModel();

            using (MainDBUnitWorkContext context = new MainDBUnitWorkContext())
            {
                ICategoryRepository _categoryRepository = new CategoryRepository(context);
                ITagRepository      _tagRepository      = new TeamTagRepository(context);
                ITileRepository     _tileRepository     = new TileRepository(context);
                ITeamRepository     _teamRepository     = new TeamRepository(context);
                IReportRepository   _reportRepository   = new ReportRepository(context);
                IUserRepository     _userRepository     = new UserRepository(context);

                TileServices tileService = new TileServices(_tileRepository, _teamRepository, _reportRepository, _userRepository, _tagRepository, _categoryRepository, null);

                //Owner
                IEnumerable <UserLoginApp> userList = tileService.GetOwnerList(userName, teamGuid, isAdmin);
                filterViewModel.Owner = userList.OrderBy(_ => _.UserName).Distinct <UserLoginApp>(new UserComparer());


                //Category
                IEnumerable <AppCategory> categoryList = tileService.GetCategoryList();
                filterViewModel.SubCategory = categoryList.OrderBy(_ => _.CategoryName).Distinct <AppCategory>(new CategoryComparer());


                //Tag
                IEnumerable <AppTeamTag> tagList = tileService.GetTagListByTeam(teamGuid).Distinct <AppTeamTag>(new TagComparer());
                filterViewModel.Tag = tagList;
            }



            return(jss.Serialize(filterViewModel));
        }