private static void SellMedicine() { Console.Clear(); MainMenu.MenuS(); ConsoleEx.WriteLine("".PadLeft(115, '='), ConsoleColor.DarkMagenta); ConsoleEx.WriteLine(" :: SELL MEDICINE ::", ConsoleColor.Gray); Console.WriteLine(); Console.Write("Enter the Id of the medicine: "); int idSellMedicine = Convert.ToInt32(Console.ReadLine()); Medicine medicine = new Medicine(); Console.Write("Enter the amount: "); int amountSellMedicine = Convert.ToInt32(Console.ReadLine()); if (medicine.ReloadById(idSellMedicine).WithPrescription == false) { Order.Sell(idSellMedicine, amountSellMedicine, medicine.ReloadById(idSellMedicine).Amount); } else { Console.Write("Enter customer's name: "); string customerName = Console.ReadLine().Trim(); Console.Write("Enter PESEL number: "); string pesel = Console.ReadLine().Trim(); Console.Write("Enter the prescription number: "); int prescriptionNumber = Convert.ToInt32(Console.ReadLine()); Order.SellMedicine(idSellMedicine, amountSellMedicine, medicine.ReloadById(idSellMedicine).Amount); int prescriptionId = Prescription.SavePrescription(customerName, pesel, prescriptionNumber); Order.UpdateOrders(prescriptionId, idSellMedicine, amountSellMedicine); } ConsoleEx.WriteLine("Success!", ConsoleColor.Green); Console.Write("Press ENTER to continue... "); Console.ReadLine(); }
public abstract int Save(Medicine medicine);
public override int Save(Medicine medicine) { return(0); }
public override Medicine Reload() { Medicine medicine = new Medicine(); return(medicine); }