public HtmlString GetHistoryTitleHtml() { switch (this.EntryType) { case TicketHistoryEntryType.Created: return(new HtmlString($"<u>{User.ShortName}</u> created the ticket '{ParentTicket.GetTicketIdentifier()}'.")); case TicketHistoryEntryType.AssignedToSolver: return(new HtmlString($"<u>{User.ShortName}</u> <b class=\"text-success\">assigned</b> ticket '{ParentTicket.GetTicketIdentifier()}'")); case TicketHistoryEntryType.AssignedToNewSolver: return(new HtmlString($"<u>{User.ShortName}</u> <b class=\"text-warning\"><i>re</i>-assigned</b> ticket '{ParentTicket.GetTicketIdentifier()}'")); case TicketHistoryEntryType.UnassignedFromSolver: return(new HtmlString($"<u>{User.ShortName}</u> <b class=\"text-danger\">unassigned</b> ticket '{ParentTicket.GetTicketIdentifier()}'")); case TicketHistoryEntryType.StatusChanged: return(new HtmlString($"Ticket status was updated by <u>{User.ShortName}</u>.")); case TicketHistoryEntryType.StatusChangedByWorkflow: return(new HtmlString($"Ticket status was changed by workflow rules.")); case TicketHistoryEntryType.AttachmentAdded: return(new HtmlString($"<u>{User.ShortName}</u> has uploaded an attachment.")); case TicketHistoryEntryType.CommentAdded: return(new HtmlString($"<u>{User.ShortName}</u> added a comment.")); case TicketHistoryEntryType.TicketTypeModified: return(new HtmlString($"<u>{User.ShortName}</u> updated the ticket type.")); case TicketHistoryEntryType.TitleModified: return(new HtmlString($"<u>{User.ShortName}</u> changed the title.")); case TicketHistoryEntryType.DescriptionModified: return(new HtmlString($"<u>{User.ShortName}</u> modified the description.")); case TicketHistoryEntryType.PriorityChanged: return(new HtmlString($"The ticket's priority was updated by <u>{User.ShortName}</u>.")); case TicketHistoryEntryType.Archived: return(new HtmlString($"This ticket has been archived by <u>{User.ShortName}</u>.")); default: return(new HtmlString("")); } }
private void RestoreToSingleTicket() { // Need to check for locks on any of the settings in the source list if (listboxSourceTicket.Items.Cast <FormattedListBoxItem>() .Where(item => item.Id != OriginalTicket.PrimaryKey.Id) .Any(item => PosHelper.IsLocked(TableName.Ticket, item.Id))) { PosDialogWindow.ShowDialog( Types.Strings.OneOrMoreOfTheTicketsInThisPartyIsCurrentlyBeingModifiedSomewhereElseCanNotChangeToSingleTicket, Types.Strings.TicketLocked); return; } // Move TicketItems IEnumerable <Ticket> tickets = TicketManager.GetPartyTickets(ParentTicket.PartyId); foreach (Ticket ticket in tickets) { if (ticket.PrimaryKey.Equals(ParentTicket.PrimaryKey) || ticket.IsClosed || ticket.IsCanceled) { continue; } // Move all ticket items that are not on the ParentTicket, back to // the ParentTicket #if DEMO int ticketItemCount = ParentTicket.GetNumberOfTicketItems() + ticket.GetNumberOfTicketItems(); if (ticketItemCount > 3) { PosDialogWindow.ShowDialog(Window.GetWindow(this), Types.Strings.YouCanNotAddMoreThan3TicketItemsToASingleTicketInTheDemoVersionAdditionalTicketItemsWillBeRemoved, Types.Strings.DemoRestriction); } #endif IEnumerable <TicketItem> ticketItems = TicketItem.GetAll(ticket.PrimaryKey); foreach (TicketItem ticketItem in ticketItems) { #if DEMO if (ParentTicket.GetNumberOfTicketItems() >= 3) { ticketItem.Delete(); continue; } #endif ticketItem.SetTicketId(ParentTicket.PrimaryKey.Id); ticketItem.UpdateTicketId(); } // Delete the child ticket TicketManager.Delete(ticket.PrimaryKey); } // Delete Party Invites IEnumerable <PartyInvite> invites = PartyInvite.GetAll(ParentTicket.PartyId); foreach (PartyInvite invite in invites) { PartyInvite.Delete(invite.Id); } // Delete the party Party.Delete(ParentTicket.PartyId); ParentTicket.SetPartyId(0); ParentTicket.Update(); CurrentTicket = OriginalTicket = ParentTicket; // Done, Close the parent window Window.GetWindow(this).Close(); }