public void AnalyzeItems(ExternalResource source, List <ExternalColumnComparer <String, Int32> > DBvalidateFields, List <ExternalColumnComparer <String, Int32> > notEmptyColumns, List <ExternalColumnComparer <String, Int32> > notDuplicatedColumns) { if (DBvalidateFields.Count > 0) { List <Int32> validatedItems = new List <Int32>(); foreach (ExternalColumnComparer <String, Int32> dbValidate in DBvalidateFields) { List <ExternalCell> invalidItems = null; //if (fields.Where(f=> dbValidate.DestinationColumn.Id == f.Id && f.HasAlternative)) if (dbValidate.DestinationColumn.HasAlternative && !validatedItems.Contains(dbValidate.DestinationColumn.Id)) { List <DestinationItemCells <Int32> > items = new List <DestinationItemCells <Int32> >(); items.Add(new DestinationItemCells <Int32>(dbValidate.DestinationColumn) { Cells = source.GetColumnCells(dbValidate.DestinationColumn.InputType, dbValidate.Number) }); foreach (Int32 index in dbValidate.DestinationColumn.AlternativeAttributes) { if (DBvalidateFields.Where(f => f.DestinationColumn.Id == index).Any()) { items.Add(new DestinationItemCells <Int32>(DBvalidateFields.Where(f => f.DestinationColumn.Id == index).Select(f => f.DestinationColumn).FirstOrDefault()) { Cells = source.GetColumnCells(DBvalidateFields.Where(f => f.DestinationColumn.Id == index).Select(f => f.DestinationColumn).FirstOrDefault().InputType, DBvalidateFields.Where(f => f.DestinationColumn.Id == index).Select(f => f.Number).FirstOrDefault()) }); } } validatedItems.Add(dbValidate.DestinationColumn.Id); validatedItems.AddRange(dbValidate.DestinationColumn.AlternativeAttributes); invalidItems = View.ValidateAlternateDBItems(items); invalidItems.ForEach(i => i.isDBduplicate = true); } else if (!validatedItems.Contains(dbValidate.DestinationColumn.Id)) { invalidItems = View.ValidateDBItems(dbValidate.DestinationColumn, source.GetColumnCells(dbValidate.DestinationColumn.InputType, dbValidate.Number)); validatedItems.Add(dbValidate.DestinationColumn.Id); invalidItems.ForEach(i => i.isDBduplicate = true); } } } ValidateSourceData(source, notEmptyColumns, notDuplicatedColumns); }
public void AnalyzeItems(ExternalResource source, List <ExternalColumnComparer <String, Int32> > noDBfields, List <Int32> notEmptyColumns, List <Int32> notDuplicatedColumns) { if (noDBfields.Count > 0) { foreach (ExternalColumnComparer <String, Int32> field in noDBfields) { List <ExternalCell> invalidItems = View.ValidateDBItems(field.DestinationColumn, source.GetColumnCells(field.DestinationColumn.InputType, field.Number)); invalidItems.ForEach(i => i.isDBduplicate = true); } } source.ValidateSourceData(notEmptyColumns, notDuplicatedColumns); }