/// <summary> /// 編集処理を実行します。 /// </summary> /// <param name="taskItem">タスク</param> /// <returns>Task</returns> private async Task <bool> ExecuteEdit(TaskItem taskItem) { var win = new TaskEditForm(); win.Initialize(this.ShowingGroup, taskItem); var ret = await win.ShowWindow(ResourceManager.Instance.MainForm); if (ret == SubWindowResult.Submit) { ResourceManager.Instance.AddTaskItem(taskItem.Group, taskItem); if (this.ShowingGroup != null) { this.RefleshTaskItems(this.ShowingGroup.ChildTaskItems.ToList(), this.ShowingGroup); } else { if (!this.isVisibleAddTask) { var taskList = ResourceManager.Instance.GetAllTaskItems(); var filtered = Utils.FilterRecentLimitTask(taskList); this.RefleshTaskItems(filtered, null); } else { var list = ResourceManager.Instance.GetAllTaskItems(); this.RefleshTaskItems(list, null); } } return(true); } return(false); }
/// <summary> /// 追加処理を実行します。 /// </summary> /// <returns>Task</returns> private async Task <bool> ExecuteAdd() { var item = new TaskItem(); KeyInfo groupKey = null; if (this.ShowingGroup != null) { groupKey = this.ShowingGroup.Key; } item.Key = KeyInfo.CreateKeyInfoTask(groupKey); var win = new TaskEditForm(); win.Initialize(this.ShowingGroup, item); var ret = await win.ShowWindow(ResourceManager.Instance.MainForm); if (ret == SubWindowResult.Submit) { if (item.Group != null) { if (item.Group.Equals(groupKey) || this.ShowingGroup == null) { ResourceManager.Instance.AddTaskItem(item.Group, item); this.AddRow(item); } } return(true); } return(false); }
async private void metroButton2_Click(object sender, EventArgs e) { DailyTask dt = new DailyTask(); using (TaskEditForm editForm = new TaskEditForm(dt)) { if (editForm.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { var group = this.metroTabControl1.SelectedTab.Tag as ITaskGroup; if (TaskManager.AddTask(group, dt)) { TaskForm form = new TaskForm(this, dt); form.Show(); this.metroTabControl1.SelectedTab.Controls.Add(form); this.metroTabControl1.SelectedTab.ScrollControlIntoView(form); form.FormClosed += form_FormClosed; FileHelper.SaveJosn(TaskManager.ConvertJson()); } } } NotifyMessage m = new NotifyMessage(); m.Title = "Test"; m.NotifyInterval = new TimeSpan(0, 0, 3); NotifySchedule nm = new NotifySchedule(); }
public ActionResult Edit(int id, TaskEditForm collection) { try { if (ModelState.IsValid) { TaskService repoTask = new TaskService(); int SelectedMainTask = (collection.SelectedMainTask != null)?Int32.Parse(collection.SelectedMainTask):0; int SelectedTaskState = Int32.Parse(collection.SelectedTaskState); if (SelectedMainTask != collection.CurrentMainTask) { if (SelectedMainTask == 0) { repoTask.DeleteMainTask(collection.Id);//DELETE FROM Task_Task WHERE TaskId = , SubTaskId = } else { repoTask.InsertMainTask(collection.Id, SelectedMainTask);//INSERT TaskId, SubTaskId INTO Task_Task } } if (SelectedTaskState != collection.CurrentTaskState) { repoTask.InsertTaskState(id, SelectedTaskState); } if (repoTask.Update(new CD.Task( collection.Id, collection.Name, collection.Description, collection.StartDate, collection.DeadLine, collection.ProjectId, collection.TaskTeam, (collection.SelectedMainTask != null)?(int?)Int32.Parse(collection.SelectedMainTask):null))) { return(RedirectToAction("Details", "Task", new { id = collection.Id })); } return(View(id)); } return(View(id)); } catch { return(View(id)); } }
/*[ProjectManagerRequired]*/ // GET: Task/Edit/5 public ActionResult Edit(int id) { TaskService repoTask = new TaskService(); CD.Task task = repoTask.Get(id); TaskStateService repoTaskState = new TaskStateService(); IEnumerable <CD.Task> tasks = repoTask.GetByProjectId(task.ProjectId); IEnumerable <CD.Task> taskHierarchy = repoTask.GetSubHierarchy(id); IEnumerable <CD.Task> taskList = tasks.Except(taskHierarchy, new IdComparer <CD.Task>()); TaskEditForm taskEdit = new TaskEditForm( task, repoTaskState.GetByTaskId(id), taskList, repoTaskState.Get() ); return(View(taskEdit)); }
private void NewTaskToolStripMenuItem_Click(object sender, EventArgs e) { NewTaskForm ntf = new NewTaskForm(); if (ntf.ShowDialog() == DialogResult.OK) { TaskEditForm tef = new TaskEditForm(); tef.InitForm(ntf.N, ntf.M); if (tef.ShowDialog() == DialogResult.OK) { IsNewTask = true; TaskTypeComboBox.SelectedIndex = tef.TaskType; SimplexTables.Clear(); SourceN = tef.N; SourceM = tef.M; SourceSign = tef.Signs; SourceVectorb = tef.Vectorb; SourceVectorc = tef.Vectorc; SourceMatrixA = tef.MatrixA; SourceTaskType = tef.TaskType; PrintSolveLog(TaskInfotextBox); SimplexTable smptbl = new SimplexTable(CanonicalN, CanonicalM); smptbl.GetTable(CanonicalMatrixA, CanonicalVectorb, CanonicalVectorc); smptbl.TaskType = CanonicalTaskType; SimplexTables.Add(smptbl); currentSimplexTable = SimplexTables.Count - 1; UpdateSimplexGrid(); OpenTableMode(); } } }