コード例 #1
0
        private string GetCreatedTicketDescription(TicketPart ticket)
        {
            string ticketIdAndTitle        = this.GetTicketIdAndTitle(ticket.Record);
            string createTicketDescription = string.Format(
                "{0} '{1}'",
                T("Creates a new Ticket").Text,
                ticketIdAndTitle);

            if (ticket.Record.Parent != null)
            {
                var parentTicket = this.ticketRepository.Table.FirstOrDefault(c => c.Id == ticket.Record.Parent.Id);
                if (parentTicket != null)
                {
                    createTicketDescription = string.Format(
                        "Creates a sub ticket '{0}' for '{1}'",
                        this.GetTicketIdAndTitle(parentTicket),
                        ticketIdAndTitle);
                }
            }

            string relatedContentItemString = string.Empty;

            if (ticket.Record.RelatedContentItem != null)
            {
                var relatedContentItem = this.services.ContentManager.Get(ticket.Record.RelatedContentItem.Id);
                relatedContentItemString = string.Format(" {0} {1}", this.T("for").Text, CRMHelper.GetContentItemTitle(relatedContentItem));
            }

            return(string.Format("{0}{1}", createTicketDescription, relatedContentItemString));
        }