public static string GetTicketGridViewItem(RestCommand command, int ticketID)
        {
            TicketGridViewItem ticketGridViewItem = TicketGridView.GetTicketGridViewItem(command.LoginUser, ticketID);

            if (ticketGridViewItem.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(ticketGridViewItem.GetXml("TicketGridViewItem", true));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["TicketNumber"] != null)
        {
            try
            {
                int     ticketNumber = int.Parse(Request["TicketNumber"]);
                Tickets tickets      = new Tickets(UserSession.LoginUser);
                tickets.LoadByTicketNumber(UserSession.LoginUser.OrganizationID, ticketNumber);
                if (tickets.IsEmpty)
                {
                    RedirectBadRequest();
                    return;
                }
                _ticketID = tickets[0].TicketID;
            }
            catch (Exception)
            {
                RedirectBadRequest();
                return;
            }
        }
        else
        {
            try
            {
                _ticketID = int.Parse(Request["ticketid"]);
            }
            catch
            {
                RedirectBadRequest();
                return;
            }
        }

        if (!IsPostBack)
        {
            TicketGridViewItem ticket = TicketGridView.GetTicketGridViewItem(UserSession.LoginUser, _ticketID);
            if (ticket == null)
            {
                RedirectBadRequest();
                return;
            }

            WriteProperties(ticket);
            WriteCustomers(ticket);
            WriteActions(ticket);
        }
    }