public static int count(this ICell cell, string field) { try { if (!cell.ContainsField(field)) { return(0); } object field_obj = cell.GetField <object>(field); IEnumerable enumerable = field_obj as IEnumerable; if (enumerable != null) { int cnt = 0; var enumerator = enumerable.GetEnumerator(); while (enumerator.MoveNext()) { ++cnt; } return(cnt); } else { return(1); } } catch { return(0); } }
public static bool less_than_or_equal(this ICell cell, string field, int value) { if (!cell.ContainsField(field)) { return(false); } return(cell.GetField <List <long> >(field).Any(_ => _ <= value)); }
public static bool less_than(this ICell cell, string field, double value) { if (!cell.ContainsField(field)) { return(false); } return(cell.GetField <List <double> >(field).Any(_ => _ < value)); }
public static bool greater_than_or_equal(this ICell cell, string field, double value) { if (!cell.ContainsField(field)) { return(false); } return(cell.GetField <List <double> >(field).Any(_ => _ >= value)); }
public static bool greater_than(this ICell cell, string field, int value) { if (!cell.ContainsField(field)) { return(false); } return(cell.GetField <List <long> >(field).Any(_ => _ > value)); }
public static bool has(this ICell cell, string field, string value) { try { if (!cell.ContainsField(field)) { return(false); } object field_obj = cell.GetField <object>(field); if (field_obj is string) { return(field_obj as string == value); } IEnumerable enumerable = field_obj as IEnumerable; if (enumerable != null) { foreach (object element in enumerable) { if (element.ToString() == value) { return(true); } } return(false); } else { return(field_obj.ToString() == value); } } catch { } return(false); }
public static int cell_has(IntPtr cell, string field) { ICell c = (ICell)GCHandle.FromIntPtr(cell).Target; return(c.ContainsField(field) ? 1 : 0); }
public static bool has(this ICell cell, string field) { return(cell.ContainsField(field)); }