Exemple #1
0
 /// <summary>
 /// 得到一个实体
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ShowShop.Model.Accessories.Collection GetModelByID(int id)
 {
     ShowShop.Model.Accessories.Collection model = new ShowShop.Model.Accessories.Collection();
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select  top 1 [id],[collectiontype],[collectionid],[collectionname],[collectiondate],[collectionuid] from yxs_collection ");
     strSql.Append(" where [id]=@id ");
     SqlParameter[] parameters = (SqlParameter[])this.ValueIDPara(id);
     using (SqlDataReader reader = ChangeHope.DataBase.SQLServerHelper.ExecuteReader(strSql.ToString(), parameters))
     {
         if (reader.Read())
         {
             model.ID = reader.GetInt32(0);
             model.CollectionType = reader.GetInt32(1);
             model.CollectionId = reader.GetInt32(2);
             model.CollectionName = reader.GetString(3);
             model.CollectionDate = reader.GetDateTime(4);
             model.CollectionId = reader.GetInt32(5);
         }
     }
     return model;
 }
Exemple #2
0
 /// <summary>
 /// 所有数据集合
 /// </summary>
 /// <returns></returns>
 public List<ShowShop.Model.Accessories.Collection> GetAll()
 {
     List<ShowShop.Model.Accessories.Collection> list = new List<ShowShop.Model.Accessories.Collection>();
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select  [id],[collectiontype],[collectionid],[collectionname],[collectiondate],[collectionuid] from yxs_collection ");
     strSql.Append(" where 1=1");
     using (SqlDataReader reader = ChangeHope.DataBase.SQLServerHelper.ExecuteReader(strSql.ToString()))
     {
         while (reader.Read())
         {
             ShowShop.Model.Accessories.Collection model = new ShowShop.Model.Accessories.Collection();
             model.ID = reader.GetInt32(0);
             model.CollectionType = reader.GetInt32(1);
             model.CollectionId = reader.GetInt32(2);
             model.CollectionName = reader.GetString(3);
             model.CollectionDate = reader.GetDateTime(4);
             model.CollectionId = reader.GetInt32(5);
             list.Add(model);
         }
     }
     return list;
 }