Beispiel #1
0
 public static void Initial()
 {
     ShopItemCache = ShopItemAccessor.SelectAll()
                     .OrderBy(b => b.Sort)
                     .ThenByDescending(c => c.CreateTime)
                     .ToList();
 }
Beispiel #2
0
        public static void Remove(ShopItem ShopItem)
        {
            //更新資料庫
            ShopItemAccessor.Delete(ShopItem);

            //更新記憶体
            ShopItemCache.Remove(ShopItem);
        }
Beispiel #3
0
        public static void Save(ShopItem ShopItem)
        {
            if (ShopItem.Id == "-1")
            {
                ShopItem.Id = Guid.NewGuid().ToString();
            }

            ShopItem.UpdateTime = DateTime.Now;
            ShopItem.RoundItems = ShopItem.RoundItems.OrderBy(r => r.StartTime).ToList();

            lock (SaveObject)
            {
                //更新資料庫
                ShopItemAccessor.UpdateInsert(ShopItem);

                //更新記憶體
                ShopItemCache.Remove(ShopItem);
                ShopItemCache.Add(ShopItem);
            }
        }