예제 #1
0
        private void edit_ticket_Click(object sender, EventArgs e)
        {
            if (ticket_list.SelectedItems.Count < 1)
            {
                MessageBox.Show("You need to select a Ticket");
            }
            else
            {
                int code = int.Parse(ticket_list.SelectedItems[0].Text);

                var ticket = TicketDAO.getTicketById(database, code);
                var type   = ticket.id_type != null?TypeDAO.getType(database, ticket.id_type.Value) : null;

                var client        = ClientDAO.getClient(database, ticket.client_id);
                var admin         = AdminDAO.getAdminByID(database, ticket.admin_id);
                var info_requests = RequestDAO.getTicketRequests(database, code);
                var actions       = ActionDAO.getTicketActions(database, code);
                var steps         = type != null?StepDAO.getStepsOfType(database, type.id) : null;

                TicketDetails t = new TicketDetails(database, ticket, type, client, admin, info_requests, actions, steps);
                t.Changed += new TicketDetails.RemovedEventHandler(TicketRemoved);
                t.Show();
            }
        }