Esempio n. 1
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <returns></returns>
        public List <Favorite> GetList()
        {
            string sql           = CreateSqlString.SelectSqlString(new Favorite {
            });
            DataTable       da   = SqlHelper.GetDataTable(sql, CommandType.Text);
            List <Favorite> list = new List <Favorite> {
            };

            if (da.Rows.Count > 0)
            {
                list = new List <Favorite>();
                Favorite Favorite = null;
                foreach (DataRow row in da.Rows)
                {
                    Favorite = new Favorite();
                    LoadEntity(Favorite, row);
                    list.Add(Favorite);
                }
            }
            return(list);
        }
Esempio n. 2
0
 public static void Setup(int testItems)
 {
     SetTestRepo();
     for(int i=0;i<testItems;i++){
         Favorite item=new Favorite();
         _testRepo._items.Add(item);
     }
 }
Esempio n. 3
0
 public static void Setup(Favorite item)
 {
     SetTestRepo();
     _testRepo._items.Add(item);
 }
Esempio n. 4
0
 /// <summary>
 ///  初始化实体
 /// </summary>
 /// <param name="Favorite"></param>
 /// <param name="row"></param>
 /// <param name="row"></param>
 private void LoadEntity(Favorite Favorite, DataRow row)
 {
     Favorite.FavoriteId = row["FavoriteId"] != DBNull.Value ? row["FavoriteId"].ToString() : string.Empty;
     Favorite.ProductId  = row["ProductId"] != DBNull.Value ? row["ProductId"].ToString() : string.Empty;
     Favorite.UserId     = row["UserId"] != DBNull.Value ? row["UserId"].ToString() : string.Empty;
 }
Esempio n. 5
0
 /// <summary>
 /// 用于向 Favorites EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToFavorites(Favorite favorite)
 {
     base.AddObject("Favorites", favorite);
 }
Esempio n. 6
0
 /// <summary>
 /// 创建新的 Favorite 对象。
 /// </summary>
 /// <param name="id">Id 属性的初始值。</param>
 /// <param name="employeeNumber">EmployeeNumber 属性的初始值。</param>
 /// <param name="documentId">DocumentId 属性的初始值。</param>
 public static Favorite CreateFavorite(global::System.Int32 id, global::System.Int32 employeeNumber, global::System.Int32 documentId)
 {
     Favorite favorite = new Favorite();
     favorite.Id = id;
     favorite.EmployeeNumber = employeeNumber;
     favorite.DocumentId = documentId;
     return favorite;
 }