public List<Error> ValidateRow(List<string> row, int indexOfRow)
{
List<Error> errors = new List<Error>();
// number of variables in datastructure
int numOfVariables = this.StructuredDataStructure.Variables.Count();
// number of current row values
int rowCount = row.Count();
// number of is equal
if (numOfVariables.Equals(rowCount))
{
int valuePosition = 0;
foreach (string v in row)
{
try
{
VariableIdentifier hv = SubmitedVariableIdentifiers.ElementAt(row.IndexOf(v));
Variable sdvu = getVariableUsage(hv);
ValueValidationManager validationManager = ValueValidationManagerDic[sdvu.Id];
List<Error> temp = new List<Error>();
// returns the checked value and update the error list if error appears
object value = validationManager.CheckValue(v, indexOfRow,ref temp);
if (temp.Count == 0)
{
temp = validationManager.ValidateValue(v, indexOfRow);
// check Constraints
foreach (Constraint constraint in sdvu.DataAttribute.Constraints)
{
//new Error(ErrorType.Value, "Not in Range", new object[] { name, value, row, dataType });
if (!constraint.IsSatisfied(value))
temp.Add(new Error(ErrorType.Value, constraint.ErrorMessage, new object[] { sdvu.Label, value, indexOfRow, sdvu.DataAttribute.DataType.Name }));
}
}
if (temp != null) errors = errors.Union(temp).ToList();
valuePosition++;
}
catch
{
//test
if (true)
{
}
}
}
}
// different value lenght
else
{
Error e = new Error(ErrorType.Other, "Number of Values different as number of variables");
errors.Add(e);
}
NumberOfRows++;
return errors;
}