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(); }
private void ModifyProject_Load(object sender, EventArgs e) { this.CenterToScreen(); FormSelectProject form = new FormSelectProject(); form.ShowDialog(); if (form.DialogResult != DialogResult.OK) { MessageBox.Show("No project selected.", "Attention"); Close(); } _SelectedProjectId = form._SelectedProjectId; FakePreferenceRepository preferenceRepository = new FakePreferenceRepository(); string preferredProjectId = preferenceRepository.GetPreference(_CurrentAppUser.UserName, FakePreferenceRepository.PREFERENCE_PROJECT_ID); if (_SelectedProjectId.ToString() == preferredProjectId) { MessageBox.Show("Cannot modify your current session project.", "Attention"); Close(); } textBoxProjectName.Text = form._SelectedProjectName; }
public FormIssueDashboard(AppUser appUser) { InitializeComponent(); _CurrentAppUser = appUser; _SelectedProjectId = Convert.ToInt32(preferenceRepository.GetPreference(_CurrentAppUser.UserName, FakePreferenceRepository.PREFERENCE_PROJECT_ID)); }