public override IModel CreateModel(SqlDataReader dr) { RepoDetail repodetail = new RepoDetail(); int indexDetailId = dr.GetOrdinal("DetailId"); repodetail.DetailId = Convert.ToInt32(dr[indexDetailId]); int indexRepoId = dr.GetOrdinal("RepoId"); if (dr["RepoId"] != DBNull.Value) { repodetail.RepoId = Convert.ToInt32(dr[indexRepoId]); } int indexRepoDetailStatus = dr.GetOrdinal("RepoDetailStatus"); if (dr["RepoDetailStatus"] != DBNull.Value) { repodetail.RepoDetailStatus = (Common.StatusEnum)Convert.ToInt32(dr[indexRepoDetailStatus]); } int indexStockId = dr.GetOrdinal("StockId"); if (dr["StockId"] != DBNull.Value) { repodetail.StockId = Convert.ToInt32(dr[indexStockId]); } int indexRepoApplyDetailId = dr.GetOrdinal("RepoApplyDetailId"); if (dr["RepoApplyDetailId"] != DBNull.Value) { repodetail.RepoApplyDetailId = Convert.ToInt32(dr[indexRepoApplyDetailId]); } int indexRepoWeight = dr.GetOrdinal("RepoWeight"); if (dr["RepoWeight"] != DBNull.Value) { repodetail.RepoWeight = Convert.ToDecimal(dr[indexRepoWeight]); } int indexUnit = dr.GetOrdinal("Unit"); if (dr["Unit"] != DBNull.Value) { repodetail.Unit = Convert.ToInt32(dr[indexUnit]); } int indexRepoPrice = dr.GetOrdinal("RepoPrice"); if (dr["RepoPrice"] != DBNull.Value) { repodetail.RepoPrice = Convert.ToDecimal(dr[indexRepoPrice]); } int indexCurrency = dr.GetOrdinal("Currency"); if (dr["Currency"] != DBNull.Value) { repodetail.Currency = Convert.ToInt32(dr[indexCurrency]); } int indexStockLogId = dr.GetOrdinal("StockLogId"); if (dr["StockLogId"] != DBNull.Value) { repodetail.StockLogId = Convert.ToInt32(dr[indexStockLogId]); } return repodetail; }
public override IModel CreateModel(DataRow dr) { RepoDetail repodetail = new RepoDetail(); repodetail.DetailId = Convert.ToInt32(dr["DetailId"]); if (dr["RepoId"] != DBNull.Value) { repodetail.RepoId = Convert.ToInt32(dr["RepoId"]); } if (dr["RepoDetailStatus"] != DBNull.Value) { repodetail.RepoDetailStatus = (Common.StatusEnum)Convert.ToInt32(dr["RepoDetailStatus"]); } if (dr["StockId"] != DBNull.Value) { repodetail.StockId = Convert.ToInt32(dr["StockId"]); } if (dr["RepoApplyDetailId"] != DBNull.Value) { repodetail.RepoApplyDetailId = Convert.ToInt32(dr["RepoApplyDetailId"]); } if (dr["RepoWeight"] != DBNull.Value) { repodetail.RepoWeight = Convert.ToDecimal(dr["RepoWeight"]); } if (dr["Unit"] != DBNull.Value) { repodetail.Unit = Convert.ToInt32(dr["Unit"]); } if (dr["RepoPrice"] != DBNull.Value) { repodetail.RepoPrice = Convert.ToDecimal(dr["RepoPrice"]); } if (dr["Currency"] != DBNull.Value) { repodetail.Currency = Convert.ToInt32(dr["Currency"]); } if (dr["StockLogId"] != DBNull.Value) { repodetail.StockLogId = Convert.ToInt32(dr["StockLogId"]); } return repodetail; }