using System; using System.Data; namespace Common { public class DataRowReader { private DataRow Row; public DataRowReader(DataRow row) { this.Row = row; } public string GetString(string fieldName) { return TypeConvert.ToString(this.Row[fieldName]); } public int GetInt(string fieldName) { return TypeConvert.ToInt32(this.Row[fieldName]); } public Decimal GetDecimal(string fieldName) { return TypeConvert.ToDecimal(this.Row[fieldName]); } public long GetInt64(string fieldName) { return TypeConvert.ToInt64(this.Row[fieldName]); } public int GetInt(int columnIndex) { return TypeConvert.ToInt32(this.Row[columnIndex]); } public string GetString(int columnIndex) { return TypeConvert.ToString(this.Row[columnIndex]); } public bool GetBoolean(string fieldName) { return TypeConvert.ToBoolean(this.Row[fieldName]); } public bool GetBoolean(int columnIndex) { return TypeConvert.ToBoolean(this.Row[columnIndex]); } public DateTime GetDateTime(string fieldName) { return TypeConvert.ToDateTime(this.Row[fieldName]); } } }