Example #1
0
        //loop through passed in ticket properties and get user input,
        private static string[] GetTicketData(string[] props, string type)
        {
            string[] output = new string[props.Length];
            int      nextID = TicketList.getNextTicketID(type);

            output[0] = nextID.ToString();

            //skip TicketID
            for (int i = 1; i < props.Length; i++)
            {
                Ui.GetDetailPrompt(props[i]);
                output[i] = Console.ReadLine();
            }
            return(output);
        }
Example #2
0
        //searches tickets by status/priority/submitter
        private static void SearchTickets()
        {
            string        menuInput = "";
            List <Ticket> foundList = new List <Ticket>();

            while (menuInput != "0")
            {
                Ui.DisplayMenu("search");
                menuInput = Console.ReadLine();
                string searchString = "";
                switch (menuInput)
                {
                case "1":
                    Ui.GetDetailPrompt("status");
                    searchString = Console.ReadLine();
                    foundList    = TicketList.FindTickets(searchString, "status");
                    if (foundList.Count > 0)
                    {
                        Ui.DisplayFoundTickets(foundList);
                    }
                    break;

                case "2":
                    Ui.GetDetailPrompt("priority");
                    searchString = Console.ReadLine();
                    foundList    = TicketList.FindTickets(searchString, "priority");
                    if (foundList.Count > 0)
                    {
                        Ui.DisplayFoundTickets(foundList);
                    }
                    break;

                case "3":
                    Ui.GetDetailPrompt("submitter");
                    searchString = Console.ReadLine();
                    foundList    = TicketList.FindTickets(searchString, "submitter");
                    if (foundList.Count > 0)
                    {
                        Ui.DisplayFoundTickets(foundList);
                    }
                    break;

                default: break;
                }
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            logger.Info("Program started");

            //display program title
            Ui.DisplayMenu("title");

            //read all the files and dump tickets into TicketList Class
            //create file if readfile returns null (no/empty file)
            TicketList.bugs = FileReader.ReadFile("bugs");
            if (TicketList.bugs != null)
            {
                logger.Info(TicketList.bugs.Count + " bug tickets added! next id = " + TicketList.getNextTicketID("bugs"));
            }
            else
            {
                CreateFile("bugs");
                TicketList.bugs = FileReader.ReadFile("bugs");
                logger.Info(TicketList.bugs.Count + " bug tickets added! next id = " + TicketList.getNextTicketID("bugs"));
            }

            TicketList.enhancements = FileReader.ReadFile("enhancements");
            if (TicketList.enhancements != null)
            {
                logger.Info(TicketList.enhancements.Count + " enhancement tickets added! next id = " + TicketList.getNextTicketID("enhancements"));
            }
            else
            {
                CreateFile("enhancements");
                TicketList.enhancements = FileReader.ReadFile("enhancements");
                logger.Info(TicketList.enhancements.Count + " enhancement tickets added! next id = " + TicketList.getNextTicketID("enhancements"));
            }

            TicketList.tasks = FileReader.ReadFile("tasks");
            if (TicketList.tasks != null)
            {
                logger.Info(TicketList.tasks.Count + " task tickets added! next id = " + TicketList.getNextTicketID("tasks"));
            }
            else
            {
                CreateFile("tasks");
                TicketList.tasks = FileReader.ReadFile("tasks");
                logger.Info(TicketList.tasks.Count + " task tickets added! next id = " + TicketList.getNextTicketID("tasks"));
            }
            //loop Main Menu options until quit is selected
            string menuInput = "";

            while (menuInput != "0")
            {
                Ui.DisplayMenu("main");
                menuInput = Console.ReadLine();
                switch (menuInput)
                {
                case "1":
                    DisplayTickets();     //loops until back to main menu is selected
                    break;

                case "2":
                    CreateTickets();     //loops until  back to main menu is selected
                    break;

                case "3":
                    SearchTickets();     //loops until back to main menu is selected
                    break;

                default: break;
                }
            }
            logger.Info("Program exit");
        }