static void Main(string[] args) { //================================================================================== // instances of costumer accounts CostList = new CustomerAccount("sam", "89012345", "*****@*****.**"); CostList.addNewCostumerAccount("john", "56789012", "*****@*****.**"); CostList.addNewCostumerAccount("Jane", "45678901", "*****@*****.**"); CostList.addNewCostumerAccount("alex", "23456789", "*****@*****.**"); CostList.addNewCostumerAccount("steve", "12345678", "*****@*****.**"); CostList.printcostumerTable(); //================================================================================== // instances of orders Console.WriteLine(); DeliverOrderList = new DeliveryOrder("pencil", 20, 10.00, "sam", 7777); DeliverOrderList.createOrder("book", 1, 50.00, "john", 5555); DeliverOrderList.createOrder("note", 3, 20.00, "alex", 3333); DeliverOrderList.printOrdersTable(); bool run = true; int yes; //program starts makeOrders = new PurchaseOrderManager(); Console.WriteLine(); while (run) { Console.WriteLine("Please enter the accountID:"); string accountID = Console.ReadLine(); Console.WriteLine("Please enter the item:"); string item = Console.ReadLine(); Console.WriteLine("Please enter quantity (only numbers):"); int quantity = int.Parse(Console.ReadLine()); //if (quantity < 0) quantity = -quantity; Console.WriteLine("Please enter the totalPrice(only numbers, integers or decimals):"); string newPrice = Console.ReadLine(); double totalPrice = double.Parse(newPrice); CustomerInterface.request(item, quantity, totalPrice, accountID); Console.WriteLine("Do you want to start a new order? Enter 1 for yes or 0 for no"); yes = int.Parse(Console.ReadLine()); run = (yes == 1) ? true : false; Console.WriteLine(); } makeOrders.DeliverOrderTable.printOrdersTable(); Console.WriteLine(); Console.WriteLine("You've reached the end of the program."); }
public int requestorder(string item, int quantity, double totalprice, string accountid) { int result = 0; //if -1 : not approved //if 0 : account not found (either no account on the store or n CustomerAccountIndividual costumer = CostList.ReadAccountInfo(accountid); if (costumer != null) //costumer found { result = BankInterface.authorize(costumer.getCardNo(), out uint authorizationNo); if (result == 1) //approved { DeliverOrderTable.createOrder(item, quantity, totalprice, accountid, authorizationNo); this.CustEmail = costumer.getCustEmail(); Email.emailConfirmation(this.CustEmail); } } else { Console.WriteLine("Costumer was not found. Try again."); Console.WriteLine(); } return(result); //if -1 : not approved //if 0 : not found //if 1 : not approved } //end of requestorder