protected void Page_Load(object sender, EventArgs e) { if (HttpContext.Current.Session == null || HttpContext.Current.Session["admin"] == null) { Response.Redirect("~/LoginP.aspx"); } Page.Header.Title = "Fast food - Orders"; if (IsPostBack == false) { SearchTextBox.Text = ""; this.order_state = OrderStates.order_to_deliver; OrdersStateTextBox.Text = this.order_state; l1 = OrdersDAO.GetORDERsByState(this.order_state); OrdersListView.DataSource = l1; OrdersListView.DataBind(); } }
private void GetAndBindOrders(string order_state) { if (!string.IsNullOrEmpty(SearchTextBox.Text.Trim())) { this.search = SearchTextBox.Text.Trim(); } if (DateCheckBox.Checked && !string.IsNullOrEmpty(DateTextBox.Text.Trim())) { if (string.IsNullOrEmpty(this.search)) { l1 = OrdersDAO.GetORDERsByStateAndDate(order_state, DateTextBox.Text.Trim()); OrdersListView.DataSource = l1; OrdersListView.DataBind(); } else { l1 = OrdersDAO.GetORDERsByStateAndSearchAndDate(order_state, this.search.Trim(), DateTextBox.Text.Trim()); OrdersListView.DataSource = l1; OrdersListView.DataBind(); } } else { if (string.IsNullOrEmpty(this.search)) { l1 = OrdersDAO.GetORDERsByState(order_state); OrdersListView.DataSource = l1; OrdersListView.DataBind(); } else { l1 = OrdersDAO.GetORDERsByStateAndSearch(order_state, this.search.Trim()); OrdersListView.DataSource = l1; OrdersListView.DataBind(); } } }
//// ReSharper restore NotAccessedField.Local public static void Main(string[] args) { _eventAggregator = new SimpleEventAggregator(); _orderListView = new OrdersListView(); _orderDetailView = new OrderDetailView(_eventAggregator); _orderHistoryView = new OrderHistoryView(_eventAggregator); _orderView = new OrderView(_eventAggregator); var orders = GenerateOrders(); _orderListView.EventAggregator = _eventAggregator; _orderListView.SetOrders(orders); ConsoleKeyInfo consoleKeyInfo; do { Console.Write("Enter an order number: "); consoleKeyInfo = Console.ReadKey(); Console.WriteLine(); int?number = ParseCharacter(consoleKeyInfo); if (number.HasValue) { _orderListView.SelectOrder(number.Value); Thread.Sleep(500); } else { Console.WriteLine("Invalid input"); } }while (consoleKeyInfo.Key != ConsoleKey.Enter); }