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(); } } }