public HashSet <DeliveryWarehouseItemModel> GetWarehouseDeliveries() { string query = "SELECT delivery_warehouse.id, medicine.name, delivery_warehouse.quantity, delivery_warehouse.cost, delivery_warehouse.date " + "FROM delivery_warehouse " + "LEFT JOIN medicine ON medicine.id = delivery_warehouse.id_medicine "; command = new MySqlCommand(query, connection); MySqlDataReader reader = command.ExecuteReader(); HashSet <DeliveryWarehouseItemModel> items = new HashSet <DeliveryWarehouseItemModel>(); DeliveryWarehouseItemModel item; while (reader.Read()) { item = new DeliveryWarehouseItemModel(); item.id = reader.GetValue(0).ToString(); item.name = reader.GetValue(1).ToString(); item.quantity = reader.GetValue(2).ToString(); item.cost = reader.GetValue(3).ToString(); item.date = reader.GetValue(4).ToString(); items.Add(item); } command.Dispose(); return(items); }
public DeliveryWarehouseViewModel() { _selectedItem = null; GetDataFromDatabase(); }