示例#1
0
        private void button_bugreport_Click(object sender, EventArgs e)
        {
            Bug b = new Bug();

            b.Show();
        }
        private void button_update_Click(object sender, EventArgs e)
        {
            MySqlConnection conn  = new MySqlConnection("server = localhost; user id = root; database = bugtrack");
            int             BugID = 0;

            if (textBox_bugid.Text.Trim() != "")
            {
                BugID = int.Parse(textBox_bugid.Text.Trim());
            }
            string ProjectTitle   = comboBox_project.Text.ToString();
            string BugTitle       = textBox_bugtitle.Text.Trim();
            string BugDescription = textBox_bugissue.Text.Trim();
            string ReportDate     = reportDate.Text.Trim();
            string ImagePath      = lbl_img_path.Text.Trim();
            string status         = combo_bugStatus.Text.ToString();
            //getting loggedin user in added by field
            string loggedusertype = Form1.usertype;

            string reportedby = loggedusertype;

            ReportDate = DateTime.Now.ToString("yyyy-MM-dd");


            try
            {
                //Database connection
                MySqlCommand sda = new MySqlCommand("update bugreport set project='" + this.comboBox_project.Text + "',bugtitle='" + this.textBox_bugtitle.Text + "',bugissue='" + this.textBox_bugissue.Text + "',reportdate='" + this.reportDate.Text + "',status='" + this.combo_bugStatus.Text + "',image='" + this.lbl_img_path.Text + "' where bugreport.id='" + this.textBox_bugid.Text + "'", conn);
                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 updated. click ok to continue");
                    //Refresh Data Grid View
                    Bug       vb = new Bug();
                    DataTable dt = vb.Select_bug();
                    dataGridView.DataSource = dt;
                    //Clear all the Input fields
                    textBox_bugid.Clear();
                    comboBox_project.Text = "";
                    textBox_bugtitle.Clear();
                    textBox_bugissue.Clear();
                    reportDate.Text      = "";
                    lbl_img_path.Text    = "path";
                    combo_bugStatus.Text = "";
                }
                else
                {
                    MessageBox.Show("Bug failed to update. click ok to continue");
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            finally
            {
                //Step :CLose Connection
                conn.Close();
            }
        }
示例#3
0
        private void btn_managebug_Click(object sender, EventArgs e)
        {
            Bug bg = new Bug();

            bg.Show();
        }