コード例 #1
0
        public void InitializeFields(ref TablesList tables, ref Booking booking, ref CustomersList customers)
        {
            comboTables.ItemsSource       = tables.Tables;
            comboTables.DisplayMemberPath = "TableInfo";

            for (int i = 0; i < tables.Count; i++)
            {
                if (tables[i].TableNumber == booking.TableNumber)
                {
                    comboTables.SelectedIndex = i;
                    break;
                }
            }
            txtCurrentTime.Text = booking.Timing.Duration;
            DisplayTiming();

            for (int i = 0; i < customers.Count; i++)
            {
                if (customers[i].Id == booking.CustomerId)
                {
                    txtName.Text  = customers[i].Name;
                    txtEmail.Text = customers[i].Email;
                    txtPhone.Text = customers[i].Phone;
                    break;
                }
            }
        }
コード例 #2
0
ファイル: SearchTab.cs プロジェクト: Tarunpreetsingh16/CSharp
        public void SearchTables(object sender, RoutedEventArgs args)
        {
            if (comboTableSearch.SelectedIndex != -1)
            {
                lblSearchMessage.Content = String.Empty;
                TablesList tablesLeft = new TablesList();
                Timing     timing     = comboTableSearch.SelectedItem as Timing;

                var tableQuery = from table in tables.Tables
                                 select table;

                foreach (Table table in tableQuery)
                {
                    var timingsQuery = from startTiming in table.Timings.Timings
                                       where startTiming.StartTime == timing.StartTime
                                       select startTiming.Duration;

                    if (timingsQuery.ToList().Count == 0)
                    {
                        tablesLeft.Add(table);
                    }
                }

                listBoxTables.ItemsSource       = tablesLeft.Tables;
                listBoxTables.DisplayMemberPath = "TableInfo";
            }
            else
            {
                lblSearchMessage.Content = "Please select a time to search!";
            }
        }
コード例 #3
0
        public Window1(ref Booking booking, ref TablesList tables, ref CustomersList customers, ref BookingsList bookings)
        {
            this.booking   = booking;
            this.tables    = tables;
            this.bookings  = bookings;
            this.customers = customers;

            InitializeComponent();
            DefineRestaurantTimings();
            InitializeFields(ref tables, ref booking, ref customers);
        }