private void admin_AssignBug_Load(object sender, EventArgs e)
        {
            //Datatable created to hold the categories from database
            admin_AssignBug a        = new admin_AssignBug();
            DataTable       dtassign = a.Selectutype();

            //Specify datasource for assigned box
            comboBox_assign.DataSource = dtassign;
            //Specify display member and valuemenber for combobox
            comboBox_assign.DisplayMember = "username";
            comboBox_assign.ValueMember   = "username";
            //Data Gird view
            admin_AssignBug vu = new admin_AssignBug();
            DataTable       dt = vu.SelectBug();

            dataGridView1.DataSource = dt;
        }
        private void btn_appoint_Click(object sender, EventArgs e)
        {
            int BugID = 0;

            if (textBox_bugID.Text.Trim() != "")
            {
                BugID = int.Parse(textBox_bugID.Text.Trim());
            }
            string BugTitle = textBox_BugTitle.Text.Trim();

            //Database connection
            MySqlConnection conn = new MySqlConnection("server = localhost; user id = root; database = bugtrack");

            try
            {
                MySqlCommand sda = new MySqlCommand("update bugreport set assignedto='" + this.comboBox_assign.Text + "' WHERE bugreport.id= '" + this.textBox_bugID.Text + "'", conn);
                //Open Connection
                conn.Open();
                int rows = sda.ExecuteNonQuery();
                //if Inserted rows is greater is greater than 0
                //Else set isSuccess to false, Save Failed

                if (rows > 0)
                {
                    MessageBox.Show("Bug Assigned. click ok to continue");
                    //Refresh Data Grid View
                    admin_AssignBug vb = new admin_AssignBug();
                    DataTable       dt = vb.SelectBug();
                    dataGridView1.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("Bug failed to Assigned. click ok to continue");
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            finally
            {
                //CLose Connection
                conn.Close();
            }
        }
Ejemplo n.º 3
0
        private void btn_assignbug_Click(object sender, EventArgs e)
        {
            admin_AssignBug aab = new admin_AssignBug();

            aab.Show();
        }