Exemplo n.º 1
0
        /// <summary>
        /// Updates the list of bugs on the bug page when index of either combo box changes.
        /// </summary>
        public void UpdateBugList()
        {
            List <dataLayer.Bug> bugs;

            if (comboBox2SelectApplication.SelectedIndex != 0 &&
                comboBox2StatusFilter.SelectedIndex != 0)
            {
                // show the bugs
                int appId = ((dataLayer.Application)comboBox2SelectApplication.SelectedItem).AppID;

                // show all status or just one
                if (comboBox2StatusFilter.SelectedIndex == 1)
                {
                    bugs = dataLayer.Bugs.GetAllBugsFromApp(appId);
                }
                else
                {
                    int statusId = ((dataLayer.StatusCode)comboBox2StatusFilter.SelectedItem).StatusCodeId;
                    bugs = dataLayer.Bugs.GetAllBugsFromAppWithStatCode(appId, statusId);
                }

                // insert the add new bug
                dataLayer.Bug newBug = new dataLayer.Bug();
                newBug.BugDesc = "<Add New>";
                bugs.Insert(0, newBug);

                listBox2BugList.DataSource    = bugs;
                listBox2BugList.DisplayMember = "BugDesc";
            }
            // take out bug entries
            else if (comboBox2SelectApplication.SelectedIndex != 0)
            {
                // call method to clear bug page
                ClearBugPage();
                bugs = new List <dataLayer.Bug>();

                // insert the add new bug
                dataLayer.Bug newBug = new dataLayer.Bug();
                newBug.BugDesc = "<Add New>";
                bugs.Insert(0, newBug);

                listBox2BugList.DataSource    = bugs;
                listBox2BugList.DisplayMember = "BugDesc";
            }
            else
            {
                listBox2BugList.DataSource = null;
            }
        }
Exemplo n.º 2
0
        private void listBox2BugList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox2BugList.SelectedIndex != 0 && (dataLayer.Bug)listBox2BugList.SelectedItem != null)
            {
                dataLayer.Bug bug = (dataLayer.Bug)listBox2BugList.SelectedItem; // get the bug
                // Fill the display
                labelVal2BugId.Text           = bug.BugId.ToString();
                labelVal2SubmitDate.Text      = bug.BugDate.ToString();
                textBox2Description.Text      = bug.BugDesc;
                textBox2Details.Text          = bug.BugDetails;
                textBox2RepSteps.Text         = bug.RepSteps;
                comboBox2Status.SelectedIndex = bug.CurStatus.StatusCodeId - 1;

                // get newest bug log data to get status
                comboBox2Status.Enabled = true;

                // show fix date if not null
                if (bug.FixDate != null)
                {
                    labelVal2FixDate.Text = bug.FixDate.ToString();
                }
                else
                {
                    labelVal2FixDate.Text = "";
                }

                // fill activity log with all logs of this bug
                FillBugActivityLog(bug.BugId);

                textBox2UpdateComments.Enabled = true;
                textBox2UpdateComments.Text    = "";
            }
            else
            {
                ClearBugPage();
                labelVal2BugId.Text = "New";
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates and existing bug or makes a new one. If bug is existing, update bug log.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2Save_Click(object sender, EventArgs e)
        {
            dataLayer.Bug bug;
            // check if new bug
            if (listBox2BugList.SelectedIndex == 0)
            {
                // check if values are filled in
                if (textBox2Description.Text != "" &&
                    textBox2Details.Text != "" &&
                    textBox2RepSteps.Text != "")
                {
                    bug            = new dataLayer.Bug();
                    bug.AppId      = ((dataLayer.Application)comboBox2SelectApplication.SelectedItem).AppID;
                    bug.UserId     = loggedInUser;
                    bug.BugSignOff = null;
                    bug.BugDate    = DateTime.Now;
                    bug.BugDesc    = textBox2Description.Text;
                    bug.BugDetails = textBox2Details.Text;
                    bug.RepSteps   = textBox2RepSteps.Text;
                    bug.FixDate    = null;

                    bug.Save(); // save the bug to db

                    // add new bug logalogalogalogalogalogalogalogalogalogalogalogalogalogalogalogalogalog
                    dataLayer.BugLog log = new dataLayer.BugLog();
                    log.BugLogDate   = DateTime.Now;
                    log.StatusCodeId = ((dataLayer.StatusCode)comboBox2Status.SelectedItem).StatusCodeId;
                    log.UserId       = loggedInUser;
                    log.BugLogDesc   = textBox2UpdateComments.Text;
                    log.BugId        = bug.BugId;

                    log.Save(); // save the log to db

                    FillBugActivityLog(bug.BugId);
                    MessageBox.Show(this, "Bug saved.", "Success");
                }
                else
                {
                    MessageBox.Show(this, "No field Can be left blank.", "Form Error");
                }
            }
            // old bug
            else
            {
                // check if values are filled in
                if (textBox2Description.Text != "" &&
                    textBox2Details.Text != "" &&
                    textBox2RepSteps.Text != "" &&
                    textBox2UpdateComments.Text != "")
                {
                    bug = (dataLayer.Bug)listBox2BugList.SelectedItem;
                    // apply sign off if status set to closed
                    if (((dataLayer.StatusCode)comboBox2Status.SelectedItem).StatusCodeId == (int)dataLayer.StatusCode.Codes.Closed &&
                        bug.BugSignOff == null)
                    {
                        bug.BugSignOff        = loggedInUser;
                        bug.FixDate           = DateTime.Now;
                        labelVal2FixDate.Text = bug.FixDate.ToString();
                    }
                    bug.BugDesc    = textBox2Description.Text;
                    bug.BugDetails = textBox2Details.Text;
                    bug.RepSteps   = textBox2RepSteps.Text;

                    bug.Save(); // save the bug to db

                    // add new bug logalogalogalogalogalogalogalogalogalogalogalogalogalogalogalogalogalog
                    dataLayer.BugLog log = new dataLayer.BugLog();
                    log.BugLogDate   = DateTime.Now;
                    log.StatusCodeId = ((dataLayer.StatusCode)comboBox2Status.SelectedItem).StatusCodeId;
                    log.UserId       = loggedInUser;
                    log.BugLogDesc   = textBox2UpdateComments.Text;
                    log.BugId        = ((dataLayer.Bug)listBox2BugList.SelectedItem).BugId;

                    log.Save(); // save the log to db

                    FillBugActivityLog(bug.BugId);
                    textBox2UpdateComments.Text = "";
                    MessageBox.Show(this, "Bug saved.", "Success");
                }
                else
                {
                    MessageBox.Show(this, "No field Can be left blank.", "Form Error");
                }
            }

            UpdateBugList();
        }