private void project_info_Click(object sender, RoutedEventArgs e)
        {
            // Go to project page based on current window and user:
            // If it's a user's project, he can manage it
            // Else he just will see it's information
            Project project = (Project)(sender as Button).DataContext;

            try
            {
                HomeWindow window   = (HomeWindow)Window.GetWindow(this);
                Boolean    isMember = false;
                foreach (DMLUser user in project.Workers)
                {
                    if (user.NumMec == _userID)
                    {
                        isMember = true;
                    }
                }
                if (isMember)
                {
                    window.goToProjectPage(project);
                }
                else
                {
                    window.goToProjectStaticPage(project);
                }
            } catch (Exception exc)
            {
                StaffWindow window = (StaffWindow)Window.GetWindow(this);
                window.goToProjectPage(project);
            }
        }
 private void save_project_changes_button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         checkMandatoryFields();
         MessageBoxResult confirm = MessageBox.Show(
             "Do you confirm these changes?",
             "Changes Confirmation",
             MessageBoxButton.YesNo,
             MessageBoxImage.Question
             );
         if (confirm == MessageBoxResult.Yes)
         {
             saveChanges();
             MessageBox.Show("The project has been changed!");
             HomeWindow window = (HomeWindow)Window.GetWindow(this);
             // Go to changed project page
             window.goToProjectPage(_project);
         }
     }
     catch (SqlException exc)
     {
         Helpers.ShowCustomDialogBox(exc);
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
示例#3
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);
     }
 }
 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);
     }
 }