Ejemplo n.º 1
0
        static void TestParse()
        {
            PlanSchedule sch = new PlanSchedule
            {
                Url         = @"http://*****:*****@"c:\",
                Format      = "Excel",
                WaitEnd     = true,
                Reports     = new Report[] {
                    new Report {
                        Id      = "4767",
                        Name    = "Report A",
                        Cuid    = "AAAAAAAAAAAAAAAAAAAé",
                        Type    = "Webi",
                        Prompts = new Prompt[] {
                            new Prompt {
                                Name = "Begin Date", Value = "01/01/2009"
                            },
                            new Prompt {
                                Name = "End Date", Value = "01/02/2009"
                            }
                        }
                    }
                }
            };

            sch.ParseToXml(@"c:\out2.xml");
            PlanSchedule reports2 = PlanSchedule.ParseFromXml(@"c:\out2.xml");
        }
Ejemplo n.º 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(); }
 }