private void FormRecord_Load(object sender, EventArgs e) { this.CenterToParent(); //create and add a new issue Issue tmp = new Issue(); IssueRepository.Add(tmp); //get the index from newly implemented issue then remove it _i = tmp.Id; IssueRepository.Remove(tmp); IdBox.Text = (_i.ToString()); foreach (AppUser user in _userRepository.GetAll()) { comboBox1.Items.Add(user.LastName + ", " + user.FirstName); } comboBox1.SelectedIndex = 0; ComponentBox.SelectedText = ""; foreach (IssueStatus issueStatus in IssueStatusRepository.GetAll()) { comboBox2.Items.Add(issueStatus.Value); } comboBox2.SelectedIndex = 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(); } }
public void createbutton_Click(object sender, EventArgs e) { Issue issue = new Issue(); issue.Title = Titlebox.Text.Trim(); issue.Id = i; issue.DiscoveryDate = dateTimePicker1.Value; issue.Discoverer = discovererbox.GetItemText(discovererbox.SelectedItem); issue.Component = textBox3.Text.Trim(); string statusval = statusbox.GetItemText(statusbox.SelectedItem); issue.IssueStatusId = issueRepository.GetIdByStatus(statusval); issue.InitialDescription = descriptbox.Text; foreach (Project p in FakeProjectRepository._Projects) { if (_SelectedProject == p.Name) { issue.ProjectId = p.Id; } } string result = newissue.Add(issue); if (result == FakeIssueRepository.NO_ERROR) { MessageBox.Show("Issue Recorded Successfully."); } else { MessageBox.Show("Issue not recorded. " + result, "Attention."); } this.Close(); }
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; } }
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(); }