public bool VerifyColumnValueIn( int index, List <string> list, bool paintcol = true, int sheet = 1, string comment = "Este Valor no es permitido en esta columna.", bool jaro = false, string colToCompare = null, string table = null, string colId = null, bool notin = false) { try { bool res = true; IXLRange UsedRange = wb.Worksheet(sheet).RangeUsed(); var l = UsedRange.LastRow().RowNumber(); //se toma el número de filas que se deben revisar, sin contar la cabecera. Por eso empieza en 2 for (int i = headerin + 1; i <= UsedRange.LastRow().RowNumber(); i++) { var value = cleanText(wb.Worksheet(sheet).Cell(i, index).Value.ToString()); if (list.Exists(x => string.Equals(cleanText(x), value, StringComparison.OrdinalIgnoreCase)) == notin) { res = false; if (paintcol) { string aux = ""; if (jaro) { var similarities = hanaValidator.Similarities( wb.Worksheet(sheet).Cell(i, index).Value.ToString(), colToCompare, table, colId, 0.9f); aux = similarities.Any() ? "\nNo será: '" + similarities[0].ToString() + "'?" : ""; } paintXY(index, i, XLColor.Red, comment + aux); } } } valid = valid && res; if (!res) { addError("Valor no valido", "Valor o valores no validos en la columna: " + index, false); } return(res); } catch (Exception e) { Debug.WriteLine(e); return(false); } }
public IEnumerable <People> VerifyExisting(People person, float n, string fn = null) { string fullname; if (fn == null) { fullname = String.Concat(person.FirstSurName, String.Concat(" ", String.Concat(person.SecondSurName, String.Concat(" ", String.Concat(person.Names, String.Concat(" ", person.Document) ) ) ) ) ); } else { fullname = fn; } //SQL command in Hana string colToCompare = "concat(a.\"FirstSurName\"," + "concat('' ''," + "concat(a.\"SecondSurName\"," + "concat('' ''," + "concat(a.\"Names\", " + "concat('' '',a.\"Document\")" + ")" + ")" + ")" + ")" + ")"; string colId = "a.\"CUNI\""; string table = "People"; var similarities = hanaValidator.Similarities(fullname, colToCompare, table, colId, 0.9f); var sim = _context.Person.ToList().Where( i => similarities.Contains(i.CUNI) ).ToList(); return(sim); }