private void remove_Click(object sender, EventArgs e) { AskAdminID admin = new AskAdminID(); admin.ShowDialog(); int admin_id = admin.id; using (ticket_systemEntities db = new ticket_systemEntities()) { ObjectParameter count = new ObjectParameter("res", SqlDbType.Int); if (t.admin_id == admin_id) { db.RemoveTicket(this.t.code, count); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException exc) { TicketSystemDBQueryable.overwrite(exc); } } if (!count.Value.Equals(0)) { MessageBox.Show("Ticket successfully removed"); OnTicketChanged(EventArgs.Empty); } else { MessageBox.Show("Error"); } } Close(); }
private void remove_Click(object sender, EventArgs e) { AskAdminID admin = new AskAdminID(); admin.ShowDialog(); int admin_id = admin.id; if (actions != null && ticket.admin_id == admin_id) { Boolean removed = false; if (this.admin.id == admin_id) { removed = TicketDAO.removeTicket(database, ticket.code); } if (removed) { MessageBox.Show("Ticket successfully removed"); OnTicketChanged(EventArgs.Empty); Close(); } else { MessageBox.Show("Error"); } } else { MessageBox.Show("Error"); } }
private void submit_action_Click(object sender, EventArgs e) { AskAdminID admin = new AskAdminID(); admin.ShowDialog(); int admin_id = admin.id; if (state_list.SelectedItem.ToString().Equals(ticket.STATE)) { int order = steps_list.SelectedIndex; if (order >= 0) { L_IckEtS.model.Action action = new L_IckEtS.model.Action(note.Text, ticket.code, admin_id, order + 1, ticket.id_type); ActionDAO.insertAction(database, action); Close(); } else { MessageBox.Show("Must Select a step"); } //TODO: Test } else { if (actions_list.Items.Count > 0) { if (ticket.admin_id == admin_id) { TicketDAO.closeTicket(database, ticket.code); OnTicketChanged(EventArgs.Empty); Close(); } else { MessageBox.Show("You cannot close this ticket"); } } else { MessageBox.Show("This ticket has no Actions"); } } }
private void submit_action_Click(object sender, EventArgs e) { AskAdminID admin = new AskAdminID(); admin.ShowDialog(); int admin_id = admin.id; using (ticket_systemEntities db = new ticket_systemEntities()) { if (state_list.SelectedItem.ToString().Equals(t.STATE)) { int order = steps_list.SelectedIndex; if (order != -1) { db.CreateAction(note.Text, t.code, admin_id, order + 1, t.id_type); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException exc) { TicketSystemDBQueryable.overwrite(exc); } Close(); } else { MessageBox.Show("Must choose step to resolve"); } } else { if (new TicketSystemDBQueryable().existsActions(db, t.code)) { if (t.admin_id == admin_id) { db.CloseTicket(t.code); try { db.SaveChanges(); OnTicketChanged(EventArgs.Empty); } catch (DbUpdateConcurrencyException exc) { TicketSystemDBQueryable.overwrite(exc); } Close(); } else { MessageBox.Show("You cannot close this ticket"); } } else { MessageBox.Show("This ticket has no Actions"); } } } }