Ejemplo n.º 1
0
        //Done bookingpage code

        //Customerpage code

        //Submit the customer page
        //Depending on the case (see caseSwtich declaration) it will add or update the customer
        //For the cases not listed it is not visible
        private void CusSubmitBtn_Click(object sender, RoutedEventArgs e)
        {
            Customer cus = new Customer();

            switch (caseSwitch)
            {
            case 1:

                if (existingCus)
                {
                    CustomerPage.Visibility = Visibility.Hidden;
                    BookingPage.Visibility  = Visibility.Visible;
                    CustomerNumberBox.Text  = CusNumBox.Text;
                    BookingRefBox.Text      = (lastBookingRef + 1).ToString();
                    break;
                }

                SetCustomerObjectData(cus);
                db.AddCustomer(cus);
                lastCusNum += 1;

                CustomerNumberBox.Text = lastCusNum.ToString();
                BookingRefBox.Text     = (lastBookingRef + 1).ToString();

                CustomerPage.Visibility = Visibility.Hidden;
                BookingPage.Visibility  = Visibility.Visible;

                break;

            case 4:

                cus = SetCustomerObjectData(cus);

                db.AddCustomer(cus);

                customerList.Add(cus);

                lastCusNum += 1;

                CustomerPage.Visibility = Visibility.Hidden;
                StartPage.Visibility    = Visibility.Visible;

                break;

            case 5:

                cus = SetCustomerObjectData(cus);

                db.UpdateCustomer(cus);

                CustomerPage.Visibility = Visibility.Hidden;
                StartPage.Visibility    = Visibility.Visible;

                break;
            }
        }