Exemple #1
0
 public void ModifyDocument(EditDescription editDescription, Func <SrmDocument, SrmDocument> action, Func <SrmDocumentPair, AuditLogEntry> logFunc = null)
 {
     if (_batchChangesOriginalDocument == null)
     {
         if (SkylineWindow != null)
         {
             SkylineWindow.ModifyDocument(editDescription.GetUndoText(DataSchemaLocalizer), action,
                                          logFunc ?? (docPair => AuditLogEntry.CreateSimpleEntry(MessageType.set_to_in_document_grid, docPair.NewDocumentType,
                                                                                                 editDescription.AuditLogParseString, editDescription.ElementRefName, CellValueToString(editDescription.Value))));
         }
         else
         {
             var doc = _documentContainer.Document;
             if (!_documentContainer.SetDocument(action(doc), doc))
             {
                 throw new InvalidOperationException(Resources
                                                     .SkylineDataSchema_VerifyDocumentCurrent_The_document_was_modified_in_the_middle_of_the_operation_);
             }
         }
         return;
     }
     VerifyDocumentCurrent(_batchChangesOriginalDocument, _documentContainer.Document);
     _batchEditDescriptions.Add(editDescription);
     _document = action(_document.BeginDeferSettingsChanges());
 }
Exemple #2
0
 public void ModifyDocument(EditDescription editDescription, Func <SrmDocument, SrmDocument> action)
 {
     if (_batchChangesOriginalDocument == null)
     {
         SkylineWindow.ModifyDocument(editDescription.GetUndoText(DataSchemaLocalizer), action);
         return;
     }
     VerifyDocumentCurrent(_batchChangesOriginalDocument, _documentContainer.Document);
     _document = action(_document.BeginDeferSettingsChanges());
 }
Exemple #3
0
 public void ModifyDocument(EditDescription editDescription, Func <SrmDocument, SrmDocument> action, Func <SrmDocumentPair, AuditLogEntry> logFunc = null)
 {
     if (_batchChangesOriginalDocument == null)
     {
         SkylineWindow.ModifyDocument(editDescription.GetUndoText(DataSchemaLocalizer), action,
                                      logFunc ?? (docPair => AuditLogEntry.CreateSimpleEntry(docPair.OldDoc, MessageType.set_to_in_document_grid,
                                                                                             editDescription.ColumnCaption.GetCaption(DataSchemaLocalizer), editDescription.ElementRefName, CellValueToString(editDescription.Value))));
         return;
     }
     VerifyDocumentCurrent(_batchChangesOriginalDocument, _documentContainer.Document);
     _batchEditDescriptions.Add(editDescription);
     _document = action(_document.BeginDeferSettingsChanges());
 }
Exemple #4
0
 public void ModifyDocument(EditDescription editDescription, Func <SrmDocument, SrmDocument> action, Func <SrmDocumentPair, AuditLogEntry> logFunc = null)
 {
     if (_batchChangesOriginalDocument == null)
     {
         if (SkylineWindow != null)
         {
             SkylineWindow.ModifyDocument(editDescription.GetUndoText(DataSchemaLocalizer), action,
                                          logFunc ?? (docPair => LogEntryFromEditDescription(editDescription, docPair)));
         }
         else
         {
             var doc = _documentContainer.Document;
             if (!_documentContainer.SetDocument(action(doc), doc))
             {
                 throw new InvalidOperationException(Resources
                                                     .SkylineDataSchema_VerifyDocumentCurrent_The_document_was_modified_in_the_middle_of_the_operation_);
             }
         }
         return;
     }
     VerifyDocumentCurrent(_batchChangesOriginalDocument, _documentContainer.Document);
     _batchEditDescriptions.Add(editDescription);
     _document = action(_document.BeginDeferSettingsChanges());
 }