Esempio n. 1
0
        public ActionResult DailyInvoicingRefresh(string paramOne)
        {
            DateTime refDate = new DateTime();

            if (paramOne.Length > 5 && DateTime.TryParse(paramOne, out refDate))
            {
                refDate = DateTime.ParseExact(paramOne, "MM-dd-yyyy",
                                              CultureInfo.InvariantCulture);
            }

            ArchivesChecker.ProcessEmailsForArchive();
            ArchivesChecker.PopulateOrdersByInvoiceDate(refDate);
            ArchivesChecker.CheckPendingOrders();
            return(RedirectToAction("DailyInvoicing"));
        }
Esempio n. 2
0
        public static int _SyncBuffer  = 5; // How much time post-sync to toggle _syncReady? (_SyncHour + _SyncBuffer must be <= 23 -- 24 hours)

        public static void MinutelyTaskChecker()
        {
            if (_SyncReady && DateTime.Now.Hour == Convert.ToInt32(Settings.GetSettingsValue("EmailSyncHour", "1")) && Settings.GetSettingsValue("EmailSyncOn", "0") == "1")
            {
                Log.Append("***Scheduled synchronizations and updates started***");
                _SyncReady = false;
                PSTImporter.SyncPSTFiles();
                Global.GetAllEmails();
            }
            else if (!_SyncReady && DateTime.Now.Hour == Convert.ToInt32(Settings.GetSettingsValue("EmailSyncHour", "1")) + _SyncBuffer)
            {
                _SyncReady = true;
            }

            // Archive check every 30 minutes
            if (Environment.MachineName.Contains("EXCOTRACK3") && DateTime.Now.Minute % 30 == 0)
            {
                Log.Append("Checking Pending Invoices to generate");

                // Pull archival data from emails
                ArchivesChecker.ProcessEmailsForArchive();
                // Update orders pending
                ArchivesChecker.CheckPendingOrders();
            }

            // Archive check every 5 minutes
            if (DateTime.Now.Minute % 5 == 0)
            {
                ArchivesChecker.ProcessCacheFiles();
            }

            // Refresh archives every 10 minutes on a separate thread
            if (DateTime.Now.Minute % 10 == 0)
            {
                // Refresh archives
                ArchivesChecker.GetEntireArchive();
            }
        }