public IEnumerable <Ticket> Load(bool includeDone) { List <TicketSerializableData> serializableDataList = JsonConvert.DeserializeObject <List <TicketSerializableData> >(File.ReadAllText(this.filePath)); foreach (TicketSerializableData data in serializableDataList.OrderBy(serializableTicketData => serializableTicketData.ID)) { TicketState ticketState = TicketStateRegistry.Instance.GetByCode(data.StatusCode); if (ticketState != null && (ticketState != TicketStateRegistry.Instance.Get <DoneTicketState>() || includeDone)) { TracTicket tracTicket = new TracTicket(data.ID); Ticket ticket = new Ticket(tracTicket, ticketState, data.TicketProperties); yield return(ticket); } } }
public Ticket CreateNew(int id, TicketState initialState) { TracTicket tracTicket = new TracTicket(id); return(new Ticket(tracTicket, initialState, new CustomTicketProperties())); }
public Ticket(TracTicket tracTicket, TicketState currentState, CustomTicketProperties ticketProperties) { this.TracTicket = tracTicket; this.CurrentState = currentState; this.ticketProperties = ticketProperties; }