public string GetData() { TicketsView tickets = new TicketsView(_command.LoginUser); TicketTypes ticketTypes = new TicketTypes(_command.LoginUser); ticketTypes.LoadAllPositions(_command.Organization.OrganizationID); TicketType ticketType = null; CustomFields customFields; string elementName = "Ticket"; switch (_restTicketType) { case RestTicketType.Bug: elementName = "Bug"; ticketType = ticketTypes.FindByName("Bugs"); break; case RestTicketType.Feature: elementName = "Feature"; ticketType = ticketTypes.FindByName("Features"); break; case RestTicketType.Task: elementName = "Task"; ticketType = ticketTypes.FindByName("Tasks"); break; case RestTicketType.Issue: elementName = "Issue"; ticketType = ticketTypes.FindByName("Issues"); break; default: break; } if (ticketType == null) { tickets.LoadByOrganizationID(_command.Organization.OrganizationID); customFields = null; } else { tickets.LoadByTicketTypeID(ticketType.TicketTypeID); customFields = new CustomFields(_command.LoginUser); customFields.LoadByTicketTypeID(_command.Organization.OrganizationID, ticketType.TicketTypeID); } RestXmlWriter writer = new RestXmlWriter(elementName + "s"); foreach (TicketsViewItem ticket in tickets) { writer.XmlWriter.WriteStartElement(elementName); RestTicketsViewItem.WriteTicketsViewItemXml(_command, writer.XmlWriter, ticket, customFields); writer.XmlWriter.WriteEndElement(); } return(writer.GetXml()); }
public string GetData() { TicketsViewItem ticket = TicketsView.GetTicketsViewItem(_command.LoginUser, _ticketID); CustomFields customFields = new CustomFields(_command.LoginUser); customFields.LoadByTicketTypeID(_command.Organization.OrganizationID, ticket.TicketTypeID); RestXmlWriter writer = new RestXmlWriter("Ticket"); WriteTicketsViewItemXml(_command, writer.XmlWriter, ticket, customFields); return(writer.GetXml()); }