예제 #1
0
 private void OnElapsedTime(object source, ElapsedEventArgs e)
 {
     //System.Diagnostics.Debugger.Launch();
     //Import Files from Box -- Start
     try
     {
         TraceService("box import triggered @" + DateTime.Now.ToString(), false);
         ImportBoxFiles importbox = new ImportBoxFiles(boxSettings);
         importbox.ImportFiles(basePath);
     }catch (Exception ex)
     {
         TraceService("Error:OnElapsedTime: " + ex.Message, false);
     }
     //Import Files from Box -- End
 }
예제 #2
0
        private void WindowsScheduler_Load(object sender, EventArgs e)
        {
            DialogResult dialogueResult = MessageBox.Show("Do you want to start the scheduler?", "Confirm", MessageBoxButtons.YesNo);

            if (dialogueResult == DialogResult.Yes)
            {
                //Import Files from Box -- Start
                ClientSettingsSection clientSettingsSection = (ClientSettingsSection)ConfigurationManager.GetSection("EBP.BoxSalesReportImport");

                pathTimeFrequency = clientSettingsSection.Settings.Get("TimeFrequency").Value.ValueXml.InnerText;
                pathOfLogFile     = clientSettingsSection.Settings.Get("LogFile").Value.ValueXml.InnerText;
                basePath          = clientSettingsSection.Settings.Get("BasePath").Value.ValueXml.InnerText;

                boxSettings = new BoxSettings
                {
                    ClientID              = clientSettingsSection.Settings.Get("CLIENT_ID").Value.ValueXml.InnerText,
                    ClientSecret          = clientSettingsSection.Settings.Get("CLIENT_SECRET").Value.ValueXml.InnerText,
                    EnterpriceId          = clientSettingsSection.Settings.Get("ENTERPRISE_ID").Value.ValueXml.InnerText,
                    JwtPrivateKeyPassword = clientSettingsSection.Settings.Get("JWT_PRIVATE_KEY_PASSWORD").Value.ValueXml.InnerText,
                    JwtPublicKeyId        = clientSettingsSection.Settings.Get("JWT_PUBLIC_KEY_ID").Value.ValueXml.InnerText,
                    PrivateKey            = clientSettingsSection.Settings.Get("PRIVATE_KEY").Value.ValueXml.InnerText,
                };

                ImportBoxFiles importbox = new ImportBoxFiles(boxSettings);
                importbox.ImportFiles(BasePath);
                //Import Files from Box -- End

                //Import Files from Box -- Start
                ImportFtpFiles importFtp = new ImportFtpFiles();
                importFtp.ImportFiles(basePath);
                //Import Files from Box -- End

                ImportSales();
                var timer = new System.Windows.Forms.Timer();

                timer.Interval = (int)(float.Parse(ConfigurationManager.AppSettings["ImportInterval"]) * 60000);
                timer.Tick    += timer1_Tick;
                timer.Start();
            }

            //Application.Exit();
        }