/// <summary> /// Compare Datastructure with Submited Variables /// And create a Dictionary of ValueValidationmanagers /// </summary> /// <remarks></remarks> /// <param name="row"></param> /// <returns></returns> public List <Error> ValidateComparisonWithDatatsructure(List <VariableIdentifier> variableIdentifers) { List <Error> errors = new List <Error>(); try { List <VariableIdentifier> source = getDatastructureVariableIdentifiers(); DatastructureMatchCheck dmc = new DatastructureMatchCheck(); errors = dmc.Execute(SubmitedVariableIdentifiers, source, this.StructuredDataStructure.Name); } catch { } if (errors == null) { for (int i = 0; i < variableIdentifers.Count; i++) { VariableIdentifier hv = variableIdentifers.ElementAt(i); if (hv != null) { Variable sdvu = getVariableUsage(hv); if (sdvu != null) { string varName = sdvu.Label; bool optional = sdvu.IsValueOptional; string dataType = sdvu.DataAttribute.DataType.SystemType; // change parameters to only sdvu this.ValueValidationManagerDic.Add(sdvu.Id, createValueValidationManager(varName, dataType, optional, sdvu.DataAttribute)); } else { errors.Add(new Error(ErrorType.Datastructure, "Error with name of Variable")); } } }//for } else { if (errors.Count > 0) { return(errors); } else { return(null); } } return(null); }
/// <summary> /// Compare Datastructure with Submited Variables /// And create a Dictionary of ValueValidationmanagers /// </summary> /// <remarks></remarks> /// <param name="row"></param> /// <returns></returns> public List <Error> ValidateComparisonWithDatatsructure(List <VariableIdentifier> variableIdentifers) { List <Error> matchErrors = new List <Error>(); List <Error> orderErrors = new List <Error>(); List <Error> errors = new List <Error>(); try { List <VariableIdentifier> source = getDatastructureVariableIdentifiers(); //check if all variables exist in the incoming and the existing datastructure DatastructureMatchCheck dmc = new DatastructureMatchCheck(); matchErrors = dmc.Execute(SubmitedVariableIdentifiers, source, this.StructuredDataStructure.Name); // check the equivalent order of the strutcures DatastructureOrderCheck dso = new DatastructureOrderCheck(); orderErrors = dso.Execute(SubmitedVariableIdentifiers, source, this.StructuredDataStructure.Name); sameOrderLikeStructure = orderErrors == null ? true : false; if (matchErrors != null) { errors.AddRange(matchErrors); } if (orderErrors != null) { errors.AddRange(orderErrors); } } catch { } if (!errors.Any()) { for (int i = 0; i < variableIdentifers.Count; i++) { VariableIdentifier hv = variableIdentifers.ElementAt(i); if (hv != null) { Variable sdvu = getVariableUsage(hv); if (sdvu != null) { string varName = sdvu.Label; bool optional = sdvu.IsValueOptional; string dataType = sdvu.DataAttribute.DataType.SystemType; // change parameters to only sdvu if (!this.ValueValidationManagerDic.ContainsKey(sdvu.Id)) { this.ValueValidationManagerDic.Add(sdvu.Id, createValueValidationManager(varName, dataType, optional, sdvu)); } } else { errors.Add(new Error(ErrorType.Datastructure, "Error with name of Variable")); } } }//for } else { if (errors.Count > 0) { return(errors); } else { return(null); } } return(null); }
/// <summary> /// Compare Datastructure with Submited Variables /// And create a Dictionary of ValueValidationmanagers /// </summary> /// <remarks></remarks> /// <param name="row"></param> /// <returns></returns> public List<Error> ValidateComparisonWithDatatsructure(List<VariableIdentifier> variableIdentifers) { List<Error> errors = new List<Error>(); try { List<VariableIdentifier> source = getDatastructureVariableIdentifiers(); DatastructureMatchCheck dmc = new DatastructureMatchCheck(); errors = dmc.Execute(SubmitedVariableIdentifiers, source, this.StructuredDataStructure.Name); } catch { } if (errors == null) { for (int i = 0; i < variableIdentifers.Count; i++) { VariableIdentifier hv = variableIdentifers.ElementAt(i); if (hv != null) { Variable sdvu = getVariableUsage(hv); if (sdvu != null) { string varName = sdvu.Label; bool optional = sdvu.IsValueOptional; string dataType = sdvu.DataAttribute.DataType.SystemType; // change parameters to only sdvu this.ValueValidationManagerDic.Add(sdvu.Id, createValueValidationManager(varName, dataType, optional, sdvu.DataAttribute)); } else { errors.Add(new Error(ErrorType.Datastructure, "Error with name of Variable")); } } }//for } else { if (errors.Count > 0) return errors; else return null; } return null; }