Exemple #1
0
        private void DGV_TestDrive_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (RoleType == "Administrator" || RoleType == "Manager")
                {
                    if (DGV_TestDrive.Items.IsEmpty)
                    {
                        BookDrive Book = new BookDrive();
                        Book.Department = Department;
                        Book_page.Navigate(Book);
                    }

                    else
                    {
                        Cbook = new ChangeBooking();
                        object item = DGV_TestDrive.SelectedItem;
                        Cbook.txt_BookNo.Text = (DGV_TestDrive.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text;
                        ID               = (DGV_TestDrive.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text;
                        Cbook.ID         = ID;
                        Cbook.Department = Department;
                        Book_page.Navigate(Cbook);
                    }
                }

                else
                {
                }
            }
            catch (Exception)
            {
            }
        }
Exemple #2
0
        private void Can_AddDrive_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ViewBook = new ViewBooking();
            AddBook  = new BookDrive();

            ViewBook.Book_page = null;
            DependencyObject currParent = VisualTreeHelper.GetParent(this);

            while (currParent != null && ViewBook.Book_page == null)
            {
                ViewBook.Book_page = currParent as Frame;
                currParent         = VisualTreeHelper.GetParent(currParent);
            }

            if (ViewBook.Book_page != null)
            {
                AddBook.Department = Department;
                ViewBook.Book_page.Navigate(AddBook);
            }
        }