protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Order order = (Order)Session["order"]; bool hasOrder = order != null; bool hasMessage = Session["message"] != null; if (hasOrder) { List <OrderDetail> carts = order.carts; DataTable dt = CartUI.getDataTable(carts); table_products.DataSource = dt; table_products.DataBind(); Button1.Text = "Submit"; } if (hasMessage) { label_notification.Text = Session["message"].ToString(); Session["message"] = null; } if (!hasOrder) { Button1.Text = "Go back"; if (!hasMessage) { label_notification.Text = "Order is empty."; } } } }
public static void DisplayService(int serviceId = 0) { CartManager cartManager = new CartManager(); Console.Clear(); if (cartManager.RetrieveAll().Count > 0) { CartUI.CartDisplay(); } ProductUI.ProductDisplay(); }