private void gridEX1_LinkClicked(object sender, Janus.Windows.GridEX.ColumnActionEventArgs e) { try { if (e.Column.Key == "AcSeriesHelp") { DataRow dr = (DataRow)((DataRowView)gridEX1.GetRow().DataRow).Row; if (dr["AcSeriesDeskbookLink"].ToString() == Properties.Resources.mHelp) { ActivityConfig.ACSeriesRow acsr = (ActivityConfig.ACSeriesRow)UIHelper.AtMng.acMng.DB.ACSeries.FindByACSeriesId(CurrentAcSeriesId()); fTriangle HelpTriangle = new fTriangle(acsr, UIHelper.AtMng); HelpTriangle.Show(); } } if (e.Column.Key == "SeriesHelp") { DataRow dr = (DataRow)((DataRowView)gridEX1.GetRow().DataRow).Row; if (dr["SeriesDeskbookLink"].ToString() == Properties.Resources.mHelp) { ActivityConfig.SeriesRow asr = (ActivityConfig.SeriesRow)UIHelper.AtMng.acMng.DB.Series.FindBySeriesId(CurrentSeriesId()); fTriangle HelpTriangle = new fTriangle(asr, UIHelper.AtMng); HelpTriangle.Show(); } } } catch (Exception x) { UIHelper.HandleUIException(x); } }
protected override void AfterAdd(DataRow dr) { ActivityConfig.SeriesRow acr = (ActivityConfig.SeriesRow)dr; acr.SeriesId = myA.AtMng.PKIDGet("Series", 1); acr.CreatesFile = false; acr.OncePerFile = false; acr.ConfirmMultipleInstance = false; acr.SingleInstancePerFile = false; acr.Obsolete = false; acr.AllowMove = false; acr.AlwaysAvailable = false; //acr.ContainerFileId = 1; acr.SeriesDescEng = "Enter series description..."; acr.SeriesDescFre = "Enter series description..."; }
protected override void AfterChange(DataColumn dc, DataRow ddr) { ActivityConfig.SeriesRow dr = (ActivityConfig.SeriesRow)ddr; switch (dc.ColumnName) { case SeriesFields.SeriesDescEng: if (dr.IsNull("SeriesDescFre")) { dr.SeriesDescFre = dr.SeriesDescEng; dr.EndEdit(); } break; case "NameFormatE": if (dr.IsNull("NameFormatF")) { dr.NameFormatF = dr.NameFormatE; dr.EndEdit(); } break; case SeriesFields.SeriesDescFre: if (dr.IsNull("SeriesDescEng")) { dr.SeriesDescEng = dr.SeriesDescFre; dr.EndEdit(); } break; case "NameFormatF": if (dr.IsNull("NameFormatE")) { dr.NameFormatE = dr.NameFormatF; dr.EndEdit(); } break; } }
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); }
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; } } } } }
public void Draw(ActivityConfig.SeriesRow workflow) { mySeries = workflow; Reset(); curPoint = new Point(10, 30); maxX = 0; maxY = 0; int countOfStarts = 0; foreach (lmDatasets.ActivityConfig.ACSeriesRow acs in workflow.GetACSeriesRows()) { if (HideObsolete & acs.Obsolete) { } else { bool isStart = UIHelper.AtMng.acMng.GetACSeries().IsStart(acs); if (isStart) { Start s1 = new Start(this); myOtherSteps.Add(s1); maxY = countOfStarts; curPoint.Y = maxY * DefaultHeightGap + 30; Point checkAheadPoint = new Point(curPoint.X + DefaultWidthGap + 60, curPoint.Y + 27); while (HitStep(checkAheadPoint) != null) { countOfStarts++; maxY++; curPoint.Y = maxY * DefaultHeightGap + 30; checkAheadPoint = new Point(curPoint.X + DefaultWidthGap + 60, curPoint.Y + 27); } s1.Draw(curPoint); s1.gridX = maxX; s1.gridY = maxY; curPoint.X = 50; if (!acs.Start) { acs.Start = true; } AddStep(acs); AddConnector(s1, mySteps[GetStepKey(acs)]); curPoint.X = 10; maxX = 0; if (SelectedStep == null & SelectedConnector == null) { SelectStep(mySteps[GetStepKey(acs)]); } maxY++; countOfStarts++; } else { //check to see if it is not a start if (acs.Start) { acs.Start = false; } } } } drawingSurface.Clear(drawingSurfaceBGColor); Refresh(); }
public string GetNodeText(ActivityConfig.ACSeriesRow acsr, StepType st, bool multiLine) { string newLine = " "; if (multiLine) { newLine = Environment.NewLine; } string acsrDesc = ""; string acText = "", acSeriesText = ""; string acQuestion = ""; ActivityConfig.SeriesRow ssr = null; if (!acsr.IsSubseriesIdNull()) { ssr = myA.DB.Series.FindBySeriesId(acsr.SubseriesId); } if (myA.AppMan.Language.ToUpper() == "ENG") { //acText = "AC " + acsr.ActivityCodeRow.ActivityCode; //if (!acsr.IsSuffixNull()) acText = acsr.ActivityCodeRow.ActivityNameEng; if (acsr.DescEng.Length > 0) { acText += ": " + acsr.DescEng; } acText += newLine + " (" + acsr.StepCode + ")"; acsrDesc = acsr.DescEng; //acText = acsr.StepCode; //acText += newLine + acsr.ActivityCodeRow.ActivityNameEng; //acsrDesc = acsr.DescEng; //if(acsr.DescEng.Length>0) // acText += " - " + acsr.DescEng; if (multiLine) { acQuestion = acsr.StepCode + newLine + acsr.DescEng; } else { acQuestion = acsrDesc; } if (ssr != null) { acSeriesText = ssr.SeriesDescEng; } } else { //acText = "AC " + acsr.ActivityCodeRow.ActivityCode; //if (!acsr.IsSuffixNull()) acText = acsr.ActivityCodeRow.ActivityNameFre; if (acsr.DescFre.Length > 0) { acText += " : " + acsr.DescFre; } acText += newLine + " (" + acsr.StepCode + ")"; acsrDesc = acsr.DescFre; //acText = acsr.StepCode; //acText += newLine + acsr.ActivityCodeRow.ActivityNameFre; //acsrDesc = acsr.DescFre; //acText += " : " + acsr.DescFre; if (multiLine) { acQuestion = acsr.StepCode + newLine + acsr.DescFre; } else { acQuestion = acsrDesc; } if (ssr != null) { acSeriesText = ssr.SeriesDescFre; } } switch (st) { case StepType.Subseries: return(acSeriesText); case StepType.Branch: case StepType.Merge: case StepType.NonRecorded: case StepType.Move: case StepType.Convert: case StepType.Rule: case StepType.Action: return(acsrDesc); case StepType.Decision: return(acQuestion); default: return(acText); } }
public DataTable Validate(ActivityConfig.SeriesRow sr) { return(null); }
public ActivityConfig.SeriesRow Clone(ActivityConfig.SeriesRow oldSeries) { //copy series row ActivityConfig.SeriesRow newSeries = mySeriesDT.NewSeriesRow(); newSeries.ItemArray = oldSeries.ItemArray; mySeriesDT.AddSeriesRow(newSeries); newSeries.CreatesFile = oldSeries.CreatesFile; newSeries.OncePerFile = oldSeries.OncePerFile; newSeries.ConfirmMultipleInstance = oldSeries.ConfirmMultipleInstance; newSeries.SingleInstancePerFile = oldSeries.SingleInstancePerFile; newSeries.Obsolete = oldSeries.Obsolete; newSeries.ContainerFileId = 0; newSeries.SeriesDescEng = "Copy of " + newSeries.SeriesDescEng; newSeries.SeriesDescFre = "Copie de " + newSeries.SeriesDescFre; System.Collections.Generic.Dictionary <int, int> concordance = new System.Collections.Generic.Dictionary <int, int>(); //copy acseries rows foreach (ActivityConfig.ACSeriesRow acsr in oldSeries.GetACSeriesRows()) { ActivityConfig.ACSeriesRow newAcsr = myA.DB.ACSeries.NewACSeriesRow(); newAcsr.ItemArray = acsr.ItemArray; newAcsr.SeriesId = newSeries.SeriesId; myA.DB.ACSeries.AddACSeriesRow(newAcsr); concordance.Add(acsr.ACSeriesId, newAcsr.ACSeriesId); newAcsr.Finish = acsr.Finish; newAcsr.Start = acsr.Start; newAcsr.OnceOnly = acsr.OnceOnly; newAcsr.Seq = acsr.Seq; newAcsr.InitialStep = acsr.InitialStep; newAcsr.StepType = acsr.StepType; myA.GetACSeries().ReplaceRelFields(newAcsr, acsr, true); //foreach (ActivityConfig.ACConvertRow accr in acsr.GetACConvertRowsByACSeries_ACConvert()) //{ // lmDatasets.ActivityConfig.ACConvertRow newAcc = myA.DB.ACConvert.NewACConvertRow(); // newAcc.ItemArray = accr.ItemArray; // newAcc.ACSeriesId = accr.ACSeriesId; // myA.DB.ACConvert.AddACConvertRow(newAcc); //} } foreach (ActivityConfig.ACSeriesRow acsr in oldSeries.GetACSeriesRows()) { foreach (ActivityConfig.ACDependencyRow acdr in acsr.GetACDependencyRowsByNextSteps()) { lmDatasets.ActivityConfig.ACDependencyRow newAcd = myA.DB.ACDependency.NewACDependencyRow(); newAcd.ItemArray = acdr.ItemArray; newAcd.CurrentStepId = concordance[acdr.CurrentStepId]; if (concordance.ContainsKey(acdr.NextStepId)) { newAcd.NextStepId = concordance[acdr.NextStepId]; } else { newAcd.NextStepId = acdr.NextStepId; } myA.DB.ACDependency.AddACDependencyRow(newAcd); newAcd.LinkType = acdr.LinkType; if (!acdr.IsDescEngNull()) { newAcd.DescEng = acdr.DescEng; } if (!acdr.IsDescFreNull()) { newAcd.DescFre = acdr.DescFre; } } } return(newSeries); }