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