public void BindDocumentData(lmDatasets.docDB.DocumentDataTable a, bool DocSearchResults, atriumBE.DocManager dm) { myDM = dm; //ucDocPreview1.Init(dm); ucDocView1.Init(dm); //if(!FM.IsVirtualFM) // dm.GetRecipient().LoadByFileId(FM.CurrentFile.FileId); ucRecordList1.Init(myDM); DataView dv = new DataView(a, "", "", DataViewRowState.ModifiedCurrent | DataViewRowState.Unchanged); this.documentBindingSource.DataSource = dv; this.documentBindingSource.DataMember = ""; if (firstTime) { dcceh = new DataColumnChangeEventHandler(a_ColumnChanged); a.ColumnChanged += dcceh; dm.DB.DocContent.ColumnChanged += dcceh; dm.DB.Recipient.ColumnChanged += dcceh; ueh = new atLogic.UpdateEventHandler(ucRecords_OnUpdate); dm.GetDocument().OnUpdate += ueh; dm.GetDocContent().OnUpdate += ueh; dm.GetRecipient().OnUpdate += ueh; } firstTime = false; if (DocSearchResults) { pnlGrid.CaptionVisible = Janus.Windows.UI.InheritableBoolean.False; } ucRecordList1.SearchResult(DocSearchResults); if (documentBindingSource.Current != null) { ApplySecurity(CurrentRow()); } NoData(documentBindingSource.Count == 0); if (documentBindingSource.Count > 0) { timer1.Start(); } }
public override void ApplySecurity(DataRow dr) { if (FileForm() != null && FileForm().ReadOnly) { //ucDocPreview1.ReadOnly(true); ucDocView1.ReadOnly(true); return; } docDB.DocumentRow cbr = (docDB.DocumentRow)dr; if (cbr == null) { return; } //problem here is that doccontent does not load until preview async finsihes //need to implement a canedit that just takes the docid bool canEditDC = myDM.GetDocContent().CanEdit(cbr.DocContentRow); UIHelper.EnableControls(documentBindingSource, myDM.GetDocument().CanEdit(cbr)); UIHelper.EnableCommandBarCommand(tsDelete2, myDM.GetDocument().CanDelete(cbr)); if (cbr.isElectronic) { if (canEditDC) { CheckoutToggle(cbr); cmdRevise.Enabled = Janus.Windows.UI.InheritableBoolean.True; } else { tsCheckout.Enabled = Janus.Windows.UI.InheritableBoolean.False; tsCheckin.Enabled = Janus.Windows.UI.InheritableBoolean.False; tsUndoCheckout.Enabled = Janus.Windows.UI.InheritableBoolean.False; cmdRevise.Enabled = Janus.Windows.UI.InheritableBoolean.False; } } else { tsCheckin.Enabled = Janus.Windows.UI.InheritableBoolean.False; tsCheckout.Enabled = Janus.Windows.UI.InheritableBoolean.False; tsUndoCheckout.Enabled = Janus.Windows.UI.InheritableBoolean.False; cmdRevise.Enabled = Janus.Windows.UI.InheritableBoolean.False; } }