private void SelectButton_Click(object sender, EventArgs e)
        {
            FakeIssueStatusRepository formStatusRepo = new FakeIssueStatusRepository();
            Issue modifyIssue = new Issue();

            foreach (DataGridViewRow row in dataGridView.SelectedRows)
            {
                modifyIssue.ID                 = Int32.Parse(row.Cells[0].Value.ToString());
                modifyIssue.title              = row.Cells[1].Value.ToString();
                modifyIssue.discoveryDate      = DateTime.Parse(row.Cells[2].Value.ToString());
                modifyIssue.discoverer         = row.Cells[3].Value.ToString();
                modifyIssue.initialDescription = row.Cells[4].Value.ToString();
                modifyIssue.component          = row.Cells[5].Value.ToString();

                foreach (IssueStatus s in formStatusRepo.GetAll())
                {
                    if (s.Value == row.Cells[6].Value.ToString())
                    {
                        modifyIssue.status = s.Id;
                    }
                }
            }

            if (operationType == 0)
            {
                DialogResult = DialogResult.OK;
                FormModifyIssue modifyForm = new FormModifyIssue(modifyIssue, selectedProject);
                modifyForm.ShowDialog();
                modifyForm.Dispose();
            }

            else if (operationType == 1)
            {
                DialogResult result = MessageBox.Show("Are you sure you want to remove: " + modifyIssue.title + "?", "Confirmation", MessageBoxButtons.YesNo);

                if (result == DialogResult.Yes)
                {
                    formIssueRepo.Remove(modifyIssue);
                }

                else
                {
                    MessageBox.Show("Remove canceled", "Attention", MessageBoxButtons.OK);
                    Dispose();
                }
            }
            Dispose();
        }
        private void buttonSelect_Click(object sender, EventArgs e)
        {
            if (dataIssue.SelectedCells.Count < 0)
            {
                MessageBox.Show("A Issue must be selected.", "Attention");
            }
            else
            {
                _selectedID = dataIssue.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow = dataIssue.Rows[_selectedID];
                int             sID         = Convert.ToInt32(selectedRow.Cells["ID"].Value);

                _selectedID = sID;

                FormModifyIssue mod = new FormModifyIssue(_selectedID);
                mod.ShowDialog();
                this.Close();
            }
        }
예제 #3
0
        private void SelIssue_Click(object sender, EventArgs e)
        {
            if (this.listOfIssues.SelectedRows.Count == 0)
            {
                MessageBox.Show("An Issue must be Selected", "Error!");
            }
            else
            {
                int             selectedIndex = this.listOfIssues.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow   = this.listOfIssues.Rows[selectedIndex];
                string          title         = selectedRow.Cells["issTitle"].Value.ToString();
                selectedIssueId = Convert.ToInt32(selectedRow.Cells["issueId"].Value);

                Issue issueToModify = new Issue();
                FakeIssueStatusRepository isStat = new FakeIssueStatusRepository();

                issueToModify.id                 = Convert.ToInt32(selectedRow.Cells["issueId"].Value);
                issueToModify.project_id         = projectId;
                issueToModify.Discoverer         = selectedRow.Cells["disc"].Value.ToString();
                issueToModify.DiscoveryDate      = Convert.ToDateTime(selectedRow.Cells["discDate"].Value);
                issueToModify.Title              = selectedRow.Cells["issTitle"].Value.ToString();
                issueToModify.IssueStatusid      = isStat.GetIdByStatus(selectedRow.Cells["stat"].Value.ToString());
                issueToModify.initialDescription = selectedRow.Cells["intiDesc"].Value.ToString();
                issueToModify.Component          = selectedRow.Cells["comp"].Value.ToString();

                FormModifyIssue modify = new FormModifyIssue(issueToModify);
                modify.ShowDialog();
                if (modify.DialogResult == DialogResult.Cancel)
                {
                    MessageBox.Show("Modification Cancelled ! .", "Attention");
                    this.DialogResult = DialogResult.Cancel;
                }
                else
                {
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
        }