// Create a diary file by // - creating an empty diary // - save it to the file // filename - is the diary filename // public static Diary Create(string filename, int sprdur) { string fullname = Fullname(filename); if (File.Exists(fullname)) { Console.WriteLine($"File {fullname} already exists. Not creating."); return(null); } Diary temp = new Diary(); if (sprdur != 0) { temp.duration = sprdur; // Default duration is 1 week } else { temp.duration = Diary.DEFAULT_DURATION; } temp.sprints = new List <Sprint>(); // Create an empty list of sprints temp.active = Calendar.Create(temp.duration); temp.AssignID(temp.active); temp.created = DateTime.Now; Console.WriteLine($"Creating empty diary {fullname} duration {sprdur}"); temp.Save(fullname); return(temp); }
public void Close() { Console.WriteLine("Close current sprint"); diary = Diary.Load(filename); diary.CloseSprint(); diary.Save(filename); }
public void Modify() { Console.WriteLine("Modify diary"); diary = Diary.Load(filename); diary.duration = cli.duration; diary.Save(filename); }
public void Todo() { Console.WriteLine("Add a task to current sprint"); diary = Diary.Load(filename); Todo todo = new Todo(); todo.effort_estimate = cli.estimate; todo.project = cli.project; todo.description = cli.Operand(); diary.active.Add(todo); diary.Save(filename); }
public void Blocked() { Console.WriteLine("Mark a task blocked"); diary = Diary.Load(filename); if ((cli.task == null) || (cli.task.Length < 1)) { Console.WriteLine("Need a task id to mark blocked"); return; } Console.WriteLine($"Marking task {cli.task} blocked"); diary.active.Blocked(cli.task, cli.Operand()); diary.Save(filename); }
public void Done() { Console.WriteLine("Mark a task Done"); diary = Diary.Load(filename); if ((cli.task == null) || (cli.task.Length < 1)) { Console.WriteLine("Need a task id to mark done"); return; } Console.WriteLine($"Marking task {cli.task} done"); diary.active.Done(cli.task); diary.Save(filename); }