public void AddBugTicket(bugTicket bug) { bug.TicketId = bugTickets.Count() == 0 ? 1 : bugTickets.Max(b => b.TicketId) + 1; StreamWriter sw = new StreamWriter("bug.txt", true); sw.WriteLine($"{bug.TicketId},{bug.summary},{bug.status},{bug.priority},{bug.submitter},{bug.assigned},{bug.watching},{bug.severity}"); sw.Close(); bugTickets.Add(bug); sw.Close(); }
public void readTicket() { StreamReader sr = new StreamReader("bug.txt"); while (!sr.EndOfStream) { string lineOfCode = sr.ReadLine(); string[] parsedLineOfCode = lineOfCode.Split(','); bugTicket bTicket = new bugTicket { TicketId = ulong.Parse(parsedLineOfCode[0]), summary = parsedLineOfCode[1], status = parsedLineOfCode[2], priority = parsedLineOfCode[3], submitter = parsedLineOfCode[4], assigned = parsedLineOfCode[5], watching = parsedLineOfCode[6], severity = parsedLineOfCode[7], }; bugTickets.Add(bTicket); } sr.Close(); StreamReader srr = new StreamReader("enh.txt"); while (!srr.EndOfStream) { string lineOfCode = srr.ReadLine(); string[] parsedLineOfCode = lineOfCode.Split(','); enhanceTicket eTicket = new enhanceTicket { TicketId = ulong.Parse(parsedLineOfCode[0]), summary = parsedLineOfCode[1], status = parsedLineOfCode[2], priority = parsedLineOfCode[3], submitter = parsedLineOfCode[4], assigned = parsedLineOfCode[5], watching = parsedLineOfCode[6], software = parsedLineOfCode[7], cost = parsedLineOfCode[8], reason = parsedLineOfCode[7], estimate = parsedLineOfCode[9], }; enhanceTickets.Add(eTicket); } srr.Close(); StreamReader srrr = new StreamReader("task.txt"); while (!srrr.EndOfStream) { string lineOfCode = srrr.ReadLine(); string[] parsedLineOfCode = lineOfCode.Split(','); taskTicket tTicket = new taskTicket { TicketId = ulong.Parse(parsedLineOfCode[0]), summary = parsedLineOfCode[1], status = parsedLineOfCode[2], priority = parsedLineOfCode[3], submitter = parsedLineOfCode[4], assigned = parsedLineOfCode[5], watching = parsedLineOfCode[6], projectName = parsedLineOfCode[7], dueDate = parsedLineOfCode[8], }; taskTickets.Add(tTicket); } srrr.Close(); }