public static GlobalAppModelParameter DuplicateAppModelParamAsGlobal(AppModelParameter appModelParameter) { GlobalAppModelParameter globalParam = new GlobalAppModelParameter(); globalParam.Guid = appModelParameter.Guid; globalParam.PlaceHolder = appModelParameter.PlaceHolder; globalParam.Description = appModelParameter.Description; globalParam.Path = appModelParameter.Path; globalParam.ExecutionValue = appModelParameter.ExecutionValue; foreach (OptionalValue ov in appModelParameter.OptionalValuesList) { OptionalValue newOV = new OptionalValue(); newOV.Guid = ov.Guid; newOV.Value = ov.Value; newOV.IsDefault = ov.IsDefault; globalParam.OptionalValuesList.Add(newOV); } bool isOptionalValuesEmpty = globalParam.OptionalValuesList.Count == 0; globalParam.OptionalValuesList.Add(new OptionalValue() { Value = GlobalAppModelParameter.CURRENT_VALUE, IsDefault = isOptionalValuesEmpty }); return(globalParam); }
public void PopulateOptionalValuesByTuple(AppModelParameter AMP, Dictionary <Tuple <string, string>, List <string> > OptionalValuesPerParameterDict, Tuple <string, string> tuple) { foreach (string Value in OptionalValuesPerParameterDict[tuple]) { OptionalValue OptionalValueExist = AMP.OptionalValuesList.Where(x => x.Value == Value).FirstOrDefault(); if (OptionalValueExist == null) { OptionalValue OptionalValue = new OptionalValue() { Value = Value }; if (AMP.OptionalValuesList.Count == 0) { OptionalValue.IsDefault = true; } AMP.OptionalValuesList.Add(OptionalValue); ParameterValuesUpdated = true; } } }