コード例 #1
0
        public void AddEnhancement()
        {
            Format f = new Format();

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


            string          file        = "../../Files/Enhancements.txt";
            EnhancementFile ef          = new EnhancementFile(file);
            Enhancement     enhancement = new Enhancement();

            Console.Write("    Enter Enhancement Summary: ");
            enhancement.summary = Console.ReadLine();

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

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

            ef.AddEnhancement(enhancement);
            Console.Write("    Enhancement succesfully added! Press any key ro return to the main menu: ");
            Console.ReadKey();
        }
コード例 #2
0
        public void AddTicket(Tickets t)
        {
            TaskFile        tf = new TaskFile();
            EnhancementFile ef = new EnhancementFile();
            int             i = new[] { tf.GetMaxTaskID(), ef.GetMaxEnhID(), GetMaxTicketID() }.Max() + 1;

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

            sw.WriteLine($"\n{i},{t.summary},{t.status},{t.priority},{t.submitter},{t.assigned},{t.watchrgoup},{t.severity}");
            Ticket.Add(t);
            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);

            //}t.recordID, t.summary, t.status, t.priority, t.submitter, t.assigned, t.watchrgoup, t.severity);
            //catch (Exception ex)
            //{
            //    logger.Error(ex.Message);
            //}
        }
コード例 #3
0
        public void Process(int selection)
        {
            string          file = "../../Files/enhancements.txt";
            EnhancementFile ef   = new EnhancementFile(file);
            EnhancementMenu em   = new EnhancementMenu();

            em.EnhancementMenuHeader();
            ef.ShowEnhancements();
            em.ViewEnhancementtMenu();
            selection = em.GetEncmntMenuInpput();

            switch (selection)
            {
            case 1:
                em.AddEnhancement();
                break;

            case 2:
                em.EditEnhancement();
                break;

            case 3:
                em.DeleteEnhancement();
                break;
            }
        }
コード例 #4
0
        public int GetMaxEnhID()
        {
            EnhancementFile ef    = new EnhancementFile(EnhancementFilePath());
            List <int>      maxID = new List <int>();

            foreach (Enhancement e in ef.Enhancemnet)
            {
                maxID.Add(e.recordID);
            }
            return(maxID.Max());
        }
コード例 #5
0
        public void ShowEnhancements()
        {
            EnhancementFile enhancementFile = new EnhancementFile(EnhancementFilePath());
            Format          f = new Format();

            foreach (Enhancement e in enhancementFile.Enhancemnet)
            {
                Console.WriteLine(f.GetEnhancementsFormat(), e.recordID, e.summary, e.status, e.priority, e.submitter, e.assigned, e.watchrgoup, e.software, e.cost, e.reason, e.estimate);
            }
            Console.WriteLine();
        }