Ejemplo n.º 1
0
        private void buttonSelect_Click_1(object sender, EventArgs e)
        {
            this.Hide();
            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;

                FakeIssueRepository iss2 = new FakeIssueRepository();
                Issue        i2          = iss2.GetIssueByID(sID);
                DialogResult result      = MessageBox.Show("Are you sure you want to Remove:" + i2.Title, "Confirmation", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    bool res = iss2.Remove(i2);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Remove Canceled", "Attention", MessageBoxButtons.OK);
                }
            }
        }
Ejemplo n.º 2
0
        private void selIss_Click(object sender, EventArgs e)
        {
            if (this.issuesList.SelectedRows.Count == 0)
            {
                MessageBox.Show("An Issue must be Selected", "Error!");
            }
            else
            {
                int             selectedIndex = this.issuesList.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow   = this.issuesList.Rows[selectedIndex];
                string          title         = selectedRow.Cells["issTitle"].Value.ToString();
                selectedIssueId = Convert.ToInt32(selectedRow.Cells["isId"].Value);
                DialogResult confirmation        = MessageBox.Show(String.Format("Are you sure you want to remove \"{0}\"?", title), "Confirmation", MessageBoxButtons.YesNo);
                FakeIssueStatusRepository isStat = new FakeIssueStatusRepository();
                if (confirmation == DialogResult.Yes)
                {
                    Issue issToRemove = new Issue();
                    issToRemove.id                 = Convert.ToInt32(selectedRow.Cells["isId"].Value);
                    issToRemove.project_id         = currentProject;
                    issToRemove.Discoverer         = selectedRow.Cells["disc"].Value.ToString();
                    issToRemove.DiscoveryDate      = Convert.ToDateTime(selectedRow.Cells["discDate"].Value);
                    issToRemove.Title              = selectedRow.Cells["issTitle"].Value.ToString();
                    issToRemove.IssueStatusid      = isStat.GetIdByStatus(selectedRow.Cells["stat"].Value.ToString());
                    issToRemove.initialDescription = selectedRow.Cells["intiDesc"].Value.ToString();
                    issToRemove.Component          = selectedRow.Cells["comp"].Value.ToString();
                    FakeIssueRepository rmvIssue = new FakeIssueRepository();
                    bool rmvSuccess = rmvIssue.Remove(issToRemove);

                    if (rmvSuccess == true)
                    {
                        this.issuesList.Rows.RemoveAt(selectedIndex);
                        //this.DialogResult = DialogResult.OK;
                        //this.Close();
                    }
                    else
                    {
                        MessageBox.Show("This Issue could not be removed", "Error!");
                        this.DialogResult = DialogResult.Cancel;
                        this.Close();
                    }
                }
                else
                {
                    //MessageBox.Show("Remove Cancelled!","Attention");
                    this.DialogResult = DialogResult.Cancel;
                    this.Close();
                }
            }
        }
        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();
        }