Exemplo n.º 1
0
 /// <summary>
 /// 插入t_GalleryClassification
 /// </summary>
 public virtual bool Insert(t_GalleryClassification galleryClassification)
 {
     string sql = "insert into t_GalleryClassification (Id, Name, Description, Sort) values (@Id, @Name, @Description, @Sort)";
     SqlParameter [] parameters = new SqlParameter[]
     {
         new SqlParameter("@Id", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Id", DataRowVersion.Default, galleryClassification.Id),
         new SqlParameter("@Name", SqlDbType.NVarChar, 32, ParameterDirection.Input, false, 0, 0, "Name", DataRowVersion.Default, galleryClassification.Name),
         new SqlParameter("@Description", SqlDbType.NVarChar, 200, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Default, galleryClassification.Description),
         new SqlParameter("@Sort", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Sort", DataRowVersion.Default, galleryClassification.Sort)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Exemplo n.º 2
0
        public List<t_GalleryClassification> selectAllDate()
        {
            string sql = "select * from t_GalleryClassification";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            List<t_GalleryClassification> _List = new List<t_GalleryClassification>();
            foreach (DataRow dr in dt.Rows)
            {
                t_GalleryClassification obj = new t_GalleryClassification(dr);
                _List.Add(obj);
            }
            return _List;
        }
Exemplo n.º 3
0
 public void Clone(t_GalleryClassification obj)
 {
     //分类Id
     Id = obj.Id;
     //分类名称
     Name = obj.Name;
     //分类说明
     Description = obj.Description;
     //排序字段
     Sort = obj.Sort;
 }
Exemplo n.º 4
0
 public t_GalleryClassification selectARowDate(string m_id)
 {
     string sql = string.Format("select * from t_GalleryClassification where  Id='{0}'",m_id);
       DataTable dt = null;
     try
      {
      dt = db.ExecuteQueryDataSet(sql).Tables[0];
     }
       catch (Exception ex)
     {
      throw ex;
       }
     if (dt == null)
      return null;
     if (dt.Rows.Count == 0)
     return null;
     DataRow dr = dt.Rows[0];
     t_GalleryClassification m_Gall=new t_GalleryClassification(dr);
      return m_Gall;
 }
Exemplo n.º 5
0
 /// <summary>
 /// 更新t_GalleryClassification
 /// </summary>
 public virtual bool Update(t_GalleryClassification galleryClassification)
 {
     string sql = "update t_GalleryClassification set  Name = @Name,  Description = @Description,  Sort = @Sort where  Id = @Id";
     SqlParameter [] parameters = new SqlParameter[]
     {
         new SqlParameter("@Id", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Id", DataRowVersion.Default, galleryClassification.Id),
         new SqlParameter("@Name", SqlDbType.NVarChar, 32, ParameterDirection.Input, false, 0, 0, "Name", DataRowVersion.Default, galleryClassification.Name),
         new SqlParameter("@Description", SqlDbType.NVarChar, 200, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Default, galleryClassification.Description),
         new SqlParameter("@Sort", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Sort", DataRowVersion.Default, galleryClassification.Sort)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }