Esempio n. 1
0
        private void Refund_Click(object sender, RoutedEventArgs e)
        {
            var dbMani = new DatabaseManipulation();
            int custID;

            if (-1 != (custID = dbMani.FindCustomer()))
            {
                vmvo.CurrentCustomer.CustomerID = custID;
                vmvo.CurrentCustomer.FirstName  = vmvo.FirstName;
                vmvo.CurrentCustomer.LastName   = vmvo.LastName;
                vmvo.CurrentCustomer.Phone      = vmvo.Phone;

                // Find the frame.
                Frame            frame  = null;
                DependencyObject parent = VisualTreeHelper.GetParent(this);

                // Cycles through to MainWindow frame
                while (parent != null && frame == null)
                {
                    frame  = parent as Frame;
                    parent = VisualTreeHelper.GetParent(parent);
                }

                // Change the page of the frame.
                if (frame != null)
                {
                    frame.Navigate(new RefundOrder());
                }
                //Code Courtesy of Shmuel Zang in codeprojects.com https://www.codeproject.com/Questions/281551/frame-navigation-in-WPF
            }
            else
            {
                MessageBox.Show("Could Not Find Specific Customer.", "Alert!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 2
0
        private void ConfirmCust_Click(object sender, RoutedEventArgs e)
        {
            DatabaseManipulation dataMani = new DatabaseManipulation();
            int custID;

            if ((custID = dataMani.FindCustomer()) == -1)
            {
                if ((custID = dataMani.AddCustomer()) != -1)
                {
                    vmvo.CurrentCustomer.CustomerID = custID;
                    vmvo.CurrentCustomer.FirstName  = vmvo.FirstName;
                    vmvo.CurrentCustomer.LastName   = vmvo.LastName;
                    vmvo.CurrentCustomer.Phone      = vmvo.Phone;

                    // Find the frame.
                    Frame            frame  = null;
                    DependencyObject parent = VisualTreeHelper.GetParent(this);

                    // Cycles through to MainWindow frame
                    while (parent != null && frame == null)
                    {
                        frame  = parent as Frame;
                        parent = VisualTreeHelper.GetParent(parent);
                    }

                    // Change the page of the frame.
                    if (frame != null)
                    {
                        frame.Navigate(new PurchaseOrder());
                    }
                    //Code Courtesy of Shmuel Zang in codeprojects.com https://www.codeproject.com/Questions/281551/frame-navigation-in-WPF
                }
                else
                {
                    MessageBox.Show("Error: Could Not Add Customer To Database", "Alert!", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("Customer Already Exists", "Alert!", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }