Exemplo n.º 1
0
        private void equipment_info_Click(object sender, RoutedEventArgs e)
        {
            ResourceItem equipment = (ResourceItem)(sender as Button).DataContext;
            StaffWindow  window    = (StaffWindow)Window.GetWindow(this);

            window.goToEquipmentPage(equipment.Resource);
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        private void create_kit_button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                checkMandatoryFields();
                DataTable toRequest = verifyUnits();

                MessageBoxResult confirm = System.Windows.MessageBox.Show(
                    "Do you confirm the kit creation?",
                    "Kit Creation Confirmation",
                    MessageBoxButton.YesNo,
                    MessageBoxImage.Question
                    );
                if (confirm == MessageBoxResult.Yes)
                {
                    Kit kit = submitKitCreation(toRequest);
                    System.Windows.MessageBox.Show("Kit has been succesfully created!");
                    StaffWindow window = (StaffWindow)Window.GetWindow(this);
                    window.goToKitPage(kit, true);
                }
            }
            catch (SqlException exc)
            {
                Helpers.ShowCustomDialogBox(exc);
            }
            catch (Exception exc)
            {
                System.Windows.MessageBox.Show(exc.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 4
0
        private void kit_info_Click(object sender, RoutedEventArgs e)
        {
            // Go to selected kit's page
            Kit         kit    = (Kit)(sender as Button).DataContext;
            StaffWindow window = (StaffWindow)Window.GetWindow(this);

            window.goToKitPage(kit);
        }
Exemplo n.º 5
0
        private void equipment_info_Click(object sender, RoutedEventArgs e)
        {
            // Go to selected equipment's page
            ElectronicResources equipment = (ElectronicResources)(sender as Button).DataContext;
            StaffWindow         window    = (StaffWindow)Window.GetWindow(this);

            window.goToEquipmentPage(equipment);
        }
 private void project_class_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (_project.ProjectClass != null)
     {
         StaffWindow window = (StaffWindow)Window.GetWindow(this);
         window.goToClassPage(_project.ProjectClass);
     }
 }
 private void project_last_requisitions_list_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     // Go to selected requisition page
     if (project_last_requisitions_list.SelectedItem != null)
     {
         Requisition requisition = project_last_requisitions_list.SelectedItem as Requisition;
         StaffWindow window      = (StaffWindow)Window.GetWindow(this);
         window.goToRequisitionPage(requisition);
     }
 }
 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;
         StaffWindow window = (StaffWindow)Window.GetWindow(this);
         window.goToUserPage(user);
     }
 }
 private void all_projects_listbox_MouseDoubleClick(object sender, RoutedEventArgs e)
 {
     // Go to selected project's page
     if (all_projects_listbox.SelectedItem != null)
     {
         Project     selectedProject = all_projects_listbox.SelectedItem as Project;
         StaffWindow window          = (StaffWindow)Window.GetWindow(this);
         window.goToProjectPage(selectedProject);
     }
 }
Exemplo n.º 10
0
 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();
     }
 }
Exemplo n.º 11
0
        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);
            }
        }
Exemplo n.º 12
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);
         }
     }
 }
Exemplo n.º 13
0
        private void create_equipment_button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                checkMandatoryFields();
                // Change filename and produce it's new complete path
                String RunningPath = AppDomain.CurrentDomain.BaseDirectory;
                String name        = equipment_name.Text + "_" + equipment_manufacturer.Text + "_" + equipment_model.Text;
                name.Replace(" ", "");
                String imagePath = string.Format("{0}images\\", System.IO.Path.GetFullPath(System.IO.Path.Combine(RunningPath, @"..\..\"))) + name + System.IO.Path.GetExtension(fileName);

                MessageBoxResult confirm = MessageBox.Show(
                    "Do you confirm the creation of the equipment?",
                    "Equipment Creation Confirmation",
                    MessageBoxButton.YesNo,
                    MessageBoxImage.Question
                    );
                if (confirm == MessageBoxResult.Yes)
                {
                    SubmitEquipment(imagePath);
                    // Copy image file to project path
                    System.IO.File.Copy(fileName, imagePath, true);

                    MessageBox.Show("Equipment has been successfully added!");

                    // Go to created equipment's page
                    StaffWindow window = (StaffWindow)Window.GetWindow(this);
                    window.goToEquipmentPage(_equipment, true);
                }
            }
            catch (SqlException exc)
            {
                Helpers.ShowCustomDialogBox(exc);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 14
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);
     }
 }