private void DeleteBtn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var selPage = this.categoryViewer.NavigationService.Content.GetType().Name.ToString();

            switch (counter)
            {
            case 0:
                if (selPage.ToString() == "Users")
                {
                    userP.ControlsOn();
                    deleteTxt.Text        = "Confirm";
                    newBtn.Visibility     = Visibility.Hidden;
                    editBtn.Visibility    = Visibility.Hidden;
                    refreshBtn.Visibility = Visibility.Hidden;
                    printBtn.Visibility   = Visibility.Hidden;

                    counter = 1;
                }
                else if (selPage.ToString() == "BusP")
                {
                    busP.ControlsOn();
                    deleteTxt.Text        = "Confirm";
                    newBtn.Visibility     = Visibility.Hidden;
                    editBtn.Visibility    = Visibility.Hidden;
                    refreshBtn.Visibility = Visibility.Hidden;
                    printBtn.Visibility   = Visibility.Hidden;

                    counter = 1;
                }
                else if (selPage.ToString() == "Shifts")
                {
                    MessageBox.Show("To delete a job click a job from the list and click the delete icon");

                    deleteTxt.Text        = "Confirm";
                    newBtn.Visibility     = Visibility.Hidden;
                    editBtn.Visibility    = Visibility.Hidden;
                    refreshBtn.Visibility = Visibility.Hidden;
                    printBtn.Visibility   = Visibility.Hidden;

                    counter = 1;
                }
                break;

            case 1:
                if (selPage.ToString() == "Users" && counter == 1)
                {
                    #region testing validation

                    RestClient restClient = new RestClient();
                    restClient.endPoint = "http://localhost:8080/AppServer_war_exploded/logic/delete/user/" + userP.userIdTxt.Text;


                    string response = restClient.makeRequest();
                    MessageBox.Show("ENDPOINT: \n" + restClient.endPoint + "RESPONSE: " + response);

                    if (response == "true")
                    {
                        deleteTxt.Text = "Delete";
                        MessageBox.Show("user succesfully deleted");

                        newBtn.Visibility     = Visibility.Visible;
                        editBtn.Visibility    = Visibility.Visible;
                        refreshBtn.Visibility = Visibility.Visible;
                        printBtn.Visibility   = Visibility.Visible;

                        userP.ControlsOff();
                        userP.driverTypeBox.SelectedIndex  = 0;
                        userP.cpcTypeBox.SelectedIndex     = 0;
                        userP.licenseTypeBox.SelectedIndex = 0;
                        userP.userTypeBox.SelectedIndex    = 0;
                        userP.sNameTxt.Clear();
                        userP.fNameTxt.Clear();
                        userP.userIdTxt.Clear();
                        userP.emailTxt.Clear();

                        categoryViewer.Navigate(userP = new Users(this));
                        ShowControls();
                        counter = 0;
                    }

                    #endregion
                }
                else if (selPage.ToString() == "BusP" && counter == 1)
                {
                    #region testing validation

                    RestClient restClient = new RestClient();
                    restClient.endPoint = "http://localhost:8080/AppServer_war_exploded/logic/delete/bus/" + busP.regTxt.Text;


                    string response = restClient.makeRequest();
                    MessageBox.Show("ENDPOINT: \n" + restClient.endPoint + "RESPONSE: " + response);

                    if (response == "true")
                    {
                        deleteTxt.Text = "Delete";
                        MessageBox.Show("user succesfully deleted");

                        newBtn.Visibility     = Visibility.Visible;
                        editBtn.Visibility    = Visibility.Visible;
                        refreshBtn.Visibility = Visibility.Visible;
                        printBtn.Visibility   = Visibility.Visible;

                        busP.Clear();
                        categoryViewer.Navigate(busP = new BusP(this));
                        busP.ControlsOff();
                        counter = 0;
                        ShowControls();
                    }

                    #endregion
                }
                else if (selPage.ToString() == "Shifts" && counter == 1)
                {
                    #region testing validation

                    Job        job        = (Job)shiftP.jobInfoDataGrid.SelectedItem;
                    RestClient restClient = new RestClient();
                    restClient.endPoint = "http://localhost:8080/AppServer_war_exploded/logic/job/delete/" + job.job_id;


                    string response = restClient.makeRequest();
                    MessageBox.Show("ENDPOINT: \n" + restClient.endPoint + "RESPONSE: " + response);

                    if (response == "true")
                    {
                        deleteTxt.Text = "Delete";
                        MessageBox.Show("job succesfully deleted");

                        newBtn.Visibility     = Visibility.Visible;
                        editBtn.Visibility    = Visibility.Visible;
                        refreshBtn.Visibility = Visibility.Visible;
                        printBtn.Visibility   = Visibility.Visible;

                        categoryViewer.Navigate(shiftP = new Shifts(this));
                        shiftP.ControlsOff();
                        counter = 0;
                        ShowControls();
                    }
                    #endregion
                }
                break;
            }
        }
        private void settingsBtn_Click(object sender, RoutedEventArgs e)
        {
            categoryViewer.Navigate(busP = new BusP(this));

            //HideControls();
        }
        private void EditBtn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var selPage = this.categoryViewer.NavigationService.Content.GetType().Name.ToString();

            switch (counter)
            {
            case 0:
                if (selPage.ToString() == "Users")
                {
                    userP.ControlsOn();

                    editImg.Source = new BitmapImage(new Uri("Images/save.jpg", UriKind.Relative));
                    editTxt.Text   = "Save";

                    newBtn.Visibility     = Visibility.Hidden;
                    deleteBtn.Visibility  = Visibility.Hidden;
                    refreshBtn.Visibility = Visibility.Hidden;
                    printBtn.Visibility   = Visibility.Hidden;

                    counter = 1;
                }
                else if (selPage.ToString() == "BusP")
                {
                    busP.ControlsOn();

                    editImg.Source = new BitmapImage(new Uri("Images/save.jpg", UriKind.Relative));
                    editTxt.Text   = "Save";

                    newBtn.Visibility     = Visibility.Hidden;
                    deleteBtn.Visibility  = Visibility.Hidden;
                    refreshBtn.Visibility = Visibility.Hidden;
                    printBtn.Visibility   = Visibility.Hidden;

                    counter = 1;
                }
                else if (selPage.ToString() == "Shifts" && shiftP.jobInfoDataGrid.SelectedIndex == -1)
                {
                    MessageBox.Show("You Must Select a Job to edit it");
                }
                else if (selPage.ToString() == "Shifts" && shiftP.jobInfoDataGrid.SelectedIndex != -1)
                {
                    editImg.Source = new BitmapImage(new Uri("Images/save.jpg", UriKind.Relative));
                    editTxt.Text   = "Save";
                    shiftP.ControlsOn();
                    newBtn.Visibility     = Visibility.Hidden;
                    deleteBtn.Visibility  = Visibility.Hidden;
                    refreshBtn.Visibility = Visibility.Hidden;
                    printBtn.Visibility   = Visibility.Hidden;

                    counter = 1;
                }
                break;

            case 1:
                if (selPage.ToString() == "Users" && counter == 1)
                {
                    #region testing validation

                    RestClient restClient = new RestClient();
                    restClient.endPoint = "http://localhost:8080/AppServer_war_exploded/logic/edit/user/" + userP.userIdTxt.Text + "/" + userP.userTypeBox.SelectedIndex + "/" +
                                          userP.fNameTxt.Text + "/" + userP.sNameTxt.Text + "/" + userP.driverTypeBox.SelectedIndex + "/" + userP.licenseTypeBox.SelectedIndex + "/" + userP.cpcTypeBox.SelectedIndex + "/" + userP.emailTxt.Text;


                    string response = restClient.makeRequest();

                    if (response == "true")
                    {
                        MessageBox.Show("user succesfully edited");
                        editImg.Source = new BitmapImage(new Uri("Images/edit.png", UriKind.Relative));
                        newSave.Text   = "New";
                        editTxt.Text   = "Edit";

                        newBtn.Visibility     = Visibility.Visible;
                        deleteBtn.Visibility  = Visibility.Visible;
                        refreshBtn.Visibility = Visibility.Visible;
                        printBtn.Visibility   = Visibility.Visible;

                        userP.ControlsOff();
                        userP.driverTypeBox.SelectedIndex  = 0;
                        userP.cpcTypeBox.SelectedIndex     = 0;
                        userP.licenseTypeBox.SelectedIndex = 0;
                        userP.userTypeBox.SelectedIndex    = 0;
                        userP.sNameTxt.Clear();
                        userP.fNameTxt.Clear();
                        userP.userIdTxt.Clear();
                        userP.emailTxt.Clear();

                        categoryViewer.Navigate(userP = new Users(this));
                        ShowControls();
                        counter = 0;
                    }

                    #endregion
                }
                else if (selPage.ToString() == "BusP" && counter == 1)
                {
                    #region testing validation

                    RestClient restClientT = new RestClient();
                    restClientT.endPoint = "http://localhost:8080/AppServer_war_exploded/logic/edit/bus/" + busP.regTxt.Text + "/" + busP.busTypeBox.SelectedIndex + "/" + busP.weightTxt.Text + "/" +
                                           busP.heightTxt.Text + "/" + busP.widthTxt.Text + "/" + busP.capacityTxt.Text + "/" + busP.yearTxt.Text + "/" + busP.modelTypeBox.Text + "/" + busP.tachoTypeBox.SelectedIndex;


                    string response = restClientT.makeRequest();

                    if (response == "true")
                    {
                        MessageBox.Show("Bus succesfully edited");
                        editImg.Source = new BitmapImage(new Uri("Images/edit.png", UriKind.Relative));
                        newSave.Text   = "New";
                        editTxt.Text   = "Edit";

                        newBtn.Visibility     = Visibility.Visible;
                        deleteBtn.Visibility  = Visibility.Visible;
                        refreshBtn.Visibility = Visibility.Visible;
                        printBtn.Visibility   = Visibility.Visible;

                        busP.Clear();
                        categoryViewer.Navigate(busP = new BusP(this));
                        busP.ControlsOff();
                        counter = 0;
                        ShowControls();
                    }

                    #endregion
                }
                else if (selPage.ToString() == "Shifts" && counter == 1)
                {
                    #region testing validation

                    RestClient restClient = new RestClient();
                    restClient.endPoint = "http://localhost:8080/AppServer_war_exploded/logic/job/edit/" + shiftP.tempJob.job_id + "/" + shiftP.driverT.user_id + "/" + shiftP.busT.bus_reg + "/" +
                                          shiftP.tempJob.start_location + "/" + shiftP.tempJob.end_location + "/" + shiftP.tempJob.pass_num;
                    restClient.httpMethod = httpVerb.POST;
                    restClient.postJson   = shiftP.tempJob.route;
                    restClient.postRoute  = shiftP.tempJob.date;
                    string response = restClient.makeRequest();

                    if (response == "true")
                    {
                        MessageBox.Show("Job succesfully edited");
                        editImg.Source = new BitmapImage(new Uri("Images/edit.png", UriKind.Relative));
                        newSave.Text   = "New";
                        editTxt.Text   = "Edit";

                        newBtn.Visibility     = Visibility.Visible;
                        deleteBtn.Visibility  = Visibility.Visible;
                        refreshBtn.Visibility = Visibility.Visible;
                        printBtn.Visibility   = Visibility.Visible;


                        categoryViewer.Navigate(shiftP = new Shifts(this));

                        counter = 0;
                        ShowControls();
                    }

                    #endregion
                }
                break;
            }
        }