Beispiel #1
0
 protected void SeatingGridView_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
 {
     // Seat walk-in customers
     MessageUserControl.TryRun(() =>
     {
         // TODO: There are a lot of assumptions in parsing the input, and it would be better
         //       to break this into chunks an display appropriate "usage" messages to the end-user.
         // Get the controls
         GridViewRow row = SeatingGridView.Rows[e.NewSelectedIndex];
         var tableControl = row.FindControl("TableNumber") as Label;
         var numberInPartyControl = row.FindControl("NumberInParty") as TextBox;
         var waiterListControl = row.FindControl("WaiterList") as DropDownList;
         var when = DateTime.Parse(SearchDate.Text).Add(TimeSpan.Parse(SearchTime.Text));
         // Seat the customer
         var controller = new SeatingController();
         controller.SeatCustomer(when, byte.Parse(tableControl.Text), int.Parse(numberInPartyControl.Text), int.Parse(waiterListControl.SelectedValue));
         // Refresh the gridview
         SeatingGridView.DataBind();
     }, "Customer Seated", "New walk-in customer has been seated");
 }
Beispiel #2
0
 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 SeatingController();
             controller.SeatCustomer(when, reservationId, selectedItems, int.Parse(WaiterDropDownList.SelectedValue));
             // Refresh the gridview
             SeatingGridView.DataBind();
         }, "Customer Seated", "Reservation customer has arrived and has been seated");
     }
 }