예제 #1
0
        private void btnScheduler_Click(object sender, EventArgs e)
        {
            btnScheduler.Select();
            panelRight.Controls.Clear();
            FrmSchedule emlpoyeeSchedule = new FrmSchedule(Employee)
            {
                TopLevel = false,
                Dock     = DockStyle.Fill
            };

            emlpoyeeSchedule.Show();
            panelRight.Controls.Add(emlpoyeeSchedule);
        }
예제 #2
0
 private void btSchedule_Click()
 {
     try{
         var activesheet = (Excel.Worksheet)_excelapp.ActiveSheet;
         if (!_parser.checkTablePresent(activesheet))
         {
             return;
         }
         using (var lForm = new FrmSchedule(_excelapp.Hwnd)) {
             lForm.Reports     = _parser.GetReportsList(activesheet.ListObjects[1]);
             lForm.Destination = _settings.GetWorksheetParam("Destination", "");
             lForm.Format      = _settings.GetWorksheetParam("Format", "");
             lForm.NotifEmail  = _settings.GetWorksheetParam("NotifEmail", "");
             if (lForm.ShowDialog() != DialogResult.OK)
             {
                 return;
             }
             var reports = _parser.ParseListObjectToReports(activesheet.ListObjects[1], true);
             if (lForm.Schedule)
             {
                 _settings.SetWorksheetParam("Destination", lForm.Destination);
                 _settings.SetWorksheetParam("Format", lForm.Format);
                 _settings.SetWorksheetParam("NotifEmail", lForm.NotifEmail);
                 var scheduler = new SchedulerManager(_session);
                 var runner    = new FrmRunner(_session.Logger, scheduler.Cancel);
                 var exitcode  = runner.Execute(() =>
                                                scheduler.ScheduleReports(
                                                    ref reports,
                                                    lForm.WithPrompts,
                                                    lForm.Date,
                                                    lForm.Destination,
                                                    lForm.Format,
                                                    lForm.WaitEnd,
                                                    lForm.CleanEnd,
                                                    lForm.NotifEmail
                                                    )
                                                );
                 if (exitcode == ExitCode.FAILED || exitcode == ExitCode.CANCELED)
                 {
                     return;
                 }
                 _parser.UpdateListObjectStatus(activesheet.ListObjects[1], reports);
             }
             else if (lForm.CreateXML)
             {
                 string lFilename = String.Empty;
                 using (SaveFileDialog saveDialog = new SaveFileDialog()) {
                     saveDialog.Filter = "XML FIle|*.xml";
                     saveDialog.Title  = "Save XML File";
                     saveDialog.ShowDialog();
                     lFilename = saveDialog.FileName;
                 }
                 if (lFilename != String.Empty)
                 {
                     try {
                         Application.UseWaitCursor = true;
                         PlanSchedule schedulerplan = new PlanSchedule {
                             Credentials = this._session.Credentials,
                             WithPrompts = lForm.WithPrompts,
                             Destination = lForm.Destination,
                             Format      = lForm.Format,
                             WaitEnd     = lForm.WaitEnd,
                             CleanEnd    = lForm.CleanEnd,
                             NotifEmail  = lForm.NotifEmail,
                             Reports     = reports
                         };
                         schedulerplan.ParseToXml(lFilename);
                         MsgBox.Show("Command line :", "\"" + Func.GetRunnerPath() + "\" \"" + lFilename + "\" \"" + lFilename.Replace(".xml", ".log") + "\"");
                     } catch { throw; } finally {
                         Application.UseWaitCursor = false;
                     }
                 }
             }
         }
     } catch (Exception ex) { new BusinessObjectsUtils.FrmException(_excelapp.Hwnd, ex).ShowDialog(); }
 }