public override IModel CreateModel(SqlDataReader dr) { Bank bank = new Bank(); int indexBankId = dr.GetOrdinal("BankId"); bank.BankId = Convert.ToInt32(dr[indexBankId]); int indexBankName = dr.GetOrdinal("BankName"); bank.BankName = Convert.ToString(dr[indexBankName]); int indexBankEname = dr.GetOrdinal("BankEname"); bank.BankEname = Convert.ToString(dr[indexBankEname]); int indexBankFullName = dr.GetOrdinal("BankFullName"); if (dr["BankFullName"] != DBNull.Value) { bank.BankFullName = Convert.ToString(dr[indexBankFullName]); } int indexBankShort = dr.GetOrdinal("BankShort"); if (dr["BankShort"] != DBNull.Value) { bank.BankShort = Convert.ToString(dr[indexBankShort]); } int indexCapitalType = dr.GetOrdinal("CapitalType"); if (dr["CapitalType"] != DBNull.Value) { bank.CapitalType = Convert.ToInt32(dr[indexCapitalType]); } int indexBankLevel = dr.GetOrdinal("BankLevel"); if (dr["BankLevel"] != DBNull.Value) { bank.BankLevel = Convert.ToInt32(dr[indexBankLevel]); } int indexSwitchBack = dr.GetOrdinal("SwitchBack"); if (dr["SwitchBack"] != DBNull.Value) { bank.SwitchBack = Convert.ToBoolean(dr[indexSwitchBack]); } int indexParentId = dr.GetOrdinal("ParentId"); if (dr["ParentId"] != DBNull.Value) { bank.ParentId = Convert.ToInt32(dr[indexParentId]); } int indexBankStatus = dr.GetOrdinal("BankStatus"); bank.BankStatus = (Common.StatusEnum)Convert.ToInt32(dr[indexBankStatus]); int indexCreatorId = dr.GetOrdinal("CreatorId"); bank.CreatorId = Convert.ToInt32(dr[indexCreatorId]); int indexCreateTime = dr.GetOrdinal("CreateTime"); bank.CreateTime = Convert.ToDateTime(dr[indexCreateTime]); int indexLastModifyId = dr.GetOrdinal("LastModifyId"); if (dr["LastModifyId"] != DBNull.Value) { bank.LastModifyId = Convert.ToInt32(dr[indexLastModifyId]); } int indexLastModifyTime = dr.GetOrdinal("LastModifyTime"); if (dr["LastModifyTime"] != DBNull.Value) { bank.LastModifyTime = Convert.ToDateTime(dr[indexLastModifyTime]); } return bank; }
public override IModel CreateModel(DataRow dr) { Bank bank = new Bank(); bank.BankId = Convert.ToInt32(dr["BankId"]); bank.BankName = Convert.ToString(dr["BankName"]); bank.BankEname = Convert.ToString(dr["BankEname"]); if (dr["BankFullName"] != DBNull.Value) { bank.BankFullName = Convert.ToString(dr["BankFullName"]); } if (dr["BankShort"] != DBNull.Value) { bank.BankShort = Convert.ToString(dr["BankShort"]); } if (dr["CapitalType"] != DBNull.Value) { bank.CapitalType = Convert.ToInt32(dr["CapitalType"]); } if (dr["BankLevel"] != DBNull.Value) { bank.BankLevel = Convert.ToInt32(dr["BankLevel"]); } if (dr["SwitchBack"] != DBNull.Value) { bank.SwitchBack = Convert.ToBoolean(dr["SwitchBack"]); } if (dr["ParentId"] != DBNull.Value) { bank.ParentId = Convert.ToInt32(dr["ParentId"]); } bank.BankStatus = (Common.StatusEnum)Convert.ToInt32(dr["BankStatus"]); bank.CreatorId = Convert.ToInt32(dr["CreatorId"]); bank.CreateTime = Convert.ToDateTime(dr["CreateTime"]); if (dr["LastModifyId"] != DBNull.Value) { bank.LastModifyId = Convert.ToInt32(dr["LastModifyId"]); } if (dr["LastModifyTime"] != DBNull.Value) { bank.LastModifyTime = Convert.ToDateTime(dr["LastModifyTime"]); } return bank; }