public DocumentLibrarySelectionForm(List <string> selectedDocumentIds, dbDocument.DocumentType documentType) { InitializeComponent(); cmbDocumentType.DataSource = Enum.GetNames(typeof(dbDocument.DocumentType)); DocumentType = documentType; cmbDocumentType.SelectedIndex = cmbDocumentType.FindStringExact(Enum.GetName(typeof(dbDocument.DocumentType), documentType)); Closing += DocumentLibrarySelectionForm_Closing; Load += DocumentLibrarySelectionForm_Load; documentLibraryListControl.DoubleClick += documentLibraryListControl_DoubleClick; documentLibraryListControl.Items.Clear(); documentLibraryListControl.DefaultDocumentType = documentType; List <Document> documents = DocumentManager.GetDocumentsByType((int)documentType); foreach (Document document in documents) { //--------------------------------------------------------------------------------------// //--- Only add to the Library List if the document is not already selected in a list ---// //--------------------------------------------------------------------------------------// //INFO: This may not work because an instrument may have multiple instances //if (selectedDocumentIds.Find( s => s == document.uuid ) == null) documentLibraryListControl.AddListViewObject(document); } }
private void SelectDocumentType(dbDocument.DocumentType documentType) { foreach (DocumentType type in cmbDocumentType.Items) { if (type.typeId == (int)documentType) { cmbDocumentType.SelectedItem = type; } } }
public static bool IsEditableDocumentType(dbDocument.DocumentType documentType) { bool editable = false; var bean = CacheManager.GetDocumentTypeCache().getItem("" + (int)documentType) as LuDocumentTypeBean; if (bean != null && bean.objectEditable != null) { editable = bean.objectEditable.Value; } return(editable); }
private void cmbDocumentType_SelectedIndexChanged(object sender, EventArgs e) { if (cmbDocumentType.SelectedIndex != -1) { dbDocument.DocumentType documentType = (dbDocument.DocumentType)Enum.Parse(typeof(dbDocument.DocumentType), cmbDocumentType.Text); documentLibraryListControl.Items.Clear(); documentLibraryListControl.DefaultDocumentType = documentType; List <Document> documents = DocumentManager.GetDocumentsByType((int)documentType); foreach (Document document in documents) { //--------------------------------------------------------------------------------------// //--- Only add to the Library List if the document is not already selected in a list ---// //--------------------------------------------------------------------------------------// //INFO: This may not work because an instrument may have multiple instances //if (selectedDocumentIds.Find( s => s == document.uuid ) == null) documentLibraryListControl.AddListViewObject(document); } } }
public DocumentForm(dbDocument.DocumentType documentType) : this() { SelectDocumentType(documentType); }