Exemple #1
0
        private void EditTicket()
        {
            if (ticketsListView.SelectedItems.Count != 1)
            {
                return;
            }

            var tag = (Ticket)ticketsListView.SelectedItems[0].Tag;

            using (var form = new TicketDetailsForm(mContext, FormUtil.GetFontContext(), FormUtil.GetFormatter(), Project, tag)) {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                tag.UpdateAndGenerateHistoryRecord(mContext, TicketChangeFormatter.Default, t => {
                    return(form.RetrieveTicket(t));
                });

                // Flush.
                mContext.Flush();

                // Show tickets.
                ShowTickets();

                UpdateTicket(true);
            }
        }
Exemple #2
0
        private void AddTicket()
        {
            Milestone[] milestones = Project.GetMilestones(mContext);
            if (milestones.Length == 0)
            {
                MessageBox.Show(
                    Resources.String_PleaseAddAMilestoneBeforeAddingATicket,
                    Resources.String_Error,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error,
                    MessageBoxDefaultButton.Button1,
                    FormUtil.GetMessageBoxOptions(this));
                tabControl.SelectedTab = milestonesTabPage;
                return;
            }

            using (var form = new TicketDetailsForm(mContext, FormUtil.GetFontContext(), FormUtil.GetFormatter(), Project, null)) {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                Ticket ticket = form.RetrieveTicket();

                // Add.
                ticket.Add(mContext);

                // Flush.
                mContext.Flush();

                // Create ticket history entry.
                TicketHistory ticketHistory = ticket.NewHistory(Resources.String_TicketCreated);
                ticketHistory.Add(mContext);

                // Show tickets.
                ShowTickets();

                FormUtil.SelectNew(ticketsListView, ticket);

                UpdateButtonsEnabledProperty();

                ticketsListView.Focus();

                UpdateTicket(true);
            }
        }