Ejemplo n.º 1
0
        public CrissCrossLib.Hierarchical.CrcReportFolder GetAllReportsHierarchicalNoCache(string username)
        {
            ReportingService2010Soap rService = m_ssrsSoapClientFactory.MakeSsrsSoapClient();
            var fac = new CrissCrossLib.Hierarchical.CrcReportFolderFactory();

            return(fac.Create(rService));
        }
Ejemplo n.º 2
0
        public CrcSsrsSoapClientFactory MakeMockSoapClientFactory(ReportingService2010Soap serviceClient)
        {
            // mock the factory
            var soapClientFactory = MockRepository.GenerateMock <CrcSsrsSoapClientFactory>();

            soapClientFactory.Expect(s => s.MakeSsrsSoapClient()).Return(serviceClient);
            return(soapClientFactory);
        }
Ejemplo n.º 3
0
        public void SetListChildrenExpectation(ReportingService2010Soap mockService, string path, CatalogItem[] returnItems)
        {
            var lcResponse = new ListChildrenResponse(null, returnItems);

            mockService.Expect(m => m.ListChildren(
                                   Arg <ListChildrenRequest> .Matches(
                                       lcr => lcr.ItemPath == path)
                                   )).Return(lcResponse);
        }
Ejemplo n.º 4
0
        public CatalogItem[] GetAllReportsNoCache(string username)
        {
            ReportingService2010Soap rService = m_ssrsSoapClientFactory.MakeSsrsSoapClient();

            var lcRequest = new ListChildrenRequest()
            {
                //TrustedUserHeader = new TrustedUserHeader(),
                ItemPath  = "/",
                Recursive = true
            };
            //CatalogItem[] catalogItems = null;
            var lcResponse = rService.ListChildren(lcRequest);

            var reportsOnly = lcResponse.CatalogItems.Where(c => c.TypeName != null && c.TypeName.Equals(Hierarchical.CrcReportFolderFactory.ReportServiceItemTypes.Report)).ToArray();

            return(reportsOnly);
        }
Ejemplo n.º 5
0
        public CrcReportDefinition GetReportDefn(string reportPath, string username)
        {
            // first, use the username to get description
            var reportCat = this.GetReportCatalogItem(reportPath, username);

            ReportingService2010Soap rService = m_ssrsSoapClientFactory.MakeSsrsSoapClient();

            GetItemParametersRequest req = new GetItemParametersRequest()
            {
                ItemPath     = reportPath,
                ForRendering = true
            };
            var resp = rService.GetItemParameters(req);

            var factory = new CrcReportDefinitionFactory();

            return(factory.Create(reportPath, reportCat, resp.Parameters, m_extraConfiguration));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Applies the specified choices to the already-existing report definition
        /// and updates the dependant parameters
        /// </summary>
        public void RefreshDependantParameters(CrcReportDefinition repDefn, CrcParameterChoiceCollection newChoices)
        {
            var mapResult = repDefn.MapParameterChoices(newChoices);

            if (!mapResult.MappingValid)
            {
                // todo - friendlier message back to ui
                throw new ApplicationException(string.Format("invalid params - could not map supplied values to definitions for report {0}. complaints: {1}",
                                                             repDefn.DisplayName, string.Join(", ", mapResult.Complaints.ToArray())));
            }
            var conv = new CrcParameterConverter();
            List <ParameterValue> valueList = conv.GetParametersValuesForSsrsWebService(repDefn);
            // get new params from web service
            ReportingService2010Soap rService = m_ssrsSoapClientFactory.MakeSsrsSoapClient();

            logger.DebugFormat("RefreshDependantParameters: rep {0} calling WS to get new validvalid. Passing {1} values", repDefn.DisplayName, valueList.Count());

            var grpRequest  = new GetItemParametersRequest(new TrustedUserHeader(), repDefn.ReportPath, null, true, valueList.ToArray(), null);
            var grpResponse = rService.GetItemParameters(grpRequest);

            // work out which params to refresh
            List <string> paramsToRefresh = new List <string>();

            foreach (string updatedParam in newChoices.ParameterChoiceList.Select(p => p.Name))
            {
                var paramDefn = repDefn.ParameterDefinitions.First(p => p.Name == updatedParam);
                paramsToRefresh = paramsToRefresh.Union(paramDefn.DependantParameterNames).ToList();
            }
            logger.DebugFormat("RefreshDependantParameters: rep {0} based on choices, have {1} parameters that need refreshing", repDefn.DisplayName, paramsToRefresh.Count());

            var refresher = new CrcParameterRefresher();

            foreach (string paramLoop in paramsToRefresh)
            {
                var paramDefn          = repDefn.ParameterDefinitions.First(p => p.Name == paramLoop);
                var latestParamDetails = grpResponse.Parameters.FirstOrDefault(p => p.Name == paramLoop);
                if (latestParamDetails == null)
                {
                    throw new ApplicationException(String.Format("Was expecting web service to return new details for parameter {0} but none found",
                                                                 paramLoop));
                }
                refresher.RefreshParameter(paramDefn, latestParamDetails);
            }
        }
Ejemplo n.º 7
0
        public CrcReportFolder Create(ReportingService2010Soap rService, string path)
        {
            var ret = new CrcReportFolder();

            ret.Path       = path;
            ret.FolderName = CrcReportDefinition.ReportNameFromPath(path);


            var lcRequest = new ListChildrenRequest(new TrustedUserHeader(), path, false);


            var lcResponse = rService.ListChildren(lcRequest);

            foreach (CatalogItem itemLoop in lcResponse.CatalogItems)
            {
                if (itemLoop.TypeName != null && itemLoop.TypeName.Equals(ReportServiceItemTypes.Folder))
                {
                    var sf = Create(rService, itemLoop.Path);
                    if (sf.Reports.Count() > 0 || sf.SubFolders.Count() > 0)
                    {
                        ret.SubFolders.Add(sf);
                    }
                }
                else if (itemLoop.TypeName != null && itemLoop.TypeName.Equals(ReportServiceItemTypes.Report))
                {
                    if (!itemLoop.Hidden)
                    {
                        var repItem = new CrcReportItem();
                        repItem.ReportPath  = itemLoop.Path;
                        repItem.DisplayName = itemLoop.Name;
                        repItem.Description = itemLoop.Description;
                        ret.Reports.Add(repItem);
                    }
                }
            }
            return(ret);
        }
Ejemplo n.º 8
0
 public CrcReportFolder Create(ReportingService2010Soap rService)
 {
     return(Create(rService, @"/"));
 }