Ejemplo n.º 1
0
        /// <summary>
        /// Team Site All reports
        /// </summary>
        /// <param name="userAlias"></param>
        /// <param name="teamSiteGuid"></param>
        /// <param name="isAdmin"></param>
        /// <param name="sortField"></param>
        /// <param name="sortOrder"></param>
        /// <returns></returns>
        public IEnumerable <AppReport> GetAllReportsOfTeamSite(string userAlias, string teamSiteGuid, bool isAdmin,
                                                               SortField sortField, SortOrder sortOrder)
        {
            TileServices tService = new TileServices(_tileRepository, _teamRepository, _reportRepository, null, null, null, null);
            int          teamId   = _teamRepository.GetFiltered(_ => _.TeamGuid == new Guid(teamSiteGuid)).FirstOrDefault().Id;



            ParameterProvider pp = new ParameterProvider();

            pp.AddParameter(ContextVariable.CurrentTeamSiteGuid.ToString(), new Guid(teamSiteGuid));

            //if (userAlias != "")
            //{
            //pp.AddParameter(ContextVariable.CurrentUser.ToString(), userAlias);
            //}

            pp.AddParameter(ContextVariable.TeamSiteGuidUnderControl.ToString(), new List <Guid> {
                new Guid(teamSiteGuid)
            });


            int allreportsTileId = _tileRepository.GetAllReportsTileId(teamId);

            return(_reportRepository.
                   GetReportsByExpression(
                       tService.GetTeamSite_AllReportsTile()
                       .GetCombinedLogic(isAdmin, allreportsTileId)
                       .GetExpression(pp)).ToArray()
                   .Select(_ => _.ToAppReport()));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get all the owners that has reports owned
        /// </summary>
        /// <param name="userAlias"></param>
        /// <param name="siteGuid"></param>
        /// <param name="isCurrentSiteAdmin"></param>
        /// <returns></returns>
        public ICollection <UserLoginApp> GetOwnerList(string userAlias, string siteGuid, bool isCurrentSiteAdmin)
        {
            int teamId = _teamRepository.GetFiltered(_ => _.TeamGuid == new Guid(siteGuid)).FirstOrDefault().Id;

            int allReportTileID = _tileRepository.GetAllReportsTileId(teamId);

            EditReportService editService = new EditReportService(_reportRepository, _userRepository, _teamRepository, _categoryRepository, _tagRepository, _tileRepository);

            ICollection <Statistics> ls = editService.GetTeamSiteReportsStatistics(allReportTileID, userAlias, siteGuid, isCurrentSiteAdmin);

            IEnumerable <UserLoginApp> userList = new List <UserLoginApp>();

            if (ls.Count() > 0)
            {
                Statistics OwnerStatistics = ls.Where(_ => _.Name == "Owner").FirstOrDefault();

                userList = OwnerStatistics.Values.Select(_ => new UserLoginApp
                {
                    Id       = _.GUID,
                    UserName = _.Name
                }).OrderBy(_ => _.UserName);
            }

            return(userList.ToList());
        }