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