Ejemplo n.º 1
0
        /// <summary>
        /// Instantiate the maps used to store tickets.
        /// Maps are sorted by the ticket status.
        /// </summary>
        public static Dictionary <string, List <RepairTicket> > BuildTicketMap(ApplicationDbContext context, string userId, Dictionary <string, List <RepairTicket> > map)
        {
            map = new Dictionary <string, List <RepairTicket> >();

            List <string> ticketOrder = UpdateDatabase.GetTicketOrder(context, userId);

            if (ticketOrder is not null)
            {
                foreach (string status in ticketOrder)
                {
                    map.Add(status, new List <RepairTicket>());
                }
            }
            else
            {
                map.Add(Constants.RUSH, new List <RepairTicket>());
                map.Add(Constants.CORPORATE_CUSTOMER, new List <RepairTicket>());
                map.Add(Constants.CUSTOMER_REPLY, new List <RepairTicket>());
                map.Add(Constants.NEW, new List <RepairTicket>());
                map.Add(Constants.READY_TO_REPAIR, new List <RepairTicket>());
                map.Add(Constants.IN_PROGRESS, new List <RepairTicket>());
                map.Add(Constants.WAITING_FOR_PARTS, new List <RepairTicket>());
                map.Add(Constants.SENT_OFFSITE, new List <RepairTicket>());
                map.Add(Constants.WAITING_ON_CUSTOMER, new List <RepairTicket>());
                map.Add(Constants.RESOLVED, new List <RepairTicket>());
                map.Add(Constants.READY_FOR_PICKUP, new List <RepairTicket>());
            }


            return(map);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Instantiate the maps used to store status bools.
        /// Maps are sorted by the ticket status.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="userId"></param>
        /// <param name="map"></param>
        /// <returns></returns>
        public static Dictionary <string, bool> BuildStatusMap(ApplicationDbContext context, string userId, Dictionary <string, bool> map)
        {
            map = new Dictionary <string, bool>();

            List <string> includedTickets = UpdateDatabase.GetIncludeTickets(context, userId);


            if (includedTickets is not null)
            {
                foreach (string status in UpdateDatabase.GetTicketOrder(context, userId))
                {
                    map.Add(status, includedTickets.Contains(status));
                }
            }
            else
            {
                map.Add(Constants.RUSH, true);
                map.Add(Constants.CORPORATE_CUSTOMER, true);
                map.Add(Constants.CUSTOMER_REPLY, true);
                map.Add(Constants.NEW, true);
                map.Add(Constants.READY_TO_REPAIR, true);
                map.Add(Constants.IN_PROGRESS, true);
                map.Add(Constants.WAITING_FOR_PARTS, true);
                map.Add(Constants.SENT_OFFSITE, true);
                map.Add(Constants.WAITING_ON_CUSTOMER, true);
                map.Add(Constants.RESOLVED, true);
                map.Add(Constants.READY_FOR_PICKUP, true);
            }

            return(map);
        }