private void InternalDecisionRule(ActivityConfig.ACSeriesRow acsr) { if (acsr.StepType == (int)StepType.Decision && acsr.GetActivityFieldRows().Length > 0) { //make sure connectors are Yes and No foreach (ActivityConfig.ACDependencyRow acdr in acsr.GetACDependencyRowsByNextSteps()) { if (acdr.DescEng == "Yes" || acdr.DescEng == "No") { //good } else { AddValidationRecord(acsr, ValidationType.Error, "Internal decision has invalid answer descriptions"); } if (acdr.DescFre == "Oui" || acdr.DescFre == "Non") { //good } else { AddValidationRecord(acsr, ValidationType.Error, "Internal decision has invalid answer descriptions"); } } } }
private void ConnectorRules(ActivityConfig.ACSeriesRow acsr) { foreach (ActivityConfig.ACDependencyRow acdr in acsr.GetACDependencyRowsByNextSteps()) { if (!acsr.SeriesRow.OncePerFile & !acsr.SeriesRow.SingleInstancePerFile & acdr.LinkType == (int)ConnectorType.Transfer) { AddValidationRecord(acsr, ValidationType.Error, "You cannot use a 'Transfer' connector in a series that is not single instance or once per file."); } } }
public ActivityConfig.ACSeriesRow GetAutoStep(ActivityConfig.ACSeriesRow acs) { foreach (lmDatasets.ActivityConfig.ACDependencyRow acdr in acs.GetACDependencyRowsByNextSteps()) { if (acdr.LinkType == (int)atriumBE.ConnectorType.Auto) { return(acdr.ACSeriesRowByPreviousSteps); } } return(null); }
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); }
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); }