Esempio n. 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);
            }
        }
Esempio n. 2
0
        private void uiCommandManager1_CommandClick(object sender, Janus.Windows.UI.CommandBars.CommandEventArgs e)
        {
            try
            {
                switch (e.Command.Key)
                {
                case "cmdDeleteSuspendedAC":
                    DeleteSuspendedActivity();
                    break;

                case "cmdResume":
                    ResumeActivity();
                    break;

                case "cmdJumpToFile":
                    ACEState aces = ACEStateDictionnary[CurrentRow().ActivityId];
                    fFile    f    = MainForm.OpenFile(aces.FileId);
                    break;

                case "cmdRefresh":
                    LoadData();
                    break;
                }
            }
            catch (Exception x)
            {
                UIHelper.HandleUIException(x);
            }
        }
Esempio n. 3
0
 private void DeleteSuspendedActivity()
 {
     if (CurrentRow() != null)
     {
         if (MessageBox.Show(LawMate.Properties.Resources.AreYouSureYouWantToDeleteThisSuspendedActivity, LawMate.Properties.Resources.DeleteSuspendedActivity, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
         {
             int      pos  = autoSaveGridEX.CurrentRow.Position;
             ACEState aces = ACEStateDictionnary[CurrentRow().ActivityId];
             ACEStateDictionnary.Remove(aces.ActivityId);
             AtMng.DeleteSuspendedAc(aces);
             autoSaveBindingSource.DataSource = null;
             AutoSaveDT.Clear();
             AutoSaveDT.AcceptChanges();
             LoadAutoSaveDT();
             autoSaveBindingSource.DataSource = AutoSaveDT;
             SetRowChangeUI(autoSaveBindingSource.Count == 0);
             if (autoSaveBindingSource.Count != 0)
             {
                 if (autoSaveBindingSource.Count == pos)
                 {
                     autoSaveGridEX.Row = pos - 1;
                 }
                 else
                 {
                     autoSaveGridEX.Row = pos;
                 }
             }
         }
     }
 }
Esempio n. 4
0
        private void ResumeActivity()
        {
            //if (listBox1.SelectedIndex != -1)
            if (CurrentRow() != null)
            {
                if (CurrentRow().HasErrors)
                {
                    pnlCannotResume.Closed = false;
                    throw new LMException(CurrentRow().RowError);
                }
                else
                {
                    //restores aces object
                    ACEState aces = ACEStateDictionnary[CurrentRow().ActivityId];

                    //check for latest on resume
                    if (DocumentIsLatest(aces, CurrentRow()))
                    {
                        Close();
                        //get fm
                        FileManager fm = AtMng.GetFile(aces);

                        fFile f = MainForm.OpenFile(fm.CurrentFile.FileId);
                        f.RestoreWizard(aces);
                    }
                    else if (CurrentRow().HasErrors)
                    {
                        pnlCannotResume.Closed = false;
                        throw new LMException(CurrentRow().RowError);
                    }
                }
            }
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
        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();
        }