protected void lnkDeleteTask_OnClick(object sender, EventArgs e)
        {
            // we are only marking the status as deleteded, not physically deleting the task.
            lblErrorMessage.Text = "";
            LinkButton btn = (LinkButton)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));

            taskMgr.UpdateTaskStatus(task, TaskStatus.Delete);
            taskMgr.UpdateTask(task);
            taskMgr.UpdateTaskList(task.RECORD_ID);
            if (OnTaskAdd != null)
            {
                OnTaskAdd("added", task.RECORD_ID, (decimal)task.RECORD_SUBID);
            }
            if (task.RECORD_TYPE == (int)TaskRecordType.Audit)             // update the Question Status when adding tasks for an audit followup.
            {
                EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(task.RECORD_ID, (decimal)task.RECORD_SUBID);

                if (auditQuestion != null)
                {
                    auditQuestion.Status = "02";
                    EHSAuditMgr.UpdateAnswer(auditQuestion);
                }
                SessionManager.ReturnRecordID = task.RECORD_ID;
                SessionManager.ReturnObject   = "AddTask";
                SessionManager.ReturnStatus   = true;
            }
        }
Пример #2
0
        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);
            }
        }