Beispiel #1
0
        public loginform()
        {
            InitializeComponent();
            this.Text = "Bug Tracker - Login";

            CodeDetails CodeDetails = new CodeDetails();

            //this.Visible = false;
            //CodeDetails.Show();
            this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
        }
Beispiel #2
0
        private void ViewBugs_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedCells.Count > 0)
            {
                string str = null;
                foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                {
                    str = row.Cells[0].Value.ToString(); // gets bug ID and uses it for the bug details form
                }

                mySqlConnection = new SqlConnection(connectionString);
                SqlCommand cmd = new SqlCommand("SELECT * FROM code_data WHERE [FK_Ticket_ID] = @BUGID", mySqlConnection);

                cmd.Parameters.AddWithValue("@BUGID", str);
                mySqlConnection.Open();

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.HasRows) //if there is any rows in code data relating to ticket, full bug detail window opens.
                    {
                        BugDetails BugDetails = new BugDetails();
                        BugDetails.TheValue    = str; //uses bug id in bug details class
                        BugDetails.FormClosed += BugDetails_FormClosed;
                        BugDetails.Show();
                    }
                    else //user is required to enter code details to view page
                    {
                        DialogResult dialogResult = MessageBox.Show("There is no extra details, would you like to add some?", "Code Details", MessageBoxButtons.YesNo);
                        if (dialogResult == DialogResult.Yes)
                        {
                            //do something
                            CodeDetails CodeDetails = new CodeDetails();
                            CodeDetails.TheValue = str; // uses bug id in code details class
                            CodeDetails.Show();
                        }
                        else if (dialogResult == DialogResult.No)
                        {
                            return;
                        }
                    }
                }
            }
        }