Esempio n. 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);
         }
     }
 }
Esempio n. 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;
        }
Esempio n. 3
0
        public ApplicationLayer Load(Session session)
        {
            string           jcontent = File.ReadAllText(string.Format(".\\saves\\{0}.json", session.Name));
            SessionContent   content  = JsonConvert.DeserializeObject <SessionContent>(jcontent);
            ApplicationLayer app      = new ApplicationLayer(content.tickets, content.pieces);

            Ticket[] closed = app.FilterTicketsBy((t) => t.Closed);
            if (closed != null)
            {
                foreach (Ticket ticket in closed)
                {
                    ticket.CalculateDuration(); //recalculate Durations
                }
            }
            return(app);
        }