Ejemplo n.º 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);
        }
Ejemplo n.º 2
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");
        }