示例#1
0
        private void SetupPage()
        {
            ddlScheduleScope.Items.Clear();

            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, 0, SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_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, 0, true);
                    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";
                }
            }
            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";
            }

            // get tasks - due or escalated
            respForList = new List <decimal>();
            respForList.Add(SessionManager.UserContext.Person.PERSON_ID);
            respForList.AddRange(SQMModelMgr.SelectPersonListBySupvID(SessionManager.UserContext.Person.EMP_ID).Select(l => l.PERSON_ID).ToList());
            respPlantList = new List <decimal>();


            SessionManager.UserContext.TaskList.Clear();
            SessionManager.UserContext.TaskList = new List <TaskItem>();
            DateTime fromDate = DateTime.Now.AddMonths(-3);

            if (UserContext.CheckUserPrivilege(SysPriv.view, SysScope.inbox))
            {
                SessionManager.UserContext.TaskList.AddRange(TaskMgr.ProfileInputStatus(new DateTime(fromDate.Year, fromDate.Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), respForList, respPlantList));
                SessionManager.UserContext.TaskList.AddRange(TaskMgr.IncidentTaskStatus(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, respForList, respPlantList, false));
            }

            ++SessionManager.UserContext.InboxReviews;
        }
示例#2
0
        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, "");
        }
示例#3
0
        public static bool CheckUserPrivilege(SysPriv priv, SysScope scope)
        {
            bool hasPriv = false;

            if (SessionManager.UserContext.PrivList != null)
            {
                if (SessionManager.UserContext.PrivList.Where(p => p.PRIV <= 100 && p.SCOPE.ToLower() == SysScope.system.ToString()).FirstOrDefault() != null)                  // system admim or company admin has privs to any resource
                {
                    hasPriv = true;
                }
                else
                {
                    if (SessionManager.UserContext.PrivList.Where(p => p.PRIV == (int)priv && p.SCOPE.ToLower() == scope.ToString()).FirstOrDefault() != null)                      // check specific priv & scope combination
                    {
                        hasPriv = true;
                    }
                }
            }

            return(hasPriv);
        }
        public static bool CheckUserPrivilege(SysPriv priv, SysScope scope)
        {
            bool hasPriv = false;

            if (SessionManager.UserContext.PrivList != null)
            {
                if (SessionManager.UserContext.PrivList.Where(p => p.PRIV <= 100 && p.SCOPE.ToLower() == SysScope.system.ToString()).FirstOrDefault() != null)                  // system admim or company admin has privs to any resource
                {
                    hasPriv = true;
                }
                else
                {
                    if (priv >= SysPriv.approve && priv <= SysPriv.release5)
                    {
                        if (SessionManager.UserContext.PrivList.Where(p => p.PRIV == (int)priv && p.SCOPE.ToLower() == scope.ToString()).FirstOrDefault() != null)                          // check for any approval level if base approval priv given
                        {
                            hasPriv = true;
                        }
                    }
                    else
                    {
                        if (SessionManager.UserContext.PrivList.Where(p => p.PRIV == (int)priv && p.SCOPE.ToLower() == scope.ToString()).FirstOrDefault() != null)                          // check specific priv & scope combination
                        {
                            hasPriv = true;
                        }
                        else
                        {
                            // check if config or admin privs for this scope
                            if (SessionManager.UserContext.PrivList.Where(p => p.SCOPE == scope.ToString() && p.PRIV <= (int)SysPriv.config).FirstOrDefault() != null)
                            {
                                hasPriv = true;
                            }
                        }
                    }
                }
            }

            return(hasPriv);
        }
        public static SysPriv GetMaxScopePrivilege(SysScope scope)
        {
            SysPriv  maxPriv   = SysPriv.none;
            PRIVLIST adminPriv = null;

            if ((adminPriv = SessionManager.UserContext.PrivList.Where(p => p.PRIV <= 100 && p.SCOPE.ToLower() == SysScope.system.ToString()).FirstOrDefault()) != null)              // system admim or company admin has privs to any resource
            {
                maxPriv = (SysPriv)adminPriv.PRIV;
            }
            else
            {
                foreach (PRIVLIST priv in SessionManager.UserContext.PrivList.Where(l => l.SCOPE.ToLower() == scope.ToString()).ToList())
                {
                    if (priv.PRIV < (int)maxPriv)
                    {
                        maxPriv = (SysPriv)priv.PRIV;
                    }
                }
            }

            return(maxPriv);
        }
示例#6
0
        private void SetupPage()
        {
            ddlScheduleScope.Items.Clear();
            ddlTaskScope.Items.Clear();

            // only show escalations if company is using the supervisor field ?
            SETTINGS setting = SessionManager.GetUserSetting("COMPANY", "PERSON_ADD_FIELDS");

            if (setting != null && setting.VALUE.ToLower().Contains("supv"))
            {
                btnEscalateView.Visible = true;
            }

            SysPriv maxPriv = UserContext.GetMaxScopePrivilege(SysScope.busloc);

            List <BusinessLocation> locationList = SessionManager.PlantList;

            locationList = UserContext.FilterPlantAccessList(locationList);

            if (maxPriv <= SysPriv.config)              // is a plant admin or greater ?
            {
                // AW20170105 - move this up so it can be used by both admin and non admin
                //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, 0, SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_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);

                    ddlTaskScope.Visible = false;
                    mnuTaskScope.Visible = true;
                    SQMBasePage.SetLocationList(mnuTaskScope, locationList, 0, SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME, "TOP", true);
                    mnuTaskScope.Items[0].Items.Insert(0, mi);
                }
                else
                {
                    ddlScheduleScope.Visible = true;
                    mnuScheduleScope.Visible = false;
                    SQMBasePage.SetLocationList(ddlScheduleScope, locationList, 0, true);
                    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";

                    ddlTaskScope.Visible = true;
                    mnuTaskScope.Visible = false;
                    SQMBasePage.SetLocationList(ddlTaskScope, locationList, 0, true);
                    ddlTaskScope.Items.Insert(0, new RadComboBoxItem((SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME), "0"));
                    ddlTaskScope.Items[0].ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png";
                }
            }
            else
            {
                ddlScheduleScope.Visible = true;
                mnuScheduleScope.Visible = false;
                // AW20170105 - this is the one on the Calendar page... we are not opening up the list for this one.
                //SQMBasePage.SetLocationList(ddlScheduleScope, locationList, 0, true);
                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";

                SQMBasePage.SetLocationList(ddlTaskScope, locationList, 0, true);
                ddlTaskScope.Items.Insert(0, new RadComboBoxItem((SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME), "0"));
                ddlTaskScope.Items[0].ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png";
                ddlTaskScope.Visible           = true;
                mnuTaskScope.Visible           = false;
            }

            dmToDate.SelectedDate         = SessionManager.UserContext.LocalTime.AddMonths(3);
            dmFromDate.SelectedDate       = SessionManager.UserContext.LocalTime.AddMonths(-3);
            rcbStatusSelect.SelectedValue = "a";

            ++SessionManager.UserContext.InboxReviews;
        }
 public static bool CheckUserPrivilege(SysPriv priv, SysScope scope)
 {
     return(UserContext.CheckUserPrivilege(priv, scope));
 }
        public void BindTaskAdd(int recordType, decimal recordID, decimal recordSubID, string taskStep, string taskType, string originalDetail, decimal plantID, string context)
        {
            PSsqmEntities ctx = new PSsqmEntities();

            if (TaskXLATList == null || TaskXLATList.Count == 0)
            {
                TaskXLATList = SQMBasePage.SelectXLATList(new string[5] {
                    "TASK_STATUS", "RECORD_TYPE", "INCIDENT_STATUS", "NOTIFY_SCOPE_TASK", "ACTION_CATEGORY"
                });
            }

            pnlUpdateTask.Visible      = false;
            pnlAddTask.Visible         = true;
            btnTaskAdd.CommandArgument = recordType.ToString() + "~" + recordID.ToString() + "~" + recordSubID.ToString() + "~" + taskStep + "~" + taskType + "~" + plantID.ToString();

            lblTaskTypeValueAdd.Text = TaskXLATList.Where(l => l.XLAT_GROUP == "RECORD_TYPE" && l.XLAT_CODE == recordType.ToString()).FirstOrDefault().DESCRIPTION;

            switch ((TaskRecordType)recordType)
            {
            case TaskRecordType.Audit:
                if ((recordSubID > 0) || taskStep == "350")
                {                               // action required if subid references a specific audit question
                    lblTaskTypeValueAdd.Text += (" - " + TaskXLATList.Where(l => l.XLAT_GROUP == "NOTIFY_SCOPE_TASK" && l.XLAT_CODE == taskStep).FirstOrDefault().DESCRIPTION);
                }
                else
                {
                    lblTaskTypeValueAdd.Text += (" - " + TaskXLATList.Where(l => l.XLAT_GROUP == "NOTIFY_SCOPE_TASK" && l.XLAT_CODE == "300").FirstOrDefault().DESCRIPTION);
                }
                break;

            default:
                return;

                break;
            }

            lblTaskDetailValueAdd.Text   = originalDetail;                                                                                                       // cause of the requirement
            rdpTaskDueDTAdd.SelectedDate = SessionManager.UserContext.LocalTime;                                                                                 // default to today?
            lblTaskStatusValueAdd.Text   = TaskXLATList.Where(l => l.XLAT_GROUP == "TASK_STATUS" && l.XLAT_CODE == (0).ToString()).FirstOrDefault().DESCRIPTION; // default to the "Open" status

            ddlScheduleScopeAdd.Items.Clear();
            mnuScheduleScopeAdd.Items.Clear();

            BusinessLocation location = new BusinessLocation().Initialize(plantID);
            SysPriv          maxPriv  = UserContext.GetMaxScopePrivilege(SysScope.busloc);

            List <BusinessLocation> locationList = SessionManager.PlantList;

            locationList = UserContext.FilterPlantAccessList(locationList);

            if (maxPriv <= SysPriv.config)              // is a plant admin or greater ?
            {
                // AW20170105 - move this up so it can be used by both admin and non admin
                //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)
                {
                    ddlScheduleScopeAdd.Visible = false;
                    mnuScheduleScopeAdd.Visible = true;
                    SQMBasePage.SetLocationList(mnuScheduleScopeAdd, locationList, plantID, location.Plant.PLANT_NAME, "TOP", true);
                    //RadMenuItem mi = new RadMenuItem();
                    //mi.Text = (location.Plant.PLANT_NAME);
                    //mi.Value = plantID.ToString();
                    ////mi.ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png";
                    //mnuScheduleScopeAdd.Items[0].Items.Insert(0, mi);
                    //mnuScheduleScopeAdd.Attributes.Add("z-index", "9");
                }
                else
                {
                    ddlScheduleScopeAdd.Visible = true;
                    mnuScheduleScopeAdd.Visible = false;
                    SQMBasePage.SetLocationList(ddlScheduleScopeAdd, locationList, plantID, true);
                }
            }
            else
            {
                ddlScheduleScopeAdd.Visible = true;
                mnuScheduleScopeAdd.Visible = false;
                //ddlScheduleScopeAdd.Items.Insert(0, new RadComboBoxItem((SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME), "0"));
                //ddlScheduleScopeAdd.Items[0].ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png";
                SQMBasePage.SetLocationList(ddlScheduleScopeAdd, locationList, plantID, true);
            }

            List <PERSON> personList = SQMModelMgr.SelectPlantPersonList(1, plantID).Where(l => !string.IsNullOrEmpty(l.EMAIL)).OrderBy(l => l.LAST_NAME).ToList();

            SQMBasePage.SetPersonList(ddlAssignPersonAdd, personList, "", 0, false, "LF");

            List <TaskItem> tasklist = TaskMgr.ExceptionTaskListByRecord(recordType, recordID, recordSubID);

            rptTaskList.DataSource = tasklist;
            rptTaskList.DataBind();
            if (tasklist.Count > 0)
            {
                pnlListTasks.Visible = true;
            }
            else
            {
                pnlListTasks.Visible = false;
            }

            btnTaskAdd.Visible    = true;
            btnTaskUpdate.Visible = false;
        }