Example #1
0
        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);
            }
        }
Example #2
0
        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);
        }