private void edit_ticket_Click(object sender, EventArgs e) { using (ticket_systemEntities db = new ticket_systemEntities()) { 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 = new TicketSystemDBQueryable().getTicketById(db, code); var info_requests = new TicketSystemDBQueryable().getTicketRequests(db, code); var ticket_actions = new TicketSystemDBQueryable().getTicketActions(db, code); var steps = ticket.id_type != null ? new TicketSystemDBQueryable().getStepsOfType(db, (int)ticket.id_type) : null; TicketDetails t = new TicketDetails(ticket, info_requests, ticket_actions, steps); t.Changed += new TicketDetails.RemovedEventHandler(TicketRemoved); t.Show(); } } }
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(); } }