示例#1
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();
            }
        }
示例#2
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();
        }