public static void RemoveTask(string panelName, string taskName) { string storyName = panelName.Split('_')[0]; StoryTask task = Stories.Find(x => x.StoryBoxName == storyName).Tasks.Find(x => x.Name == taskName); using (LiteDatabase db = new LiteDatabase(DB_PATH)) { var tasks = db.GetCollection <StoryTask>("StoryTask"); tasks.Delete(Query.EQ("Name", taskName)); } Stories.Find(x => x.StoryBoxName == storyName).Tasks.Remove(task); Program.MainForm.Controls.Find(panelName, false)[0].Controls.Remove(Program.MainForm.Controls.Find(panelName, false)[0].Controls.Find(taskName, false)[0]); }
private void updateDatabaseTasks() { List <StoryTask> tempTasks = new List <StoryTask>(); using (LiteDatabase db = new LiteDatabase(JoScrum.DB_PATH)) { var stories = db.GetCollection <StoryTask>("StoryTask"); tempTasks = stories.Find(x => x.StoryBoxName == StoryBoxName).ToList(); } foreach (StoryTask task in tempTasks) { StoryTask newTask = new StoryTask(task.AssignedTo, task.Date, task.Text, StoryBoxName, task.Name, task.Type); Tasks.Add(newTask); } }
public static void MoveToTask(string panelName, string taskName, TaskType taskType) { string storyName = panelName.Split('_')[0]; string newPanelName = string.Empty; if (taskType == TaskType.NOT_STARTED) { newPanelName = storyName + "_NotStarted"; } else if (taskType == TaskType.IN_PROGRESS) { newPanelName = storyName + "_InProgress"; } else if (taskType == TaskType.DONE) { newPanelName = storyName + "_Done"; } if (panelName == newPanelName) { return; } StoryTask task = Stories.Find(x => x.StoryBoxName == storyName).Tasks.Find(x => x.Name == taskName); task.Type = taskType; using (LiteDatabase db = new LiteDatabase(DB_PATH)) { var tasks = db.GetCollection <StoryTask>("StoryTask"); tasks.Update(task); } Program.MainForm.Controls.Find(newPanelName, false)[0].Controls.Add(Program.MainForm.Controls.Find(panelName, false)[0].Controls.Find(taskName, false)[0]); }