public List<String> GetHeaders(string report, string parameters, string winSCPPath,
                                       string rslFilePath, string windowsOutput, WinSCPSession winSCP)
        {
            List<String> headerList = null;

            String windowsOutputPath = windowsOutput + @"GFT_DiffTool_Output\headers\";
            String rslReport = Path.GetFileNameWithoutExtension(report);
            String reportHeaderFileName = rslReport + "-headers.txt";

            if (File.Exists(windowsOutputPath + reportHeaderFileName))
            {
                headerList = new List<string>();
                string line;

                try
                {
                    using (var reader = File.OpenText(windowsOutputPath + reportHeaderFileName))
                    {
                        headerList = new List<String>();
                        while ((line = reader.ReadLine()) != null) { headerList.Add(line); }
                    }
                }
                catch (Exception e)
                {
                    throw new Exception(String.Format("Could not open file: {0}\n\n{1}", windowsOutputPath + reportHeaderFileName, e.Message));
                }
            }
            else
            {
                if (_soapService == null || String.IsNullOrEmpty(_sessionID))
                    throw new Exception("You must start the SOAP Service session before running a report.");

                string serverFileName;

                try
                {
                    serverFileName = _soapService.RunCallableRunrepRunReportFormatted(_sessionID, report, "csv", "csv", parameters);
                }
                catch (Exception e)
                {
                    throw new Exception(String.Format("Error running report: {0}\n\n{1}", report, e.Message));
                }

                string csvDirectory = rslFilePath.Substring(0, rslFilePath.IndexOf("/share/") + 1) + "out/";
                string periodRange = " -ps 01/01/2010:01:02:03 -pe 01/01/2012:01:02:03";
                headerList = winSCP.GetHeaders(winSCPPath, csvDirectory, serverFileName, rslReport, parameters + periodRange, windowsOutputPath);
            }

            return headerList;
        }
示例#2
0
        public List<Column> GetColumns( string reportName,
                                        string hostName,
                                        int soapPort,
                                        int genevaPort,
                                        string unixUserName,
                                        string unixPassword,
                                        string runrepUserName,
                                        string runrepPassword,
                                        string sshHostKeyFingerprint,
                                        string winSCPPath,
                                        string rslFilePath,
                                        string windowsOutput,
                                        string hostPortNo)
        {
            CallableRunrepSession runrep = null;
            WinSCPSession winSCP = null;

            List<String> headers = null;

            try
            {
                string soapURL = "http://" + hostName + ":" + soapPort;
                runrep = new CallableRunrepSession(soapURL, hostName, genevaPort, runrepUserName, runrepPassword, false);

                winSCP = new WinSCPSession(hostName, unixUserName, unixPassword, sshHostKeyFingerprint, hostPortNo);

                headers = runrep.GetHeaders(reportName, "-p " + UnselectedPortfolios[0], winSCPPath, rslFilePath, windowsOutput, winSCP);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                if (runrep != null) runrep.ShutdownSession();
            }

            List<Column> headerList = null;

            if (headers != null)
            {
                int i = 0;
                headerList = headers.Select(name => new Column(i++, name)).ToList();
            }

            return headerList;
        }
        public void RunReports(List<Report> reportList, List<string> portfolioList, string serverType,
                               string version, WinSCPSession winSCP, string winSCPPath, string rslFilePath,
                               string windowsOutput)
        {
            string csvDirectory = rslFilePath.Substring(0, rslFilePath.IndexOf("/share/") + 1) + "out/";

            foreach (Report report in reportList)
            {
                foreach (string portfolio in portfolioList)
                {
                    if (_soapService == null || String.IsNullOrEmpty(_sessionID))
                        throw new Exception("You must start the SOAP Service session before running a report.");

                    OnStartRunningReport(new Tuple<string, string, string>(report.Name, portfolio, serverType), EventArgs.Empty);

                    string serverFileName;
                    try
                    {
                        string reportParameters;
                        if (report.AccountingRunType.Equals("AGA"))
                        {
                            reportParameters = report.Parameters;
                        }
                        else
                        {
                            reportParameters = "-p \"" + portfolio + "\" " + report.Parameters;
                        }
                        serverFileName = _soapService.RunCallableRunrepRunReportFormatted(_sessionID, report.Name, "csv", "csv", reportParameters);
                    }
                    catch (Exception e)
                    {
                        throw new Exception(String.Format("Error running report: {0}\n\n{1}", report, e.Message));
                    }

                    winSCP.DownloadCSV(winSCPPath, csvDirectory, serverType, version, serverFileName, report.Name, portfolio, windowsOutput);

                    OnReportReady(new object(), EventArgs.Empty);
                }
            }
        }
示例#4
0
        public void GetCSVs(string hostName,
                            int soapPort,
                            int genevaPort,
                            string unixUserName,
                            string unixPassword,
                            string runrepUserName,
                            string runrepPassword,
                            string sshHostKeyFingerprint,
                            string winSCPPath,
                            string rslFilePath,
                            string windowsOutput,
                            string serverType,
                            string version,
                            string hostPortNo)
        {
            CallableRunrepSession runrep = null;
            WinSCPSession winSCP = null;

            try
            {
                string soapURL = "http://" + hostName + ":" + soapPort;
                runrep = new CallableRunrepSession(soapURL, hostName, genevaPort, runrepUserName, runrepPassword, false);

                winSCP = new WinSCPSession(hostName, unixUserName, unixPassword, sshHostKeyFingerprint, hostPortNo);

                String windowsOutputPath = windowsOutput + @"GFT_DiffTool_Output\" + DateTime.Today.ToString("yyyy-MM-dd")
                + "-" + version + @"\" + serverType + @"\";

                DirectoryInfo dir = new DirectoryInfo(windowsOutputPath);

                if (dir.Exists) { dir.Delete(true); }

                runrep.StartRunningReport += StartRunningReport;
                runrep.ReportReady += ReportReady;
                runrep.RunReports(SelectedReports, SelectedPortfolios, serverType, version, winSCP,
                                    winSCPPath, rslFilePath, windowsOutput);
                runrep.ReportReady -= ReportReady;
                runrep.StartRunningReport -= StartRunningReport;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                if (runrep != null) runrep.ShutdownSession();
            }
        }
示例#5
0
        public void GetReports( string hostName,
                                string unixUserName,
                                string unixPassword,
                                string sshHostKeyFingerprint,
                                string winSCPPath,
                                string rslFilePath,
                                string windowsOutput,
                                string hostPortNo)
        {
            List<string> rslList = null;

            try
            {
                winSCP = new WinSCPSession(hostName, unixUserName, unixPassword, sshHostKeyFingerprint, hostPortNo);
                rslList = winSCP.GetRSLList(winSCPPath, rslFilePath, windowsOutput);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }

            rslList.Sort();
            if (rslList != null)
            {
                UnselectedReports = rslList.Select(name => new Report(name)).ToList();
            }
        }