private void autoSaveBindingSource_CurrentChanged(object sender, EventArgs e) { try { if (CurrentRow() != null) { ACEState aces = ACEStateDictionnary[CurrentRow().ActivityId]; atriumDB dsA = new atriumDB(); dsA.Merge(ACEState.GetDSFromACE(aces, myFM.GetBEMngrForTable("EFile").MyDS.DataSetName)); docDB dsD = new docDB(); dsD.Merge(ACEState.GetDSFromACE(aces, myFM.GetBEMngrForTable("Document").MyDS.DataSetName)); SetRowChangeUI(false); if (dsA.Activity.FindByActivityId(aces.ActivityId).IsDocIdNull()) { ucDocView1.NoAssociatedDocument(LawMate.Properties.Resources.NoDocument); //ucDoc1.NoAssociatedDocument(LawMate.Properties.Resources.NoDocument); } else { myFM.GetDocMng().isMerging = true; myFM.GetDocMng().DB.Merge(dsD); myFM.GetDocMng().isMerging = false; docDB.DocumentRow dr = myFM.GetDocMng().DB.Document.FindByDocId(dsA.Activity.FindByActivityId(aces.ActivityId).DocId); DataView dvDoc = new DataView(dr.Table, "DocId=" + dr.DocId.ToString(), "", DataViewRowState.CurrentRows); //ucDoc1.Datasource = dvDoc; //ucDoc1.PreviewAsync(); ucDocView1.Datasource = dvDoc; ucDocView1.PreviewAsync(); if (CurrentRow().RowError.Length > 0) { pnlCannotResume.DockStyle = Janus.Windows.UI.Dock.PanelDockStyle.Top; pnlCannotResume.Closed = false; cmdResume.Enabled = Janus.Windows.UI.InheritableBoolean.False; pnlAutoSave.DockStyle = Janus.Windows.UI.Dock.PanelDockStyle.Top; label1.Text = CurrentRow().RowError; } else { pnlCannotResume.Closed = true; pnlCannotResume.DockStyle = Janus.Windows.UI.Dock.PanelDockStyle.Fill; label1.Text = ""; } } } else { SetRowChangeUI(true); } } catch (Exception x) { UIHelper.HandleUIException(x); } }
private bool DocumentIsLatest(ACEState aceState, appDB.AutoSaveRow autoSaveRow) { atriumDB dsA = new atriumDB(); dsA.Merge(ACEState.GetDSFromACE(aceState, myFM.GetBEMngrForTable("EFile").MyDS.DataSetName)); docDB dsD = new docDB(); dsD.Merge(ACEState.GetDSFromACE(aceState, myFM.GetBEMngrForTable("Document").MyDS.DataSetName)); int docid = dsA.Activity.FindByActivityId(aceState.ActivityId).DocId; if (!myFM.GetDocMng().GetDocContent().IsLatest(dsD.DocContent.FindByDocId(docid))) { autoSaveRow.RowError = LawMate.Properties.Resources.DocumentPartOfSuspendedActivityHasBeenModified; return(false); } return(true); }
private void LoadAutoSaveDT() { ACEStateDictionnary = new Dictionary <int, ACEState>(); AutoSaveDT = new appDB.AutoSaveDataTable(); AutoSaveDT.BeginLoadData(); foreach (ACEState itm in AtMng.SuspendedAcs) { //itm.Doc_DB.FileFormat.Merge(myFM.GetDocMng().DB.FileFormat); appDB.AutoSaveRow autoSaveRow = AutoSaveDT.NewAutoSaveRow(); ActivityConfig.ACSeriesRow[] acsr = (ActivityConfig.ACSeriesRow[])AtMng.acMng.DB.ACSeries.Select("acseriesid=" + itm.AcSeriesId); ACEStateDictionnary.Add(itm.ActivityId, itm); if (acsr.Length == 1) { autoSaveRow.StepCode = acsr[0].StepCode; autoSaveRow.ActivityNameEng = acsr[0].ActivityNameEng; } else { autoSaveRow.StepCode = LawMate.Properties.Resources.INVALIDACTIVITY; autoSaveRow.ActivityNameEng = LawMate.Properties.Resources.INVALIDACTIVITY; autoSaveRow.RowError = LawMate.Properties.Resources.CannotResumeThisActivity; } autoSaveRow.ActivityId = itm.ActivityId; atriumDB dsA = new atriumDB(); dsA.Merge(ACEState.GetDSFromACE(itm, myFM.GetBEMngrForTable("EFile").MyDS.DataSetName)); autoSaveRow.SaveDate = dsA.Activity.FindByActivityId(itm.ActivityId).ActivityEntryDate; if (!dsA.Activity.FindByActivityId(itm.ActivityId).IsDocIdNull()) { DocumentIsLatest(itm, autoSaveRow); } atriumDB.EFileRow efr = dsA.EFile.FindByFileId(itm.FileId); if (efr == null) { try { efr = AtMng.GetFile(itm.FileId).CurrentFile; } catch (Exception x) { efr = null; } } if (efr == null) { autoSaveRow.FileName = LawMate.Properties.Resources.DELETEDFILE; autoSaveRow.FullFileNumber = LawMate.Properties.Resources.DELETEDFILE; autoSaveRow.RowError = LawMate.Properties.Resources.CannotResumeThisActivity; } else { autoSaveRow.FileName = efr.NameE; autoSaveRow.FullFileNumber = efr.FullFileNumber; } AutoSaveDT.AddAutoSaveRow(autoSaveRow); } AutoSaveDT.EndLoadData(); }