示例#1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (IssueRepository.IsDuplicate(TitleTextBox.Text.Trim()) != true)
            {
                issue.Id    = _i;
                issue.Title = TitleTextBox.Text.Trim();

                issue.ProjectID          = _selId;
                issue.Discoverer         = comboBox1.SelectedItem.ToString();
                issue.Component          = ComponentBox.Text.Trim();
                issue.DiscoveryDate      = dateTimePicker1.Value;
                issue.IssueStatusId      = IssueStatusRepository.GetIdByStatus(comboBox2.SelectedItem.ToString());
                issue.InitialDescription = InitialDescription.Text.Trim();

                string result = IssueRepository.Add(issue);
                if ((result == FakeIssueRepository.NO_ERROR))
                {
                    MessageBox.Show("Issue added!");
                }
                else
                {
                    MessageBox.Show("Error! " + result, "Requires your attention!");
                }
                this.Close();
            }
            else
            {
                MessageBox.Show("Please input unique Title");
            }
        }
示例#2
0
        private void ButtonModifyIssue_click(object sender, EventArgs e)
        {
            //int newId = Int32.Parse(textBoxid.Text); is this needed? I'm not sure if we are supposed to modify the id. It is greyed out in the example
            string   newIssueTitle      = textBoxtitle.Text.Trim();
            string   newIssueDiscoverer = comboBoxdiscoverer.Text.Trim();
            string   newIssueComponent  = textBoxcomponent.Text.Trim();
            string   newDescription     = textBoxdescription.Text.Trim();
            int      newStatusId        = issueStatusRepository.GetIdByStatus(comboBoxstatus.Text);
            DateTime newDate            = dateTimediscovery.Value;

            //_SelectedIssueId = Convert.ToInt32(preferenceRepository.GetPreference(_CurrentAppUser.UserName, FakePreferenceRepository.PREFERENCE_PROJECT_ID));

            if (newIssueTitle == "")
            {
                MessageBox.Show("Issue name cannot be empty or blank", "Attention");
                return;
            }
            FakeIssueRepository issueRepository = new FakeIssueRepository();

            Issue issue = new Issue {
                Id = _SelectedIssueId, Title = newIssueTitle, DiscoveryDate = newDate, Discoverer = newIssueDiscoverer, InitialDescription = newDescription, Component = newIssueComponent, IssueStatusId = newStatusId
            };
            string result = issueRepository.Modify(issue);

            if (result != FakeIssueRepository.NO_ERROR)
            {
                MessageBox.Show("Error modifying issue.  Error: " + result);
            }
            else
            {
                MessageBox.Show("Issue modification successful.", "Information");
                this.Close();
            }
        }
示例#3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox2.Text.IsNullOrEmpty() || dateTimePicker1.Checked == false || comboBoxStatus.SelectedIndex == -1 || comboBoxDiscoverer.SelectedIndex == -1)
     {
         MessageBox.Show("Please verify all required elements are inpu", "Attention");
     }
     else
     {
         //Creating Issue
         Issue issue = new Issue();
         issue.Title = textBox2.Text.Trim();
         issue.InitialDesscription = richTextBoxDescription.Text.Trim();
         issue.Discoverer          = comboBoxDiscoverer.SelectedItem.ToString();
         issue.Component           = textBox3.Text.Trim();
         issue.DiscoveryDate       = dateTimePicker1.Value;
         issue.IssueStatusId       = fakeIssueStatusRepository.GetIdByStatus(comboBoxStatus.SelectedItem.ToString());
         string result = issueRepository.Add(issue, out _SelectedProjectID);
         if (result == FakeIssueRepository.NO_ERROR)
         {
             MessageBox.Show("Issue Added Successfully");
         }
         else
         {
             MessageBox.Show("Issue not created, " + result, "Attention.");
         }
         this.Close();
     }
 }
示例#4
0
        private void modifybutton_Click_1(object sender, EventArgs e)
        {
            modifyme.Title         = Titlebox.Text.Trim();
            modifyme.Id            = modifyme.Id;
            modifyme.DiscoveryDate = dateTimePicker1.Value;
            modifyme.Discoverer    = discovererbox.GetItemText(discovererbox.SelectedItem);
            modifyme.Component     = textBox3.Text.Trim();
            string statusval = statusbox.GetItemText(statusbox.SelectedItem);

            modifyme.IssueStatusId      = issueRepository.GetIdByStatus(statusval);
            modifyme.InitialDescription = descriptbox.Text;
            foreach (Project p in FakeProjectRepository._Projects)
            {
                if (_SelectedProject == p.Name)
                {
                    modifyme.ProjectId = p.Id;
                }
            }
            string result = newissue.Modify(modifyme);

            if (result == FakeIssueRepository.NO_ERROR)
            {
                MessageBox.Show("Issue Modified Successfully.");
            }
            else
            {
                MessageBox.Show("Issue not Modified. " + result, "Attention.");
            }
            this.Close();
        }
示例#5
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows == null)
            {
                MessageBox.Show("A project must be selected.", "Attention");
            }
            else
            {
                string selectedId = dataGridView1.SelectedRows[0].Cells[0].Value + string.Empty;
                _SelectedIssueId = Convert.ToInt32(selectedId);
            }

            if (previousPage == 1)
            {
                this.Hide();
                FormModifyIssue form = new FormModifyIssue(_SelectedIssueId);
                form.ShowDialog();
                form.Dispose();
            }
            if (previousPage == 2)
            {
                this.Hide();
                DialogResult isSure = MessageBox.Show("Are you sure you want to remove: " + dataGridView1.SelectedRows[0].Cells[1].Value.ToString(), "Confirmation", MessageBoxButtons.YesNo);
                if (isSure == DialogResult.Yes)
                {
                    FakeIssueRepository repository = new FakeIssueRepository();
                    int      id          = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value.ToString());
                    string   title       = dataGridView1.SelectedRows[0].Cells[1].Value + string.Empty;
                    DateTime date        = Convert.ToDateTime(dataGridView1.SelectedRows[0].Cells[2].Value.ToString());
                    string   discoverer  = dataGridView1.SelectedRows[0].Cells[3].Value + string.Empty;
                    string   description = dataGridView1.SelectedRows[0].Cells[4].Value + string.Empty;
                    string   component   = dataGridView1.SelectedRows[0].Cells[5].Value + string.Empty;
                    string   status      = dataGridView1.SelectedRows[0].Cells[6].Value + string.Empty;
                    int      issuestatus = _StatusRepository.GetIdByStatus(status);

                    Issue issue = new Issue {
                        Id = id, Title = title, DiscoveryDate = date, Discoverer = discoverer, InitialDescription = description, Component = component, IssueStatusId = issuestatus
                    };


                    bool result = repository.Remove(issue);
                    if (result == true)
                    {
                        MessageBox.Show("Issue removed.", "Information");
                    }
                    else
                    {
                        MessageBox.Show("Error removing issue " + issue.Title, "Information");
                    }

                    Close();
                }
                if (isSure == DialogResult.No)
                {
                    MessageBox.Show("Remove canceled", "Attention", MessageBoxButtons.OK);
                    Close();
                }
            }
        }
示例#6
0
        private void buttonCreate_Click(object sender, EventArgs e)
        {
            bool   isValid = false;
            string ValidIssue;
            string IssueStat;
            FakeIssueRepository       IssueRepository = new FakeIssueRepository();
            FakeIssueStatusRepository StatRepo        = new FakeIssueStatusRepository();
            IssueStatus IsStat = new IssueStatus();
            Issue       issue  = new Issue();

            issue.ProjectID     = ID;
            issue.ID            = IssueRepository.GetNextIssueID(ID);
            issue.DiscoveryDate = dateTimeDiscoveryDate.Value;
            if (!IssueRepository.isDuplicate(textBoxIssueTitle.ToString()))
            {
                issue.Title = textBoxIssueTitle.Text.ToString();
            }
            if (comboBoxDiscoverer.SelectedIndex > 0)
            {
                issue.Discoverer = comboBoxDiscoverer.SelectedItem.ToString();
            }
            issue.InitialDescription = textBoxInitialDescription.Text.ToString();
            issue.Component          = textBoxComponent.Text.ToString();
            IssueStat           = comboBoxIssueStatus.SelectedItem.ToString();
            issue.IssueStatusID = StatRepo.GetIdByStatus(IssueStat);

            ValidIssue = IssueRepository.ValidateIssue(issue);
            if (ValidIssue == "")
            {
                IssueRepository.Add(issue);
                isValid = true;
                MessageBox.Show("Issue was successfully created!", "Attention");
                this.Close();
            }
            else
            {
                MessageBox.Show(ValidIssue, "Attention");
                isValid = false;
            }
        }
示例#7
0
        private void CreateIssueButton_Click(object sender, EventArgs e)
        {
            int newissueId = 1;

            foreach (Issue issueId in issueRepository.GetAll(_SelectedProjectId))
            {
                if (issueId.Id > newissueId)
                {
                    newissueId = issueId.Id;
                }
            }
            newissueId++;

            Issue issue = new Issue();

            issue.Id                 = newissueId;
            issue.Title              = textBoxtitle.Text.Trim();
            issue.DiscoveryDate      = DateTime.Parse(dateTimediscovery.Text);
            issue.Discoverer         = comboBoxdiscoverer.Text;
            issue.InitialDescription = textBoxdescription.Text;
            issue.Component          = textBoxcomponent.Text;
            issue.IssueStatusId      = issueStatusRepository.GetIdByStatus(comboBoxstatus.Text);
            FakePreferenceRepository preferenceRepository = new FakePreferenceRepository();

            _SelectedProjectId = Convert.ToInt32(preferenceRepository.GetPreference(_CurrentAppUser.UserName, FakePreferenceRepository.PREFERENCE_PROJECT_ID));
            issue.ProjectId    = _SelectedProjectId;


            string result = issueRepository.Add(issue);

            if (result == FakeIssueRepository.NO_ERROR)
            {
                MessageBox.Show("Issue added successfully.");
            }
            else
            {
                MessageBox.Show("Issue not created. " + result, "Attention.");
            }
            this.Close();
        }