clsImportDocument Class |
For Dimension code DataClassID refer to eCoreDataClassID.
Use MPInterface.bImportDocument(clsImportBaseeCoreDataClassID, String, clsImportDocumenteDocumentType, clsImportDocumenteLinkType, String, String, DateTime, String, String) to import.Namespace: MARIInterface
The clsImportDocument type exposes the following members.
| Name | Description | |
|---|---|---|
| clsImportDocument | Initializes a new instance of the clsImportDocument class |
| Name | Description | |
|---|---|---|
| ByteData | To upload a file as a byte array without physical file path | |
| ByteDataMIMEType | The mime type will be set automatically, by extension from FileNameAndPath. Please set this field, when data is delivered as byte array in ByteData.
| |
| DataClassID |
Type of the data (internal ClassID) See clsImportBase.eCoreDataClassID. Not for all dimensions document can be linked. See Folder definition in the settings of MARIProejct.
| |
| DataKey |
Key of the data (Projectnumber,ContractID etc.)
| |
| DateTime | (readonly) Date of primary creation | |
| DMSDocumentID | DMSDocumentID Internal Key in the DMS System | |
| DocumentID | (readonly) Internal Document of the picture or document in the Sub Tables | |
| DocumentType |
Picture or document: eDocumentType.
| |
| FileNameAndPath |
Path of the file, where MARIIntercace can directly access the source file.
| |
| FolderID |
FolderId of the folder definition for the given dimension DataClassID . SELECT GroupID FROM MARIFolderDocumentsGroups
This property can be used instead of the property FolderName | |
| FolderName |
FolderName in the dimension. If no Folder Name given, the first tab in the folders is used. SELECT [Description] AS FolderName, ClassID, GroupID FROM MARIFolderDocumentsGroups
This property can be used instead of the property FolderID | |
| LinkToUploadedDocument | ID of the existing document: Load as reference to the access ID. In Memory, the real ID from the table will be used. | |
| LinkType |
Mandatory selection for the file handling: eLinkType | |
| Memo | Memo of the document. Also Text for the Note variant | |
| Title |
Title of the document
|
Store the Folder Names (tabs) by dimension. View: MARIFolderDocumentsGroups: :Table: MPSammelmappeGruppen
Locical Link between a master data and a document: View: MARIFolderDocuments: :Table: MPSammelmappe
Store binary data in the database for files: View: MARIDocuments: :Table: MPDokumente
Store binary data for images: View: MARIPictures: :Table: MPBilder
/// <summary> /// Example to upload a file into the file mechanism and attach it to a dimension /// </summary> /// <param name="sFileName">Full file+path name</param> /// <param name="sDocTitle">Text in the list of files</param> /// <param name="nClassID">Dimension 40=project</param> /// <param name="sClassKey">Project number or employee number...</param> /// <param name="sFolderName">The folder mechanism has folders for each dimension. The correct folder is found by its name</param> /// <returns></returns> private int bImportFileToDatabase(string sFileName, string sDocTitle, clsImportBase.eCoreDataClassID nClassID, string sClassKey, string sFolderName) { string sErrordetails; try { //The import tool has to have access to the file System.IO.FileInfo fi = new System.IO.FileInfo(sFileName); if (fi.Exists) { clsImportDocument NewDocument = new clsImportDocument(); NewDocument.DocumentType = clsImportDocument.eDocumentType.Document; // or Picture NewDocument.DateTime = fi.LastAccessTime; NewDocument.DataClassID = nClassID; NewDocument.FileNameAndPath = sFileName; NewDocument.LinkType = clsImportDocument.eLinkType.UploadDocument; NewDocument.Title = sDocTitle; NewDocument.DataKey = sClassKey; NewDocument.FolderName = sFolderName; if (MPInterface.bImportDocument(NewDocument, clsImportBase.eImportMode.ValidateAndImport)) { return NewDocument.DocumentID; // ID in MARIPictures/MARIDocuments } else { throw new NotImplementedException(MPInterface.sPrintErrors()); } } } catch (Exception ex) { sErrordetails = ex.Message; Assert.False(true, sErrordetails); } return 0; }
/// <summary> /// Link a filed already uploaded to another location. Serveral links, but only one file in the database. /// </summary> /// <param name="lFileID"></param> /// <param name="sFileName"></param> /// <param name="sDocTitle"></param> /// <param name="nClassID"></param> /// <param name="sClassKey"></param> /// <param name="sFolderName"></param> /// <returns></returns> private bool bLinkExistingFileToObject(int lFileID, string sFileName, string sDocTitle, clsImportBase.eCoreDataClassID nClassID, string sClassKey, string sFolderName) { try { //The import tool has to have access to the file System.IO.FileInfo fi = new System.IO.FileInfo(sFileName); if (fi.Exists) { clsImportDocument NewDocument = new clsImportDocument(); NewDocument.DocumentType = clsImportDocument.eDocumentType.Document; // or Picture NewDocument.DateTime = fi.LastAccessTime; NewDocument.DataClassID = nClassID; NewDocument.FileNameAndPath = sFileName; NewDocument.LinkType = clsImportDocument.eLinkType.LinkToUploadedDocument; NewDocument.LinkToUploadedDocument = lFileID; NewDocument.Title = sDocTitle; NewDocument.DataKey = sClassKey; NewDocument.FolderName = sFolderName; if (MPInterface.bImportDocument(NewDocument, clsImportBase.eImportMode.ValidateAndImport)) { return true; } else { throw new NotImplementedException(MPInterface.sPrintErrors()); } } } catch (Exception) { throw; } return false; }
private bool bAddNoteToFolder(string sNoteContent, string sNoteTitle, clsImportBase.eCoreDataClassID nClassID, string sClassKey) { clsImportDocument NewDocument = new clsImportDocument(); NewDocument.DocumentType = clsImportDocument.eDocumentType.Document; // This property is not relevant for a note NewDocument.DateTime = DateTime.Now; NewDocument.DataClassID = nClassID; NewDocument.LinkType = clsImportDocument.eLinkType.Notice; // Link Type for a note NewDocument.Title = sNoteTitle; NewDocument.DataKey = sClassKey; NewDocument.Memo = sNoteContent; if (MPInterface.bImportDocument(NewDocument, clsImportBase.eImportMode.ValidateAndImport)) { return true; } else { throw new NotImplementedException(MPInterface.sPrintErrors()); } }