public static void DeleteAuditTask(decimal auditId, int recordTypeId) { var entities = new PSsqmEntities(); var taskMgr = new TaskStatusMgr(); taskMgr.DeleteTask(recordTypeId, auditId); }
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; } }
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); }
protected void btnTaskAssignUpdate_Click(object sender, EventArgs e) { Button btn = (Button)sender; if (btn == null || string.IsNullOrEmpty(btn.CommandArgument)) { return; } if (ddlAssignPerson.SelectedItem != null) { TaskStatusMgr taskMgr = new TaskStatusMgr().CreateNew(0, 0); TASK_STATUS task = taskMgr.SelectTask(Convert.ToDecimal(btn.CommandArgument)); task.COMMENTS = tbAssignComment.Text; task.STATUS = ((int)TaskStatus.New).ToString(); task.RESPONSIBLE_ID = Convert.ToDecimal(ddlAssignPerson.SelectedValue); taskMgr.UpdateTask(task); // send email EHSNotificationMgr.NotifyTaskAssigment(task, 0); } if (OnTaskUpdate != null) { OnTaskUpdate("update"); } }
private void UpdateSelectedTask(decimal taskID) { TaskStatusMgr taskMgr = new TaskStatusMgr().CreateNew(0, 0); TASK_STATUS task = taskMgr.SelectTask(taskID); uclTask.BindTaskUpdate(task, ""); }
private void UpdateSelectedTask(decimal taskID) { TaskStatusMgr taskMgr = new TaskStatusMgr().CreateNew(0, 0); TASK_STATUS task = taskMgr.SelectTask(taskID); SessionManager.ReturnObject = task; SessionManager.ReturnStatus = true; SessionManager.ReturnPath = (Request.Path.ToString() + "?v=T"); // return to action/task view Response.Redirect("/Home/TaskAction.aspx"); }
private void UpdateTaskList(string cmd) { List <decimal> respTaskForList = new List <decimal>(); List <decimal> respTaskPlantList = new List <decimal>(); string selectedValue = "0"; if (ddlTaskScope.SelectedIndex > -1) { selectedValue = ddlTaskScope.SelectedValue; } else if (mnuTaskScope.SelectedItem != null) { selectedValue = mnuTaskScope.SelectedItem.Value; } SysPriv maxPriv = UserContext.GetMaxScopePrivilege(SysScope.busloc); bool adminList = false; if (maxPriv <= SysPriv.config) // is a plant admin or greater ? { adminList = true; } if (selectedValue == "0" || selectedValue == "TOP") { respTaskForList.Add(SessionManager.UserContext.Person.PERSON_ID); } else { respTaskForList.Add(SessionManager.UserContext.Person.PERSON_ID); if (selectedValue.All(c => c >= '0' && c <= '9') == false) { // all accessible plants for a selected BU decimal busOrgID = Convert.ToDecimal(selectedValue.Substring(2, selectedValue.Length - 2)); respTaskForList.AddRange(SQMModelMgr.SelectPersonList(SessionManager.PrimaryCompany().COMPANY_ID, busOrgID, true, false).Select(l => l.PERSON_ID).ToArray()); } else { // specific plant //respTaskForList.AddRange(SQMModelMgr.SelectPlantPersonList(SessionManager.PrimaryCompany().COMPANY_ID, Convert.ToDecimal(selectedValue), "").Select(l => l.PERSON_ID).ToArray()); respTaskForList.AddRange(SQMModelMgr.SelectPlantPersonList(SessionManager.PrimaryCompany().COMPANY_ID, Convert.ToDecimal(selectedValue)).Select(l => l.PERSON_ID).ToArray()); } //if (SessionManager.CheckUserPrivilege(SysPriv.config, SysScope.busorg)) // enableItemLinks = true; } TaskStatusMgr myTasks = new TaskStatusMgr().CreateNew(0, 0); myTasks.SelectTaskList(new int[3] { (int)TaskRecordType.Audit, (int)TaskRecordType.HealthSafetyIncident, (int)TaskRecordType.PreventativeAction }, new string[2] { ((int)SysPriv.action).ToString(), ((int)SysPriv.notify).ToString() }, SessionManager.UserContext.Person.PERSON_ID, respTaskForList, rcbStatusSelect.SelectedValue.ToString(), (DateTime)dmFromDate.SelectedDate, (DateTime)dmToDate.SelectedDate, cbCreatedByMe.Checked, adminList); uclTaskList.BindTaskList(myTasks.TaskList, ""); }
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 rgTasks_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { try { GridDataItem parentItem = ((sender as RadGrid).NamingContainer as GridNestedViewItem).ParentItem as GridDataItem; if (parentItem != null) { decimal questionID = Convert.ToDecimal(parentItem.GetDataKeyValue("QuestionId").ToString()); HiddenField hdn = (HiddenField)parentItem.FindControl("hdnAuditID"); decimal auditID = Convert.ToDecimal(hdn.Value.ToString()); TaskStatusMgr myTasks = new TaskStatusMgr().CreateNew(0, 0); //myTasks.LoadTaskList((int)TaskRecordType.Audit, auditID, questionID); List <TaskItem> tasks = TaskMgr.ExceptionTaskListByRecord((int)TaskRecordType.Audit, auditID, questionID); (sender as RadGrid).DataSource = tasks; } } catch (Exception ex) { } }
protected void lblDueDate_OnClick(object sender, EventArgs e) { lblErrorMessage.Text = ""; LinkButton btn = (LinkButton)sender; if (btn == null || string.IsNullOrEmpty(btn.CommandArgument)) { return; } PSsqmEntities ctx = new PSsqmEntities(); int recordType; TaskStatusMgr taskMgr = new TaskStatusMgr().CreateNew(0, 0); TASK_STATUS task = new TASK_STATUS(); AUDIT audit = new AUDIT(); try { decimal recordID = Convert.ToDecimal(btn.CommandArgument.ToString()); if (TaskXLATList == null || TaskXLATList.Count == 0) { TaskXLATList = SQMBasePage.SelectXLATList(new string[5] { "TASK_STATUS", "RECORD_TYPE", "INCIDENT_STATUS", "NOTIFY_SCOPE_TASK", "ACTION_CATEGORY" }); } task = taskMgr.SelectTask(recordID); BindTaskUpdate(task, ""); } catch (Exception ex) { lblErrorMessage.Text = ex.Message.ToString(); } pnlAddTask.Visible = false; pnlUpdateTask.Visible = true; string script = "function f(){OpenUpdateTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); }
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"); } }
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); }
protected void btnTaskAssign_Click(object sender, EventArgs e) { PSsqmEntities ctx = new PSsqmEntities(); 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)); btnAssignSave.CommandArgument = task.TASK_ID.ToString(); decimal plantID = GetTaskLocation(task); BusinessLocation location = new BusinessLocation().Initialize(plantID); // AW 20161229 - if they get this far, they can assign the task to anyone in a plant that they have access... //SysPriv maxPriv = UserContext.GetMaxScopePrivilege(SysScope.busloc); //if (maxPriv <= SysPriv.config) // is a plant admin or greater ? //{ List <BusinessLocation> locationList = SessionManager.PlantList; locationList = UserContext.FilterPlantAccessList(locationList); if (locationList.Select(l => l.Plant.BUS_ORG_ID).Distinct().Count() > 1 && SessionManager.IsUserAgentType("ipad,iphone") == false) { ddlScheduleScope.Visible = false; mnuScheduleScope.Visible = true; SQMBasePage.SetLocationList(mnuScheduleScope, locationList, location.Plant.PLANT_ID, location.Plant.PLANT_NAME, "TOP", true); //RadMenuItem mi = new RadMenuItem(); //mi.Text = (SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME); //mi.Value = "0"; //mi.ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png"; //mnuScheduleScope.Items[0].Items.Insert(0, mi); } else { ddlScheduleScope.Visible = true; mnuScheduleScope.Visible = false; SQMBasePage.SetLocationList(ddlScheduleScope, locationList, location.Plant.PLANT_ID, true); } //} //else //{ // ddlScheduleScope.Visible = true; // mnuScheduleScope.Visible = false; // //ddlScheduleScope.Items.Insert(0, new RadComboBoxItem((SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME), "0")); // //ddlScheduleScope.Items[0].ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png"; //} List <PERSON> personList = SQMModelMgr.SelectPlantPersonList(1, plantID).Where(l => !string.IsNullOrEmpty(l.EMAIL)).OrderBy(l => l.LAST_NAME).ToList(); SQMBasePage.SetPersonList(ddlAssignPerson, personList, "", 0, false, "LF"); tbAssignComment.Text = task.COMMENTS; string script = "function f(){OpenAssignTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); }
protected void btnTaskUpdate_Click(object sender, EventArgs e) { PSsqmEntities ctx = new PSsqmEntities(); lblErrorMessage.Text = ""; 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.RECORD_TYPE = recordType; //task.RECORD_ID = recordID; //task.RECORD_SUBID = recordSubID; //task.TASK_STEP = taskStep; //task.TASK_TYPE = taskType; //task.TASK_SEQ = 0; task.DUE_DT = rdpTaskDueDT.SelectedDate; //task.RESPONSIBLE_ID = Convert.ToDecimal(ddlAssignPerson.SelectedValue.ToString()); //task.DETAIL = lblTaskDetailValue.Text.ToString(); // this is the original detail, so we don't change it. //task.DESCRIPTION = tbTaskDescription.Text.ToString(); task.COMMENTS = tbTaskComments.Text.ToString(); //task.STATUS = ((int)TaskStatus.New).ToString(); //task.CREATE_DT = SessionManager.UserContext.LocalTime != null ? SessionManager.UserContext.LocalTime : DateTime.UtcNow; //task.CREATE_ID = SessionManager.UserContext.Person.PERSON_ID; taskMgr.UpdateTask(task); taskMgr.UpdateTaskList(task.RECORD_ID); // send email PERSON assignTo = SQMModelMgr.LookupPerson(ctx, (decimal)task.RESPONSIBLE_ID, "", false); EHSNotificationMgr.NotifyTaskAssigment(task, assignTo.PLANT_ID); // reset the fields for the next add ddlAssignPersonAdd.SelectedValue = ""; tbTaskDescriptionAdd.Text = ""; rdpTaskDueDTAdd.SelectedDate = DateTime.Today; 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; } if (Page.Request.Url.ToString().Contains("AssessmentForm")) { // now update the list and stay on the popup if adding through assessment form BindTaskAdd(task.RECORD_TYPE, task.RECORD_ID, (decimal)task.RECORD_SUBID, task.TASK_STEP, task.TASK_TYPE, lblTaskDetailValue.Text.ToString(), assignTo.PLANT_ID, ""); lblErrorMessage.Text = ""; string script = "function f(){OpenUpdateTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); } else { SessionManager.ReturnRecordID = task.RECORD_ID; SessionManager.ReturnObject = "UpdateTask"; SessionManager.ReturnStatus = true; if (OnTaskUpdate != null) { OnTaskUpdate("update"); } } }
protected void btnTaskAdd_Click(object sender, EventArgs e) { PSsqmEntities ctx = new PSsqmEntities(); lblErrorMessage.Text = ""; Button btn = (Button)sender; if (btn == null || string.IsNullOrEmpty(btn.CommandArgument)) { return; } string[] cmd = btn.CommandArgument.Split('~'); // recordType, recordID, recordSubID, taskStep, taskType, plantID int recordType = Convert.ToInt32(cmd[0]); decimal recordID = Convert.ToDecimal(cmd[1]); decimal recordSubID = Convert.ToDecimal(cmd[2]); string taskStep = cmd[3]; string taskType = cmd[4]; decimal plantID = 0; decimal.TryParse(cmd[5], out plantID); // make sure that the Assign To Employee has been selected if (ddlAssignPersonAdd.SelectedValue.ToString().Equals("")) { // I don't think we need to bind the list at this point BindTaskAdd(recordType, recordID, recordSubID, taskStep, taskType, lblTaskDetailValueAdd.Text.ToString(), plantID, ""); lblErrorMessage.Text = lblErrRequiredInputs.Text.ToString(); string script = "function f(){OpenUpdateTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); } else { TaskStatusMgr taskMgr = new TaskStatusMgr(); taskMgr.Initialize(recordType, recordID); TASK_STATUS task = new TASK_STATUS(); task.RECORD_TYPE = recordType; task.RECORD_ID = recordID; task.RECORD_SUBID = recordSubID; task.TASK_STEP = taskStep; task.TASK_TYPE = taskType; task.TASK_SEQ = 0; task.DUE_DT = rdpTaskDueDTAdd.SelectedDate; task.RESPONSIBLE_ID = Convert.ToDecimal(ddlAssignPersonAdd.SelectedValue.ToString()); task.DETAIL = lblTaskDetailValueAdd.Text.ToString(); task.DESCRIPTION = tbTaskDescriptionAdd.Text.ToString(); task.STATUS = ((int)TaskStatus.New).ToString(); task.CREATE_DT = SessionManager.UserContext.LocalTime != null ? SessionManager.UserContext.LocalTime : DateTime.UtcNow; task.CREATE_ID = SessionManager.UserContext.Person.PERSON_ID; taskMgr.CreateTask(task); taskMgr.UpdateTaskList(task.RECORD_ID); // send email PERSON assignTo = SQMModelMgr.LookupPerson(ctx, (decimal)task.RESPONSIBLE_ID, "", false); EHSNotificationMgr.NotifyTaskAssigment(task, assignTo.PLANT_ID); // reset the fields for the next add ddlAssignPersonAdd.SelectedValue = ""; tbTaskDescriptionAdd.Text = ""; rdpTaskDueDTAdd.SelectedDate = DateTime.Today; if (OnTaskAdd != null) { OnTaskAdd("added", task.RECORD_ID, (decimal)task.RECORD_SUBID); } if (recordType == (int)TaskRecordType.Audit) // update the Question Status when adding tasks for an audit followup. { EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(recordID, recordSubID); if (auditQuestion != null) { auditQuestion.Status = "02"; EHSAuditMgr.UpdateAnswer(auditQuestion); } //SessionManager.ReturnRecordID = task.RECORD_ID; //SessionManager.ReturnObject = "AddTask"; //SessionManager.ReturnStatus = true; } if (Page.Request.Url.ToString().Contains("AssessmentForm")) { // now update the list and stay on the popup BindTaskAdd(recordType, recordID, recordSubID, taskStep, taskType, lblTaskDetailValueAdd.Text.ToString(), plantID, ""); lblErrorMessage.Text = ""; string script = "function f(){OpenUpdateTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); } else { SessionManager.ReturnRecordID = task.RECORD_ID; SessionManager.ReturnObject = "AddTask"; SessionManager.ReturnStatus = true; } } }