コード例 #1
0
        // private constructor
        private TEMPOServerProxy()
        {
            // create the proxies
            _adminServices     = new AdminServices.AdminServices();
            _adminServices.Url = System.Configuration.ConfigurationManager.AppSettings["TEMPO.RequestBroker.AdminServices.AdminServices"];

            _tsServices     = new TSServices.TimeSheetServices();
            _tsServices.Url = System.Configuration.ConfigurationManager.AppSettings["TEMPO.RequestBroker.TSServices.TimeSheetServices"];

            _rsServices             = new ReportingServices.ReportExecutionService();
            _rsServices.Url         = System.Configuration.ConfigurationManager.AppSettings["TEMPO.RequestBroker.ReportingServices.ReportingService"];
            _rsServices.Credentials = new System.Net.NetworkCredential(
                System.Configuration.ConfigurationManager.AppSettings["TEMPO.Authorization.NetworkCredential.RS.UserName"],
                System.Configuration.ConfigurationManager.AppSettings["TEMPO.Authorization.NetworkCredential.RS.Password"],
                System.Configuration.ConfigurationManager.AppSettings["TEMPO.Authorization.NetworkCredential.RS.Domain"]);

            // authorization services
            _authservices     = new TEMPO.Authorization.AuthFramework.AuthorizationServices();
            _authservices.Url = System.Configuration.ConfigurationManager.AppSettings["TEMPO.Authorization.AuthFramework.AuthorizationServices"];

            // Create a new instance of CredentialCache.
            CredentialCache credentialCache = new CredentialCache();

            // Create a new instance of NetworkCredential using the client
            NetworkCredential credentials = new NetworkCredential(Thread.CurrentPrincipal.Identity.Name, ((TEMPOIdentity)Thread.CurrentPrincipal.Identity).Password);

            // Add the NetworkCredential to the CredentialCache for both proxies
            credentialCache.Add(new Uri(_adminServices.Url), "Basic", credentials);
            credentialCache.Add(new Uri(_tsServices.Url), "Basic", credentials);

            // Add the CredentialCache to the proxy class credentials.
            _tsServices.Credentials    = credentialCache;
            _adminServices.Credentials = credentialCache;
        }
コード例 #2
0
ファイル: ReportService.cs プロジェクト: radtek/eSoda
        public byte[] GetReportFromRS(ReportCallContext reportContext, out string mimeType, out string extension)
        {
            reportContext.ReportName = "/eSoda/" + reportContext.ReportName;

            ReportExecutionService ws = new ReportingServices.ReportExecutionService();

            Warning[] warnings;
            string[]  sids;
            string    encoding;

            ws.Credentials = System.Net.CredentialCache.DefaultCredentials;

            ws.Timeout = 1000 * 600;
            //parameters[0] = new ParameterValue();
            //parameters[0].Name = "params";
            //parameters[0].Value = reportContext.ReportParameters.ToString(SaveOptions.DisableFormatting);

            ExecutionInfo   execInfo   = new ExecutionInfo();
            ExecutionHeader execHeader = new ExecutionHeader();

            ws.ExecutionHeaderValue = execHeader;
            byte[] reportContent = null;
            try
            {
                execInfo = ws.LoadReport(reportContext.ReportName, null);
                ws.SetExecutionParameters(reportContext.Parameters, "pl-PL");
                string sessionID = ws.ExecutionHeaderValue.ExecutionID;
                reportContent = ws.Render(reportContext.ReportFormat, null, out extension, out mimeType, out encoding, out warnings, out sids);
            }
            catch (Exception ex)
            {
                mimeType  = null;
                extension = null;
                System.Diagnostics.Trace.WriteLine(ex.Message);
                throw;
            }
            return(reportContent);
        }