コード例 #1
0
        static void CreateAllOutputFiles(ReportLogger reportLogger)
        {
            List <ConfigOPFile> internationalOfferLoaderFiles = new List <ConfigOPFile>();

            reportLogger.StartLog("Load Files to process");
            internationalOfferLoaderFiles = Get.GetInternationalOfferLoaderFiles();
            reportLogger.EndLog("Files Loaded");

            reportLogger.StartLog("Processing International OfferLoader Files");
            try
            {
                foreach (ConfigOPFile configOpFile in internationalOfferLoaderFiles)
                {
                    if (configOpFile.Template.Trim() == "Long")
                    {
                        ProcessLongOutput(configOpFile.FileName, reportLogger);
                    }
                    else if (configOpFile.Template.Trim() == "Detail")
                    {
                        ProcessDetailOutput(configOpFile.FileName, reportLogger);
                    }
                    else if (configOpFile.Template.Trim() == "Short")
                    {
                        ProcessShortOutput(configOpFile.FileName, reportLogger);
                    }
                }
                reportLogger.EndLog("End of International OfferLoader Files");
            }
            catch (Exception e)
            {
                reportLogger.EndLog(e);
            }
        }
コード例 #2
0
        public static void ImportRunFtp()
        {
            ReportLogger importRunFtpLogger = new ReportLogger("ImportRunFtpLogger");

            importRunFtpLogger.StartLog("Start of Run");

            try
            {
                SaveCriteria(importRunFtpLogger);
                UpdateIncludeTable(importRunFtpLogger);
                LoadFlightCostCache(importRunFtpLogger);
                LoadPropertyPriceCache(importRunFtpLogger);
                CreateAllOutputFiles(importRunFtpLogger);
                SendEmails("Dear All, the InternationalOfferLoader has successfully completed an import and load run for");
                importRunFtpLogger.EndLog();
            }
            catch (Exception e)
            {
                importRunFtpLogger.EndLog(e);
            }
        }
コード例 #3
0
        internal static void CheckQueItems()
        {
            List <string> queItems = CoreDataLibrary.Data.Get.GetQueItems();

            Parallel.ForEach(queItems, currentExportItem =>
            {
                ReportLogger reportLogger = new ReportLogger(currentExportItem);
                try
                {
                    ExportItem exportItem = Get.GetExportItem(currentExportItem);
                    reportLogger          = new ReportLogger(exportItem.ExportItemName);
                    reportLogger.StartLog("Exporting : " + exportItem.ExportItemName);
                    exportItem.Export(reportLogger);
                    reportLogger.EndLog(exportItem.ExportItemName + " : Exported");
                }
                catch (Exception e)
                {
                    reportLogger.EndLog(e);
                    Emailer.SendEmail("*****@*****.**", "CoreDataReportService", "MainProcess->Run", e);
                }
            });
        }
        public override bool Run()
        {
            if (DueToRun())
            {
                ReportLogger.AddMessage("Trello", "Passed Due To Run.");
                ReportLogger reportLogger = new ReportLogger(Name);
                int          stepId       = reportLogger.AddStep();
                try
                {
                    ReportLogger.AddMessage("Trello", "Running");
                    List <TrelloList> lists = GetLists(key, token);
                    //Returns list of ids etc in correct order as per on screen
                    ReportLogger.AddMessage("Trello", "GetList");

                    Dictionary <string, string> contacts = Get.Contacts();

                    foreach (KeyValuePair <string, string> contact in contacts)
                    {
                        string message = Emailer.EmailContent(lists, contact.Value);

                        Emailer.SendEmail(contact.Key,
                                          "LCTG - Daily Business Priorities", message, false,
                                          "*****@*****.**");
                        ReportLogger.AddMessage("Trello", "Email sent.");
                    }
                    reportLogger.EndStep(stepId);
                    ReportLogger.AddMessage("Trello", "Completed");
                }
                catch (Exception ex)
                {
                    reportLogger.EndStep(stepId, ex);
                    return(false);
                }
                reportLogger.EndLog();
                return(true);
            }
            return(false);
        }
コード例 #5
0
        public static void Run()
        {
            if (!CoreDataLib.IsLive())
            {
                List <ExportItem> runList = Get.GetAllRunItems();
                foreach (ExportItem exportItem in runList)
                {
                    ReportLogger reportLogger = new ReportLogger(exportItem.ExportItemName);
                    try
                    {
                        //exportItem.Export(reportLogger);
                        if (exportItem.ExportItemName == "LCH_FullStock_HotelOnly_HC_ENG")
                        {
                            exportItem.Export(reportLogger);
                            //LchFullStockImagesEngTsmExportItem expItem = new LchFullStockImagesEngTsmExportItem(exportItem);
                            //expItem.Export(reportLogger);
                        }
                        //exportItem.Export(reportLogger);
                        //if (exportItem.ExportItemName.Contains("LCH_FullStock_HotelOnly_ENG_100R"))
                        //{
                        //    exportItem.Export(reportLogger);
                        //}
                        reportLogger.EndLog();
                    }
                    catch (Exception e)
                    {
                        reportLogger.EndLog(e);
                    }
                }
                //Parallel.ForEach(runList, currentExportItem =>
                //{
                //    ReportLogger reportLogger = new ReportLogger(currentExportItem.ExportItemName);
                //    try
                //    {
                //        reportLogger.StartLog(currentExportItem.ExportItemName);
                //        currentExportItem.Export(reportLogger);
                //        reportLogger.EndLog();
                //    }
                //    catch (Exception e)
                //    {
                //        reportLogger.EndLog(e);
                //        Emailer.SendEmail("*****@*****.**", "CoreDataReportService", "MainProcess->Run", e);
                //    }
                //});
            }
            else
            {
                List <ExportItem> runList = Get.GetRunItems(DateTime.Now.Hour);

                Parallel.ForEach(runList, currentExportItem =>
                {
                    ReportLogger reportLogger = new ReportLogger(currentExportItem.ExportItemName);
                    try
                    {
                        reportLogger.StartLog(currentExportItem.ExportItemName);
                        currentExportItem.Export(reportLogger);
                        reportLogger.EndLog();
                    }
                    catch (Exception e)
                    {
                        reportLogger.EndLog(e);
                        Emailer.SendEmail("*****@*****.**", "CoreDataReportService", "MainProcess->Run", e);
                    }
                });
            }
        }