Exemplo n.º 1
0
        private void dataGridView_bug_list_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            db = new DbEntities();
            if (dataGridView_bug_list.Columns[e.ColumnIndex].Name == "Assign")
            {
                panelAssignBug.Show();
                panelAssignBug.Enabled = true;

                // fetch data from datagridview through row and cell's index number
                /* lblBugId.Text = dataGridView_bug_list.Rows[e.RowIndex].Cells["id"].Value.ToString();*/
                int rowindex = dataGridView_bug_list.CurrentCell.RowIndex; //current row
                lblBugId.Text       = dataGridView_bug_list.Rows[rowindex].Cells[0].Value.ToString();
                txtProdName.Text    = dataGridView_bug_list.Rows[rowindex].Cells[1].Value.ToString();
                txtBugName.Text     = dataGridView_bug_list.Rows[rowindex].Cells[2].Value.ToString();
                richTxtBugDesc.Text = dataGridView_bug_list.Rows[rowindex].Cells[3].Value.ToString();
                btnAssignBug.Show();
                // display values in combobox selectAssignTo
                var query = from o in db.Users_tbl where o.role == "Developer" select o;
                selectAssignTo.DataSource    = query.ToList();
                selectAssignTo.DisplayMember = "fullname";
                selectAssignTo.ValueMember   = "id";
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            db = new DbEntities();
            var session_user = Session.user;
            int rowindex     = dataGridAssignedTask.CurrentCell.RowIndex; //current row
            var uname        = dataGridAssignedTask.Rows[rowindex].Cells[7].Value.ToString();
            var fname        = dataGridAssignedTask.Rows[rowindex].Cells[8].Value.ToString();

            var query = from o in db.AssignedBugs_tbl where o.bug_id == txtBugId.Text &&
                        o.username == uname && o.fullname == fname select o;

            var query2 = from o in db.Bugs_tbl where o.id.ToString() == txtBugId.Text select o;

            //var query3 = from o in assignedBugstblBindingSource.DataSource as List<AssignedBugs_tbl>
            //            where o.username == session_user select o;

            if (
                txtBugId.Text == "" ||
                txtProdName.Text == "" ||
                txtBugName.Text == "" ||
                richTxtBugDesc.Text == "" ||
                richTxtSyntax.Text == ""
                )
            {
                MessageBox.Show("Please select bug in above datagrid to debug.", "Message",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (!chkboxSolved.Checked && !checkBoxUnsolved.Checked && !checkBoxInProgress.Checked)
            {
                MessageBox.Show("Please check either checkboxes as per the bug is solved or not.", "Message",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (chkboxSolved.Checked && !checkBoxUnsolved.Checked && !checkBoxInProgress.Checked)
            {
                // temporarily save changes
                foreach (AssignedBugs_tbl o in query)
                {
                    o.syntax = richTxtSyntax.Text;
                    o.status = "Solved";
                }
                foreach (Bugs_tbl b in query2)
                {
                    b.status = "Closed";
                }
                // saving the changes
                try
                {
                    db.SaveChanges();
                    MessageBox.Show("Your edit has been submitted successfully.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (checkBoxInProgress.Checked && !checkBoxUnsolved.Checked && !chkboxSolved.Checked)
            {
                // temporarily save changes
                foreach (AssignedBugs_tbl o in query)
                {
                    o.syntax = richTxtSyntax.Text;
                    o.status = "In Progress";
                }
                foreach (Bugs_tbl b in query2)
                {
                    b.status = "In Progress";
                }
                // saving the changes
                try
                {
                    db.SaveChanges();
                    MessageBox.Show("Your edit has been submitted successfully.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (checkBoxUnsolved.Checked && !checkBoxInProgress.Checked && !chkboxSolved.Checked)
            {
                // temporarily save changes
                foreach (AssignedBugs_tbl o in query)
                {
                    o.syntax = richTxtSyntax.Text;
                    o.status = "Unsolved";
                }
                foreach (Bugs_tbl b in query2)
                {
                    b.status = "Unsolved";
                }
                // saving the changes
                try
                {
                    db.SaveChanges();
                    MessageBox.Show("Your edit has been submitted successfully.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Please check one of the box not more than one to submit your work. Thank you!",
                                "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 3
0
 private void Login_Load(object sender, EventArgs e)
 {
     db = new DbEntities();
     userstblBindingSource.DataSource = db.Users_tbl.ToList();
 }