예제 #1
0
        public FixedBug getFixedBugByID(int id)
        {
            String sql = "SELECT code,fixed_code FROM tbl_bug AS b,tbl_fixed_bug AS f WHERE f.bug_id=b.id AND f.id=@id";

            try
            {
                conn.Open();
                MySqlCommand sqlCommand = new MySqlCommand(sql, conn);
                sqlCommand.Parameters.AddWithValue("@id", id);
                MySqlDataReader result = sqlCommand.ExecuteReader();
                while (result.Read())
                {
                    fixedBug           = new FixedBug();
                    fixedBug.CodeBlock = result.GetString(result.GetOrdinal("code"));
                    fixedBug.FixedCode = result.GetString(result.GetOrdinal("fixed_code"));

                    return(fixedBug);
                    //  project.Id = result.GetInt32(result.GetOrdinal("id"));
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(" project bug" + e.Message);
            }


            return(null);
        }
예제 #2
0
        public bool insertFixedBug(FixedBug fixedBug)
        {
            this.fixedBug = fixedBug;
            String sql = "INSERT INTO tbl_fixed_bug (bug_id,fixed_code,fixed_by,fixed_date) VALUES(@bug_id,@fixed_code,@fixed_by,@fixed_date)";

            try
            {
                conn.Open();
                MySqlCommand sqlCommand = new MySqlCommand(sql, conn);
                sqlCommand.Parameters.AddWithValue("@bug_id", fixedBug.Bug_id);
                sqlCommand.Parameters.AddWithValue("@fixed_code", fixedBug.FixedCode);
                sqlCommand.Parameters.AddWithValue("@fixed_by", fixedBug.BugFixedBy);
                sqlCommand.Parameters.AddWithValue("@fixed_date", fixedBug.FixedDate);

                int  rowUpdate     = sqlCommand.ExecuteNonQuery();//non query is for such query which is not responsible for fetching data from database.
                bool statusUpdated = updateBugStatus(fixedBug.Bug_id);
                conn.Close();
                if (rowUpdate > 0 && statusUpdated == true)
                {
                    conn.Close();
                    return(true);
                }
                else
                {
                    conn.Close();

                    return(false);
                }
            }
            catch (Exception e) { }


            return(false);
        }
예제 #3
0
        public FixedBug getFixedBugById(int id)
        {
            BugDao daobug = new BugDao();

            try
            {
                fixedBug = daobug.getFixedBugByID(id);
                return(fixedBug);
            }
            catch (Exception e) { }


            return(null);
        }
예제 #4
0
        public bool InsertFixedBug(int bugID, String fixedCode, String fixedBy, DateTime fixedDate)
        {
            BugDao daoBug = new BugDao();

            fixedBug            = new FixedBug();
            fixedBug.Bug_id     = bugID;
            fixedBug.FixedCode  = fixedCode;
            fixedBug.BugFixedBy = fixedBy;
            fixedBug.FixedDate  = fixedDate;

            bool status = daoBug.insertFixedBug(fixedBug);

            if (status == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
        public List <FixedBug> getAllFixedBug()
        {
            String sql = "SELECT f.id,f.Fixed_by,f.fixed_date,b.name FROM tbl_fixed_bug AS f,tbl_bug AS b WHERE f.bug_id=b.id";

            try
            {
                conn.Open();
                List <FixedBug> allFixedBug = new List <FixedBug>();

                MySqlCommand    sqlCommand = new MySqlCommand(sql, conn);
                MySqlDataReader result     = sqlCommand.ExecuteReader();
                while (result.Read())
                {
                    fixedBug = new FixedBug();

                    fixedBug.FixedBugId = result.GetInt32(result.GetOrdinal("id"));
                    fixedBug.BugName    = result.GetString(result.GetOrdinal("name"));
                    fixedBug.BugFixedBy = result.GetString(result.GetOrdinal("Fixed_by"));
                    fixedBug.FixedDate  = result.GetDateTime(result.GetOrdinal("fixed_date"));


                    allFixedBug.Add(fixedBug);



                    //  project.Id = result.GetInt32(result.GetOrdinal("id"));
                }
                return(allFixedBug);
            }
            catch (Exception e)
            {
                MessageBox.Show(" project bug" + e.Message);
            }

            return(null);
        }
예제 #6
0
        private void btnViewFixedBug_Click(object sender, EventArgs e)
        {
            Int32 selectedRowCount =
                dataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected);

            if (selectedRowCount > 0)
            {
                DataGridViewRow rowIndex = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex];
                //   FormFixBug fixBug = new FormFixBug(Convert.ToInt32(rowIndex.Cells["bug_id"].Value), user);
                ///  fixBug.Show();
                bugController = new BugController();
                fixedBug      = bugController.getFixedBugById((Convert.ToInt32(rowIndex.Cells["fixed ID"].Value)));
                FormViewFixedBug viewFixedBug = new FormViewFixedBug(fixedBug);
                viewFixedBug.Show();



                // label1.Text = "" + myDataGrid.CurrentCell.RowIndex + Convert.ToString(rowIndex.Cells["bug_id"].Value);
            }
            else
            {
                MessageBox.Show("Select a row to fix bug");
            }
        }
예제 #7
0
 public FormViewFixedBug(FixedBug fixedBug)
 {
     this.fixedBug    = fixedBug;
     InitializeComponent();
 }
예제 #8
0
        private void button_bughis_Click(object sender, EventArgs e)
        {
            FixedBug fix = new FixedBug();

            fix.Show();
        }