Example #1
0
        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());
        }
Example #2
0
        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);
        }
Example #3
0
        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());
        }
Example #4
0
        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();
        }
Example #5
0
        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);
            }
        }
Example #6
0
        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);
        }
Example #7
0
        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());
        }
Example #8
0
        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}");
            }
        }
Example #9
0
        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);
            }
        }