Пример #1
0
        /// <summary>
        /// Handles navigation button click events
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nav_click(object sender, EventArgs e)
        {
            Control flatbtn = (FlatButton_WOC)sender;

            if (flatbtn.TabIndex == 0)
            {
                Home_Tab.getInstance().populateCharts();
                Home_Tab.getInstance().populateDataGridAgeAnalysis();
                Home_Tab.getInstance().populateDataGridDREAnalysis();
                Home_Tab.getInstance().populateDataGridDRRAnalysis();
                materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey900, Primary.Red700, Primary.Red700, Accent.Red700, TextShade.WHITE);
            }
            if (flatbtn.TabIndex == 1)
            {
                Users_Tab.getInstance().populateDataGridView();
                materialSkinManager.ColorScheme = new ColorScheme(Primary.Red700, Primary.Red700, Primary.Red700, Accent.Red700, TextShade.WHITE);
            }
            else if (flatbtn.TabIndex == 2)
            {
                Projects_Tab.getInstance().populateDataGridView();
                materialSkinManager.ColorScheme = new ColorScheme(Primary.Red700, Primary.Red700, Primary.Red700, Accent.Red700, TextShade.WHITE);
            }
            else if (flatbtn.TabIndex == 3)
            {
                Defects_Tab.getInstance().populateDataGridView();
                materialSkinManager.ColorScheme = new ColorScheme(Primary.Red700, Primary.Red700, Primary.Red700, Accent.Red700, TextShade.WHITE);
            }

            navAdapter.ShowTab((flatbtn).TabIndex);
        }
Пример #2
0
        /// <summary>
        /// Setup navigation between tabs
        /// </summary>
        private void SetupNavigation()
        {
            navAdapter.AddTab(Home_Tab.getInstance(), true);
            navAdapter.AddTab(Users_Tab.getInstance(), false);
            navAdapter.AddTab(Projects_Tab.getInstance(), false);
            navAdapter.AddTab(Defects_Tab.getInstance(), false);

            panelTabs_Holder.Controls.Add(Users_Tab_Child.getInstance());
            Users_Tab_Child.getInstance().Dock = DockStyle.Fill;
            panelTabs_Holder.Controls.Add(Projects_Tab_Child.getInstance());
            Projects_Tab_Child.getInstance().Dock = DockStyle.Fill;
            panelTabs_Holder.Controls.Add(Modules_Tab.getInstance());
            Modules_Tab.getInstance().Dock = DockStyle.Fill;
            panelTabs_Holder.Controls.Add(Modules_Tab_Child.getInstance());
            Modules_Tab_Child.getInstance().Dock = DockStyle.Fill;
            panelTabs_Holder.Controls.Add(Defects_Tab_Child.getInstance());
            Defects_Tab_Child.getInstance().Dock = DockStyle.Fill;
            panelTabs_Holder.Controls.Add(Defects_Tab_Child2.getInstance());
            Defects_Tab_Child2.getInstance().Dock = DockStyle.Fill;
        }
        /// <summary>
        /// Handle the function of adding a project to the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnProjectSave_Click(object sender, EventArgs e)
        {
            string projectName = txtProjectName.Text.Trim();
            string manager     = comboBoxManager.Text;
            string frontEndDev = comboBoxFrontEndDev.Text;
            string backEndDev  = comboBoxBackEndDev.Text;
            string tester      = comboBoxTester.Text;
            string priority    = "";

            if (RadioButtonPriorityLow.Checked == true)
            {
                priority = "Low";
            }
            else if (RadioButtonPriorityMed.Checked == true)
            {
                priority = "Medium";
            }
            else
            {
                priority = "High";
            }

            if (projectName != "" && manager != "" && frontEndDev != "" && backEndDev != "" && tester != "") // Check if required fields are filled
            {
                if (DbConnector.OpenSQLConnection())                                                         // Open connection to the database
                {
                    // Connection opened
                    ProjectDataAccess project = new ProjectDataAccess();

                    if (btnProjectSave.Text == "Save")
                    {
                        if (!project.IsProjectNameExist(projectName))
                        {
                            if (project.InsertProject(projectName, manager, frontEndDev, backEndDev, tester, priority, dateTimePickerStart.Value.Date, dateTimePickerEnd.Value.Date))
                            {
                                // Record inserted successfully
                                MessageBox.Show("Record has been inserted successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                Projects_Tab.getInstance().BringToFront();
                                Projects_Tab.getInstance().populateDataGridView();
                            }
                            else
                            {
                                // Record was not inserted
                                MessageBox.Show("The record could not be saved", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            // Project Name already exists
                            MessageBox.Show("The Project Name entered already exists in the database", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else if (btnProjectSave.Text == "Update")
                    {
                        if (project.UpdateProject(projectId, projectName, manager, frontEndDev, backEndDev, tester, priority, dateTimePickerStart.Value.Date, dateTimePickerEnd.Value.Date))
                        {
                            // Record updated successfully
                            MessageBox.Show("Record has been updated successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Projects_Tab.getInstance().BringToFront();
                            Projects_Tab.getInstance().populateDataGridView();
                        }
                        else
                        {
                            // Record was not updated
                            MessageBox.Show("The record could not be updated", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    // Connection could not be opened
                    MessageBox.Show("Connection to the database could not be established", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                // Fields not filled correctly
                MessageBox.Show("Please fill all the required fields", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
 /// <summary>
 /// Navigate to the Projects List view
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnProjectCancel_Click(object sender, EventArgs e)
 {
     Projects_Tab.getInstance().BringToFront();
     Projects_Tab.getInstance().populateDataGridView();
 }