private static void CalculateTotalPrice(string[] v) { string pharmacyName = v[0]; if (!pharmacies.ContainsKey(pharmacyName)) { Console.WriteLine("Could not CalculateTotalPrice"); return; } Pharmacy pharmacy = pharmacies[pharmacyName]; Console.WriteLine(pharmacy.CalculateTotalPrice()); }
private static void PharmacyInfo(string[] v) { string pharmacyName = v[0]; if (!pharmacies.ContainsKey(pharmacyName)) { Console.WriteLine("Could not get PharmacyInfo"); return; } Pharmacy pharmacy = pharmacies[pharmacyName]; Console.WriteLine(pharmacy); }
private static void GetMedicineWithHighestPrice(string[] v) { string pharmacyName = v[0]; if (!pharmacies.ContainsKey(pharmacyName)) { Console.WriteLine("Could not GetMedicineWithHighestPrice"); return; } Pharmacy pharmacy = pharmacies[pharmacyName]; Console.WriteLine(pharmacy.GetMedicineWithHighestPrice()); }
private static void SellAllMedicines(string[] v) { string pharmacyName = v[0]; if (!pharmacies.ContainsKey(pharmacyName)) { Console.WriteLine("Could not SellAllMedicines"); return; } Pharmacy pharmacy = pharmacies[pharmacyName]; pharmacy.SellAllMedicines(); }
private static void CreatePharmacy(string[] v) { string name = v[0]; try { Pharmacy pharmacy = new Pharmacy(name); pharmacies.Add(name, pharmacy); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } }
private static void Order(string[] v) { string medicineName = v[0]; string pharmacyName = v[1]; if (!pharmacies.ContainsKey(pharmacyName) || !medicines.ContainsKey(medicineName)) { Console.WriteLine("Could not order medicine"); return; } Medicine medicine = medicines[medicineName]; Pharmacy pharmacy = pharmacies[pharmacyName]; pharmacy.Order(medicine); }
private static void GetMedicineWithLowestPrice(string[] arguments) { string pharmacyName = arguments[0]; if (!pharmacies.ContainsKey(pharmacyName)) { Console.WriteLine("Could not GetEmployeeWithLowestPrice"); return; } Pharmacy pharmacy = pharmacies[pharmacyName]; Console.WriteLine(pharmacy.GetMedicineWithLowestPrice()); }
private static void Sell(string[] v) { string medicineName = v[0]; string pharmacyName = v[1]; if (!pharmacies.ContainsKey(pharmacyName) || !medicines.ContainsKey(medicineName)) { Console.WriteLine("Could not sell medicine"); return; } Medicine medicine = medicines[medicineName]; Pharmacy pharmacy = pharmacies[pharmacyName]; if (pharmacy.Sell(medicine)) { Console.WriteLine($"Sold medicine {medicineName}"); } else { Console.WriteLine($"Did not sell medicine {medicineName}"); } }
private static void RenamePharmacy(string[] v) { string pharmacyName = v[0]; string newName = v[1]; if (!pharmacies.ContainsKey(pharmacyName)) { Console.WriteLine("Could not RenamePharmacy"); return; } Pharmacy pharmacy = pharmacies[pharmacyName]; try { pharmacy.RenamePharmacy(newName); pharmacies.Remove(pharmacyName); pharmacies.Add(newName, pharmacy); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } }