using System; using PizzaService; using PizzaSystem; namespace PizzaPresentation { public partial class AdminMenu : System.Web.UI.Page { private AdminService adminService; public AdminService AdminService { get { return adminService; } } protected void Page_Load(object sender, EventArgs e) { // check if app has yet run, set up APIs if (Application["PizzaSys"] == null) { PizzaConfig pizzaService = new PizzaConfig(); Application["PizzaSys"] = pizzaService; } PizzaConfig pizzaSystem = (PizzaConfig)Application["PizzaSys"]; adminService = pizzaSystem.AdminService; } public void AdvanceDayButton_OnClick(object sender, EventArgs e) { try { adminService.AdvanceDay(); AdvanceDayResultLabel.Text = "Success"; } catch (ApplicationException e1) { // show error message (just the part supplied in service layer) AdvanceDayResultLabel.Text = "Failed: " + e1.Message; } } public void PizzaDoneButton_OnClick(object sender, EventArgs e) { try { adminService.MarkNextOrderReady(); PizzaDoneResultLabel.Text = "Success"; } catch (ApplicationException e1) { // show error message PizzaDoneResultLabel.Text = "Failed: " + e1.Message; } } public void ChangePizzaOptionsButton_OnClick(object sender, EventArgs e) { Response.Redirect("AdminChangeOptions.aspx", false); } } }