Exemplo n.º 1
0
        private void uiContextMenu2_Popup(object sender, EventArgs e)
        {
            try
            {
                if (!FileForm().ReadOnly)
                {
                    atriumDB.ActivityBFRow acbf = CurrentRow();
                    if (acbf == null || (activityBFGridEX.HitTest() != Janus.Windows.GridEX.GridArea.Cell && activityBFGridEX.HitTest() != Janus.Windows.GridEX.GridArea.PreviewRow) || InEditMode)
                    {
                        uiContextMenu2.Close();
                        return;
                    }


                    if (acbf.Completed)
                    {
                        cmdCompleteBF.Image = LawMate.Properties.Resources.checkboxFalse;
                        cmdCompleteBF.Text  = LawMate.Properties.Resources.UncompleteBF;
                    }
                    else
                    {
                        cmdCompleteBF.Image = LawMate.Properties.Resources.checkbox;
                        cmdCompleteBF.Text  = LawMate.Properties.Resources.CompleteBF;
                    }
                }
                else
                {
                    uiContextMenu2.Close();
                }
            }
            catch (Exception x)
            {
                UIHelper.HandleUIException(x);
            }
        }
Exemplo n.º 2
0
        public bool IsDirect(atriumDB.ActivityBFRow abr)
        {
            if (abr.IsisMailNull())
            {
                return(false);
            }

            if (abr.isMail)
            {
                return(true);
            }
            if (abr.BFType == 2 || abr.BFType == 8)
            {
                return(true);
            }
            if (abr.BFType == 7)
            {
                if ((!abr.IsRoleCodeNull() && abr.RoleCode.Substring(0, 1) == "F") || myA.AtMng.GetSetting(AppBoolSetting.FileBFRead))
                {
                    return(true);
                }

                if ((!abr.IsRoleCodeNull() && abr.RoleCode.Substring(0, 1) == "G") || myA.AtMng.GetSetting(AppBoolSetting.RoleBFRead))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 3
0
        protected override void BeforeUpdate(DataRow ddr)
        {
            atriumDB.ActivityBFRow dr = (atriumDB.ActivityBFRow)ddr;
            if (dr.ActivityRow != null)
            {
                myA.GetProcess().SetActive(dr.ActivityRow.ProcessRow);
            }

            AllowEdit = true;
            BeforeChange("BFDate", ddr);
            AllowEdit = false;
        }
Exemplo n.º 4
0
 /// <summary>
 /// This method is used to sync bf records between datasets
 /// It only works after the bf has been saved and committed
 /// </summary>
 /// <param name="abfr"></param>
 public void SyncBF(atriumDB.ActivityBFRow abfr, bool forDelete)
 {
     //see if bf is loaded
     atriumDB.ActivityBFRow abfrToSync = DB.ActivityBF.FindByActivityBFId(abfr.ActivityBFId);
     if (abfrToSync != null)
     {
         if (abfrToSync.RowState == DataRowState.Unchanged)
         {
             if (forDelete)
             {
                 abfrToSync.Delete();
                 abfrToSync.AcceptChanges();
             }
             else
             {
                 abfrToSync.EndEdit();
                 abfrToSync.RejectChanges();
                 //if it is sync it
                 GetActivityBF().Load(abfr.ActivityBFId);
             }
         }
     }
     else
     {
         //load it
         atriumDB.ActivityBFRow abr = (atriumDB.ActivityBFRow)GetActivityBF().Load(abfr.ActivityBFId);
         //need to add some tests for role as well
         if (!abr.IsRoleCodeNull() && (myatMng.OfficeMng.GetOfficer().IsInRole(abr.RoleCode) || myatMng.GetFile(abr.FileId).GetFileContact().IsInRole(abr.RoleCode)))
         {
             //ok to keep
         }
         else if (BfListOfficerId != 0 && !abr.IsBFOfficerIDNull() && abr.BFOfficerID == BfListOfficerId)
         {
             //ok to keep
         }
         else
         {
             try
             {
                 abr.Delete();
             }
             catch (Exception x)
             {
                 //do nothing
                 abr.RowError = "";
             }
             abr.AcceptChanges();
         }
     }
 }
Exemplo n.º 5
0
        private void activityBFGridEX_LoadingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
        {
            try
            {
                lmWinHelper.FormatGridRowBFOfficer(e.Row);
                lmWinHelper.FormatGridRowBFDateLoading(e.Row);

                atriumDB.ActivityBFRow abfr = (atriumDB.ActivityBFRow)((DataRowView)e.Row.DataRow).Row;
                e.Row.Cells["StepCode"].Value = abfr.ActivityRow.StepCode;
            }
            catch (Exception x)
            {
                System.Diagnostics.Trace.WriteLine(x.Message);
            }
        }
Exemplo n.º 6
0
        protected override void AfterAdd(DataRow dr)
        {
            atriumDB.ActivityBFRow abf = (atriumDB.ActivityBFRow)dr;
            string ObjectName          = this.myActivityBFDT.TableName;

            abf.ActivityBFId = this.myA.AtMng.PKIDGet(ObjectName, 10);

            abf.FileId = abf.ActivityRow.FileId;
            abf.ACBFId = USERBFID;
            ActivityConfig.ACBFRow acbr = myA.AtMng.acMng.DB.ACBF.FindByACBFId(abf.ACBFId);

            if (!abf.ActivityRow.IsBFPriorityNull())
            {
                abf.Priority = abf.ActivityRow.BFPriority;
            }
            else
            {
                abf.Priority = 0;
            }

            abf.BFType = acbr.BFType;
            switch (abf.BFType)
            {
            case 2:     //Direct
                abf.BFOfficerID = myA.AtMng.WorkingAsOfficer.OfficerId;
                break;

            case 7:     //Role
            case 5:     // Roles
                abf.RoleCode = acbr.RoleCode;
                break;
            }


            // if (abf.IsNull("Completed"))
            abf.Completed = false;

            //if (abf.IsNull("isRead"))
            abf.isRead = false;

            //if (abf.IsBFDateNull())
            abf.BFDate            = DateTime.Today;
            abf.InitialBFDate     = abf.BFDate;
            abf.ManuallyCompleted = false;
            abf.isMail            = acbr.isMail;
            abf.MonitorIncomplete = acbr.MonitorIncomplete;
        }
Exemplo n.º 7
0
        public override void ApplySecurity(DataRow dr)
        {
            if (FileForm() != null && !FileForm().ReadOnly&& dr != null)
            {
                atriumDB.ActivityBFRow ar = (atriumDB.ActivityBFRow)dr;
                if (dr.RowState == DataRowState.Added)
                {
                    ucBFOfficerId.Visible = true;
                    ebBFPerson.Visible    = false;
                    UIHelper.EnableControls(activityBFBindingSource, true);
                }
                else
                {
                    ucBFOfficerId.Visible = false;
                    ebBFPerson.Visible    = true;
                    UIHelper.EnableControls(activityBFBindingSource, FM.GetActivityBF().CanEditBF(ar));
                }

                if (ar.Completed)
                {
                    cmdCompleteBF.Image       = LawMate.Properties.Resources.checkboxFalse;
                    cmdCompleteBF.Text        = LawMate.Properties.Resources.UncompleteBF;
                    cmdCompleteBF.ToolTipText = LawMate.Properties.Resources.UncompleteBF;
                }
                else
                {
                    cmdCompleteBF.Image       = LawMate.Properties.Resources.checkbox;
                    cmdCompleteBF.Text        = LawMate.Properties.Resources.CompleteBF;
                    cmdCompleteBF.ToolTipText = LawMate.Properties.Resources.CompleteBF;
                }

                if (FM.GetActivityBF().CanEditBF(ar))
                {
                    cmdCompleteBF.Enabled = Janus.Windows.UI.InheritableBoolean.True;
                }
                else
                {
                    cmdCompleteBF.Enabled = Janus.Windows.UI.InheritableBoolean.False;
                }
            }

            if (dr == null)
            {
                UIHelper.EnableControls(activityBFBindingSource, false);
            }
        }
Exemplo n.º 8
0
        public override bool CanDelete(DataRow row)
        {
            atriumDB.ActivityBFRow dr = (atriumDB.ActivityBFRow)row;

            if (myA.IsVirtualFM)
            {
                return(true);
            }

            if (dr.ACBFId != USERBFID)
            {
                return(false);
            }
            //if (myA.AtMng.OfficeLoggedOn.OfficeId == dr.ForOfficeId)
            //{ return true; }
            //else

            if (dr.HasVersion(DataRowVersion.Original) && myA.AtMng.WorkingAsOfficer.OfficerId.ToString() == dr["BFOfficerID", DataRowVersion.Original].ToString())
            {
                return(true);
            }
            else if (!dr.HasVersion(DataRowVersion.Original) && myA.AtMng.WorkingAsOfficer.OfficerId.ToString() == dr["BFOfficerID"].ToString())
            {
                return(true);
            }
            else
            {
                //if (dr.HasVersion(DataRowVersion.Original) && !dr.IsNull(dr.Table.Columns[ActivityFields.BFOfficerID],DataRowVersion.Original))
                //{
                //    DataRow odr;
                //    odr = this.myA.AtMng.officeMng.DB.Officer.Select("officerId=" + dr["BFOfficerID",DataRowVersion.Original])[0];
                //    if (odr == null)
                //    {
                //        throw new AtriumException(Resources.ActivityNoDelOtherOffice);
                //    }
                //}
                //else
                //{
                return(false | AllowDelete);
                //}
            }
        }
Exemplo n.º 9
0
        public bool CanEditBF(DataRow ddr)
        {
            atriumDB.ActivityBFRow dr = (atriumDB.ActivityBFRow)ddr;
            if (!myA.IsVirtualFM && dr.FileId != myA.CurrentFile.FileId)
            {
                return(false);
            }
            if (dr.ActivityRow != null && dr.ActivityRow.EFileRow.RowState == DataRowState.Added)
            {
                return(true);
            }

            bool ok = myA.AtMng.SecurityManager.CanUpdate(dr.FileId, atSecurity.SecurityManager.Features.ActivityBF) > atSecurity.SecurityManager.LevelPermissions.No;

            if (!ok)
            {
                return(ok);
            }

            //fixed!!!!
            if (!dr.IsRoleCodeNull())
            {
                if (myA.IsVirtualFM)
                {
                    ok = true;
                }
                else
                {
                    ok = false;
                    if ((myA.AtMng.OfficeMng.GetOfficer().IsInRole(dr.RoleCode) || myA.GetFileContact().IsInRole(dr.RoleCode)))
                    {
                        //ok to keep
                        ok = true;
                    }
                    else
                    {
                        //check buddies
                        foreach (lmDatasets.officeDB.OfficerDelegateRow odr in myA.AtMng.OfficerLoggedOn.GetOfficerDelegateRowsByOfficerWorkAs())
                        {
                            if (odr.AccessLevel == 1 & (myA.AtMng.OfficeMng.GetOfficer().IsInRole(dr.RoleCode, odr.OfficerId) || myA.GetFileContact().IsInRole(dr.RoleCode, odr.OfficerId)))
                            {
                                ok = true;
                            }
                        }
                    }
                }
            }
            else if (!dr.IsBFOfficerIDNull())
            {
                ok = false;

                //ok to keep
                if (dr.BFOfficerID == myA.AtMng.WorkingAsOfficer.OfficerId)
                {
                    ok = true;
                }
                else
                {
                    //check buddies
                    foreach (lmDatasets.officeDB.OfficerDelegateRow odr in myA.AtMng.OfficerLoggedOn.GetOfficerDelegateRowsByOfficerWorkAs())
                    {
                        if (odr.AccessLevel == 1 & odr.OfficerId == dr.BFOfficerID)
                        {
                            ok = true;
                        }
                    }
                }
            }
            else
            {
                ok = false;
            }

            //if they have override permission let them edit
            //override is used to override manual completes as well
            bool canOverride = myA.AtMng.SecurityManager.CanOverride(dr.FileId, atSecurity.SecurityManager.Features.ActivityBF) == atSecurity.SecurityManager.ExPermissions.Yes;

            return(ok | AllowEdit | canOverride);

            //old incomplete code follows
            //kept in case there is a bug above

            //if (myA.AtMng.OfficeLoggedOn.OfficeId == dr.ForOfficeId)
            //{ }
            //else
            if (!dr.IsRoleCodeNull() && (myA.AtMng.OfficeMng.GetOfficer().IsInRole(dr.RoleCode) | myA.GetFileContact().IsInRole(dr.RoleCode)))
            {
            }
            else if (dr.HasVersion(DataRowVersion.Original) && this.myA.AtMng.WorkingAsOfficer.OfficerId.ToString() == dr["BFOfficerID", DataRowVersion.Original].ToString())
            {
            }
            else
            {
                DataColumn dc = dr.Table.Columns["BFOfficerID"];
                if (dr.HasVersion(DataRowVersion.Original) && !dr.IsNull(dc, DataRowVersion.Original))
                {
                    if (this.myA.AtMng.OfficeMng.DB.Officer.FindByOfficerId(dr.BFOfficerID) != null)
                    {
                    }
                    else
                    {
                        ok = false;
                        //this.myA.RaiseError((int)AtriumEnum.AppErrorCodes.CACannotEditAnotherOffice);
                    }
                }
                else
                {
                    ok = false;
                    //this.myA.RaiseError((int)AtriumEnum.AppErrorCodes.CACannotEditAnotherOffice);
                }
            }
            return(ok | AllowEdit);
        }
Exemplo n.º 10
0
 protected override void AfterUpdate(DataRow ddr)
 {
     atriumDB.ActivityBFRow dr  = (atriumDB.ActivityBFRow)ddr;
     ActivityConfig.ACBFRow arc = myA.AtMng.acMng.DB.ACBF.FindByACBFId(dr.ACBFId);
     myA.AtMng.SyncBF(dr, myA.IsVirtualFM, false);
 }
Exemplo n.º 11
0
        protected override void AfterChange(DataColumn dc, DataRow row)
        {
            atriumDB.ActivityBFRow dr = (atriumDB.ActivityBFRow)row;
            switch (dc.ColumnName)
            {
            case ActivityFields.Completed:
                //if (dr.Completed && dr.isMail && dr.isRead == false)
                //JLL: 2018-07-19 removed ismail flag. mark as read whenever it's completed.
                if (dr.Completed && dr.isRead == false)
                {
                    dr.isRead = true;
                }

                if (dr.Completed)
                {
                    dr.CompletedByID = this.myA.AtMng.WorkingAsOfficer.OfficerId;
                    dr.CompletedDate = DateTime.Now;
                }
                else
                {
                    dr.SetCompletedByIDNull();
                    dr.SetCompletedDateNull();
                }

                dr.EndEdit();
                break;

            case "BFType":
                switch (dr.BFType)
                {
                //case 1: //Office BFs
                //    dr.SetBFOfficerIDNull();
                //    dr.SetRoleCodeNull();
                //    dr.ForOfficeId = myA.AtMng.OfficeLoggedOn.OfficeId;
                //    break;

                case 2:         //Direct - wipe out Role; update ForOfficeId to LoggedOnOffice
                    dr.BFOfficerID = myA.AtMng.WorkingAsOfficer.OfficerId;
                    dr.SetRoleCodeNull();
                    //dr.ForOfficeId = myA.AtMng.OfficeLoggedOn.OfficeId;
                    break;

                case 7:         //Roles
                    dr.SetBFOfficerIDNull();
                    dr.SetRoleCodeNull();
                    //dr.ForOfficeId = myA.AtMng.OfficeLoggedOn.OfficeId;
                    break;

                case 8:         //Recipient
                    //JLL: 2009/07/27 Handling of proper diarizing without FILE - e.g. LA09.04
                    if (dr.ActivityRow.IsDocIdNull())
                    {
                        throw new Exception("Workflow is not configured properly.  Please contact an administrator.  \n\nError: Cannot use BF Type Recipient without a document");
                    }
                    else
                    {
                        docDB.DocumentRow docr = myA.GetDocMng().DB.Document.FindByDocId(dr.ActivityRow.DocId);
                        //if (docr.GetRecipientRows().Length == 0)
                        //    myA.GetDocMng().GetRecipient().LoadByDocId(docr.DocId);
                        bool notfound = true;
                        foreach (docDB.RecipientRow rr in docr.GetRecipientRows())
                        {
                            if (rr.Type == "1")
                            {
                                if (!rr.IsOfficerIdNull())
                                {
                                    dr.BFOfficerID = rr.OfficerId;
                                    notfound       = false;
                                }
                            }
                        }
                        if (notfound)
                        {
                            throw new Exception("Workflow is not configured properly.  Please contact an administrator.  \n\nError: Cannot use BF Type Recipient without an officer as the document \"To\" recipient");
                        }
                    }
                    break;
                }
                break;
            }
        }
Exemplo n.º 12
0
        protected override void BeforeChange(DataColumn dc, DataRow ddr)
        {
            atriumDB.ActivityBFRow dr = (atriumDB.ActivityBFRow)ddr;
            switch (dc.ColumnName)
            {
            case "Completed":
            case "Priority":
            case "isRead":
            case "BFComment":
            case "BFDate":
                if (dr.RowState != DataRowState.Added && !CanEditBF(dr))
                {
                    throw new ReadOnlyException();
                }
                break;
            }

            switch (dc.ColumnName)
            {
            case "ManuallyCompleted":
                //only allow manual completion for user and mail bfs that are marked as allow manual complete
                ActivityConfig.ACBFRow neml = (ActivityConfig.ACBFRow)myA.AtMng.acMng.DB.ACBF.FindByACBFId(dr.ACBFId);
                if (neml.AllowManualComplete)
                {     //ok
                }
                else
                {
                    //   if(dr.ManuallyCompleted)
                    bool canOverride = myA.AtMng.SecurityManager.CanOverride(dr.FileId, atSecurity.SecurityManager.Features.ActivityBF) == atSecurity.SecurityManager.ExPermissions.Yes;
                    if (!canOverride)
                    {
                        throw new AtriumException("You cannot manually complete this type of BF.");
                    }
                }

                break;

            case "BFType":
                if (dr.IsBFTypeNull())
                {
                    throw new RequiredException(dc.ColumnName);
                }
                else if (!myA.CheckDomain(dr.BFType, myA.Codes("BFType")))
                {
                    throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, "BF Type", "Activity BF", "BF Type");
                }
                break;

            case "ACBFId":
                if (!myA.CheckDomain(dr.ACBFId, myA.AtMng.acMng.DB.ACBF))
                {
                    throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "ACBF");
                }
                break;

            case "ForOfficeId":
                if (!myA.CheckDomain(dr.ForOfficeId, myA.Codes("OfficeList")))
                {
                    throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Office List");
                }
                break;

            case ActivityFields.BFOfficerID:
                if (!dr.IsBFOfficerIDNull())
                {
                    if (!myA.CheckDomain(dr.BFOfficerID, myA.Codes("OfficerList")))
                    {
                        throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Officer List");
                    }
                }
                break;

            //case ActivityBFFields.ForOfficeId:
            //    if (!myA.AtMng.GetOffice(dr.ForOfficeId).CurrentOffice.IsOnLine)
            //        throw new AtriumException(Resources.ActivityBFCannotBeCreatedForAnOffLineOffice);
            //    break;
            case ActivityFields.BFDate:
                if (dr.IsBFDateNull())
                {
                    throw new RequiredException(ActivityFields.BFDate);
                }
                if (!dr.IsBFDateNull())
                {
                    myA.IsValidDate(Resources.ActivityBFBFDate, dr.BFDate, true, DebtorBE.CSLBegin, DateTime.Today.AddYears(30), Resources.ValidationCSLBegin, Resources.ValidationThirtyYearsLater);
                }
                break;
            }
        }
Exemplo n.º 13
0
        private void AutoAC(atriumDB.ActivityRow prevAC, ActivityConfig.ACSeriesRow asr, int revId, ACEngine.RevType revType, DateTime acDate, Stack <ParentChildStep> _flowQ, bool recurse)
        {
            FileManager fmp = FM;

            try
            {
                if (asr.InitialStep == (int)ACEngine.Step.CreateFile)
                {
                    myFM   = FM.AtMng.CreateFile(fmp);
                    prevAC = null;
                    revId  = 0;
                }


                ACEngine             ace;
                atriumDB.ActivityRow newAC;
                DoACAllSteps(prevAC, asr, revId, revType, acDate, out ace, out newAC, _flowQ, null);
                LastActivityId = newAC.ActivityId;
                FM.GetActivity().CalculateBF(newAC, revId != 0, false);
                if (PrototypeAC != null)
                {
                    if (!PrototypeAC.IsActivityCommentNull())
                    {
                        newAC.ActivityComment = PrototypeAC.ActivityComment;
                    }
                    //copy user bfs
                    foreach (atriumDB.ActivityBFRow abfr in PrototypeAC.GetActivityBFRows())
                    {
                        if (abfr.ACBFId == ActivityBFBE.USERBFID)
                        {
                            atriumDB.ActivityBFRow newabfr = (atriumDB.ActivityBFRow)FM.GetActivityBF().Add(newAC);
                            newabfr.BFDate        = abfr.BFDate;
                            newabfr.InitialBFDate = abfr.InitialBFDate;
                            if (!abfr.IsBFCommentNull())
                            {
                                newabfr.BFComment = abfr.BFComment;
                            }
                            newabfr.BFType      = abfr.BFType;
                            newabfr.BFOfficerID = abfr.BFOfficerID;
                        }
                    }
                }
                ace.Save(true, false);

                FM.GetDocMng().GetDocument().Send(newAC);

                //recurse to allow nested files
                if (recurse)
                {
                    AutoNextStep(newAC);
                }
            }
            catch (Exception x)
            {
                myFM = fmp;
                throw x;
            }
            finally
            {
                myFM = fmp;
            }
        }