Beispiel #1
0
        public static void RunPropertyExportFileNow(string name)
        {
            ReportLogger reportLogger = null;

            try
            {
                ExportItem exportItem = Get.GetExportItem(name);
                reportLogger = new ReportLogger(exportItem.ExportItemName);
                reportLogger.StartLog("Exporting : " + exportItem.ExportItemName);
                exportItem.Export(reportLogger);
                reportLogger.EndLog(exportItem.ExportItemName + " : Exported");
            }
            catch (Exception exception)
            {
                if (reportLogger != null)
                {
                    reportLogger.EndLog(exception);
                }
            }
        }
Beispiel #2
0
        public static void FtpFile(FileInfo fileToFtp, string ftpTarget)
        {
            ReportLogger ftpFileReportLogger = new ReportLogger("FtpFile");

            int stepId = ftpFileReportLogger.AddStep();

            try
            {
                //ftpUploadUri = "ftp://ftp.lowcosttravelgroup.com/BusinessRules/";
                FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpTarget + fileToFtp.Name);

                request.Method = WebRequestMethods.Ftp.UploadFile;

                request.Credentials = new NetworkCredential("XTGtravelgate", "LcH3rdparty");
                request.Timeout     = 60 * 10000;

                FileStream fileStream = new FileStream(fileToFtp.FullName, FileMode.Open, FileAccess.Read);

                Stream requestStream = request.GetRequestStream();
                byte[] buffer        = new byte[8092];
                int    read          = 0;
                while ((read = fileStream.Read(buffer, 0, buffer.Length)) != 0)
                {
                    requestStream.Write(buffer, 0, read);
                }

                requestStream.Flush();

                requestStream.Close();
                fileStream.Close();
                ftpFileReportLogger.EndStep(stepId);
            }
            catch (Exception e)
            {
                ftpFileReportLogger.EndStep(stepId, e);
            }
            ftpFileReportLogger.EndLog();
        }