public static void CreateOrUpdateTask(decimal auditId, decimal responsiblePersonId, int recordTypeId, DateTime dueDate, string status) { var entities = new PSsqmEntities(); AUDIT audit = SelectAuditById(entities, auditId); AUDIT_TYPE type = SelectAuditTypeById(entities, audit.AUDIT_TYPE_ID); var taskMgr = new TaskStatusMgr(); taskMgr.Initialize(recordTypeId, auditId); taskMgr.LoadTaskList(recordTypeId, auditId); TASK_STATUS task = taskMgr.FindTask("0", "T", responsiblePersonId); if (task == null) { task = taskMgr.CreateTask("0", "T", 0, type.TITLE.ToString(), dueDate, responsiblePersonId); task.STATUS = ((int)TaskMgr.CalculateTaskStatus(task)).ToString(); } else { switch (status) { case "C": task.STATUS = ((int)TaskStatus.Complete).ToString(); taskMgr.SetTaskComplete(task, responsiblePersonId); break; } //task = taskMgr.UpdateTask(task, dueDate, responsiblePersonId, audit.AUDIT_TYPE_ID.ToString()); } taskMgr.UpdateTaskList(auditId); }
public static void SetTaskComplete(decimal incidentId, int recordTypeId) { var taskMgr = new TaskStatusMgr(); taskMgr.Initialize(recordTypeId, incidentId); taskMgr.LoadTaskList(recordTypeId, incidentId); TASK_STATUS task = taskMgr.FindTask("0", "T", 0); if (task != null) { taskMgr.UpdateTaskStatus(task, TaskMgr.CalculateTaskStatus(task)); taskMgr.SetTaskComplete("0", "T", 0, true); taskMgr.UpdateTaskList(incidentId); } }
protected void btnTaskComplete_Click(object sender, EventArgs e) { Button btn = (Button)sender; if (btn == null || string.IsNullOrEmpty(btn.CommandArgument)) { return; } TaskStatusMgr taskMgr = new TaskStatusMgr().CreateNew(0, 0); TASK_STATUS task = taskMgr.SelectTask(Convert.ToDecimal(btn.CommandArgument)); task.COMMENTS = tbTaskComments.Text; task.STATUS = ((int)TaskStatus.Complete).ToString(); task = taskMgr.SetTaskComplete(task, SessionManager.UserContext.Person.PERSON_ID); taskMgr.UpdateTask(task); if (OnTaskUpdate != null) { OnTaskUpdate("update"); } }