public void Execute() { var orderAmount = Input.DecimalParse(message: "What is the order amount? "); var state = Input.ParseString(message: "What is the state? "); var taxCalculator = new TaxCalculator(); ITaxResult taxResult = taxCalculator.Calculate(orderAmount, state); taxResult.FormatTo(Console.Out); }
protected void Page_Load(object sender, EventArgs e) { ITaxResult TaxResultObj = null; try { Cart CartObj = new JavaScriptSerializer().Deserialize <Cart>(CookieProxy.Instance().GetValue("Cart").ToString()); IAddress AddressObj = new Address(int.Parse(Request.Form["aid"].ToString())); IUserProfile UserProfileObj = new UserProfile(CookieProxy.Instance().GetValue("t").ToString()); TaxResultObj = new TaxManagement().CalculateTaxFromCartItems(CartObj, AddressObj, UserProfileObj); } catch (Exception) { TaxResultObj = new TaxResult(false); } finally { var ResultObj = new { Response = TaxResultObj }; Response.Write(new JavaScriptSerializer().Serialize(ResultObj)); } }