protected void OnButtonViewDocumentClicked(object sender, EventArgs e) { ITdiTab mytab = DialogHelper.FindParentTab(this); if (mytab == null) { return; } CounterpartyDocumentNode selectedPrintableDocuments = (ytreeDocuments.GetSelectedObject() as CounterpartyDocumentNode); if (selectedPrintableDocuments.Document is CounterpartyContract) { int contractID = (selectedPrintableDocuments.Document as CounterpartyContract).Id; ITdiDialog dlg = new CounterpartyContractDlg(contractID); mytab.TabParent.AddTab(dlg, mytab); } if (selectedPrintableDocuments.Document is OrderDocument) { var rdlDoc = (selectedPrintableDocuments.Document as IPrintableRDLDocument); if (rdlDoc != null) { mytab.TabParent.AddTab(DocumentPrinter.GetPreviewTab(rdlDoc), mytab); } } }
private void LoadData() { CounterpartyContract contractAlias = null; //получаем список контрактов var contracts = UoW.Session.QueryOver <CounterpartyContract>(() => contractAlias) .Where(() => contractAlias.Counterparty.Id == Counterparty.Id) .List(); foreach (var contract in contracts) { CounterpartyDocumentNode contractNode = new CounterpartyDocumentNode(); contractNode.Document = contract; contractNode.Documents = new List <CounterpartyDocumentNode>(); CounterpartyDocs.Add(contractNode); } ytreeDocuments.YTreeModel = new RecursiveTreeModel <CounterpartyDocumentNode>(CounterpartyDocs, x => x.Parent, x => x.Documents); }
void Selection_Changed(object sender, EventArgs e) { CounterpartyDocumentNode selectedDocument = (ytreeDocuments.GetSelectedObject() as CounterpartyDocumentNode); buttonViewDocument.Sensitive = selectedDocument != null; }