Пример #1
0
 public TicketsViewItem GetTicket()
 {
     return(TicketsView.GetTicketsViewItem(Collection.LoginUser, TicketID));
 }
Пример #2
0
        public static string GetTicketProperties(LoginUser loginUser, int ticketID)
        {
            TicketsViewItem ticket = TicketsView.GetTicketsViewItem(loginUser, ticketID);

            if (ticket == null)
            {
                return("");
            }

            StringBuilder builder = new StringBuilder();

            builder.Append(@"<div style=""background-color: #EDF0F5; color: #004394; margin-bottom:10px; padding-left:5px; border: solid 1px #9FB0CF; font-size: 18px; font-weight: bold;"" class=""ui-corner-all"">Ticket Properties</div>");
            builder.Append(@"<table width=""100%"" cellpadding=""0"" cellspacing=""5"" border=""0"">");

            builder.Append("<tr>");
            builder.Append(GetColumn("Opened By", ticket.CreatorName));
            builder.Append(GetColumn("Opened On", ticket.DateCreated.ToString("g", loginUser.CultureInfo)));
            builder.Append("</tr>");

            builder.Append("<tr>");
            builder.Append(GetColumn("Last Modified By", ticket.ModifierName));
            builder.Append(GetColumn("Last Modified On", ticket.DateModified.ToString("g", loginUser.CultureInfo)));

            builder.Append("</tr>");

            builder.Append("<tr>");
            if (ticket.IsClosed)
            {
                builder.Append(GetColumn("Days Closed", ticket.DaysClosed.ToString()));
            }
            else
            {
                builder.Append(GetColumn("Days Opened", ticket.DaysOpened.ToString()));
            }

            builder.Append(GetColumn("Total Time Spent", DataUtils.MinutesToDisplayTime(Tickets.GetTicketActionTime(ticket.Collection.LoginUser, ticket.TicketID))));
            builder.Append("</tr>");


            if (ticket.IsClosed && ticket.DateClosed != null)
            {
                builder.Append("<tr>");
                if (ticket.CloserID != null)
                {
                    builder.Append(GetColumn("Closed By", ticket.CloserName));
                }
                builder.Append(GetColumn("Closed On", ((DateTime)ticket.DateClosed).ToString("g", loginUser.CultureInfo)));
                builder.Append("</tr>");
            }


            builder.Append("<tr>");
            builder.Append(GetColumn("Ticket Type", ticket.TicketTypeName));
            builder.Append(GetColumn("Assigned Group", ticket.GroupName));
            builder.Append("</tr>");

            builder.Append("<tr>");
            builder.Append(GetColumn("Status", ticket.Status));
            builder.Append(GetColumn("Product", ticket.ProductName));
            builder.Append("</tr>");

            builder.Append("<tr>");
            builder.Append(GetColumn("Severity", ticket.Severity));
            builder.Append(GetColumn("Reported Version", ticket.ReportedVersion));
            builder.Append("</tr>");

            builder.Append("<tr>");
            builder.Append(GetColumn("Assigned To", ticket.UserName));
            builder.Append(GetColumn("Resolved Version", ticket.SolvedVersion));
            builder.Append("</tr>");

            builder.Append("<tr>");
            builder.Append(GetColumn("Visible On Portal", ticket.IsVisibleOnPortal.ToString()));
            builder.Append(GetColumn("Knowledge Base", ticket.IsKnowledgeBase.ToString()));
            builder.Append("</tr>");

            CustomFields fields = new CustomFields(ticket.Collection.LoginUser);

            fields.LoadByTicketTypeID(ticket.OrganizationID, ticket.TicketTypeID);

            bool flag = false;

            foreach (CustomField field in fields)
            {
                flag = !flag;
                if (flag)
                {
                    builder.Append("<tr>");
                }

                CustomValue value;
                value = CustomValues.GetValue(ticket.Collection.LoginUser, field.CustomFieldID, ticket.TicketID);
                builder.Append(GetColumn(field.Name + "", value.Value));
                if (!flag)
                {
                    builder.Append("</tr>");
                }
            }
            if (flag)
            {
                builder.Append("</tr>");
            }
            builder.Append("</table>");

            return(builder.ToString());
        }