public void ReplaceRelFields(ActivityConfig.ACSeriesRow asr, ActivityConfig.ACSeriesRow tempAC, bool ReplaceValues) { //delete ac field if (ReplaceValues) { foreach (ActivityConfig.ActivityFieldRow afrOld in asr.GetActivityFieldRows()) { afrOld.Delete(); } } //this works if all the rel fields are for the same object //TODO:this fails if there are no activity field rows - why do we need the max instance //int instance=myA.GetActivityField().InstanceMax(asr,tempAC.GetActivityFieldRows()[0].ObjectName); //clone acfield reocrds ActivityConfig.ActivityFieldRow[] arfs = (ActivityConfig.ActivityFieldRow[])myA.DB.ActivityField.Select("ACSeriesId=" + tempAC.ACSeriesId, "Step,Seq"); foreach (lmDatasets.ActivityConfig.ActivityFieldRow arf in arfs) { lmDatasets.ActivityConfig.ActivityFieldRow newArf = myA.DB.ActivityField.NewActivityFieldRow(); newArf.ItemArray = arf.ItemArray; newArf.ACSeriesId = asr.ACSeriesId; myA.DB.ActivityField.AddActivityFieldRow(newArf); newArf.Seq = arf.Seq; newArf.Step = arf.Step; newArf.TaskType = arf.TaskType; //newArf.Instance = arf.Instance;// instance; newArf.Visible = arf.Visible; newArf.Required = arf.Required; newArf.ReadOnly = arf.ReadOnly; newArf.ObjectAlias = arf.ObjectAlias; } }
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"); } } } }
public int InstanceMax(ActivityConfig.ACSeriesRow acsr, string oName) { int InstanceCount = -1; foreach (lmDatasets.ActivityConfig.ActivityFieldRow afr in acsr.GetActivityFieldRows()) { if (!afr.IsNull("ObjectName") && afr.ObjectName == oName && afr.Instance > InstanceCount) { InstanceCount = afr.Instance; } } return(InstanceCount + 1); }
private void TemplateRule(ActivityConfig.ACSeriesRow acsr) { bool hasDoc = false; bool templateHookedUp = false; bool isEmail = false; bool languageSpecified = false; bool templateExists = false; foreach (lmDatasets.ActivityConfig.ActivityFieldRow afr in acsr.GetActivityFieldRows()) { //If StepTemplate is "isEmail", doc template must be hooked up if (acsr.ActivityCodeRow.Communication) { isEmail = true; } if (!afr.IsNull("ObjectName") && afr.ObjectName.ToUpper() == "DOCUMENT" && afr.FieldName.ToUpper() == "TEMPLATECODE") { hasDoc = true; templateHookedUp = true; languageSpecified = TemplateLanguageNotSpecified(acsr); if (afr.IsDefaultValueNull()) { AddValidationRecord(acsr, ValidationType.Warning, "Related Fields reference a blank template code."); } else { templateExists = TemplateExists(afr.DefaultValue); } } } if (isEmail && !templateHookedUp) //add error row { AddValidationRecord(acsr, ValidationType.Error, "Step is intended to be an e-mail, yet a template is not hooked up in Related Fields"); } if (hasDoc && !languageSpecified) { AddValidationRecord(acsr, ValidationType.Warning, "Step has a document, yet the language is not set through Related Fields."); } if (hasDoc && !templateExists) { AddValidationRecord(acsr, ValidationType.Error, "Related Fields reference a template code that does not exist."); } }
//If StepTemplate has template, is language specified? private bool TemplateLanguageNotSpecified(ActivityConfig.ACSeriesRow acsr) { bool languageSpecified = false; foreach (lmDatasets.ActivityConfig.ActivityFieldRow afr in acsr.GetActivityFieldRows()) { if (!afr.IsNull("ObjectName") && afr.ObjectName.ToUpper() == "DOCUMENT" && afr.FieldName.ToUpper() == "LANGUAGECODE") { if (!afr.IsDefaultValueNull() || (!afr.IsDefaultObjectNameNull() && !afr.IsDefaultFieldNameNull())) { languageSpecified = true; break; } } } return(languageSpecified); }
private void ucActivity_ASelectedValueChanged(object sender, EventArgs e) { try { //check to see if step has templates ActivityConfig.ACSeriesRow acsr = SelectedACSeries(); ACEngine ace = new ACEngine(fmCurrent); ace.TestForSteps(acsr.ACSeriesId); if (ace.HasDoc & ace.TemplateList != null) { uiTemplate.Enabled = true; UIHelper.ComboBoxInit(ace.TemplateList, uiTemplate, fmCurrent); } else { uiTemplate.Enabled = false; uiTemplate.SelectedValue = null; } //check for fields that require prompting ctx = new Dictionary <string, object>(); foreach (ActivityConfig.ActivityFieldRow afr in acsr.GetActivityFieldRows()) { if (afr.TaskType == "F" & afr.Visible & !afr.ReadOnly & afr.IsDefaultObjectNameNull() & (afr.IsDefaultValueNull() || !afr.DefaultValue.StartsWith("["))) { ctx.Add(afr.ObjectAlias + afr.FieldName, null); } } if (ctx.Count == 0) { ctx = null; } } catch (Exception x) { UIHelper.HandleUIException(x); } }