Ejemplo n.º 1
0
 internal override void OnSaveData(CommandInteractionHandler interactionHandler)
 {
     base.SavedResults.Clear();
     using (CommandExecutionContext commandExecutionContext = this.saverExecutionContextFactory.CreateExecutionContext())
     {
         WinFormsCommandInteractionHandler winFormsCommandInteractionHandler = interactionHandler as WinFormsCommandInteractionHandler;
         IUIService service = (winFormsCommandInteractionHandler == null) ? null : winFormsCommandInteractionHandler.UIService;
         commandExecutionContext.Open(service);
         foreach (SaverTaskProfile saverTaskProfile in this.saverTaskProfileList)
         {
             if (base.Cancelled)
             {
                 break;
             }
             if (saverTaskProfile.IsRunnable(base.Row, base.DataObjectStore))
             {
                 saverTaskProfile.BuildParameters(base.Row, base.DataObjectStore);
                 try
                 {
                     saverTaskProfile.Runner.ProgressReport += base.OnProgressReport;
                     commandExecutionContext.Execute(saverTaskProfile, base.Row, base.DataObjectStore);
                 }
                 finally
                 {
                     saverTaskProfile.Runner.ProgressReport -= base.OnProgressReport;
                 }
                 base.SavedResults.AddRange(saverTaskProfile.SavedResults);
                 if (base.BreakOnError && !saverTaskProfile.IgnoreException && !saverTaskProfile.IsSucceeded)
                 {
                     break;
                 }
             }
         }
         if (!base.HasWorkUnits || !base.WorkUnits.HasFailures)
         {
             if (commandExecutionContext.ShouldReload)
             {
                 this.pageToReaderTaskMapping.Reset();
             }
             base.DataObjectStore.ClearModifiedColumns();
         }
     }
 }
Ejemplo n.º 2
0
 internal override void OnReadData(CommandInteractionHandler interactionHandler, string pageName)
 {
     if (this.pageToReaderTaskMapping.IsExecuted(pageName))
     {
         return;
     }
     if (base.Table.Rows.Count == 0)
     {
         base.Table.Rows.Add(base.Table.NewRow());
     }
     else
     {
         base.Table = base.Table.Copy();
     }
     using (CommandExecutionContext commandExecutionContext = this.CreateExecutionContextForReader())
     {
         WinFormsCommandInteractionHandler winFormsCommandInteractionHandler = interactionHandler as WinFormsCommandInteractionHandler;
         IUIService service = (winFormsCommandInteractionHandler == null) ? null : winFormsCommandInteractionHandler.UIService;
         commandExecutionContext.Open(service);
         foreach (ReaderTaskProfile readerTaskProfile in this.readerTaskProfileList)
         {
             if (readerTaskProfile.IsRunnable(base.Row, base.DataObjectStore) && this.pageToReaderTaskMapping.CanTaskExecuted(pageName, readerTaskProfile.Name))
             {
                 readerTaskProfile.BuildParameters(base.Row, base.DataObjectStore);
                 commandExecutionContext.Execute(readerTaskProfile, base.Row, base.DataObjectStore);
                 base.DataObjectStore.UpdateDataObject(readerTaskProfile.DataObjectName, readerTaskProfile.DataObject);
                 base.UpdateTable(base.Row, readerTaskProfile.DataObjectName, true);
             }
         }
     }
     if (this.pageToReaderTaskMapping.Count == 0)
     {
         base.Row.AcceptChanges();
     }
     this.pageToReaderTaskMapping.Execute(pageName);
     base.DataSource = base.Table;
 }