public static void Search()
        {
            string             choice, keyword;
            BugFileManager     bug     = new BugFileManager();
            EnhanceFileManager enhance = new EnhanceFileManager();
            TaskFileManager    task    = new TaskFileManager();

            do
            {
                Console.WriteLine("What do you want to search for? ");
                Console.WriteLine("(1) Status");
                Console.WriteLine("(2) Priority");
                Console.WriteLine("(3) Submitter");
                choice = Console.ReadLine();
            } while (choice != "1" && choice != "2" && choice != "3");
            switch (choice)
            {
            case "1":
                keyword = "Closed";
                Console.WriteLine("Search for:");
                Console.WriteLine("(1) Open Tickets");
                Console.WriteLine("(2) Closed Tickets");
                keyword = Console.ReadLine();
                if (keyword == "1")
                {
                    keyword = "Open";
                }
                bug.List("status", keyword);
                task.List("status", keyword);
                enhance.List("status", keyword);
                break;

            case "2":
                Console.WriteLine("What priority you want to search for? High, Normal, or Low?");
                keyword = Console.ReadLine();
                bug.List("priority", keyword);
                task.List("priority", keyword);
                enhance.List("priority", keyword);
                break;

            case "3":
                Console.WriteLine("Which submitter you want to search for? ");
                keyword = Console.ReadLine();
                bug.List("submitter", keyword);
                task.List("submitter", keyword);
                enhance.List("submitter", keyword);
                break;
            }
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Welcome to our Ticket system");
            string choice;

            //main loop
            do
            {
                do
                {
                    Console.WriteLine("Menu:");
                    Console.WriteLine("(1) Create a New Ticket");
                    Console.WriteLine("(2) List Current Tickets");
                    Console.WriteLine("(3) Search Tickets");
                    Console.WriteLine("(4) Exit Program");
                    choice = Console.ReadLine();
                } while (choice != "1" && choice != "2" && choice != "3" && choice != "4");
                //modify input for defining what type of ticket it is. - done
                if (choice == "1")
                {
                    Console.WriteLine("What type of ticket is it");
                    Console.WriteLine("(b)ug, (e)nhancment, or (t)ask");
                    choice = Console.ReadLine();
                    CreateTicket.NewTicket(choice);
                }
                if (choice == "2")
                {
                    BugFileManager     bug     = new BugFileManager();
                    EnhanceFileManager enhance = new EnhanceFileManager();
                    TaskFileManager    task    = new TaskFileManager();
                    bug.List("", "");
                    enhance.List("", "");
                    task.List("", "");
                }
                if (choice == "3")
                {
                    SearchTicket.Search();
                }
            } while (choice != "4");
        }
        public static int GetTicketNumber()
        {
            BugFileManager     bug     = new BugFileManager();
            EnhanceFileManager enhance = new EnhanceFileManager();
            TaskFileManager    task    = new TaskFileManager();

            int ticketNumber = 0;

            //goes through each ticket array and finds the highest ticket number
            if (bug.GetHighestTicketNumber() > ticketNumber)
            {
                ticketNumber = bug.GetHighestTicketNumber();
            }
            if (task.GetHighestTicketNumber() > ticketNumber)
            {
                ticketNumber = task.GetHighestTicketNumber();
            }
            if (enhance.GetHighestTicketNumber() > ticketNumber)
            {
                ticketNumber = enhance.GetHighestTicketNumber();
            }
            return(ticketNumber);
        }
        public static void NewTicket(string choice)
        {
            string summary, status = "Open", priority, submitter, assignedTo, watching = "";

            Console.WriteLine("Please enter a brief summary of the issue");
            summary = Console.ReadLine();
            Console.WriteLine("What is the priority of this issue (High, Normal, Low)");
            priority = Console.ReadLine();
            Console.WriteLine("What is your Name?");
            submitter = Console.ReadLine();
            Console.WriteLine("Who should this ticket be assigned to?");
            assignedTo = Console.ReadLine();
            Console.WriteLine("Who will be watching this ticket?(type 'none' when done)");
            while (watching != "none")
            {
                watching = Console.ReadLine();
            }
            int ticketNumber = GetTicketNumber();

            ticketNumber++;
            switch (choice)
            {
            case "b":
                Console.WriteLine("what is the severity of this issue?");
                string severity = Console.ReadLine();

                BugFileManager bug = new BugFileManager();
                bug.saveBug(ticketNumber, summary, status, priority, submitter,
                            assignedTo, watching, severity);
                break;

            case "e":
                //software, cost, reason, estimate
                Console.WriteLine("What software is needed?");
                string software = Console.ReadLine();
                Console.WriteLine("What is the cost?");
                string cost = Console.ReadLine();
                Console.WriteLine("What is the reason for the enhancement?");
                string reason = Console.ReadLine();
                Console.WriteLine("What is the estimate?");
                string estimate = Console.ReadLine();

                EnhanceFileManager enhance = new EnhanceFileManager();
                enhance.saveEnhancements(ticketNumber, summary, status, priority, submitter,
                                         assignedTo, watching, software, cost, reason, estimate);

                break;

            case "t":
                //project name, due date
                Console.WriteLine("What should the project be named?");
                string projectName = Console.ReadLine();
                Console.WriteLine("When is it due?");
                string dueDate = Console.ReadLine();

                TaskFileManager task = new TaskFileManager();
                task.saveTask(ticketNumber, summary, status, priority, submitter,
                              assignedTo, watching, projectName, dueDate);
                break;
            }
        }