/// <summary> /// 得到一个对象实体 /// </summary> public webs_YueyxShop.Model.ProductAttributeDetails DataRowToModel(DataRow row) { webs_YueyxShop.Model.ProductAttributeDetails model=new webs_YueyxShop.Model.ProductAttributeDetails(); if (row != null) { if(row["pad_ID"]!=null && row["pad_ID"].ToString()!="") { model.pad_ID=int.Parse(row["pad_ID"].ToString()); } if(row["pa_ID"]!=null && row["pa_ID"].ToString()!="") { model.pa_ID=int.Parse(row["pa_ID"].ToString()); } if(row["sku_ID"]!=null && row["sku_ID"].ToString()!="") { model.sku_ID=int.Parse(row["sku_ID"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public webs_YueyxShop.Model.ProductAttributeDetails GetModel(int pad_ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 pad_ID,pa_ID,sku_ID from ProductAttributeDetails "); strSql.Append(" where pad_ID=@pad_ID "); SqlParameter[] parameters = { new SqlParameter("@pad_ID", SqlDbType.Int,4) }; parameters[0].Value = pad_ID; webs_YueyxShop.Model.ProductAttributeDetails model=new webs_YueyxShop.Model.ProductAttributeDetails(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }