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); //} }
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); //} }
public void AddTask() { Format f = new Format(); Console.Clear(); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\n --------------------------------------------------------------------------------------------------------------------------------------------------------------\n" + " Add Task\n" + " --------------------------------------------------------------------------------------------------------------------------------------------------------------\n"); Console.ResetColor(); string file = "../../Files/tasks.txt"; TaskFile tf = new TaskFile(file); Tasks task = new Tasks(); Console.Write(" Enter Task Summary: "); task.summary = Console.ReadLine(); Console.Write("\n Enter Task Priority: "); task.priority = f.validateInt(Console.ReadLine()); if (task.priority > 3) { Console.Write(" Please Enter a valid proiroity 1 - 3 "); task.priority = f.validateInt(Console.ReadLine()); } tf.AddTask(task); Console.Write(" Task succesfully added! Press any key ro return to the main menu: "); Console.ReadKey(); }
public void Process(int selection) { string file = "../../Files/tasks.txt"; TaskFile tf = new TaskFile(file); TaskMenu tm = new TaskMenu(); tm.TaskMenuHeader(); tf.ShowTasks(); tm.ViewTaskMenu(); selection = tm.GetTaskMenuInpput(); switch (selection) { case 1: tm.AddTask(); tm.GetTaskMenuInpput(); break; case 2: tm.EditTask(); break; case 3: tm.DeleteTask(); break; } }
public int GetMaxTaskID() { TaskFile tskf = new TaskFile(TaskFilePath()); List <int> maxID = new List <int>(); foreach (Tasks t in tskf.Task) { maxID.Add(t.recordID); } return(maxID.Max()); }
public void ShowTasks() { TaskFile taskFile = new TaskFile(TaskFilePath()); Format f = new Format(); foreach (Tasks t in taskFile.Task) { Console.WriteLine(f.GetTasksFormat(), t.recordID, t.summary, t.status, t.priority, t.submitter, t.assigned, t.watchrgoup, t.project, t.dueDate); } Console.WriteLine(); }