コード例 #1
0
        public void AddEnhancement(Enhancement e)
        {
            TicketFile tf = new TicketFile();
            TaskFile   tkf = new TaskFile();
            int        i = new[] { tf.GetMaxTicketID(), tkf.GetMaxTaskID(), GetMaxEnhID() }.Max() + 1;

            StreamWriter sw = new StreamWriter(filePath, append: true);

            sw.WriteLine($"\n{i},{e.summary},{e.status},{e.priority},{e.submitter},{e.assigned},{e.watchrgoup},{e.software},{e.cost},{e.reason},{e.estimate}");
            Enhancemnet.Add(e);
            sw.Close();

            //try
            //{
            //    //first generate movie id
            //    t.recordID = Ticket.Max(m => m.recordID) + 1;

            //    StreamWriter sw = new StreamWriter(filePath);
            //    sw.WriteLine($"\n{t.recordID},{t.summary},{t.status},{t.priority},{t.submitter},{t.assigned},{t.watchrgoup},{t.severity}");
            //    sw.Close();
            //    Ticket.Add(t);
            //    logger.Info("Ticket id {Id} added", t.recordID);

            //}
            //catch (Exception ex)
            //{
            //    logger.Error(ex.Message);
            //}
        }
コード例 #2
0
        public void AddTicket()
        {
            Format f = new Format();

            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("\n    --------------------------------------------------------------------------------------------------------------------------------------------------------------\n" +
                              "    Add Ticket\n" +
                              "    --------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
            Console.ResetColor();


            string     file   = "../../Files/tickets.txt";
            TicketFile tf     = new TicketFile(file);
            Tickets    ticket = new Tickets();

            Console.Write("    Enter Ticket Summary: ");
            ticket.summary = Console.ReadLine();

            Console.Write("\n    Enter Ticket Priority: ");

            ticket.priority = f.validateInt(Console.ReadLine());
            if (ticket.priority > 3)
            {
                Console.Write("    Please Enter a valid proiroity 1 - 3 ");
                ticket.priority = f.validateInt(Console.ReadLine());
            }

            tf.AddTicket(ticket);
            Console.Write("    Ticket succesfully added! Press any key ro return to the main menu: ");
            Console.ReadKey();
        }
コード例 #3
0
        public void Process(int selection)
        {
            TicketFile tf = new TicketFile();
            TicketMenu tm = new TicketMenu();

            tm.TicketMenuHeader();
            tf.ShowTickets();
            tm.ViewTicketMenu();
            selection = tm.GetTktMenuInpput();

            switch (selection)
            {
            case 1:
                tm.AddTicket();
                break;

            case 2:
                tm.EditTicket();
                break;

            case 3:
                tm.DeleteTicket();
                break;

            case 4:
                tm.SearchTickets();
                break;
            }
        }
コード例 #4
0
        public void ShowTickets()
        {
            TicketFile ticketFile = new TicketFile(TicketFilePath());

            Format f = new Format();

            foreach (Tickets t in ticketFile.Ticket)
            {
                Console.WriteLine(f.GetTicketsFormat(), t.recordID, t.summary, t.status, t.priority, t.submitter, t.assigned, t.watchrgoup, t.severity);
            }
        }
コード例 #5
0
        public int GetMaxTicketID()
        {
            TicketFile tf    = new TicketFile(TicketFilePath());
            List <int> maxID = new List <int>();

            foreach (Tickets t in tf.Ticket)
            {
                maxID.Add(t.recordID);
            }
            return(maxID.Max());
        }
コード例 #6
0
        public void SearchTickets()
        {
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("\n    --------------------------------------------------------------------------------------------------------------------------------------------------------------\n" +
                              "    Search Tickets\n" +
                              "    --------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
            Console.ResetColor();
            Console.Write("\n    Enter any portion of a Ticket Summary: \n");
            Console.Write("    ");
            string search = Console.ReadLine().ToLower();



            //TicketFile tix = TicketFile.LoadTickets();

            //foreach(var t in tix)
            //{
            //    Console.WriteLine(t.summary);
            //}


            TicketFile tf     = new TicketFile("../../Files/tickets.txt");
            var        ticket = tf.Ticket.Where(t => t.summary.ToLower().Contains(search));

            if (ticket.Count() > 0)
            {
                foreach (Tickets t in ticket)
                {
                    Format f = new Format();
                    Console.WriteLine(f.GetTicketsFormat(), t.recordID, t.summary, t.status, t.priority, t.submitter, t.assigned, t.watchrgoup, t.severity);
                }
            }
            else
            {
                Console.WriteLine("    There is no Ticket with a summary containing: " + search);
            }



            Console.WriteLine("\n    Press any key ro return to the main menu: ");

            Console.ReadKey();
        }