Пример #1
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public MyBookShop.Model.SysFun DataRowToModel(DataRow row)
		{
			MyBookShop.Model.SysFun model=new MyBookShop.Model.SysFun();
			if (row != null)
			{
				if(row["NodeId"]!=null && row["NodeId"].ToString()!="")
				{
					model.NodeId=int.Parse(row["NodeId"].ToString());
				}
				if(row["DisplayName"]!=null)
				{
					model.DisplayName=row["DisplayName"].ToString();
				}
				if(row["NodeURL"]!=null)
				{
					model.NodeURL=row["NodeURL"].ToString();
				}
				if(row["DisplayOrder"]!=null && row["DisplayOrder"].ToString()!="")
				{
					model.DisplayOrder=int.Parse(row["DisplayOrder"].ToString());
				}
				if(row["ParentNodeId"]!=null && row["ParentNodeId"].ToString()!="")
				{
					model.ParentNodeId=int.Parse(row["ParentNodeId"].ToString());
				}
			}
			return model;
		}
Пример #2
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public MyBookShop.Model.SysFun GetModel(int NodeId)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 NodeId,DisplayName,NodeURL,DisplayOrder,ParentNodeId from SysFun ");
			strSql.Append(" where NodeId=@NodeId ");
			SqlParameter[] parameters = {
					new SqlParameter("@NodeId", SqlDbType.Int,4)			};
			parameters[0].Value = NodeId;

			MyBookShop.Model.SysFun model=new MyBookShop.Model.SysFun();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}