public static int CompareByintOrder(ColumnInfo x, ColumnInfo y) { if (x == null) return y == null ? 0 : -1; if (y == null) return 1; int num1; try { num1 = Convert.ToInt32(x.ColumnOrder); } catch { return -1; } int num2; try { num2 = Convert.ToInt32(y.ColumnOrder); } catch { return 1; } if (num1 < num2) return -1; return x == y ? 0 : 1; }
public static int CompareByOrder(ColumnInfo x, ColumnInfo y) { if (x == null) return y == null ? 0 : -1; if (y == null) return 1; return x.ColumnOrder.CompareTo(y.ColumnOrder); }
public static List<ColumnInfo> GetColumnInfos(DataTable dt) { List<ColumnInfo> list = new List<ColumnInfo>(); if (dt == null) return (List<ColumnInfo>)null; ArrayList arrayList = new ArrayList(); foreach (DataRow dataRow in (InternalDataCollectionBase)dt.Rows) { string str1 = dataRow["Colorder"].ToString(); string str2 = dataRow["ColumnName"].ToString(); string str3 = dataRow["TypeName"].ToString(); string str4 = dataRow["IsIdentity"].ToString(); string str5 = dataRow["IsPK"].ToString(); string str6 = dataRow["Length"].ToString(); string str7 = dataRow["Preci"].ToString(); string str8 = dataRow["Scale"].ToString(); string str9 = dataRow["cisNull"].ToString(); string str10 = dataRow["DefaultVal"].ToString(); string str11 = dataRow["DeText"].ToString(); ColumnInfo columnInfo = new ColumnInfo(); columnInfo.ColumnOrder = str1; columnInfo.ColumnName = str2; columnInfo.TypeName = str3; columnInfo.IsIdentity = str4 == "√"; columnInfo.IsPrimaryKey = str5 == "√"; columnInfo.Length = str6; columnInfo.Precision = str7; columnInfo.Scale = str8; columnInfo.Nullable = str9 == "√"; columnInfo.DefaultVal = str10; columnInfo.Description = str11; if (!arrayList.Contains((object)str2)) { list.Add(columnInfo); arrayList.Add((object)str2); } } return list; }