Пример #1
0
        public BASEBean findRoot()
        {
            BASEBean root = null;

            if (parentBean == null)
            {
                root = this;
            }
            else
            {
                root = parentBean.findRoot();
            }
            return(root);
        }
 private void SaveDocument(object obj, BASEBean.eDataState dataState)
 {
     if (obj is Document)
     {
         Document document = obj as Document;
         if (cmbDocumentType.SelectedItem != null)
         {
             var type = (DocumentType) cmbDocumentType.SelectedItem;
             if (type != null)
             {
                 document.ContentType = type.contentType;
                 if (type.typeId != null) document.DocumentType = (dbDocument.DocumentType) type.typeId;
             }
         }
         ((Document) obj).DataState = dataState;
         PersistanceController.Save((Document)obj);
     }
 }
 /**
  * Call this method to save the document data to the database.
  */
 private static void SaveInstrumentDescriptionDocument( InstrumentDescription instrumentDescription,
     Document document,
     BASEBean.eDataState dataState)
 {
     var dbDocument = new dbDocument();
     String xml = instrumentDescription.Serialize();
     document.DocumentContent = dbDocument.documentContent = Encoding.UTF8.GetBytes( xml );
     dbDocument.documentSize = xml.Length;
     document.ContentType = dbDocument.contentType = ATMLContext.CONTEXT_TYPE_XML;
     dbDocument.DataState = dataState;
     if (dataState == BASEBean.eDataState.DS_ADD)
         dbDocument.dateAdded = DateTime.UtcNow;
     else if (dataState == BASEBean.eDataState.DS_EDIT)
         dbDocument.dateUpdated = DateTime.UtcNow;
     document.Description = dbDocument.documentDescription = instrumentDescription.Description;
     dbDocument.documentTypeId = (int) dbDocument.DocumentType.INSTRUMENT_DESCRIPTION;
     document.DocumentType = dbDocument.DocumentType.INSTRUMENT_DESCRIPTION;
     document.version = dbDocument.documentVersion = instrumentDescription.version;
     document.name = dbDocument.documentName = instrumentDescription.Identification.ModelName;
     dbDocument.UUID = Guid.Parse( instrumentDescription.uuid );
     document.uuid = instrumentDescription.uuid;
     dbDocument.save();
 }