public VirtualShoppingItem[] GetVirtualShoppingItems(bool getAllItem, SellState state) { VirtualShoppingItem[] items = null; MyDBHelper.Instance.ConnectionCommandSelect(mycmd => { string sqlText = "select * from virtualshoppingitem "; if (!getAllItem) { sqlText += " where SellState=@SellState "; mycmd.Parameters.AddWithValue("@SellState", (int)state); } mycmd.CommandText = sqlText; DataTable table = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); adapter.Fill(table); items = MetaDBAdapter <VirtualShoppingItem> .GetVirtualShoppingItemFromDataTable(table); table.Dispose(); adapter.Dispose(); }); return(items); }
public DiamondShoppingItem[] GetDiamondShoppingItems(bool getAllSellState, SellState state, DiamondsShoppingItemType itemType) { DiamondShoppingItem[] items = null; MyDBHelper.Instance.ConnectionCommandSelect(mycmd => { string sqlText = "select * from diamondshoppingitem where `Type`=@Type "; mycmd.Parameters.AddWithValue("@Type", (int)itemType); if (!getAllSellState) { sqlText += " and SellState=@SellState "; mycmd.Parameters.AddWithValue("@SellState", (int)state); } mycmd.CommandText = sqlText; DataTable table = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); adapter.Fill(table); items = MetaDBAdapter <DiamondShoppingItem> .GetDiamondShoppingItemFromDataTable(table); table.Dispose(); adapter.Dispose(); }); return(items); }
public VirtualShoppingItem[] GetVirtualShoppingItems(bool getAllItem, SellState state) { VirtualShoppingItem[] items = DBProvider.VirtualShoppingItemDBProvider.GetVirtualShoppingItems(getAllItem, state); if (items == null) { return(items); } foreach (var item in items) { string filePath = Path.Combine(GlobalData.VirtualShoppingImageFolder, item.Name + ".jpg"); if (File.Exists(filePath)) { using (FileStream stream = new FileStream(filePath, FileMode.Open)) { item.IconBuffer = new byte[stream.Length]; stream.Read(item.IconBuffer, 0, (int)stream.Length); } } } return(items); }
public DiamondShoppingItem[] GetDiamondShoppingItems(bool getAllSellState, SellState state, DiamondsShoppingItemType itemType) { DiamondShoppingItem[] items = DBProvider.DiamondShoppingDBProvider.GetDiamondShoppingItems(getAllSellState, state, itemType); if (items == null) { return(items); } foreach (var item in items) { string filePath = Path.Combine(GetShoppingItemDirPath(item.Name), item.Name.GetHashCode().ToString() + ".jpg"); if (File.Exists(filePath)) { using (FileStream stream = new FileStream(filePath, FileMode.Open)) { item.IconBuffer = new byte[stream.Length]; stream.Read(item.IconBuffer, 0, (int)stream.Length); } } } return(items); }