示例#1
0
 public Piece DeletePiece(Piece piece)
 {
     if (app.ticketExistsBy((t) => t.worksAt(piece)))
     {
         Console.WriteLine(string.Format("{0}", "There are already tickets for this piece:"));
         Ticket[] tickets = app.FilterTicketsBy((t) => t.worksAt(piece));
         OutputListable(tickets);
         if (Confirm(string.Format("{0}", "Delete piece and tickets?")))
         {
             app.DeleteTickets(tickets);
             Console.WriteLine(string.Format("{0}", "Tickets Deleted"));
             return(DeletePiece(piece));
         }
         else
         {
             return(null);
         }
     }
     else
     {
         if (Confirm(string.Format("Delete: {0}?", piece.text)))
         {
             return(piece);
         }
         else
         {
             return(null);
         }
     }
 }
示例#2
0
        public void OptionEndDay(uiListable session)
        {
            if (app.ticketExistsBy((t) => !t.Closed))
            {
                Ticket[] open = app.FilterTicketsBy((t) => !t.Closed);

                foreach (Ticket ticket in open)
                {
                    ticket.endWork();
                }
            }
            file.Save(app.GetPieces(), app.GetTickets(), (Session)session);
            running = false;
        }