protected void ReservationSummaryListView_OnItemCommand(object sender, ListViewCommandEventArgs e) { // Check the command name and add the reservation for the specified seats. if (e.CommandName.Equals("Seat")) { MessageUserControl.TryRun(() => { // Get the data var reservationId = int.Parse(e.CommandArgument.ToString()); var selectedItems = new List <byte>(); foreach (ListItem item in ReservationTableListBox.Items) { if (item.Selected) { selectedItems.Add(byte.Parse(item.Text.Replace("Table ", ""))); } } var when = DateTime.Parse(SearchDate.Text).Add(TimeSpan.Parse(SearchTime.Text)); // Seat the reservation customer var controller = new eRestaurantController(); controller.SeatCustomer(when, reservationId, selectedItems, int.Parse(WaiterDropDownList.SelectedValue)); // Refresh the gridview SeatingGridView.DataBind(); ReservationsRepeater.DataBind(); }, "Customer Seated", "Reservation customer has arrived and has been seated"); } }
protected void ReservationSummaryListView_ItemCommand(object sender, ListViewCommandEventArgs e) { // this is the method which will gather the seating // information for reservations and pass to the BLL // for processing // no processing will be done unless the e.CommandName is // equal to "Seat" if (e.CommandName.Equals.("Seat")) { // execution of the code will be under the control // of the MessageUserControl MessageUserControl.TryRun(() => { //1. gather necessary data from the web controls int reservationid = int.Parse(e.CommandArgument.ToString()); int waiterid = int.Parse(WaiterDropDownList.SelectedValue); DateTime when = Mocker.MockDate.Add(Mocker.MockTime); //2. we need to collect possible multiple values // from the ListBox control which contains // the selected tables to be assigned to this // group of customers List<byte> selectedTables = new List<byte>(); //3.walk throuth the ListBox row by row foreach (ListItem item_tableid in ReservationTableListBox.Items) { if (item_tableid.Selected) { selectedTables.Add(byte.Parse(item_tableid.Text.Replace("Table ",""))); ) } } //4.with all data gathered, connect to your //library controller, and send data for //processing AdminController sysmgr = new AdminController(); sysmgr.SeatCustomer(when, reservationid,selectedTables,waiterid); //5.Refresh the page(Screen) SeatingGridView.DataBind(); //6.Refresh the reservation Repeater ReservationsRepeater.DataBind(); ReservationTableListBox.DataBind(); },"Customer Seated","Reservation customer has arrived and has been seated"); } }
protected void ReservationSummaryListView_ItemCommand(object sender, ListViewCommandEventArgs e) { // this is the method which will gather the seating // information for reservations and pass the the BLL for processing //no processing will be done unless the e.CoomandName is equal to "Seat" if (e.CommandName.Equals("Seat")) { MessageUserControl.TryRun(() => { //gather the necessary data from teh web controls int reservationid = int.Parse(e.CommandArgument.ToString()); int waiterid = int.Parse(WaiterDropDownList.SelectedValue); DateTime when = Mocker.MockDate.Add(Mocker.MockTime); //we need to collect the possible multiple values from the ListBox control which contains the selected tables to be assigned to this group of customer List <byte> selectTables = new List <byte>(); //walk through the lis box row by row foreach (ListItem item_tableid in ReservationTableListBox.Items) { if (item_tableid.Selected) { selectTables.Add(byte.Parse(item_tableid.Text.Replace("Table ", ""))); } } //with all data gathered. connect to your library controller // and send data for processing AdminController sysmgr = new AdminController(); sysmgr.SeatCustomer(when, reservationid, selectTables, waiterid); // Refresh the page // Refresh both the grid view SeatingGridView.DataBind(); ReservationsRepeater.DataBind(); ReservationTableListBox.DataBind(); }, "Customer seated", "Reservation customer has arrvied and has been seated"); } }