Exemplo n.º 1
0
        private void ShowTicketHistoryDetails()
        {
            if (ticketHistoryListView.SelectedItems.Count == 1)
            {
                var tag = (TicketHistory)ticketHistoryListView.SelectedItems[0].Tag;

                var formatter = FormUtil.GetFormatter();
                timestampTextBox.Text = formatter.Format(tag.Timestamp);
                changesTextBox.Text   = tag.Changes;
                commentTextBox.Text   = tag.Comment;

                groupBox.Enabled = true;
            }
            else
            {
                timestampTextBox.Text = string.Empty;
                changesTextBox.Text   = string.Empty;
                commentTextBox.Text   = string.Empty;

                groupBox.Enabled = false;
            }
        }
Exemplo n.º 2
0
        private void ShowTicketHistory()
        {
            TicketHistory[] history   = mTicket.GetHistory(mContext);
            var             formatter = FormUtil.GetFormatter();

            ticketHistoryListView.BeginUpdate();
            ticketHistoryListView.Items.Clear();
            foreach (var th in history)
            {
                var lvi = new ListViewItem()
                {
                    Text = formatter.Format(th.Timestamp),
                    Tag  = th,
                };

                ticketHistoryListView.Items.Add(lvi);
            }

            ticketHistoryListView.EndUpdate();
            ticketHistoryListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            ticketHistoryListView.Columns[0].Width -= 4;

            ShowTicketHistoryDetails();
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
        private void ShowTicket()
        {
            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)) {
                form.ReadOnly = true;
                form.ShowDialog();
            }
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
0
 public override string ToString()
 {
     return(ToString(FormUtil.GetFormatter()));
 }