Exemplo n.º 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();
            }
        }
Exemplo n.º 2
0
        private void FormRecordIssue_Load(object sender, EventArgs e)
        {
            this.CenterToParent();
            int    nextID;
            string disc;
            string IsStat;
            FakeIssueRepository       IssueRepo     = new FakeIssueRepository();
            FakeAppUserRepository     AppRepo       = new FakeAppUserRepository();
            FakeIssueStatusRepository IssueStatRepo = new FakeIssueStatusRepository();
            List <AppUser>            userList      = new List <AppUser>();
            List <IssueStatus>        issueStatList = new List <IssueStatus>();

            nextID = IssueRepo.GetNextIssueID(ID);
            textBoxIssueID.Text = nextID.ToString();
            userList            = AppRepo.GetAll();
            foreach (AppUser user in userList)
            {
                disc = (user.LastName + ", " + user.FirstName);
                comboBoxDiscoverer.Items.Add(disc);
            }
            issueStatList = IssueStatRepo.GetAll();
            foreach (IssueStatus stat in issueStatList)
            {
                IsStat = stat.Value;
                comboBoxIssueStatus.Items.Add(IsStat);
            }
        }
Exemplo n.º 3
0
 public IssueDashboard(AppUser _CurrentAppUser, int selected_id)
 {
     _currentAppUser    = _CurrentAppUser;
     _SelectedProjectId = selected_id;
     IssueRepository    = new FakeIssueRepository(selected_id);
     InitializeComponent();
 }
Exemplo n.º 4
0
 public FormDashboard(AppUser appUser, int selId, FakeIssueRepository fake)
 {
     _Issues         = fake;
     _CurrentAppUser = appUser;
     _selId          = selId;
     InitializeComponent();
 }
Exemplo n.º 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();
                }
            }
        }
Exemplo n.º 6
0
        public FormRecord(AppUser appUser, int selId, FakeIssueRepository faker)
        {
            IssueRepository = faker;
            _selId          = selId;
            _CurrentAppUser = appUser;

            InitializeComponent();
        }
Exemplo n.º 7
0
 public RecordIssue(AppUser _CurrentAppUser, int selected, FakeIssueRepository issueRepo)
 {
     curUser                   = _CurrentAppUser;
     _SelectedProjectID        = selected;
     issueRepository           = issueRepo;
     fakeIssueStatusRepository = new FakeIssueStatusRepository();
     InitializeComponent();
     dateTimePicker1.MaxDate = DateTime.Today;
 }
        private void UpdateIssuesByMonth(int projectId)
        {
            FakeIssueRepository issueRepository   = new FakeIssueRepository();
            List <string>       issuesByMonthList = issueRepository.GetIssuesByMonth(projectId);

            var issuesByMonthCount =
                from issue in issuesByMonthList
                group issue by issue into monthGroup
                select new
            {
                Month = monthGroup.Key.ToString() + ": " + monthGroup.Count().ToString()
            };

            for (int i = 0; i < issuesByMonthCount.Count(); i++)
            {
                string line = parseIssuesByMonth(issuesByMonthCount.ElementAt(i).ToString());
                listBoxIssuesByMonth.Items.Add(line);
            }
        }
Exemplo n.º 9
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;
            }
        }
Exemplo n.º 10
0
        private string selectAProject()
        {
            string            selectedProject = "";
            FormSelectProject form            = new FormSelectProject();

            form.ShowDialog();
            if (form.DialogResult == DialogResult.OK)
            {
                FakePreferenceRepository preferenceRepository = new FakePreferenceRepository();
                preferenceRepository.SetPreference(_CurrentAppUser.UserName,
                                                   FakePreferenceRepository.PREFERENCE_PROJECT_NAME,
                                                   form._SelectedProjectName);
                int selectedProjectId = form._SelectedProjectId;
                preferenceRepository.SetPreference(_CurrentAppUser.UserName,
                                                   FakePreferenceRepository.PREFERENCE_PROJECT_ID,
                                                   selectedProjectId.ToString());
                this.Text           = "Main - " + form._SelectedProjectName;
                this.selected_id    = form._SelectedProjectId;
                selectedProject     = form._SelectedProjectName;
                fakeIssueRepository = new FakeIssueRepository(selectedProjectId);
            }
            form.Dispose();
            return(selectedProject);
        }