//Next Button
        //for Input validation and saving new user info
        private void ConfirmButton_Click(object sender, RoutedEventArgs e)
        {
            FreeCustomer    cs  = new FreeCustomer(username);
            PremiumCustomer pcs = new PremiumCustomer();

            pcs.FirstName          = cs.FirstName = av.validateFirstNameInput(txtBlockFNameError, txtBoxFName);
            pcs.LastName           = cs.LastName = av.validateLastNameInput(txtBlockLNameError, txtBoxLName);
            pcs.Phone              = cs.Phone = av.validatePhoneNoInput(txtBlockPhoneError, txtBoxPhone);
            pcs.DOB                = cs.DOB = av.validateDOBInput(txtBlockDOBError, txtBoxDOBDay, txtBoxDOBMonth, txtBoxDOBYear);
            pcs.Country            = cs.Country = av.validateCountryInput(selectionValueCountry, txtBlockCountryError);
            pcs.TownOrCity         = cs.TownOrCity = av.validateTownOrCityInput(txtBlockCityError, txtBoxCity);
            pcs.Nationality        = cs.Nationality = av.validateNationalityInput(selectionValueNationality, txtBlockNationalityError);
            pcs.CustAddress        = cs.CustAddress = av.validateAddressInput(txtBlockAddressError, txtBoxAddress);
            pcs.PostalCd           = cs.PostalCd = av.validatePostalCdInput(txtBlockPostalCdError1, txtBlockPostalCdError2, txtBoxPostalCd);
            pcs.CustPassword       = cs.CustPassword = av.validatePasswordInput(txtBlockPWError1, txtBlockPWError2, txtBlockPWError3, txtBlockConfirmPWError, txtBoxPW, txtBoxConfirmPW);
            pcs.CardType           = cs.CardType = av.validateCardTypeInput(selectionValueCardType, txtBlockCardTypeError);
            pcs.CardNo             = cs.CardNo = av.validateCardNoInput(txtBlockCardNoError1, txtBlockCardNoError2, txtBoxCardNo);
            pcs.CardExpirationDate = cs.CardExpirationDate = av.validateExpirationDateInput(txtBlockExpDateError, txtBoxExpMonth, txtBoxExpYear);
            pcs.CardHolderName     = cs.CardHolderName = av.validateCardHolderNameInput(txtBlockCardHolderNameError, txtBoxCardHolderName);
            pcs.CCV                = cs.CCV = av.validateCCVInput(txtBlockCCVError, txtBoxCCV);
            pcs.Email              = cs.Email = validateEmailInput();
            pcs.Username           = cs.Username = username;
            pcs.Subsidy            = subsidy;
            cs.ExpiryDate          = expDate;

            if (cbMembership.IsChecked == true)
            {
                pcs.Membership = "Premium";
                cs.Membership  = "";
            }
            else
            {
                pcs.Membership = "";
                cs.Membership  = "Free";
            }

            if (cs.FirstName != null && cs.LastName != null && cs.Email != "" && cs.Phone != null && cs.DOB != null && cs.Country != null && cs.TownOrCity != null && cs.Nationality != null && cs.CustAddress != null && cs.PostalCd != null && cs.CustPassword != null && cs.CardType != null && cs.CardNo != null && cs.CardExpirationDate != null && cs.CardHolderName != null && cs.CCV != null)
            {
                dbBooking db = new dbBooking();
                if (pcs.Membership == "Premium")
                {
                    pcs.Subsidy = 0.9;
                    if (cs.getCustomerDetail(username, 17) == "Free")
                    {
                        MessageBox.Show("You have signed up for premium membership! $20 has been charged to your card.");
                    }
                    pcs.updatePremiumCustDB(pcs.FirstName, pcs.LastName, pcs.Email, pcs.Phone, pcs.DOB, pcs.Country, pcs.TownOrCity, pcs.Nationality, pcs.CustAddress, pcs.PostalCd, pcs.Username, pcs.CustPassword, pcs.CardType, pcs.CardNo, pcs.CardExpirationDate, pcs.CardHolderName, pcs.CCV, pcs.Membership, pcs.Subsidy);
                }
                else if (cs.Membership == "Free")
                {
                    cs.updateFreeCustDB(cs.FirstName, cs.LastName, cs.Email, cs.Phone, cs.DOB, cs.Country, cs.TownOrCity, cs.Nationality, cs.CustAddress, cs.PostalCd, cs.Username, cs.CustPassword, cs.CardType, cs.CardNo, cs.CardExpirationDate, cs.CardHolderName, cs.CCV, cs.Membership, cs.ExpiryDate);
                }


                this.NavigationService.Navigate(new SettingsPage(username, windowColor));
            }
        }
Beispiel #2
0
        public StartupWindow()
        {
            InitializeComponent();
            Main.Content = new Pages.WelcomePage();
            FreeCustomer fcs = new FreeCustomer();
            Booking      bk  = new Booking();

            fcs.deleteExpiredCustomers();
            ObservableCollection <Booking> Hi = bk.getNoOfBookingPerMonth();
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //Display current user's info in controls for user to edit
            Customer        c     = new Customer();
            Customer        cust  = (Customer)c.getCustomerRow(username);
            FreeCustomer    fc    = new FreeCustomer();
            FreeCustomer    fcust = (FreeCustomer)fc.getCustomerRow(username);
            PremiumCustomer pc    = new PremiumCustomer();
            PremiumCustomer pcust = (PremiumCustomer)pc.getCustomerRow(username);

            if (cust.Membership == "Premium")
            {
                cbMembership.IsChecked          = true;
                PremiumErrorTxtBlock.Visibility = MembershipErrorTxtBlock.Visibility = Visibility.Hidden;
                cbBoxTheme.IsHitTestVisible     = true;
                subsidy = pcust.Subsidy;
            }
            else if (cust.Membership == "Free")
            {
                cbMembership.IsChecked          = false;
                PremiumErrorTxtBlock.Visibility = MembershipErrorTxtBlock.Visibility = Visibility.Visible;
                cbBoxTheme.IsHitTestVisible     = false;
                expDate = fcust.ExpiryDate;
            }

            txtBoxFName.Text = cust.FirstName;
            txtBoxLName.Text = cust.LastName;
            txtBoxPhone.Text = cust.Phone;
            string birth = Convert.ToDateTime(cust.DOB).ToShortDateString();

            string[] DOBParts = birth.Split('/');
            txtBoxDOBDay.Text                 = DOBParts[0];
            txtBoxDOBMonth.Text               = DOBParts[1];
            txtBoxDOBYear.Text                = DOBParts[2];
            txtBoxCity.Text                   = cust.TownOrCity;
            comboBoxCountry.SelectedValue     = cust.Country;
            comboBoxNationality.SelectedValue = cust.Nationality;
            txtBoxAddress.Text                = cust.CustAddress;
            txtBoxPostalCd.Text               = cust.PostalCd;
            txtBoxPW.Password                 = txtBoxConfirmPW.Password = cust.CustPassword;
            comboBoxCardType.Text             = cust.CardType;
            txtBoxCardNo.Text                 = cust.CardNo;
            string[] Parts = cust.CardExpirationDate.Split('/');
            txtBoxExpMonth.Text       = Parts[0];
            txtBoxExpYear.Text        = Parts[1];
            txtBoxCardHolderName.Text = cust.CardHolderName;
            txtBoxCCV.Text            = cust.CCV;
            txtBoxEmail.Text          = cust.Email;
            email = cust.Email;
            txtBoxExpMonth.Foreground = txtBoxExpYear.Foreground = txtBoxPhone.Foreground = txtBoxDOBDay.Foreground = txtBoxDOBMonth.Foreground = txtBoxDOBYear.Foreground = Brushes.Black;
        }
Beispiel #4
0
        // BINDS UI TO OBSERVABLE COLLECTION OF CART OBJECTS - TO DISPLAY CART
        private void refreshCartItems()
        {
            Customer customer = new Customer();

            customer = (Customer)customer.getCustomerRow(username);
            FreeCustomer    fcust = new FreeCustomer(username);
            PremiumCustomer pcust = new PremiumCustomer(username);
            Cart            ct    = new Cart(username);

            ListBoxCartItems.ItemsSource = ct.getCartItems();

            if (ct.getCartItems().Count == 0) //shows/hides 'none selected' text block ui
            {
                txtBlockNone.Visibility = Visibility.Visible;
            }
            else
            {
                txtBlockNone.Visibility = Visibility.Collapsed;
            }



            if (customer.Membership == "Free")
            {
                fcust.populateCustomerDetails();
                txtBlockSubsidy.Text = "None";
                finalprice           = ct.calculateTotal();
            }
            else if (customer.Membership == "Premium")
            {
                pcust.populateCustomerDetails();
                txtBlockSubsidy.Text = "10%";
                finalprice           = ct.calculateTotal();
            }

            finalprice = ct.calculateTotal();
            txtBlockTotalCost.DataContext = new Booking {
                TotalCost = finalprice
            };
        }
Beispiel #5
0
        private void ConfirmButton_Click(object sender, RoutedEventArgs e)
        {
            if (chkBox1.IsChecked == false)
            {
                MessageBox.Show("Please read and agree to the terms and conditions, and check the checkbox to proceed.");
            }
            else if (chkBox1.IsChecked == true)
            {
                if (rbYes.IsChecked == true)
                {
                    cs.Membership = "Premium";

                    PremiumCustomer pcs = new PremiumCustomer(cs.FirstName, cs.LastName, cs.Email, cs.Phone, cs.DOB, cs.Country, cs.TownOrCity, cs.Nationality, cs.CustAddress, cs.PostalCd, cs.Username, cs.CustPassword, cs.CardType, cs.CardNo, cs.CardExpirationDate, cs.CardHolderName, cs.CCV, cs.Membership, 0.9);

                    pcs.addNewCustomer();
                }
                else if (rbNo.IsChecked == true)
                {
                    cs.Membership = "Free";
                    DateTime expDate = (DateTime.Now).AddDays(30);
                    MessageBox.Show("Please note that your account will be automatically deleted at " + expDate.ToShortDateString(), "Note", MessageBoxButton.OK, MessageBoxImage.Information);
                    FreeCustomer fcs = new FreeCustomer(cs.FirstName, cs.LastName, cs.Email, cs.Phone, cs.DOB, cs.Country, cs.TownOrCity, cs.Nationality, cs.CustAddress, cs.PostalCd, cs.Username, cs.CustPassword, cs.CardType, cs.CardNo, cs.CardExpirationDate, cs.CardHolderName, cs.CCV, cs.Membership, expDate.ToShortDateString());

                    fcs.addNewCustomer();
                }

                MessageBox.Show("Welcome, " + cs.FirstName + " " + cs.LastName + "!", "Welcome"); //show msg box to welcome firstname, like: "Welcome, John!"
                var newWindow = new MainWindow(cs.Username, BorderColor);                         //create new window (Open all-tour page)
                newWindow.Top          = Window.GetWindow(this).Top;
                newWindow.Left         = Window.GetWindow(this).Left;
                newWindow.Main.Content = new BrowseToursPage(cs.Username, BorderColor);
                newWindow.Show();                                   //Show the new window

                var currentWindow = Application.Current.Windows[0]; //Set current window to variable
                currentWindow.Close();                              //Close the current window
            }
        }