public override IModel CreateModel(SqlDataReader dr) { CustomsDetail customsdetail = new CustomsDetail(); int indexDetailId = dr.GetOrdinal("DetailId"); customsdetail.DetailId = Convert.ToInt32(dr[indexDetailId]); int indexCustomsId = dr.GetOrdinal("CustomsId"); if (dr["CustomsId"] != DBNull.Value) { customsdetail.CustomsId = Convert.ToInt32(dr[indexCustomsId]); } int indexCustomsApplyId = dr.GetOrdinal("CustomsApplyId"); if (dr["CustomsApplyId"] != DBNull.Value) { customsdetail.CustomsApplyId = Convert.ToInt32(dr[indexCustomsApplyId]); } int indexCustomsApplyDetailId = dr.GetOrdinal("CustomsApplyDetailId"); if (dr["CustomsApplyDetailId"] != DBNull.Value) { customsdetail.CustomsApplyDetailId = Convert.ToInt32(dr[indexCustomsApplyDetailId]); } int indexStockId = dr.GetOrdinal("StockId"); if (dr["StockId"] != DBNull.Value) { customsdetail.StockId = Convert.ToInt32(dr[indexStockId]); } int indexGrossWeight = dr.GetOrdinal("GrossWeight"); if (dr["GrossWeight"] != DBNull.Value) { customsdetail.GrossWeight = Convert.ToDecimal(dr[indexGrossWeight]); } int indexNetWeight = dr.GetOrdinal("NetWeight"); if (dr["NetWeight"] != DBNull.Value) { customsdetail.NetWeight = Convert.ToDecimal(dr[indexNetWeight]); } int indexCustomsPrice = dr.GetOrdinal("CustomsPrice"); if (dr["CustomsPrice"] != DBNull.Value) { customsdetail.CustomsPrice = Convert.ToDecimal(dr[indexCustomsPrice]); } int indexDeliverPlaceId = dr.GetOrdinal("DeliverPlaceId"); if (dr["DeliverPlaceId"] != DBNull.Value) { customsdetail.DeliverPlaceId = Convert.ToInt32(dr[indexDeliverPlaceId]); } int indexCardNo = dr.GetOrdinal("CardNo"); if (dr["CardNo"] != DBNull.Value) { customsdetail.CardNo = Convert.ToString(dr[indexCardNo]); } int indexDetailStatus = dr.GetOrdinal("DetailStatus"); if (dr["DetailStatus"] != DBNull.Value) { customsdetail.DetailStatus = (Common.StatusEnum)Convert.ToInt32(dr[indexDetailStatus]); } int indexStockLogId = dr.GetOrdinal("StockLogId"); if (dr["StockLogId"] != DBNull.Value) { customsdetail.StockLogId = Convert.ToInt32(dr[indexStockLogId]); } return customsdetail; }
public override IModel CreateModel(DataRow dr) { CustomsDetail customsdetail = new CustomsDetail(); customsdetail.DetailId = Convert.ToInt32(dr["DetailId"]); if (dr["CustomsId"] != DBNull.Value) { customsdetail.CustomsId = Convert.ToInt32(dr["CustomsId"]); } if (dr["CustomsApplyId"] != DBNull.Value) { customsdetail.CustomsApplyId = Convert.ToInt32(dr["CustomsApplyId"]); } if (dr["CustomsApplyDetailId"] != DBNull.Value) { customsdetail.CustomsApplyDetailId = Convert.ToInt32(dr["CustomsApplyDetailId"]); } if (dr["StockId"] != DBNull.Value) { customsdetail.StockId = Convert.ToInt32(dr["StockId"]); } if (dr["GrossWeight"] != DBNull.Value) { customsdetail.GrossWeight = Convert.ToDecimal(dr["GrossWeight"]); } if (dr["NetWeight"] != DBNull.Value) { customsdetail.NetWeight = Convert.ToDecimal(dr["NetWeight"]); } if (dr["CustomsPrice"] != DBNull.Value) { customsdetail.CustomsPrice = Convert.ToDecimal(dr["CustomsPrice"]); } if (dr["DeliverPlaceId"] != DBNull.Value) { customsdetail.DeliverPlaceId = Convert.ToInt32(dr["DeliverPlaceId"]); } if (dr["CardNo"] != DBNull.Value) { customsdetail.CardNo = Convert.ToString(dr["CardNo"]); } if (dr["DetailStatus"] != DBNull.Value) { customsdetail.DetailStatus = (Common.StatusEnum)Convert.ToInt32(dr["DetailStatus"]); } if (dr["StockLogId"] != DBNull.Value) { customsdetail.StockLogId = Convert.ToInt32(dr["StockLogId"]); } return customsdetail; }