private void buttonProducts_Click(object sender, RoutedEventArgs e)
        {
            Employee employee = (from emp in jackyDigitalXDBEntities.Employees
                                 where emp.Username == Username && emp.Password == password
                                 select emp).FirstOrDefault();

            int          employeeID        = employee.EmployeeID;
            var          thisEmployeeRoles = jackyDigitalXDBEntities.selectEmployeeRoles(employeeID);
            Verification verification      = new Verification();

            foreach (string aRole in thisEmployeeRoles)
            {
                if (aRole.Contains(verification.Administrator))
                {
                    productsPage = new Products.ProductsPage();
                    mainFrame.NavigationService.Navigate(productsPage);
                }
                else if (aRole.Contains(verification.DespatchShipping))
                {
                    productsPage = new Products.ProductsPage();
                    productsPage.buttonAddCategoryProductPage.Visibility     = Visibility.Collapsed;
                    productsPage.buttonEditCategoryProductPage.Visibility    = Visibility.Collapsed;
                    productsPage.buttonAddSubCategoryProductPage.Visibility  = Visibility.Collapsed;
                    productsPage.buttonEditSubCategoryProductPage.Visibility = Visibility.Collapsed;
                    productsPage.buttonAddProductProductPage.Visibility      = Visibility.Collapsed;
                    productsPage.buttonEditProductProductPage.Visibility     = Visibility.Collapsed;
                    mainFrame.NavigationService.Navigate(productsPage);
                }
                else if (aRole.Contains(verification.ProductControl))
                {
                    productsPage = new Products.ProductsPage();
                    mainFrame.NavigationService.Navigate(productsPage);
                }
            }
        }
        private void loginUserControl_LoginClicked(object sender, RoutedEventArgs e)
        {
            LoginClickedArgs loginClickedArgs = e as LoginClickedArgs;

            Username = loginClickedArgs.UserName;
            password = loginClickedArgs.Password;

            Employee employee = (from emp in jackyDigitalXDBEntities.Employees
                                 where emp.Username == Username && emp.Password == password
                                 select emp).FirstOrDefault();

            if (employee == null)
            {
                loginUserControl.userNameTextBox.Text        = "";
                loginUserControl.passwordBox.Password        = "";
                loginUserControl.WrongUserNameTextBlock.Text = "INVALID Username or password";
                loginUserControl.WrongPasswordBlock.Text     = "";
                loginUserControl.userNameTextBox.Background  = new SolidColorBrush(Color.FromArgb(255, 255, 200, 200));
                loginUserControl.passwordBox.Background      = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            }
            else
            {
                int          employeeID        = employee.EmployeeID;
                var          thisEmployeeRoles = jackyDigitalXDBEntities.selectEmployeeRoles(employeeID);
                Verification verification      = new Verification();

                if (jackyDigitalXDBEntities.selectEmployeeRoles(employeeID).Count() != 0)
                {
                    foreach (string aRole in thisEmployeeRoles)
                    {
                        if (aRole.Contains(verification.Administrator))
                        {
                            loginUserControl.WrongUserNameTextBlock.Text = "";
                            loginUserControl.WrongPasswordBlock.Text     = "";
                            loginUserControl.Visibility = Visibility.Collapsed;
                            ShowControls();
                            pageAfterLogout = new SplashWindow.PageAfterLogout();
                            mainFrame.NavigationService.Navigate(pageAfterLogout);
                            ordersPage    = new Orders.OrdersPage();
                            productsPage  = new Products.ProductsPage();
                            customersPage = new Customers.CustomersPage();
                            employeesPage = new Employees.EmployeesPage();
                            return;
                        }

                        else if (aRole.Contains(verification.HumanResources))
                        {
                            loginUserControl.WrongUserNameTextBlock.Text = "";
                            loginUserControl.WrongPasswordBlock.Text     = "";
                            loginUserControl.Visibility = Visibility.Collapsed;
                            mainFrame.Visibility        = Visibility.Visible;
                            buttonEmployees.Visibility  = Visibility.Visible;
                            pageAfterLogout             = new SplashWindow.PageAfterLogout();
                            mainFrame.NavigationService.Navigate(pageAfterLogout);
                            employeesPage = new Employees.EmployeesPage();
                        }

                        else if (aRole.Contains(verification.CustomerService))
                        {
                            loginUserControl.Visibility = Visibility.Collapsed;
                            mainFrame.Visibility        = Visibility.Visible;
                            buttonCustomers.Visibility  = Visibility.Visible;
                            buttonOrders.Visibility     = Visibility.Visible;
                            pageAfterLogout             = new SplashWindow.PageAfterLogout();
                            mainFrame.NavigationService.Navigate(pageAfterLogout);
                            customersPage = new Customers.CustomersPage();
                            ordersPage    = new Orders.OrdersPage();
                        }

                        else if (aRole.Contains(verification.DespatchShipping))
                        {
                            loginUserControl.Visibility = Visibility.Collapsed;
                            mainFrame.Visibility        = Visibility.Visible;
                            buttonOrders.Visibility     = Visibility.Visible;
                            buttonProducts.Visibility   = Visibility.Visible;
                            buttonCustomers.Visibility  = Visibility.Visible;
                            pageAfterLogout             = new SplashWindow.PageAfterLogout();
                            mainFrame.NavigationService.Navigate(pageAfterLogout);
                            ordersPage = new Orders.OrdersPage();
                            ordersPage.buttonOrderPageAddBasicOrderInformation.Visibility    = Visibility.Collapsed;
                            ordersPage.buttonOrderPageAddDetailedOrderInformation.Visibility = Visibility.Collapsed;
                            customersPage = new Customers.CustomersPage();
                            customersPage.buttonNewCustomerBasicInformationCustomerPage.Visibility  = Visibility.Collapsed;
                            customersPage.buttonEditCustomerBasicInformationCustomerPage.Visibility = Visibility.Collapsed;
                            customersPage.buttonNewCustomerAddressCustomerPage.Visibility           = Visibility.Collapsed;
                            customersPage.buttonEditCustomerAddressCustomerPage.Visibility          = Visibility.Collapsed;
                        }

                        else if (aRole.Contains(verification.ProductControl))
                        {
                            loginUserControl.Visibility = Visibility.Collapsed;
                            mainFrame.Visibility        = Visibility.Visible;
                            buttonProducts.Visibility   = Visibility.Visible;
                            pageAfterLogout             = new SplashWindow.PageAfterLogout();
                            mainFrame.NavigationService.Navigate(pageAfterLogout);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("You have not assigend to any role yet. Please see your administrator for further assistance.");
                }
            }
        }