Exemple #1
0
 private void create_project_button_Click(object sender, RoutedEventArgs e)
 {
     try {
         checkMandatoryFields();
         MessageBoxResult confirm = MessageBox.Show(
             "Do you want to submit this project?",
             "Submission Confirmation",
             MessageBoxButton.YesNo,
             MessageBoxImage.Question
             );
         if (confirm == MessageBoxResult.Yes)
         {
             int projectID = SubmitProject();
             if (projectID != -1)
             {
                 SubmitMembers(projectID);
             }
             MessageBox.Show("Project has been created!");
             HomeWindow window = (HomeWindow)Window.GetWindow(this);
             window.goToProjectPage(_project, true);
         }
     } catch (SqlException exc)
     {
         Helpers.ShowCustomDialogBox(exc);
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemple #2
0
 private void project_class_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (_project.ProjectClass != null)
     {
         HomeWindow window = (HomeWindow)Window.GetWindow(this);
         window.goToClassPage(_project.ProjectClass);
     }
 }
 private void user_last_requisitions_list_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (class_last_requisitions_list.SelectedItem != null)
     {
         Requisition requisition = class_last_requisitions_list.SelectedItem as Requisition;
         HomeWindow  window      = (HomeWindow)Window.GetWindow(this);
         window.goToRequisitionPage(requisition);
     }
 }
Exemple #4
0
 private void project_members_listbox_MouseDoubleClick(object sender, RoutedEventArgs e)
 {
     // Go to selected member's page
     if (project_members.SelectedItem != null)
     {
         DMLUser    user   = project_members.SelectedItem as DMLUser;
         HomeWindow window = (HomeWindow)Window.GetWindow(this);
         window.goToUserPage(user);
     }
 }
 private void my_projects_listbox_MouseDoubleClick(object sender, RoutedEventArgs e)
 {
     // Go to selected project page
     if (my_projects_listbox.SelectedItem != null)
     {
         Project    selectedProject = my_projects_listbox.SelectedItem as Project;
         HomeWindow window          = (HomeWindow)Window.GetWindow(this);
         window.goToProjectPage(selectedProject);
     }
 }
 private void go_back_Click(object sender, RoutedEventArgs e)
 {
     // Go back to last page based on current window
     try
     {
         HomeWindow window = (HomeWindow)Window.GetWindow(this);
         window.goBack();
     } catch (Exception exc)
     {
         StaffWindow window = (StaffWindow)Window.GetWindow(this);
         window.goBack();
     }
 }
        private void requisition_info_Click(object sender, RoutedEventArgs e)
        {
            // Go to selected requisition's page, based on current window
            Requisition requisition = (Requisition)(sender as Button).DataContext;

            try
            {
                HomeWindow window = (HomeWindow)Window.GetWindow(this);
                window.goToRequisitionPage(requisition);
            } catch (Exception exc)
            {
                StaffWindow window = (StaffWindow)Window.GetWindow(this);
                window.goToRequisitionPage(requisition);
            }
        }
Exemple #8
0
        private void equipment_info_Click(object sender, RoutedEventArgs e)
        {
            // Go to equipment page, based on current Window
            HomeWindow window = (HomeWindow)Window.GetWindow(this);

            try
            {
                ResourceItem equipment = (ResourceItem)(sender as Button).DataContext;
                window.goToEquipmentPage(equipment.Resource);
            } catch (Exception exc)
            {
                KitItem kit = (KitItem)(sender as Button).DataContext;
                window.goToKitPage(kit.Units[0]);
            }
        }
 private void user_last_requisitions_list_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     // Go to selected requisition page, based on current window
     if (user_last_requisitions_list.SelectedItem != null)
     {
         Requisition requisition = user_last_requisitions_list.SelectedItem as Requisition;
         try
         {
             HomeWindow window = (HomeWindow)Window.GetWindow(this);
             window.goToRequisitionPage(requisition);
         } catch (Exception exc)
         {
             StaffWindow window = (StaffWindow)Window.GetWindow(this);
             window.goToRequisitionPage(requisition);
         }
     }
 }
Exemple #10
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     user  = null;
     staff = null;
     try
     {
         // Check for valid credentials
         bool logged = checkLogin();
         if (logged)
         {
             // Go to user's window, based on it's class (user or staff)
             if (user != null)
             {
                 HomeWindow home = new HomeWindow(user);
                 home.Show();
             }
             else if (staff != null)
             {
                 StaffWindow staffHome = new StaffWindow(staff);
                 staffHome.Show();
             }
             Window.GetWindow(this).Hide();
         }
         else
         {
             MessageBox.Show("User or password wrong !");
         }
     }
     catch (SqlException exc)
     {
         Helpers.ShowCustomDialogBox(exc);
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }