//Event handler for order confirmation public void orderConfirmationEvent(OrderClass confirmedOrder) { //only attempt to move order from sent to confirmed after making sure //the order sender id matches the thread sender id //otherwise it is someonelse's order if (confirmedOrder.getID() == senderId.ToString()) { //search for the confirmed order for (int s = 0; s < sentOrders.Count; s++) { if (sentOrders.ElementAt(s).getOrderId() == confirmedOrder.getOrderId()) { Console.WriteLine("Order ({0}) Confirmation Received", confirmedOrder.ToString()); orderFinish[s] = DateTime.Now; //move from sent orders to confirmed orders confirmedOrders.Add(confirmedOrder); // trace events caught //sentOrders.RemoveAt(s); i will not remove the confirmed order from s in order to //maintain the correct order in which the orders were submitted so i can use //that index for the finish time stamp //TimeStamp for end of order s } } } }
public void setOrder(OrderClass s) { StringBuilder temp = new StringBuilder(); temp.Append(s.getAmt().ToString()); //Appends amount to string temp.Append(" "); temp.Append(s.getCardNo().ToString()); //Appends card number to string temp.Append(" "); temp.Append(s.getID().ToString()); //Appends ID to string temp.Append(" "); temp.Append(s.getOrderId().ToString()); //Appends orderId to string temp.Append(" "); temp.Append(s.getnoRooms().ToString()); //Appends number of rooms to string temp.Append(" "); temp.Append(s.getPrice().ToString()); //Appends price per room to string temp.Append(" "); order = temp.ToString(); //builds string EncryptionService.ServiceClient serviceClient = new EncryptionService.ServiceClient(); //Instantiates encryption service order = serviceClient.Encrypt(order); //encrypts string }