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