public HashSet <ReceivingPharmacyItemModel> GetPharmacyReceiving() { string query = "SELECT receiving_pharmacy.id, medicine.name, receiving_pharmacy.quantity, receiving_pharmacy.cost, receiving_pharmacy.date " + "FROM receiving_pharmacy " + "LEFT JOIN medicine ON medicine.id = receiving_pharmacy.id_medicine "; command = new MySqlCommand(query, connection); MySqlDataReader reader = command.ExecuteReader(); HashSet <ReceivingPharmacyItemModel> items = new HashSet <ReceivingPharmacyItemModel>(); ReceivingPharmacyItemModel item; while (reader.Read()) { item = new ReceivingPharmacyItemModel(); 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 ReceivingWarehouseViewModel() { _selectedItem = null; GetDataFromDatabase(); }