public static void Remove(ShopItem ShopItem) { //更新資料庫 ShopItemAccessor.Delete(ShopItem); //更新記憶体 ShopItemCache.Remove(ShopItem); }
public static void UpdateInsert(ShopItem ShopItem) { UpdateInsert(new List<ShopItem>() { ShopItem }); }
public static void Delete(ShopItem ShopItem) { Delete(new List<ShopItem> { ShopItem }); }
private static List<ShopItem> SelectByDataReader(SqlCommand SqlCommand) { List<ShopItem> ShopItems = new List<ShopItem>(); using (SqlConnection SqlConnection = ConnectionManager.GetConnection()) { using (SqlCommand.Connection = SqlConnection) { SqlConnection.Open(); SqlDataReader SqlDataReader = SqlCommand.ExecuteReader(); while (SqlDataReader.Read()) { int Id = (int)SqlDataReader["Id"]; //OrderStateType OrderState = (OrderStateType)Enum.Parse(typeof(OrderStateType), (string)SqlDataReader["OrderState"]); ShopType ShopType = (ShopType)Enum.Parse(typeof(ShopType), (string)SqlDataReader["ShopTpye"]); string Name = (string)SqlDataReader["Name"]; string Memo = (string)SqlDataReader["Memo"]; string PhoneNumber = (string)SqlDataReader["PhoneNumber"]; string Address = (string)SqlDataReader["Address"]; DateTime UpdateTime = (DateTime)SqlDataReader["UpdateTime"]; DateTime CreateTime = (DateTime)SqlDataReader["CreateTime"]; ShopItem ShopItem = new ShopItem(Id, ShopType, Name, Memo, PhoneNumber, Address, UpdateTime, CreateTime); ShopItems.Add(ShopItem); } return ShopItems; } } }
public static void Save(ShopItem ShopItem) { Save(new List<ShopItem>() { ShopItem }); }