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); } }
public static void CreateOrUpdateTask(decimal incidentId, decimal responsiblePersonId, int recordTypeId, DateTime dueDate) { var entities = new PSsqmEntities(); INCIDENT incident = SelectIncidentById(entities, incidentId); var taskMgr = new TaskStatusMgr(); taskMgr.Initialize(recordTypeId, incidentId); taskMgr.LoadTaskList(recordTypeId, incidentId); TASK_STATUS task = taskMgr.FindTask("0", "T", 0); if (task == null) { task = taskMgr.CreateTask("0", "T", 0, incident.ISSUE_TYPE, dueDate, responsiblePersonId); task.STATUS = ((int)TaskMgr.CalculateTaskStatus(task)).ToString(); } else { task = taskMgr.UpdateTask(task, dueDate, responsiblePersonId, incident.ISSUE_TYPE); } taskMgr.UpdateTaskList(incidentId); }