Esempio n. 1
0
        public override bool CanAdd(DataRow parent)
        {
            atriumDB.ActivityRow ar = (atriumDB.ActivityRow)parent;
            if (ar.EFileRow == null)
            {
                return(false);
            }
            else
            {
                //2017-08-11 JLL IUTIR - 9113: isBillable MetaFileType flag
                bool fileIsBillable = ar.EFileRow.FileMetaTypeRow.isBillable;
                return(fileIsBillable && myA.GetActivity().CanAdd(ar.EFileRow));
            }


            //JLL 2014-10-21 changed to account for office of officer
            //can only manually add timelsips to my office's activities
            //commented out on 2014-11-12 - causes wizard to fail on mandate when adding file. canadd below fails.

            //if(myA.AtMng.SecurityManager.CanAdd(ar.FileId, atSecurity.SecurityManager.Features.ActivityTime) == atSecurity.SecurityManager.ExPermissions.Yes)
            //{
            //    if(myA.AtMng.WorkingAsOfficer.OfficeId == ar.OfficeId || myA.AtMng.OfficeLoggedOn.OfficeId == ar.OfficeId)
            //        return true;
            //}

            //return false;
        }
Esempio n. 2
0
        public void OutOfOfficeReply(atriumDB.ActivityRow activity)
        {
            if (myFM.AtMng.GetSetting(AppBoolSetting.useOutOfOfficeFunctionality))
            {
                if (activity.Communication)
                {
                    docDB.DocumentRow    docr   = myFM.GetDocMng().DB.Document.FindByDocId(activity.DocId);
                    docDB.RecipientRow[] recips = docr.GetRecipientRows();
                    officeDB.OfficerRow  officerRow;
                    foreach (docDB.RecipientRow rr in recips)
                    {
                        if (rr.Type != "0" && !rr.IsOfficerIdNull())
                        {
                            //check to see if they are out of the office
                            //always load in case person just set their out off office flag
                            officerRow = (officeDB.OfficerRow)myFM.AtMng.OfficeMng.GetOfficer().Load(rr.OfficerId);

                            //jll 2018-04-24 - if recipient is external, this check should never happen.
                            if (officerRow != null && officerRow.OutOfOffice)
                            {
                                if (DateTime.Now >= officerRow.OutOfOfficeStartDate && DateTime.Now <= officerRow.OutOfOfficeEndDate)
                                {
                                    // do out of office activity
                                    ActivityConfig.ACSeriesRow acsr = myFM.AtMng.acMng.DB.ACSeries.FindByACSeriesId(myFM.AtMng.GetSetting(AppIntSetting.OutOfOfficeNotification));
                                    CurrentACE = null;
                                    AutoAC(activity, acsr, officerRow.OfficerId, ACEngine.RevType.OutOfOffice, false);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        //public override void FixLookups(System.Data.DataRow ddr)
        //{
        //    atriumDB.ActivityBFRow dr = (atriumDB.ActivityBFRow)ddr;

        //    OfficerBE ofr = this.myA.AtMng.OfficeMng.GetOfficer();


        //    if (!dr.IsBFOfficerCodeNull())
        //        dr.BFOfficerID = ofr.LookupId(dr.BFOfficerCode);
        //    else
        //        dr.SetBFOfficerIDNull();


        //}

        public void AutoCompleteBFs(atriumDB.ActivityRow newAC)
        {
            //this.myA..AppMan.ExecuteSP("ActivityAutoComplete", dr.FileId, dr.OfficerId, dr.ActivityDate, dr.ActivityCodeID);
            if (newAC.ACSeriesId == myA.AtMng.GetSetting(AppIntSetting.OutOfOfficeNotification))
            {
                return;
            }

            stackLimit = 0;
            if (!newAC.IsACSeriesIdNull())
            {
                ActivityConfig.ACSeriesRow acsr = this.myA.AtMng.acMng.DB.ACSeries.FindByACSeriesId(newAC.ACSeriesId);
                AutoCompleteBFs(newAC, acsr);
            }
        }
Esempio n. 4
0
        private atriumDB.ActivityRow GetClosestActivity(FileManager fmCur, DateTime activityDate, string officeFileNo, string officeId, CodesDB.DisbursementTypeRow disbTypeR, DateTime disbDate, string fileId, ref bool encounteredError)
        {
            string concat        = "";
            string activityQuery = "officeid = " + officeId + " and fileid = " + fileId + " and (";

            //foreach (ActivityConfig.ACDisbRow acdr in disbTypeR.GetACDisbRows())
            //{
            //    activityQuery +=concat+ " activitycodeid = " + acdr.ActivityCodeId  ;
            //    concat = " or ";
            //}

            activityQuery += ")";

            atriumDB.ActivityRow[] drActivityArr = (atriumDB.ActivityRow[])fmCur.DB.Activity.Select(activityQuery);

            atriumDB.ActivityRow drClosest = null;

            if (drActivityArr.Length == 0)
            {
                WriteErrorLog(officeFileNo, activityDate, disbTypeR.DisbursementType, disbDate, Resources.FileDoesNotHaveRequiredActivity);
                encounteredError = true;
            }
            else if (drActivityArr.Length == 1)
            {
                drClosest = drActivityArr[0];
            }
            else //if (drActivityArr.Length == 2)
            {
                for (int i = 0; i < drActivityArr.Length; i++)
                {
                    DateTime t2 = drActivityArr[i].ActivityDate;
                    DateTime t3 = drClosest == null ? DateTime.MinValue : drClosest.ActivityDate;

                    System.TimeSpan ts1 = activityDate - t2;
                    System.TimeSpan ts2 = activityDate - t3;


                    if (ts1.Duration() <= ts2.Duration())
                    {
                        drClosest = drActivityArr[i];
                    }
                }
            }

            return(drClosest);
        }
Esempio n. 5
0
        private static bool TestForProcessMatch(atriumDB.ProcessRow pr, atriumDB.ActivityRow prevAc)
        {
            bool match = true;

            if (prevAc == null)
            {
                return(match);
            }
            if (pr != null)
            {
                match = false;
                if (pr.Thread.StartsWith(prevAc.ProcessRow.Thread) | prevAc.ProcessRow.Thread.StartsWith(pr.Thread))
                {
                    match = true;
                }
            }
            return(match);
        }
Esempio n. 6
0
        public override bool CanAdd(DataRow parent)
        {
            atriumDB.ActivityRow er = (atriumDB.ActivityRow)parent;
            if (er == null)
            {
                return(false);
            }
            if (er.OfficeId != myA.AtMng.WorkingAsOfficer.OfficeId)
            {
                return(false);
            }
            if (er.EFileRow == null || !er.EFileRow.FileMetaTypeRow.isBillable)
            {
                return(false);
            }

            return(AllowAdd || myA.AtMng.SecurityManager.CanAdd(er.FileId, atSecurity.SecurityManager.Features.Disbursement) > atSecurity.SecurityManager.ExPermissions.No);
        }
Esempio n. 7
0
        public void MaintainBFDate(int linkId, string linkTable, string field, DateTime relDate)
        {
            //find all liked activities
            //how to find the activity if the link table info is not there
            //or if the ac is linked to the file
            //related field config data determines this

            //**** acbf.bfdate is of this form objectalias,fieldname
            AllowEdit = true;
            //find all acbf records that match
            ActivityConfig.ACBFRow[] acbfrs = (ActivityConfig.ACBFRow[])myA.AtMng.acMng.DB.ACBF.Select("BFDate like '" + linkTable + "%' and BFDate like '%" + field + "%'");
            foreach (ActivityConfig.ACBFRow acbfr in acbfrs)
            {
                atriumDB.ActivityBFRow[] abfrs = (atriumDB.ActivityBFRow[])myA.DB.ActivityBF.Select("Completed=false and ACBFId=" + acbfr.ACBFId.ToString());

                DateTime newBf;
                if (acbfr.BFDate.Contains(","))
                {
                    string[] args = acbfr.BFDate.Split(',');
                    newBf = ActivityBE.AtriumDateAdd(relDate, args[2]);
                }
                else
                {
                    newBf = ActivityBE.CalculateBFDate(field, relDate, acbfr.BFDate);
                }

                if (newBf < DateTime.Today)
                {
                    newBf = DateTime.Today;
                }

                foreach (atriumDB.ActivityBFRow abfr in abfrs)
                {
                    atriumDB.ActivityRow ar = abfr.ActivityRow;
                    bool inContext          = false;
                    foreach (atriumDB.ProcessContextRow pcr in ar.ProcessRow.GetProcessContextRows())
                    {
                        if (pcr.LinkTable == linkTable & pcr.LinkId == linkId)
                        {
                            inContext = true;
                        }
                    }
                    if (!ar.IsLinkTableNull() && ar.LinkTable == linkTable && ar.LinkID == linkId)  //best match
                    {
                        abfr.BFDate        = newBf;
                        abfr.InitialBFDate = abfr.BFDate;
                    }
                    else if (inContext) //check for process context match
                    {
                        abfr.BFDate        = newBf;
                        abfr.InitialBFDate = abfr.BFDate;
                    }
                    else if (ar.IsLinkTableNull()) //should this be allowed
                    {
                        abfr.BFDate        = newBf;
                        abfr.InitialBFDate = abfr.BFDate;
                    }
                }
            }
            AllowEdit = false;
        }
Esempio n. 8
0
        private void AutoCompleteBFs(atriumDB.ActivityRow newAC, ActivityConfig.ACSeriesRow acsr)
        {
            stackLimit++;
            if (stackLimit < 9)
            {
                //if (acsr.GetACDependencyRowsByPreviousSteps().Length == 0)
                if (myA.AtMng.acMng.DB.ACDependency.Select("LinkType in (0,4,8,9)  and NextStepId=" + acsr.ACSeriesId.ToString()).Length == 0)
                {
                    ActivityConfig.ACSeriesRow acss = null;
                    //check to see if we are a sub-series?
                    if (newAC.ACSeriesId == acsr.ACSeriesId)
                    {
                        //use this when we are starting to follow the thread back
                        acss = myA.GetActivity().FindParentStepForAutoComplete(newAC);
                    }
                    else
                    {
                        //we have popped into a process without hitting a step
                        //this used to cause a stack overflow
                        //use the acsr to find a parent that has been done
                        //problem is that the process might have multiple references
                        //throw new AtriumException("Workflow is trying to connect through a sub-process without recording a step");
                        //do it anyways so we can handle nr and questions in same series
                        acss = myA.GetActivity().FindParentStepForAutoComplete(newAC);
                    }
                    if (acss != null && acsr.ACSeriesId != acss.ACSeriesId)
                    {
                        AutoCompleteBFs(newAC, acss);
                    }
                }

                //     else
                //     {
                //loop through previous steps and determine what this one completes
                foreach (ActivityConfig.ACDependencyRow acdr in acsr.GetACDependencyRowsByPreviousSteps())
                {
                    if ((StepType)acdr.ACSeriesRowByNextSteps.StepType == StepType.Decision | (StepType)acdr.ACSeriesRowByNextSteps.StepType == StepType.Merge | (StepType)acdr.ACSeriesRowByNextSteps.StepType == StepType.NonRecorded)// | (StepType)acdr.ACSeriesRowByNextSteps.StepType == StepType.Branch | (StepType)acdr.ACSeriesRowByNextSteps.StepType == StepType.Merge)
                    {
                        //don't recurse over obsolete links
                        if (acdr.LinkType != (int)ConnectorType.Obsolete)
                        {
                            AutoCompleteBFs(newAC, acdr.ACSeriesRowByNextSteps);
                        }
                    }
                    else if (!acdr.IsNextStepIdNull() & !acdr.IsACBFIdNull())
                    {
                        //find bf and complete
                        foreach (atriumDB.ActivityBFRow abr in this.myA.DB.ActivityBF.Select("Completed=0 and fileid=" + newAC.FileId.ToString()))
                        {
                            //changed on april 27 2009
                            //if ((!abr.IsACDepIdNull() && abr.ACDepId == acxdr.ACDependencyId) | abr.ActivityRow.ACSeriesId==acdr.CurrentStepId)
                            bool standardTest = (!abr.IsACDepIdNull() && abr.ACDepId == acdr.ACDependencyId);
                            bool versionTest  = (!abr.IsACDepIdNull() && !acdr.IsOldACDepIdNull() && abr.ACDepId == acdr.OldACDepId);

                            bool oldversionTest = false;
                            if (!standardTest & !versionTest & abr.ActivityRow != null)
                            {
                                oldversionTest = (abr.ActivityRow.ACSeriesId == acdr.CurrentStepId && !abr.IsBFCodeNull() && abr.BFCode == acdr.ACBFRow.BFCode && acdr.NextStepId == newAC.ACSeriesId);
                            }
                            // JLL commented out my fix as per TFS 3943
                            //oldversionTest = (abr.ActivityRow != null && abr.ActivityRow.ACSeriesId == acdr.CurrentStepId && !abr.IsBFCodeNull() && abr.BFCode == acdr.ACBFRow.BFCode && acdr.NextStepId == newAC.ACSeriesId);

                            if (standardTest || versionTest || oldversionTest)
                            {
                                //don't complete yourself!
                                if (newAC.ActivityId != abr.ActivityId)
                                {
                                    AllowEdit = true;
                                    //must be in same process or parent process
                                    if (newAC.ProcessRow.Thread.StartsWith(abr.ActivityRow.ProcessRow.Thread))
                                    {
                                        abr.Completed = true;
                                    }
                                    else if (abr.ActivityRow.ProcessRow.Thread.StartsWith(newAC.ProcessRow.Thread)) //or child process!
                                    {
                                        abr.Completed = true;
                                    }
                                    else if (myA.AtMng.acMng.DB.Series.FindBySeriesId(abr.ActivityRow.ProcessRow.SeriesId).SingleInstancePerFile || myA.AtMng.acMng.DB.Series.FindBySeriesId(abr.ActivityRow.ProcessRow.SeriesId).OncePerFile)
                                    {
                                        abr.Completed = true;
                                    }
                                    else if (myA.GetActivity().AboutSameAccount(newAC, abr.ActivityRow)) //there is a relationship between associated objects
                                    {
                                        abr.Completed = true;
                                    }
                                    else if (acdr.ACBFRow.AllowManualComplete & acdr.LinkType == (int)ConnectorType.BFOnly)//phase 1 for CLAS!
                                    {
                                        abr.Completed = true;
                                    }
                                    AllowEdit = false;
                                }
                            }
                        }
                    }
                    //else if (!acdr.IsNextStepIdNull() & acdr.LinkType==(int)ConnectorType.Transfer & acdr.IsACBFIdNull())
                    //{
                    //    if (!newAC.IsPreviousActivityIdNull())
                    //    {
                    //        atriumDB.ActivityRow preva = myA.DB.Activity.FindByActivityId(newAC.PreviousActivityId);

                    //        //don't kill your own process
                    //        if(newAC.ProcessId!=preva.ProcessId)
                    //            myA.GetActivityBF().CompleteAllOnProcess(preva.ProcessRow,newAC.ProcessId);
                    //    }
                    //}
                }
            }
            //  }
            stackLimit--;
        }
Esempio n. 9
0
        /// <summary>
        /// Moves a process to another file
        /// </summary>
        /// <param name="pr">process to move</param>
        /// <param name="toFile">Target file</param>
        private void Move(atriumDB.ProcessRow pr, int toFileId, atriumDB.ActivityRow splitOn)
        {
            FileManager toFM = myA.AtMng.GetFile(toFileId);

            //need to check permissions on target file
            if (!toFM.GetProcess().CanAdd(toFM.CurrentFile))
            {
                throw new AtriumException(Properties.Resources.YouNeedAddProcessPermissionOnTheDestinationFile);
            }


            CheckMove(pr);

            //this needs to be here
            myA.GetActivity().LoadByProcessId(pr.ProcessId);

            //sort activities by thread
            atriumDB.ActivityRow[] ars   = (atriumDB.ActivityRow[])myA.DB.Activity.Select("processid=" + pr.ProcessId.ToString(), "ConversationIndex");
            atriumDB.ProcessRow    newPr = null;
            int  oldFileid = pr.FileId;
            bool moveProc  = false;

            if (splitOn != null && ars.Length > 1 && ars[0].ActivityId != splitOn.ActivityId)
            {
                //create new process for split thread
                newPr = (atriumDB.ProcessRow)Add(myA.CurrentFile);

                newPr.Active = pr.Active;
                //newPr.CurrentStep = pr.CurrentStep;
                newPr.NameE    = pr.NameE;
                newPr.NameF    = pr.NameF;
                newPr.SeriesId = pr.SeriesId;
                //newPr.Thread = pr.Thread;
            }
            else
            {
                pr.FileId = toFileId;

                pr.Thread = pr.ProcessId.ToString();
                moveProc  = true;
                foreach (atriumDB.ProcessContextRow pcr in pr.GetProcessContextRows())
                {
                    pcr.FileId = toFileId;
                }
            }

            //move all activties on process
            foreach (atriumDB.ActivityRow par in pr.GetActivityRows())
            {
                if (splitOn == null || par.ConversationIndex.CompareTo(splitOn.ConversationIndex) >= 0)
                {
                    myA.GetActivity()._Move(par, toFileId);

                    if (newPr != null)
                    {
                        par.ProcessId = newPr.ProcessId;
                    }
                }
            }

            if (moveProc)
            {
                FileManager         fmOld = myA.AtMng.GetFile(oldFileid);
                atriumDB.ProcessRow prOld = fmOld.DB.Process.FindByProcessId(pr.ProcessId);
                if (prOld != null)
                {
                    prOld.Delete();
                    prOld.AcceptChanges();
                }
            }
        }
Esempio n. 10
0
        public Dictionary <int, CurrentFlow> EnabledProcesses2()
        {
            //create collection of available Processes
            Dictionary <int, CurrentFlow> enabledProcesses = new Dictionary <int, CurrentFlow>();

            fileProcesses.Clear();
            activeProcesses.Clear();
            foreach (atriumDB.ProcessRow pr in myFM.CurrentFile.GetProcessRows())
            {
                fileProcesses.Add(pr.ProcessId, pr.SeriesId);
                if (pr.Active)
                {
                    activeProcesses.Add(pr.ProcessId, pr.SeriesId);
                }
            }


            //go through series table
            //filter it based on file type

            foreach (ActivityConfig.SeriesRow sr in myFM.AtMng.acMng.DB.Series.Select("Obsolete=false", "SeriesDesc" + myFM.AppMan.Language))
            {
                bool        add           = true;
                CurrentFlow enabledSeries = new CurrentFlow();
                enabledSeries.Series = sr;

                //exclude processes that violate instance rules - onceperfile,singleinstanceperfile
                if (sr.OncePerFile & fileProcesses.ContainsValue(sr.SeriesId))
                {
                    add = false;
                }

                if (sr.SingleInstancePerFile & activeProcesses.ContainsValue(sr.SeriesId))
                {
                    add = false;
                }

                if (add)
                {
                    //look for sub series steps
                    ActivityConfig.ACSeriesRow[] acss = (ActivityConfig.ACSeriesRow[])FM.AtMng.acMng.DB.ACSeries.Select("Subseriesid=" + sr.SeriesId.ToString());
                    //verify that start activity is available
                    foreach (ActivityConfig.ACSeriesRow acsr in sr.GetACSeriesRows())
                    {
                        atriumDB.ActivityRow arp = null;
                        bool addstep             = false;
                        if (acsr.Start)
                        {
                            //check dependencies for each sub series step
                            foreach (ActivityConfig.ACSeriesRow acsrs in acss)
                            {
                                foreach (ActivityConfig.ACDependencyRow acdr in acsrs.GetACDependencyRowsByPreviousSteps())
                                {
                                    //see if the previous activity has been done
                                    bool isDone = myFM.DB.Activity.Select("ACSeriesID=" + acdr.CurrentStepId.ToString()).Length > 0;
                                    //check enable link
                                    if (acdr.LinkType == (int)ConnectorType.Enable & isDone)
                                    {
                                        //need to track parent process here
                                        addstep = true;
                                    }

                                    //check transfer link - only if it is working as  enable
                                    //TODO need to check whether enabling activity was in an active process
                                    if (acdr.LinkType == (int)ConnectorType.Transfer & isDone)
                                    {
                                        //need to track parent process here
                                        arp = (atriumDB.ActivityRow)myFM.DB.Activity.Select("ACSeriesID=" + acdr.CurrentStepId.ToString())[0];
                                        if (!activeProcesses.ContainsKey(arp.ProcessId))
                                        {
                                            arp = null;
                                        }
                                        addstep = true;
                                    }
                                    //check disable link
                                    if (acdr.LinkType == (int)ConnectorType.Disable & isDone)
                                    {
                                        addstep = false;
                                    }
                                }
                            }

                            if (addstep)
                            {
                                //check filetype rule
                                //addstep = AllowForFileType(acsr,myFM);
                                addstep = Allowed(acsr, myFM.AtMng, myFM);
                            }

                            //if ok add
                            if (addstep)
                            {
                                NextStep ns = new NextStep();
                                ns.acs = acsr;
                                if (arp == null)
                                {
                                    ns.prevAc = null;
                                }
                                else
                                {
                                    ns.prevAc = arp;
                                }

                                enabledSeries.NextSteps.Add(acsr.ACSeriesId, ns);

                                //recurse check for next steps
                                if (acsr.StepType != (int)StepType.Activity && acsr.GetACDependencyRowsByNextSteps().Length > 0)
                                {
                                    CurrentFlow newFlow = new CurrentFlow();
                                    newFlow.Series = acsr.SeriesRow;
                                    ns.Children    = newFlow;
                                    NextSteps(newFlow, acsr, arp);
                                }
                            }
                        }
                    }

                    if (enabledSeries.NextSteps.Count > 0)
                    {
                        enabledProcesses.Add(sr.SeriesId, enabledSeries);
                    }
                }
            }
            return(enabledProcesses);
        }
Esempio n. 11
0
        public Dictionary <int, CurrentFlow> EnabledProcesses()
        {
            //create collection of available Processes
            Dictionary <int, CurrentFlow> enabledProcesses = new Dictionary <int, CurrentFlow>();

            fileProcesses.Clear();
            activeProcesses.Clear();
            foreach (atriumDB.ProcessRow pr in myFM.CurrentFile.GetProcessRows())
            {
                fileProcesses.Add(pr.ProcessId, pr.SeriesId);
                if (pr.Active)
                {
                    activeProcesses.Add(pr.ProcessId, pr.SeriesId);
                }
            }


            //go through activities on file in seq
            foreach (atriumDB.ActivityRow ar in FM.DB.Activity.Select("", "ActivityID"))
            {
                ActivityConfig.ACSeriesRow acs = FM.GetActivity().GetACSeriesRow(ar);

                //go through this acseries next steps to see if they enable or disable a process
                foreach (ActivityConfig.ACDependencyRow acdr in acs.GetACDependencyRowsByNextSteps())
                {
                    if (acdr.ACSeriesRowByPreviousSteps.StepType == (int)StepType.Subseries && (acdr.LinkType == (int)ConnectorType.Enable | acdr.LinkType == (int)ConnectorType.Transfer | acdr.LinkType == (int)ConnectorType.Disable))
                    {
                        //the link is to a subprocess
                        bool add = true;
                        ActivityConfig.SeriesRow sr = FM.AtMng.acMng.DB.Series.FindBySeriesId(acdr.ACSeriesRowByPreviousSteps.SubseriesId);

                        CurrentFlow enabledSeries;
                        if (enabledProcesses.ContainsKey(sr.SeriesId))
                        {
                            enabledSeries = enabledProcesses[sr.SeriesId];
                        }
                        else
                        {
                            enabledSeries = new CurrentFlow();

                            enabledSeries.Series = sr;
                        }

                        //exclude processes that violate instance rules - onceperfile,singleinstanceperfile
                        if (sr.OncePerFile & fileProcesses.ContainsValue(sr.SeriesId))
                        {
                            add = false;
                        }

                        if (sr.SingleInstancePerFile & activeProcesses.ContainsValue(sr.SeriesId))
                        {
                            add = false;
                        }

                        if (add)
                        {
                            ActivityConfig.ACSeriesRow[] seriesSteps = (ActivityConfig.ACSeriesRow[])FM.AtMng.acMng.DB.ACSeries.Select("Seriesid=" + sr.SeriesId.ToString(), "seq,stepcode");
                            foreach (ActivityConfig.ACSeriesRow acsr in seriesSteps)
                            {
                                atriumDB.ActivityRow arp = null;
                                bool addstep             = false;
                                if (acsr.Start)
                                {
                                    if (acdr.LinkType == (int)ConnectorType.Enable)
                                    {
                                        //need to track parent process here
                                        addstep = true;
                                    }
                                    if (acdr.LinkType == (int)ConnectorType.Transfer)
                                    {
                                        //need to track parent process here
                                        addstep = true;
                                        arp     = ar;
                                        if (!fileProcesses.ContainsKey(arp.ProcessId))
                                        {
                                            arp = null;
                                        }
                                    }
                                    if (acdr.LinkType == (int)ConnectorType.Disable)
                                    {
                                        //need to track parent process here
                                        addstep = false;

                                        //remove next step
                                        if (enabledSeries.NextSteps.ContainsKey(acsr.ACSeriesId))
                                        {
                                            enabledSeries.NextSteps.Remove(acsr.ACSeriesId);
                                        }
                                        //remove series
                                        if (enabledProcesses.ContainsKey(sr.SeriesId))
                                        {
                                            enabledProcesses.Remove(sr.SeriesId);
                                        }
                                    }
                                    if (addstep)
                                    {
                                        //check filetype rule
                                        //addstep = AllowForFileType(acsr,myFM);
                                        addstep = Allowed(acsr, myFM.AtMng, myFM);
                                    }

                                    //if ok add
                                    if (addstep && !enabledSeries.NextSteps.ContainsKey(acsr.ACSeriesId))
                                    {
                                        NextStep ns = new NextStep();
                                        ns.acs     = acsr;
                                        ns.Enabled = IsEnabled(acsr);
                                        if (arp == null)
                                        {
                                            ns.prevAc = null;
                                        }
                                        else
                                        {
                                            ns.prevAc = arp;
                                        }

                                        enabledSeries.NextSteps.Add(acsr.ACSeriesId, ns);

                                        //recurse check for next steps
                                        if (acsr.StepType != (int)StepType.Activity && acsr.GetACDependencyRowsByNextSteps().Length > 0)
                                        {
                                            CurrentFlow newFlow = new CurrentFlow();
                                            newFlow.Series = acsr.SeriesRow;
                                            ns.Children    = newFlow;
                                            NextSteps(newFlow, acsr, arp);
                                        }
                                    }
                                }
                            }
                        }
                        if (enabledSeries.NextSteps.Count > 0 && !enabledProcesses.ContainsKey(sr.SeriesId))
                        {
                            enabledProcesses.Add(sr.SeriesId, enabledSeries);
                        }
                    }
                }
            }
            foreach (CurrentFlow ap in enabledProcesses.Values)
            {
                BuildOKToAdd(ap);
            }
            return(enabledProcesses);
        }
Esempio n. 12
0
        private void NextSteps(ActivityConfig.ACSeriesRow nextStep, CurrentFlow ap, atriumDB.ActivityRow prevAc, ActivityConfig.ACDependencyRow acdr)
        {
            bool add = true;

            bool pause = false;

            //do not add step if it is not a next step or answer
            if (acdr.LinkType != (int)ConnectorType.NextStep & acdr.LinkType != (int)ConnectorType.Answer)
            {
                add = false;
            }

            //check filetype rule

            if (!AllowForFileType(nextStep, myFM))
            {
                add = false;
            }
            //}

            //do not add step if it is a disable link
            //if (acdr.LinkType==(int)ConnectorType.Disable)
            //    add = false;


            //if ((StepType)nextStep.StepType == StepType.Activity)
            //{
            //check role
            bool enable = IsEnabled(nextStep);

            if (acdr.LinkType == (int)ConnectorType.Enable)
            {
                //exclude processes that violate instance rules - onceperfile,singleinstanceperfile
                ActivityConfig.SeriesRow sr = nextStep.SeriesRow;
                if (sr.OncePerFile & fileProcesses.ContainsValue(sr.SeriesId))
                {
                    add = false;
                }

                if (sr.SingleInstancePerFile & activeProcesses.ContainsValue(sr.SeriesId))
                {
                    add = false;
                }
            }

            //do not add steps from an exclusive switch if we have taken one path
            //this gets handled by the bf rule if there is a bf
            //do not add step if bf to it is completed
            //
            if (prevAc != null && !acdr.IsACBFIdNull())
            {
                atriumDB.ActivityBFRow[] abfr = (atriumDB.ActivityBFRow[])myFM.DB.ActivityBF.Select("Activityid=" + prevAc.ActivityId.ToString() + "and ACDepId=" + acdr.ACDependencyId + " and ACBFId=" + acdr.ACBFId.ToString());

                if (abfr.Length > 0)
                {
                    if (abfr[0].Completed)
                    {
                        add = false;
                    }
//need to find a better more flexible mechanism than '100 days'
//                    else if (abfr[0].BFDate > DateTime.Today.AddDays(100))
//                        add = false;
                }
                else
                {
                    //TFS#54408 CJW 2013-09-16 don't add next step if precursor bf is not on file
                    //TODO: maybe we don't need this here after all?
                    //may be we do!!!!!!!!!!!!!!!!!!
                    add = false;
                }
            }

            //check to see if process is paused
            if (prevAc != null && prevAc.ProcessRow.Paused)
            {
                pause = true;
            }

            //?do not add step if it is unique in process and has been done already?
            if (ap.Process != null && nextStep.OnceOnly & myFM.DB.Activity.Select("ProcessID=" + ap.Process.ProcessId.ToString() + " and ACSeriesID=" + acdr.NextStepId.ToString()).Length > 0)
            {
                add = false;
            }

            if (add)
            {
                NextStep ns = new NextStep();

                if (!acdr.IsDescEngNull())
                {
                    //if it is the first step in a subprocess don't add the link text
                    if (!nextStep.Start)
                    {
                        ns.LinkText = acdr["Desc" + myFM.AppMan.Language] + ": ";
                    }
                }
                ns.acs     = nextStep;
                ns.prevAc  = prevAc;
                ns.Enabled = enable;
                ns.Paused  = pause;
                if (ns.Paused)
                {
                    ns.Enabled = false;
                }
                if (flowQ != null)
                {
                    ns.FlowQ = new Stack <ParentChildStep>(flowQ);
                }

                bool merged = false;
                if (ap.NextSteps.ContainsKey(ns.acs.ACSeriesId))
                {
                    currentAP = topAP;
                    merged    = true;
                }
                else
                {
                    ap.NextSteps.Add(ns.acs.ACSeriesId, ns);
                }

                if (ap.NextSteps.Count == 1)
                {
                    ap.Series = ns.acs.SeriesRow;
                }

                if (ap.Process != null && ap.Process.SeriesId != ap.Series.SeriesId)
                {
                    ap.NewSeries = true;
                }

                if ((StepType)ns.acs.StepType != StepType.Activity)
                {
                    CurrentFlow apNew = new CurrentFlow();
                    apNew.Process = ap.Process;
                    ns.Children   = apNew;
                    if (nextStep.StepType == (int)StepType.Branch)
                    {
                        currentAP = apNew;
                    }

                    if ((StepType)ns.acs.StepType == StepType.Subseries)
                    {
                        if (flowQ == null)
                        {
                            flowQ = new Stack <ParentChildStep>();
                        }
                        //apNew.Process = null;

                        //drill into sub process
                        //find start ac series
                        //
                        lmDatasets.ActivityConfig.ACSeriesRow subStart = null;

                        //CJW 2013-6-18 added obsolete = false see PITS#41039
                        subStart = (lmDatasets.ActivityConfig.ACSeriesRow)FM.AtMng.acMng.DB.ACSeries.Select("Start = true and obsolete= false and SeriesID=" + ns.acs.SubseriesId.ToString())[0];

                        ParentChildStep pcs = new ParentChildStep();
                        pcs.ParentStep = ns.acs;
                        pcs.ChildStep  = subStart.SeriesRow;

                        flowQ.Push(pcs);

                        NextSteps(subStart, apNew, prevAc, acdr);

                        flowQ.Pop();

                        if (apNew.NextSteps.Count == 0)
                        {
                            //sub process is complete
                            //goto next step from subseries
                            NextSteps(apNew, nextStep, prevAc);
                        }
                        else
                        {
                            //sub process is active
                        }
                    }
                    else
                    {
                        //drilldown thru flow-tree
                        if (ns.acs.StepType == (int)StepType.Merge)
                        {
                            //check to see if the merge condition is met
                            if (merged)
                            {
                                ap.NextSteps.Clear();

                                NextSteps(ap, nextStep, prevAc);
                            }
                        }
                        else
                        {
                            NextSteps(apNew, nextStep, prevAc);
                            currentAP = topAP;
                        }
                    }
                }
            }
        }
Esempio n. 13
0
        private void NextSteps(CurrentFlow ap, ActivityConfig.ACSeriesRow asr, atriumDB.ActivityRow prevAc)
        {
            if (asr == null)
            {
                return;
            }

            //remove current step
            if (ap.NextSteps.ContainsKey(asr.ACSeriesId))
            {
                if ((StepType)ap.NextSteps[asr.ACSeriesId].acs.StepType == StepType.Activity || (StepType)ap.NextSteps[asr.ACSeriesId].acs.StepType == StepType.NonRecorded)
                {
                    ap.NextSteps.Remove(asr.ACSeriesId);
                }
            }


//            if (asr.GetACDependencyRowsByNextSteps().Length == 0) merged on may 9 2014
            ActivityConfig.ACDependencyRow[] acds = (ActivityConfig.ACDependencyRow[])FM.AtMng.acMng.DB.ACDependency.Select("LinkType  in (0,4,8) and CurrentStepID=" + asr.ACSeriesId.ToString());
            if (asr.StepType != (int)StepType.NonRecorded && acds.Length == 0)
            {
                ActivityConfig.ACSeriesRow acss = FM.GetActivity().FindParentStep(prevAc);

                //check for bf completion?
                //should we use the step before this?
                if (acss != null)
                {
                    //foreach (ActivityConfig.ACDependencyRow acdr in acss.GetACDependencyRowsByNextSteps())
                    //TFS#53658 CJW 2013-09-16
                    foreach (ActivityConfig.ACDependencyRow acdr in FM.AtMng.acMng.DB.ACDependency.Select("CurrentStepID=" + acss.ACSeriesId.ToString(), "Seq"))
                    {
                        bool add1 = true;
                        if (!acdr.IsACBFIdNull())
                        {
                            atriumDB.ActivityBFRow[] abfr = (atriumDB.ActivityBFRow[])myFM.DB.ActivityBF.Select("Activityid=" + prevAc.ActivityId.ToString() + "and ACDepId=" + acdr.ACDependencyId + " and ACBFId=" + acdr.ACBFId.ToString());
                            if (abfr.Length > 0)
                            {
                                //if (abfr[0].ActivityRow.ACSeriesId == acdr.CurrentStepId)
                                //{
                                if (abfr[0].Completed)
                                {
                                    add1 = false;
                                }
                                //}
                            }
                            else
                            {
                                //TFS#54408 CJW 2013-09-16 don't add next step if precursor bf is not on file
                                add1 = false;
                            }
                        }
                        if (add1)
                        {
                            NextSteps(ap, acss, prevAc);
                        }
                    }
                }
            }
            else
            {
                //add  next steps
                //foreach (ActivityConfig.ACDependencyRow acdr in asr.GetACDependencyRowsByNextSteps())
                //TFS#53658 CJW 2013-09-16
                foreach (ActivityConfig.ACDependencyRow acdr in FM.AtMng.acMng.DB.ACDependency.Select("CurrentStepID=" + asr.ACSeriesId.ToString(), "Seq"))
                {
                    ActivityConfig.ACSeriesRow nextStep = acdr.ACSeriesRowByPreviousSteps;

                    NextSteps(nextStep, ap, prevAc, acdr);
                }
            }
        }
Esempio n. 14
0
        private void MakeFile(string file, FileManager fmRoot)
        {
            FileManager fm;

            fm = fmRoot;

            if (chkNewFile.Checked)
            {
                iFiles++;
                fm = AtMng.CreateFile(fmRoot);

                if (!fmRoot.CurrentFile.FileMetaTypeRow.SubFileAutoNumber)
                {
                    fm.CurrentFile.FileNumber = "999";
                }
                fm.CurrentFile.NameE    = System.IO.Path.GetFileName(file);
                fm.CurrentFile.NameF    = System.IO.Path.GetFileName(file);
                fm.CurrentFile.FileType = ucMultiDropDown2.SelectedValue.ToString();

                atLogic.BusinessProcess bp = fm.GetBP();

                bp.AddForUpdate(fm.EFile);
                bp.AddForUpdate(fm.GetFileXRef());
                bp.AddForUpdate(fm.GetFileOffice());

                bp.Update();

                AddListItem("Created file " + file);
            }

            ActivityBP abp = fm.InitActivityProcess();

            foreach (string doc in System.IO.Directory.GetFiles(file))
            {
                string ext = System.IO.Path.GetExtension(doc);
                docDB.FileFormatRow fmt = fm.GetDocMng().DB.FileFormat.FindByFileFormat(ext);
                if (fmt != null && fmt.AllowUpload)
                {
                    iCount++;
                    ACEngine             ace   = abp.Add(DateTime.Today, acsr, null, false, null);
                    atriumDB.ActivityRow newAc = ace.NewActivity;
                    ace.DocumentDefaults(true);

                    //ace.DoStep(0);

                    //get the document from related fields
                    docDB.DocumentRow dr = (docDB.DocumentRow)ace.relTables["Document0"][0].Row;

                    DocumentBE.LoadFileX(dr, doc);

                    AddListItem("Added document: " + System.IO.Path.GetFileName(doc));
                    ace.Save(true, false);
                    abp.CurrentACE = null;
                }
                else
                {
                    AddListItem("ILLEGAL EXTENSION: " + System.IO.Path.GetFileName(doc));
                }
            }


            if (chkInclude.Checked)
            {
                chkNewFile.Checked = true;
                foreach (string subfile in System.IO.Directory.GetDirectories(file))
                {
                    MakeFile(subfile, fm);
                }
            }
        }
Esempio n. 15
0
        //public ACEngine Add(DateTime acDate, ActivityConfig.ACSeriesRow acSeries, atriumDB.ProcessRow process, bool adHoc, atriumDB.ActivityRow prevAc, string conversationIndex)
        //{
        //    if (myACE != null)
        //        throw new AtriumException("You cannot enter more than one activity at a time on a file.");

        //    myACE = new ACEngine(FM, acDate, acSeries, process, adHoc, conversationIndex, prevAc, ConnectorType.NextStep, null, 0, ACEngine.RevType.Nothing);

        //    return myACE;

        //}

        public ACEngine Add(DateTime acDate, ActivityConfig.ACSeriesRow acSeries, atriumDB.ProcessRow process, bool adHoc, atriumDB.ActivityRow prevAc)
        {
            if (myACE != null)
            {
                throw new AtriumException("You cannot enter more than one activity at a time on a file.");
            }

            myACE = new ACEngine(FM, acDate, acSeries, process, adHoc, null, prevAc, ConnectorType.NextStep, null, 0, ACEngine.RevType.Nothing, null);
            return(myACE);
        }
Esempio n. 16
0
        internal void DoACAllSteps(atriumDB.ActivityRow prevAC, ActivityConfig.ACSeriesRow asr, int revId, ACEngine.RevType revType, DateTime acDate, out ACEngine ace, out atriumDB.ActivityRow newAC, Stack <ParentChildStep> _flowQ, string conversationIndex)
        {
            atriumDB.ProcessRow pr = null;
            if (prevAC != null)
            {
                pr = prevAC.ProcessRow;
            }
            ace     = Add(acDate, asr, pr, false, prevAC, ConnectorType.NextStep, _flowQ, revId, revType, conversationIndex, null);
            ace.ctx = ctx;

            newAC = ace.NewActivity;
            if (ace.HasRel0)
            {
                ace.DoStep(ACEngine.Step.RelatedFields0, true);
            }
            if (ace.HasRel1)
            {
                ace.DoStep(ACEngine.Step.RelatedFields1, true);
            }
            if (ace.HasRel2)
            {
                ace.DoStep(ACEngine.Step.RelatedFields2, true);
            }
            if (ace.HasRel3)
            {
                ace.DoStep(ACEngine.Step.RelatedFields3, true);
            }
            if (ace.HasRel4)
            {
                ace.DoStep(ACEngine.Step.RelatedFields4, true);
            }
            if (ace.HasRel5)
            {
                ace.DoStep(ACEngine.Step.RelatedFields5, true);
            }
            if (ace.HasRel6)
            {
                ace.DoStep(ACEngine.Step.RelatedFields6, true);
            }
            if (ace.HasRel7)
            {
                ace.DoStep(ACEngine.Step.RelatedFields7, true);
            }
            if (ace.HasRel8)
            {
                ace.DoStep(ACEngine.Step.RelatedFields8, true);
            }
            if (ace.HasRel9)
            {
                ace.DoStep(ACEngine.Step.RelatedFields9, true);
            }
            if (ace.HasTimeline)
            {
                ace.DoStep(ACEngine.Step.Timeline, true);
            }

            if (ace.HasDoc & !SkipDoc)
            {
                docDB.DocumentRow dr = (docDB.DocumentRow)ace.relTables["Document0"][0].Row;

                //if (TemplateCode != null) //only set the template if it is provided
                //    dr.templateCode = TemplateCode;

                ace.DocumentDefaults(revId != 0);
                // if (dr.DocContentRow == null)
                //FM.GetDocMng().GetDocContent().Load(dr.DocRefId, dr.CurrentVersion);

                Doc0 = dr.DocContentRow.ContentsAsText;
            }
            else
            {
                ace.FM.GetDocMng().DB.RejectChanges();
                ace.relTables.Remove("Document0");

                ace.NewActivity.SetDocIdNull();
            }
            if (ace.HasBilling)
            {
                ace.DoStep(ACEngine.Step.Billing, true);
            }
        }
Esempio n. 17
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;
            }
        }
Esempio n. 18
0
 private void AutoAC(atriumDB.ActivityRow prevAC, ActivityConfig.ACSeriesRow asr, int revId, ACEngine.RevType revType, bool recurse)
 {
     AutoAC(prevAC, asr, revId, revType, DateTime.Today, null, recurse);
 }
Esempio n. 19
0
        public bool AutoNextStep(atriumDB.ActivityRow activity)
        {
            //TODO:  prevent recursive calls to outofofficereply
            OutOfOfficeReply(activity);

            bool any = false;

            ActivityConfig.ACSeriesRow acsr = FM.AtMng.acMng.DB.ACSeries.FindByACSeriesId(activity.ACSeriesId);
            if (acsr.GetACDependencyRowsByNextSteps().Length == 0)
            {
                ActivityConfig.ACSeriesRow acss = FM.GetActivity().FindParentStep(activity);
                if (acss != null)
                {
                    foreach (ActivityConfig.ACDependencyRow acdr in acss.GetACDependencyRowsByNextSteps())
                    {
                        if (acdr.LinkType == (int)ConnectorType.Auto)
                        {
                            CurrentACE = null;
                            AutoAC(activity, acdr.ACSeriesRowByPreviousSteps, 0, ACEngine.RevType.Nothing);
                            any = true;
                        }
                    }
                }
            }
            else
            {
                foreach (ActivityConfig.ACDependencyRow acdr in acsr.GetACDependencyRowsByNextSteps())
                {
                    if (acdr.LinkType == (int)ConnectorType.Auto)
                    {
                        if (acdr.ACSeriesRowByPreviousSteps.StepType == (int)StepType.Decision && acdr.ACSeriesRowByPreviousSteps.GetActivityFieldRows().Length > 0)
                        {
                            //handle auto-steps that go to internal decisions
                            //only handles one level and must be a single path

                            bool ok = CurrentACE.SillyQuestion(acdr.ACSeriesRowByPreviousSteps);
                            foreach (ActivityConfig.ACDependencyRow acdrAnswr in acdr.ACSeriesRowByPreviousSteps.GetACDependencyRowsByNextSteps())
                            {
                                if ((ok && acdrAnswr.DescEng == "Yes") | (!ok && acdrAnswr.DescEng == "No"))
                                {
                                    ActivityConfig.ACSeriesRow acs_auto = acdrAnswr.ACSeriesRowByPreviousSteps;
                                    CurrentACE = null;
                                    AutoAC(activity, acs_auto, 0, ACEngine.RevType.Nothing);
                                    any = true;
                                }
                            }
                        }
                        else
                        {
                            CurrentACE = null;
                            AutoAC(activity, acdr.ACSeriesRowByPreviousSteps, 0, ACEngine.RevType.Nothing);
                            any = true;
                        }
                    }
                }
            }

            CurrentACE = null;

            return(any);
        }
Esempio n. 20
0
        public ACEngine Add(DateTime acDate, ActivityConfig.ACSeriesRow acSeries, atriumDB.ProcessRow process, bool adHoc, atriumDB.ActivityRow prevAc, ConnectorType action, Stack <ParentChildStep> _flowQ, int revId, ACEngine.RevType revType, string conversationIndex, DataRow contextRow)
        {
            //if (_flowQ != null)
            //    flowQ = _flowQ;
            if (myACE != null)
            {
                throw new AtriumException("You cannot enter more than one activity at a time on a file.");
            }

            ConnectorType ct;

            if (action == ConnectorType.Reply | action == ConnectorType.ReplyAll | action == ConnectorType.Forward)
            {
                ct = action;
            }
            else
            {
                ct = ConnectorType.NextStep;
            }
            myACE = new ACEngine(FM, acDate, acSeries, process, adHoc, conversationIndex, prevAc, ct, _flowQ, revId, revType, contextRow);
            return(myACE);
        }
Esempio n. 21
0
        private void CreateDocument(FileManager fm, ActivityBP abp, string lotusDocId, string documentPath, string docSubject, DateTime docDate, List <string> listOfDocAttachments)
        {
            string ext = System.IO.Path.GetExtension(documentPath);

            docDB.FileFormatRow fmt = fm.GetDocMng().DB.FileFormat.FindByFileFormat(ext);

            if (fmt != null && fmt.AllowUpload)
            {
                iCount++;
                ACEngine             ace   = abp.Add(docDate, acsr, null, false, null);
                atriumDB.ActivityRow newAc = ace.NewActivity;
                ace.DocumentDefaults(true);

                docDB.DocumentRow dr = (docDB.DocumentRow)ace.relTables["Document0"][0].Row;

                DocumentBE.LoadFileX(dr, documentPath);

                dr.efSubject = docSubject;
                dr.efDate    = docDate;
                dr.Source    = "Lotus: " + lotusDocId;
                dr.IsDraft   = false;
                AddListItem("Document added: " + System.IO.Path.GetFileName(documentPath));

                if (listOfDocAttachments.Count > 0)
                {
                    DocManager            myDM = fm.GetDocMng();
                    atriumBE.AttachmentBE d    = myDM.GetAttachment();

                    foreach (string attachment in listOfDocAttachments)
                    {
                        string localAttach = attachment;
                        string attExt      = Path.GetExtension(localAttach);
                        if (attExt.Length > 10)
                        {
                            attExt = attExt.Substring(0, 10);
                            //modify extension on disk
                            File.Move(attachment, Path.ChangeExtension(attachment, attExt));
                            localAttach = Path.Combine(Path.GetDirectoryName(attachment), Path.GetFileNameWithoutExtension(attachment) + attExt);
                        }

                        //if extension is empty, modify doc extension
                        //.LONOEXT
                        if (string.IsNullOrEmpty(attExt))
                        {
                            AddExtensionToDocWithoutExt(attachment);
                            attExt      = ".LONOEXT";
                            localAttach = localAttach + attExt;
                        }

                        docDB.FileFormatRow attFmt = fm.GetDocMng().DB.FileFormat.FindByFileFormat(attExt);

                        //if extension not allowed, add it
                        if (attFmt == null)
                        {
                            AddExtensionToFileFormatTable(attExt, fm.GetDocMng().DB.FileFormat);
                            attFmt = fm.GetDocMng().DB.FileFormat.FindByFileFormat(attExt);
                        }

                        if (attFmt != null && attFmt.AllowUpload)
                        {
                            docDB.DocumentRow newDoc = (docDB.DocumentRow)myDM.GetDocument().Add(myDM.FM.CurrentFile, localAttach);

                            int indexOfSpaceInAttachment = localAttach.IndexOf(' ') - 1;

                            newDoc.efSubject = Path.GetFileNameWithoutExtension(localAttach).Substring(indexOfSpaceInAttachment).TrimStart(' '); //atts start with 6 digit lotus docNumber + space; let's remove that before import
                            newDoc.efType    = "ATT";
                            newDoc.IsDraft   = false;
                            newDoc.efDate    = newDoc.DocContentRow.ModDate;
                            newDoc.Source    = "Lotus: " + lotusDocId;

                            lmDatasets.docDB.AttachmentRow att = (lmDatasets.docDB.AttachmentRow)d.Add(dr);
                            att.AttachmentId = newDoc.DocId;
                            att.Version      = newDoc.CurrentVersion;
                            AddListItem("Attachment added: " + System.IO.Path.GetFileName(localAttach));
                        }
                        else
                        {
                            AddListItem("Attachment - Extension not permitted: " + System.IO.Path.GetFileName(localAttach));
                            ExtTW.WriteLine(attExt + ", " + localAttach);
                        }
                    }
                }

                ace.Save(true, false);
                abp.CurrentACE = null;
            }
            else
            {
                AddListItem("Extension not permitted: " + System.IO.Path.GetFileName(documentPath));
                ExtTW.WriteLine(ext + ", " + documentPath);
            }
        }
Esempio n. 22
0
        public void LoadTOC()
        {
            pnlDockTop.Height = defaultTopHeight;
            if (fmCurrent.DB.FileXRef.Select("LinkType=0 and fileid=" + fmCurrent.CurrentFileId.ToString()).Length > 0)
            {
                pnlBrowseFiles.Enabled = true;
            }
            else
            {
                pnlBrowseFiles.Enabled = false;
            }

            if (fmCurrent.DB.FileXRef.Select("LinkType=1").Length > 0 || fmCurrent.DB.FileXRef.Select("LinkType=2 and fileid=" + fmCurrent.CurrentFileId).Length > 0)
            {
                pnlXRefs.Enabled = true;
            }
            else
            {
                pnlXRefs.Enabled = false;
            }

            SetTooltipsForLinks();
            SetFileStatusColor(fmCurrent.CurrentFile.StatusCode);

            officeDB.OfficeRow orOwnerOffice = null;
            try
            {
                orOwnerOffice              = fmCurrent.AtMng.GetOffice(fmCurrent.CurrentFile.OwnerOfficeId).CurrentOffice;
                lnkJumpToOwnerFile.Tag     = orOwnerOffice.OfficeFileId;
                lnkJumpToOwnerFile.Enabled = (orOwnerOffice.OfficeFileId != fileId);
            }
            catch (Exception xoo)
            {
                lnkJumpToOwnerFile.Enabled = false;
            }

            officeDB.OfficeRow orLeadOffice = null;
            if (!fmCurrent.CurrentFile.IsLeadOfficeIdNull())
            {
                try
                {
                    orLeadOffice = fmCurrent.AtMng.GetOffice(fmCurrent.CurrentFile.LeadOfficeId).CurrentOffice;
                    lnkJumpToLeadFile.Visible = true;
                    lnkJumpToLeadFile.Tag     = orLeadOffice.OfficeFileId;
                    lnkJumpToLeadFile.Enabled = (orLeadOffice.OfficeFileId != fileId);
                }
                catch (Exception xlo)
                {
                    lnkJumpToLeadFile.Enabled = false;
                }
            }
            else
            {
                lnkJumpToLeadFile.Visible = false;
            }

            if (!fmCurrent.CurrentFile.IsFullFileNumberNull())
            {
                lblFullNumberValue.Text = fmCurrent.CurrentFile.FullFileNumber;
            }
            else
            {
                lblFullNumberValue.Text = "";
            }

            lblFilenameValue.Text = fmCurrent.CurrentFile.Name;

            atriumDB.ActivityRow ar = fmCurrent.GetActivity().GetCurrentCaseStatus(DateTime.Today.AddDays(100));
            int csId = 0;

            if (ar != null)
            {
                csId = ar.CaseStatusId;
                lblStatusDateValue.Text = ar.ActivityDate.ToString("yyyy/MM/dd");
            }
            else
            {
                lblStatusDateValue.Text = "N/A";
            }

            // WI 75873
            DataRow drProgram = null;

            if (programId > 0)
            {
                DataTable dt = Atmng.GetFile().Codes("Dim2");
                DataRow[] dr = dt.Select("ProgramId = " + programId.ToString());
                drProgram = dr[0];

                appDB.ddLookupRow dlr = (appDB.ddLookupRow)Atmng.DB.ddLookup.Select("LookupName='Dim2'")[0];
                lblProgram.Text = dlr["Description" + Atmng.AppMan.Language].ToString();
            }
            else
            {
                lblProgram.Visible      = false;
                lblProgramValue.Visible = false;
                pnlDockTop.Height      -= defaultRowHeight;
            }
            // -- End // WI 75873

            //Shared Folder START
            lblSharedFolder.Visible = false;
            lnkSharedFolder.Visible = false;
            string sharedPath = string.Empty;

            if (programId == 3)
            {
                sharedPath = Atmng.GetSetting(AppStringSetting.DataExchangeNetworkPath) + fmCurrent.CurrentFile.FullFileNumber.Replace("-", @"\");
            }
            else if (programId == 2)
            {
                sharedPath = Atmng.GetSetting(AppStringSetting.ISDataExchangeNetworkPath) + fmCurrent.CurrentFile.FullFileNumber.Replace("-", @"\");
            }

            if (sharedPath != string.Empty && System.IO.Directory.Exists(sharedPath))
            {
                lnkSharedFolder.Text    = sharedPath;
                lblSharedFolder.Visible = true;
                lnkSharedFolder.Visible = true;
            }
            else
            {
                pnlDockTop.Height -= defaultRowHeight;
            }
            //Shared Folder END

            lblTypeValue.Text       = fmCurrent.AtMng.CodeDB.FileType.FindByFileTypeCode(fmCurrent.CurrentFile.FileType)["FileTypeDesc" + Atmng.AppMan.languageCamel].ToString();
            lblStatusValue.Text     = fmCurrent.AtMng.CodeDB.Status.FindByStatusCode(fmCurrent.CurrentFile.StatusCode)["StatusDesc" + Atmng.AppMan.languageCamel].ToString();
            lblCaseStatusValue.Text = fmCurrent.AtMng.CodeDB.CaseStatus.FindByCaseStatusId(csId)["CaseStatusDesc" + Atmng.AppMan.languageCamel].ToString();
            if (drProgram != null)
            {
                lblProgramValue.Text = (string)drProgram["ProgramDescription" + Atmng.AppMan.languageCamel].ToString();
            }

            if (orOwnerOffice != null)
            {
                setOfficeTooltip(lnkJumpToOwnerFile, orOwnerOffice);
            }
            if (orLeadOffice != null)
            {
                setOfficeTooltip(lnkJumpToLeadFile, orLeadOffice);
            }

            //CLAS
            if (fmCurrent.GetCLASMng() != null && !fmCurrent.CurrentFile.IsOpponentIDNull())
            {
                lmDatasets.CLAS.DebtorRow orDB = fmCurrent.GetCLASMng().GetDebtor().FindLoad(fmCurrent.CurrentFile.OpponentID);

                if (!orDB.IsNull("SIN"))
                {
                    lblSINValue.Text = atriumBE.DebtorBE.FormattedSIN(orDB.SIN);
                }
                else
                {
                    lblSINValue.Text = "";
                }

                lnkSINLabel.Visible = true;
                lblSINValue.Visible = true;

                if (!fmCurrent.CurrentFile.IsLeadParalegalIDNull())
                {
                    lmDatasets.officeDB.OfficerRow orPL = fmCurrent.AtMng.GetOffice(fmCurrent.CurrentFile.OwnerOfficeId).GetOfficer().FindLoad(fmCurrent.CurrentFile.LeadParalegalID);
                    lblParaLegalValue.Text    = orPL.LastName + ", " + orPL.FirstName + " (" + orPL.OfficerCode + ")";
                    lblParalegal.Visible      = true;
                    lblParaLegalValue.Visible = true;
                }
                else
                {
                    lblParaLegalValue.Text    = "";
                    lblParalegal.Visible      = false;
                    lblParaLegalValue.Visible = false;
                }
            }
            else
            {   //no CLAS; hide row
                lnkSINLabel.Visible       = false;
                lblSINValue.Visible       = false;
                lblParalegal.Visible      = false;
                lblParaLegalValue.Visible = false;
                pnlDockTop.Height        -= defaultRowHeight;
            }

            ParentFile.uiPanel0.Text = fmCurrent.CurrentFile.Name;
            ucBrowse1.FileContextMenu.UsedInTreeView = false;

            if (fmCurrent.CurrentFile.FileStructXml != null)
            {
                tvContents.Nodes.Clear();
                System.Xml.XmlDocument xdToc = new System.Xml.XmlDocument();
                xdToc.InnerXml = fmCurrent.CurrentFile.FileStructXml;
                LoadTOCNode(tvContents.Nodes, xdToc.DocumentElement);
                tvContents.ExpandAll();
                tvContents.Nodes[0].EnsureVisible();
            }
        }