public string Encoder(Order order) { string str = Convert.ToString(order.getID()) + "_" + Convert.ToString(order.getCardNo()) + "_" + Convert.ToString(order.getAmt()) + "_" + Convert.ToString(order.getPrice()); webEncrypt.ServiceClient proxy = new webEncrypt.ServiceClient();//make sure your internet is connected return(proxy.Encrypt(str)); // proxy.Close(); }
//----------------------- private void OrderProcessing(object ordStrObj) { string ordstring = ordStrObj.ToString(); Coder cod = new Coder(); Order ord = cod.Decoder(ordstring); int BuyCard = ord.getCardNo(); Console.WriteLine("ChickenFarm received one order from store{0}", ord.getID()); double taxRate = 0.09; double tot = (taxRate + 1) * ord.getPrice() * ord.getAmt(); Console.WriteLine("Store{0} wants to buy {1} chickens in totally {2} dollars!", ord.getID(), ord.getAmt(), tot); if (BuyCard >= 350 && BuyCard <= 450) //check card # correct or not { Program.confirmed = false; confrim(ord); //call order confirm } else { Console.WriteLine("Store{0} failed to buy chickens cause of wrong Card #!", ord.getID()); } }
public string Encoder(Order order) { string str = Convert.ToString(order.getID()) + "_" + Convert.ToString(order.getCardNo()) + "_" + Convert.ToString(order.getAmt())+"_"+Convert.ToString(order.getPrice()); webEncrypt.ServiceClient proxy = new webEncrypt.ServiceClient();//make sure your internet is connected return proxy.Encrypt(str); // proxy.Close(); }
public void Confirmation(Order ord) { endTime = DateTime.Now; //track end time if (Program.confirmed == false) { Console.WriteLine("Store{0} has bought {1} chickens sucessfully! spend{2} ", ord.getID(), ord.getAmt(), endTime - startTime); Program.confirmed = true; } }