/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.StoreCookingStylesTable DataRowToModel(DataRow row) { Maticsoft.Model.StoreCookingStylesTable model=new Maticsoft.Model.StoreCookingStylesTable(); if (row != null) { if(row["KeyID"]!=null) { model.KeyID=row["KeyID"].ToString(); } if(row["BizID"]!=null) { model.BizID=row["BizID"].ToString(); } if(row["CookingStyleID"]!=null) { model.CookingStyleID=row["CookingStyleID"].ToString(); } if(row["CookingStyleName"]!=null) { model.CookingStyleName=row["CookingStyleName"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.StoreCookingStylesTable GetModel(string KeyID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 KeyID,BizID,CookingStyleID,CookingStyleName from StoreCookingStylesTable "); strSql.Append(" where KeyID=@KeyID "); SqlParameter[] parameters = { new SqlParameter("@KeyID", SqlDbType.NVarChar,50) }; parameters[0].Value = KeyID; Maticsoft.Model.StoreCookingStylesTable model=new Maticsoft.Model.StoreCookingStylesTable(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }