示例#1
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public MyBookShop.Model.VidoFile DataRowToModel(DataRow row)
		{
			MyBookShop.Model.VidoFile model=new MyBookShop.Model.VidoFile();
			if (row != null)
			{
				if(row["Id"]!=null && row["Id"].ToString()!="")
				{
					model.Id=int.Parse(row["Id"].ToString());
				}
				if(row["Title"]!=null)
				{
					model.Title=row["Title"].ToString();
				}
				if(row["FivPath"]!=null)
				{
					model.FivPath=row["FivPath"].ToString();
				}
				if(row["Status"]!=null)
				{
					model.Status=row["Status"].ToString();
				}
				if(row["FileExt"]!=null)
				{
					model.FileExt=row["FileExt"].ToString();
				}
			}
			return model;
		}
示例#2
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public MyBookShop.Model.VidoFile GetModel(int Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 Id,Title,FivPath,Status,FileExt from VidoFile ");
			strSql.Append(" where Id=@Id");
			SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.Int,4)
			};
			parameters[0].Value = Id;

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