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, ""); }