Пример #1
0
        private void BindProfile(EHSProfile profile)
        {
            if (profile != null)
            {
                ddlDayDue.SelectedValue      = LocalProfile().Profile.DAY_DUE.ToString();
                ddlWarningDays.SelectedValue = LocalProfile().Profile.REMINDER_DAYS.ToString();
                if (LocalProfile().Profile.APPROVER_ID > 0 && ddlFinalApprover.Items.FindByValue(LocalProfile().Profile.APPROVER_ID.ToString()) != null)
                {
                    ddlFinalApprover.SelectedValue = LocalProfile().Profile.APPROVER_ID.ToString();
                }
                else
                {
                    ddlFinalApprover.SelectedIndex = 0;
                }

                if (LocalProfile().Profile.DISPLAY_OPTION.HasValue)
                {
                    ddlDisplayOrder.SelectedIndex = (int)LocalProfile().Profile.DISPLAY_OPTION;
                }

                if (LocalProfile().Profile.EHS_PROFILE_FACT != null && LocalProfile().Profile.EHS_PROFILE_FACT.Count > 0)
                {
                    if (ddlNormFact.Items.FindByValue(LocalProfile().Profile.EHS_PROFILE_FACT.FirstOrDefault().FACTOR_ID.ToString()) != null)
                    {
                        ddlNormFact.SelectedValue = LocalProfile().Profile.EHS_PROFILE_FACT.FirstOrDefault().FACTOR_ID.ToString();
                    }
                }
                else
                {
                    EHS_PROFILE_MEASURE factMetric = null;
                    try
                    {
                        factMetric = profile.Profile.EHS_PROFILE_MEASURE.Where(l => l.EHS_MEASURE.MEASURE_CATEGORY == "FACT").FirstOrDefault();
                    }
                    catch { }
                    if (factMetric != null && ddlNormFact.Items.FindByValue(factMetric.EHS_MEASURE.MEASURE_ID.ToString()) != null)
                    {
                        ddlNormFact.SelectedValue = factMetric.EHS_MEASURE.MEASURE_ID.ToString();
                    }
                    else
                    {
                        ddlNormFact.SelectedIndex = 0;
                    }
                }

                if (ddlMetricCurrency.Items.FindByValue(LocalProfile().Plant.CURRENCY_CODE) != null)
                {
                    ddlMetricCurrency.SelectedValue = LocalProfile().Plant.CURRENCY_CODE;
                }

                pnlMetricEdit.Enabled = btnMetricCancel.Enabled = btnMetricSave.Enabled = false;
                lnkMeasureAdd.Enabled = btnMetricSave.Enabled = UserContext.CheckUserPrivilege(SysPriv.config, SysScope.envdata);

                UpdateMetricList(profile);

                pnlMetricEdit.Visible = false;
                //pnlProfileEdit.Visible = true;
            }
        }
Пример #2
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;
        }
        protected void RefreshPageContext()
        {
            string typeString = "";

            if (UserContext.GetMaxScopePrivilege(SysScope.audit) < SysPriv.view && CurrentStep == 0)
            {
                pnlAddEdit.Visible = true;
                if (!IsEditContext)
                {
                    // Add
                    btnSaveReturn.Enabled  = true;
                    btnSaveReturn.Visible  = true;
                    rddlAuditType.Visible  = (rddlAuditType.Items.Count == 1) ? false : true;
                    lblAddOrEditAudit.Text = "<strong>Add a New Audit Schedule:</strong>";

                    btnDelete.Visible = false;
                }
                else
                {
                    // Edit
                    typeString = " Audit Schedule";
                    btnSaveReturn.CommandArgument = "0";
                    SelectedTypeId        = 0;
                    btnSaveReturn.Enabled = true;
                    btnSaveReturn.Visible = true;

                    lblAddOrEditAudit.Text = "<strong>Editing " + WebSiteCommon.FormatID(EditAuditScheduleId, 6) + typeString + "</strong><br/>";

                    btnDelete.Visible = true;
                    LoadInformation();
                }

                UpdateButtonText();

                // Only admin and higher can delete audits
                if (UserContext.CheckUserPrivilege(SysPriv.admin, SysScope.system))
                {
                    btnDelete.Visible = false;
                }
            }
            else
            {
                // View only
                typeString            = " Audit Schedule";
                SelectedTypeId        = 0;
                btnSaveReturn.Enabled = false;
                btnSaveReturn.Visible = false;

                lblAddOrEditAudit.Text = "<strong>" + WebSiteCommon.FormatID(EditAuditScheduleId, 6) + typeString + " Closed</strong><br/>";

                rddlAuditType.Visible = false;
                btnDelete.Visible     = false;
                LoadInformation();
                var displaySteps = new int[] { CurrentStep };
                pnlAddEdit.Visible = false;
            }
        }
        List <decimal> SelectPlantIdsByAccessLevel()
        {
            List <decimal> plantIdList = new List <decimal>();

            if (UserContext.CheckUserPrivilege(SysPriv.admin, SysScope.system))
            {
                plantIdList = EHSAuditMgr.SelectPlantIdsByCompanyId(companyId);
            }
            else
            {
                plantIdList = SessionManager.UserContext.PlantAccessList;
                if (plantIdList == null || plantIdList.Count == 0)
                {
                    plantIdList.Add(SessionManager.UserContext.HRLocation.Plant.PLANT_ID);
                }
            }

            return(plantIdList);
        }
Пример #5
0
        public void LoadProfileInput(DateTime targetDate, EHSProfileStatus selectStatus)
        {
            UserContext.CheckUserPrivilege(SysPriv.originate, SysScope.envdata);
            LocalProfile().LoadPeriod(targetDate);
            if (LocalProfile().InputPeriod != null)
            {
                LocalProfile().MapPlantAccountingInputs(true, false);

                uclInputHdr.BindProfileInputHdr(LocalProfile());
                EHSProfileStatus status = BindProfileInputList(LocalProfile().MeasureList(true, UserContext.GetScopePrivileges(SysScope.envdata)).ToList(), LocalProfile().Profile);
                if (status == EHSProfileStatus.Normal)
                {
                    if (LocalProfile().Profile.APPROVER_ID == SessionManager.UserContext.Person.PERSON_ID || UserContext.CheckUserPrivilege(SysPriv.approve, SysScope.envdata))
                    {
                        cbFinalApproval.Enabled = true;
                    }
                    if (LocalProfile().InputPeriod.PlantAccounting.APPROVER_ID.HasValue&& LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT.HasValue)
                    {
                        cbFinalApproval.Checked  = true;
                        cbFinalApproval.Enabled  = false;
                        hfWasApproved.Value      = lblFinalApprovalBy.Text = SQMModelMgr.FormatPersonListItem(SQMModelMgr.LookupPerson((decimal)LocalProfile().InputPeriod.PlantAccounting.APPROVER_ID, ""));
                        lblFinalApprovalBy.Text += ("  " + SQMBasePage.FormatDate((DateTime)LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT, "", false));
                    }
                    else
                    {
                        cbFinalApproval.Checked = false;
                        hfWasApproved.Value     = lblFinalApprovalBy.Text = "";
                    }
                }
                MessageDisplay(selectStatus == EHSProfileStatus.Normal ? status : selectStatus);
                btnSave1.Enabled = btnSave2.Enabled = btnCancel1.Enabled = btnCancel2.Enabled = UserContext.GetMaxScopePrivilege(SysScope.envdata) < SysPriv.notify ? true : false;
            }
            else
            {
                MessageDisplay(EHSProfileStatus.NoInputs);
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    SessionManager.CurrentAdminPage = "";
                    string customerLogo = "";
                    customerLogo = System.Configuration.ConfigurationManager.AppSettings["CustomerLogo"];
                    if (string.IsNullOrEmpty(customerLogo) || customerLogo.Contains("Metricsoft"))
                    {
                        imgLogo.ImageUrl = "~/images/company/MetricsoftLogoSmall.png";
                    }
                    else
                    {
                        int pos = customerLogo.IndexOf('.');
                        customerLogo     = customerLogo.Substring(0, pos) + "Small." + customerLogo.Substring(pos + 1, customerLogo.Length - pos - 1);
                        imgLogo.ImageUrl = "~/images/company/" + customerLogo;
                    }

                    string title = System.Configuration.ConfigurationManager.AppSettings["MainTitle"];
                    if (!string.IsNullOrEmpty(title))
                    {
                        lblMainTitle.Text = title;
                    }

                    SetupPage();

                    var viewPortWidth = Convert.ToInt32(Session["vpWidth"]);
                    if (viewPortWidth <= 768)
                    {
                        RadMenu1.RenderMode = RenderMode.Mobile;
                    }

                    bool addConsole = false;
                    RadMenu1.Skin                       = "Metro";
                    RadMenu1.ExpandDelay                = 225;
                    RadMenu1.CollapseDelay              = 500;
                    RadMenu1.ExpandAnimation.Duration   = 40;
                    RadMenu1.CollapseAnimation.Duration = 20;
                    RadMenu1.DefaultGroupSettings.Flow  = Telerik.Web.UI.ItemFlow.Horizontal;

                    RadMenuItem HomeMenu = new RadMenuItem("Home");
                    RadMenu1.Items.Add(HomeMenu);
                    if (UserContext.GetScopePrivileges(SysScope.dashboard).Count() > 0)
                    {
                        HomeMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Dashboard", "/Home/Dashboard.aspx"));
                    }
                    if (UserContext.GetScopePrivileges(SysScope.inbox).Count() > 0)
                    {
                        HomeMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Calendar", "/Home/Calendar.aspx"));
                    }

                    if (UserContext.GetScopePrivileges(SysScope.system).Count() > 0 || UserContext.GetScopePrivileges(SysScope.busorg).Count() > 0)
                    {
                        RadMenuItem OrgMenu = new RadMenuItem("Organization");
                        RadMenu1.Items.Add(OrgMenu);
                        OrgMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Business Structure", "/Admin/Administrate_ViewBusOrg.aspx"));
                        OrgMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Exchange Rates", "/Admin/Administrate_CurrencyInput.aspx"));
                        if (UserContext.CheckUserPrivilege(SysPriv.admin, SysScope.system))
                        {
                            OrgMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Settings", "/Admin/Administrate_SettingInput.aspx"));
                            OrgMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Upload Data", "/Admin/Administrate_FileUpload.aspx"));
                        }
                    }

                    if (UserContext.GetScopePrivileges(SysScope.envdata).Count() > 0)
                    {
                        RadMenuItem EHSMenu1 = new RadMenuItem("Environmental");
                        RadMenu1.Items.Add(EHSMenu1);

                        if (UserContext.CheckUserPrivilege(SysPriv.config, SysScope.envdata))
                        {
                            EHSMenu1.Items.Add(new Telerik.Web.UI.RadMenuItem("Library", "/EHS/EHS_Resources.aspx"));
                            EHSMenu1.Items.Add(new Telerik.Web.UI.RadMenuItem("Metric Profiles", "/EHS/EHS_Profile.aspx"));
                        }
                        EHSMenu1.Items.Add(new Telerik.Web.UI.RadMenuItem("Data Input", "/EHS/EHS_MetricInput.aspx"));
                        EHSMenu1.Items.Add(new Telerik.Web.UI.RadMenuItem("Plant Analytics", "/EHS/EHS_ENVReport.aspx"));
                        if (addConsole == false && UserContext.GetScopePrivileges(SysScope.console).Count() > 0)
                        {
                            EHSMenu1.Items.Add(new Telerik.Web.UI.RadMenuItem("Console", "/EHS/EHS_Console.aspx?c=EHS"));
                            addConsole = true;
                        }
                    }

                    if (UserContext.GetScopePrivileges(SysScope.audit).Count() > 0 || UserContext.GetScopePrivileges(SysScope.incident).Count() > 0)
                    {
                        RadMenuItem EHSMenu2 = new RadMenuItem("Health & Safety");
                        RadMenu1.Items.Add(EHSMenu2);

                        if (UserContext.GetMaxScopePrivilege(SysScope.audit) <= SysPriv.originate)
                        {
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem("Audits", "/EHS/EHS_Audits.aspx"));
                        }
                        if (UserContext.GetMaxScopePrivilege(SysScope.audit) <= SysPriv.config)
                        {
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem("Audit Schedules", "/EHS/EHS_Audit_Scheduler.aspx"));
                        }
                        if (UserContext.GetScopePrivileges(SysScope.incident).Count() > 0)
                        {
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem("Incidents", "/EHS/EHS_Incidents.aspx"));
                        }
                        //if (UserContext.GetScopePrivileges(SysScope.prevent).Count() > 0)
                        //EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem("Preventative Actions", "/EHS/EHS_Incidents.aspx?mode=prevent"));
                        if (addConsole == false && UserContext.GetScopePrivileges(SysScope.console).Count() > 0)
                        {
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem("Console", "/EHS/EHS_Console.aspx?c=EHS"));
                        }
                    }

                    /*
                     * string menu8DActive = System.Configuration.ConfigurationManager.AppSettings["Menu8DActive"];
                     * if (!string.IsNullOrEmpty(menu8DActive)  &&  menu8DActive.ToUpper() == "FALSE")
                     * {
                     *      foreach (RadMenuItem mi in RadMenu1.Items)
                     *      {
                     *              foreach (RadMenuItem ms in mi.Items)
                     *              {
                     *                      if (ms.NavigateUrl.Contains("Problem_Case.aspx?c=QI"))
                     *                              ms.Visible = false;
                     *              }
                     *      }
                     * }
                     */
                }
            }

            catch (Exception ex)
            {
                // SQMLogger.LogException(ex);
            }
        }
Пример #7
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    if (menuXLATList == null || menuXLATList.Count == 0)
                    {
                        menuXLATList = SQMBasePage.SelectXLATList(new string[8] {
                            "MENU_HOME", "MENU_ORG", "MENU_ENV", "MENU_HS", "MENU_AUDIT", "MENU_DATA", "MENU_RM", "MENU_MEDIA"
                        });
                    }

                    SessionManager.CurrentAdminPage = "";
                    string customerLogo = "";
                    customerLogo = System.Configuration.ConfigurationManager.AppSettings["CustomerLogo"];
                    if (string.IsNullOrEmpty(customerLogo) || customerLogo.Contains("Metricsoft"))
                    {
                        imgLogo.ImageUrl = "~/images/company/MetricsoftLogoSmall.png";
                    }
                    else
                    {
                        int pos = customerLogo.IndexOf('.');
                        customerLogo     = customerLogo.Substring(0, pos) + "Small." + customerLogo.Substring(pos + 1, customerLogo.Length - pos - 1);
                        imgLogo.ImageUrl = "~/images/company/" + customerLogo;
                    }

                    string title = System.Configuration.ConfigurationManager.AppSettings["MainTitle"];
                    if (!string.IsNullOrEmpty(title))
                    {
                        lblMainTitle.Text = title;
                    }

                    SetupPage();

                    bool addConsole = false;
                    RadMenu1.Skin                       = "Metro";
                    RadMenu1.ExpandDelay                = 225;
                    RadMenu1.CollapseDelay              = 500;
                    RadMenu1.ExpandAnimation.Duration   = 40;
                    RadMenu1.CollapseAnimation.Duration = 20;
                    RadMenu1.DefaultGroupSettings.Flow  = Telerik.Web.UI.ItemFlow.Horizontal;

                    RadMenuItem HomeMenu = new RadMenuItem(GetMenu("MENU_HOME", "0").DESCRIPTION);
                    RadMenu1.Items.Add(HomeMenu);
                    if (UserContext.GetScopePrivileges(SysScope.dashboard).Count() > 0)
                    {
                        HomeMenu.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_HOME", "11").DESCRIPTION, GetMenu("MENU_HOME", "11").DESCRIPTION_SHORT));
                    }
                    if (UserContext.GetScopePrivileges(SysScope.inbox).Count() > 0)
                    {
                        HomeMenu.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_HOME", "12").DESCRIPTION, GetMenu("MENU_HOME", "12").DESCRIPTION_SHORT));
                    }

                    if (UserContext.GetMaxScopePrivilege(SysScope.busorg) <= SysPriv.admin)
                    {
                        RadMenuItem OrgMenu = new RadMenuItem(GetMenu("MENU_ORG", "0").DESCRIPTION);
                        RadMenu1.Items.Add(OrgMenu);
                        OrgMenu.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_ORG", "11").DESCRIPTION, GetMenu("MENU_ORG", "11").DESCRIPTION_SHORT));
                        OrgMenu.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_ORG", "12").DESCRIPTION, GetMenu("MENU_ORG", "12").DESCRIPTION_SHORT));
                        if (UserContext.CheckUserPrivilege(SysPriv.admin, SysScope.system) && SessionManager.UserContext.Person.PERSON_ID == 1)
                        {
                            OrgMenu.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_ORG", "13").DESCRIPTION, GetMenu("MENU_ORG", "13").DESCRIPTION_SHORT));
                            OrgMenu.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_ORG", "14").DESCRIPTION, GetMenu("MENU_ORG", "14").DESCRIPTION_SHORT));
                        }
                    }

                    if (UserContext.GetScopePrivileges(SysScope.envdata).Count() > 0)
                    {
                        RadMenuItem EHSMenu1 = new RadMenuItem(GetMenu("MENU_ENV", "0").DESCRIPTION);
                        RadMenu1.Items.Add(EHSMenu1);

                        if (UserContext.CheckUserPrivilege(SysPriv.config, SysScope.envdata))
                        {
                            EHSMenu1.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_ENV", "11").DESCRIPTION, GetMenu("MENU_ENV", "11").DESCRIPTION_SHORT));
                            EHSMenu1.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_ENV", "12").DESCRIPTION, GetMenu("MENU_ENV", "12").DESCRIPTION_SHORT));
                        }
                        EHSMenu1.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_ENV", "13").DESCRIPTION, GetMenu("MENU_ENV", "13").DESCRIPTION_SHORT));
                        EHSMenu1.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_ENV", "14").DESCRIPTION, GetMenu("MENU_ENV", "14").DESCRIPTION_SHORT));
                        if (addConsole == false && UserContext.GetScopePrivileges(SysScope.console).Count() > 0)
                        {
                            EHSMenu1.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_ENV", "15").DESCRIPTION, GetMenu("MENU_ENV", "15").DESCRIPTION_SHORT));
                            addConsole = true;
                        }
                    }

                    if (UserContext.GetScopePrivileges(SysScope.incident).Count() > 0)
                    {
                        RadMenuItem EHSMenu2 = new RadMenuItem(GetMenu("MENU_HS", "0").DESCRIPTION);
                        RadMenu1.Items.Add(EHSMenu2);
                        if (UserContext.GetScopePrivileges(SysScope.incident).Count() > 0)
                        {
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_HS", "11").DESCRIPTION, GetMenu("MENU_HS", "11").DESCRIPTION_SHORT));
                        }
                        if (UserContext.GetScopePrivileges(SysScope.console).Count() > 0)
                        {
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_HS", "12").DESCRIPTION, GetMenu("MENU_HS", "12").DESCRIPTION_SHORT));
                        }
                    }

                    if (UserContext.GetScopePrivileges(SysScope.audit).Count() > 0)
                    {
                        RadMenuItem EHSMenu2 = new RadMenuItem(GetMenu("MENU_AUDIT", "0").DESCRIPTION);
                        RadMenu1.Items.Add(EHSMenu2);
                        if (UserContext.GetMaxScopePrivilege(SysScope.audit) <= SysPriv.config && GetMenu("MENU_AUDIT", "11").STATUS.ToUpper() == "A")
                        {
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_AUDIT", "11").DESCRIPTION, GetMenu("MENU_AUDIT", "11").DESCRIPTION_SHORT));
                        }
                        if (UserContext.GetMaxScopePrivilege(SysScope.audit) <= SysPriv.originate)
                        {
                            if (GetMenu("MENU_AUDIT", "12").STATUS.ToUpper() == "A")
                            {
                                EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_AUDIT", "12").DESCRIPTION, GetMenu("MENU_AUDIT", "12").DESCRIPTION_SHORT));
                            }
                            if (GetMenu("MENU_AUDIT", "15").STATUS.ToUpper() == "A")
                            {
                                EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_AUDIT", "15").DESCRIPTION, GetMenu("MENU_AUDIT", "15").DESCRIPTION_SHORT));
                            }
                        }
                        if (UserContext.GetMaxScopePrivilege(SysScope.audit) <= SysPriv.originate && GetMenu("MENU_AUDIT", "13").STATUS.ToUpper() == "A")
                        {
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_AUDIT", "13").DESCRIPTION, GetMenu("MENU_AUDIT", "13").DESCRIPTION_SHORT));
                        }
                    }

                    if (SessionManager.GetUserSetting("MODULE", "PREVACTION") != null && SessionManager.GetUserSetting("MODULE", "PREVACTION").VALUE.ToUpper() == "A")
                    {
                        if (UserContext.GetScopePrivileges(SysScope.prevent).Count() > 0 && IsMenuActive("MENU_RM"))
                        {
                            RadMenuItem EHSMenu2 = new RadMenuItem(GetMenu("MENU_RM", "0").DESCRIPTION);
                            RadMenu1.Items.Add(EHSMenu2);
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_RM", "11").DESCRIPTION, GetMenu("MENU_RM", "11").DESCRIPTION_SHORT));
                        }
                    }

                    if (SessionManager.GetUserSetting("MODULE", "EHSDATA") != null && SessionManager.GetUserSetting("MODULE", "EHSDATA").VALUE.ToUpper() == "A")
                    {
                        if (UserContext.GetMaxScopePrivilege(SysScope.ehsdata) <= SysPriv.originate && IsMenuActive("MENU_DATA"))
                        {
                            RadMenuItem EHSMenu2 = new RadMenuItem(GetMenu("MENU_DATA", "0").DESCRIPTION);
                            RadMenu1.Items.Add(EHSMenu2);
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_DATA", "11").DESCRIPTION, GetMenu("MENU_DATA", "11").DESCRIPTION_SHORT));
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_DATA", "12").DESCRIPTION, GetMenu("MENU_DATA", "12").DESCRIPTION_SHORT));
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_DATA", "13").DESCRIPTION, GetMenu("MENU_DATA", "13").DESCRIPTION_SHORT));
                            if (UserContext.GetMaxScopePrivilege(SysScope.ehsdata) <= SysPriv.config)
                            {
                                EHSMenu2.Items.Add(new RadMenuItem(GetMenu("MENU_DATA", "21").DESCRIPTION, GetMenu("MENU_DATA", "21").DESCRIPTION_SHORT));
                                EHSMenu2.Items.Add(new RadMenuItem(GetMenu("MENU_DATA", "22").DESCRIPTION, GetMenu("MENU_DATA", "22").DESCRIPTION_SHORT));
                            }
                            if (UserContext.CheckUserPrivilege(SysPriv.approve, SysScope.ehsdata) || UserContext.CheckUserPrivilege(SysPriv.approve1, SysScope.ehsdata))
                            {
                                EHSMenu2.Items.Add(new RadMenuItem(GetMenu("MENU_DATA", "25").DESCRIPTION, GetMenu("MENU_DATA", "25").DESCRIPTION_SHORT));
                            }
                        }
                    }

                    if (SessionManager.GetUserSetting("MODULE", "MEDIA") != null && SessionManager.GetUserSetting("MODULE", "MEDIA").VALUE.ToUpper() == "A")
                    {
                        if (UserContext.GetMaxScopePrivilege(SysScope.media) <= SysPriv.originate)
                        {
                            RadMenuItem EHSMenu2 = new RadMenuItem(GetMenu("MENU_MEDIA", "0").DESCRIPTION);
                            RadMenu1.Items.Add(EHSMenu2);
                            EHSMenu2.Items.Add(new Telerik.Web.UI.RadMenuItem(GetMenu("MENU_MEDIA", "11").DESCRIPTION, GetMenu("MENU_MEDIA", "11").DESCRIPTION_SHORT));
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                // SQMLogger.LogException(ex);
            }
        }
Пример #8
0
        public int BindProfileMeasure(EHS_PROFILE_MEASURE pm)
        {
            int status = 0;

            pnlMetricEdit.Visible   = true;
            spUOMFactor.Visible     = false;
            pnlMetricEdit.Visible   = true;
            btnMetricCancel.Enabled = true;
            DisplayErrorMessage(null);

            if (pm == null)
            {
                ddlMetricID.Enabled             = ddlMetricCost.Enabled = ddlMetricDisposalCode.Enabled = ddlMetricRegStatus.Enabled = ddlMetricUOM.Enabled = ddlMetricCurrency.Enabled = ddlMetricResponsible.Enabled = false;
                ddlMetricCategory.SelectedIndex = ddlMetricID.SelectedIndex = ddlMetricDisposalCode.SelectedIndex = ddlMetricRegStatus.SelectedIndex = ddlMetricUOM.SelectedIndex = ddlMetricCost.SelectedIndex = ddlMetricResponsible.SelectedIndex = 0;
                if (ddlMetricCurrency.Items.FindByValue(LocalProfile().Plant.CURRENCY_CODE) != null)
                {
                    ddlMetricCurrency.SelectedValue = LocalProfile().Plant.CURRENCY_CODE;
                }
                lblMetricName.Text       = lblDisposalDesc.Text = "";
                tbMetricPrompt.Text      = tbUOMFactor.Text = tbWasteCode.Text = "";
                winMetricEdit.Title      = hfAddMetric.Value;
                tbValueDflt.Text         = tbCostDflt.Text = "";
                cbEnableOverride.Checked = false;
                cbMetricRequired.Checked = true;
            }
            else
            {
                winMetricEdit.Title = hfUpdateMetric.Value;
                LocalProfile().CurrentProfileMeasure = pm;
                LocalProfile().CurrentEHSMeasure     = pm.EHS_MEASURE;

                if (pm.EHS_MEASURE != null && ddlMetricCategory.Items.FindByValue(pm.EHS_MEASURE.MEASURE_CATEGORY) != null)
                {
                    ddlMetricCategory.SelectedValue = pm.EHS_MEASURE.MEASURE_CATEGORY;
                    ddlCategoryChanged(ddlMetricCategory, null);
                    ddlMetricID.SelectedValue = WebSiteCommon.PackItemValue(pm.EHS_MEASURE.MEASURE_CATEGORY, pm.EHS_MEASURE.EFM_TYPE, pm.EHS_MEASURE.MEASURE_ID.ToString());
                    lblMetricName.Text        = pm.EHS_MEASURE.MEASURE_CD;

                    if (pm.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && pm.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && pm.EHS_MEASURE.MEASURE_CATEGORY != "FACT" && ddlMetricCurrency.Items.FindByValue(pm.DEFAULT_CURRENCY_CODE) != null)
                    {
                        ddlMetricCurrency.SelectedValue = pm.DEFAULT_CURRENCY_CODE;
                    }

                    if (pm.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && pm.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && pm.EHS_MEASURE.MEASURE_CATEGORY != "FACT" && pm.DEFAULT_UOM > 0)
                    {
                        UOM uom = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == pm.DEFAULT_UOM);
                        if (uom != null)
                        {
                            if (ddlMetricUOM.Items.FindByValue(WebSiteCommon.PackItemValue(uom.UOM_CATEGORY, uom.EFM_TYPE, uom.UOM_ID.ToString())) != null)
                            {
                                ddlMetricUOM.SelectedValue = WebSiteCommon.PackItemValue(uom.UOM_CATEGORY, uom.EFM_TYPE, uom.UOM_ID.ToString());
                            }
                            else
                            {
                                ddlMetricUOM.SelectedIndex = 0;
                            }

                            if (uom.UOM_CATEGORY == "CUST")
                            {
                                spUOMFactor.Visible = true;
                            }
                        }

                        if (pm.UOM_FACTOR.HasValue)
                        {
                            tbUOMFactor.Text = SQMBasePage.FormatValue((decimal)pm.UOM_FACTOR, 5);
                        }
                    }

                    if (pm.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && pm.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && pm.EHS_MEASURE.MEASURE_CATEGORY != "FACT")
                    {
                        if (pm.NEG_VALUE_ALLOWED.HasValue && (bool)pm.NEG_VALUE_ALLOWED)
                        {
                            ddlMetricCost.SelectedValue = "CREDIT";
                        }
                        else
                        {
                            ddlMetricCost.SelectedValue = "COST";
                        }
                    }
                }

                tbMetricPrompt.Text = pm.MEASURE_PROMPT;
                ddlMetricRegStatus.SelectedValue    = pm.REG_STATUS;
                ddlMetricDisposalCode.SelectedValue = pm.UN_CODE;
                if (!string.IsNullOrEmpty(pm.UN_CODE))
                {
                    lblDisposalDesc.Text = SessionManager.DisposalCodeList.FirstOrDefault(l => l.UN_CODE == pm.UN_CODE).DESCRIPTION;
                }
                else
                {
                    lblDisposalDesc.Text = "";
                }

                tbWasteCode.Text = pm.WASTE_CODE;

                if (pm.RESPONSIBLE_ID > 0 && ddlMetricResponsible.Items.FindByValue(pm.RESPONSIBLE_ID.ToString()) != null)
                {
                    ddlMetricResponsible.SelectedValue = pm.RESPONSIBLE_ID.ToString();
                }
                else
                {
                    ddlMetricResponsible.SelectedIndex = 0;
                }

                ddlUOMChanged(ddlMetricUOM, null);
                ddlMetricStatus.SelectedValue = pm.STATUS;
                cbMetricRequired.Checked      = (bool)pm.IS_REQUIRED;

                tbValueDflt.Text         = tbCostDflt.Text = "";
                cbEnableOverride.Checked = false;
                // radEffEndDate.ShowPopupOnFocus = true;
                //radEffEndDate.SelectedDate = null;
                if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT.HasValue)
                {
                    tbValueDflt.Text = SQMBasePage.FormatValue((decimal)pm.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT, 2);
                }
                if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT.HasValue)
                {
                    tbCostDflt.Text = SQMBasePage.FormatValue((decimal)pm.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT, 2);
                }
                if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.OVERRIDE_ALLOWED.HasValue)
                {
                    cbEnableOverride.Checked = (bool)pm.EHS_PROFILE_MEASURE_EXT.OVERRIDE_ALLOWED;
                }
                //if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.EFF_END_DT.HasValue)
                //    radEffEndDate.SelectedDate = pm.EHS_PROFILE_MEASURE_EXT.EFF_END_DT;
            }

            UpdateListTitles();
            pnlMetricEdit.Enabled = btnMetricCancel.Enabled = btnMetricSave.Enabled = UserContext.CheckUserPrivilege(SysPriv.config, SysScope.envdata);

            string script = "function f(){OpenMetricEditWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);

            return(status);
        }
Пример #9
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("EHS", 2, true, true, "");
                }

                uclSearchBar.SetButtonsVisible(false, false, false, false, false, false);
                uclSearchBar.PageTitle.Text = lblTitle.Text;
                btnMetricSave.Enabled       = lnkMeasureAdd.Enabled = btnMetricCancel.Enabled = UserContext.CheckUserPrivilege(SysPriv.config, SysScope.envdata);
            }
        }
Пример #10
0
        private void SetupProfilePanel()
        {
            if (ddlMetricDisposalCode.Items.Count == 0)
            {
                ddlDayDue.Items.AddRange(WebSiteCommon.PopulateDropDownListNums(1, 31));
                ddlWarningDays.Items.AddRange(WebSiteCommon.PopulateDropDownListNums(0, 11));

                ddlMetricDisposalCode.DataSource     = SessionManager.DisposalCodeList;
                ddlMetricDisposalCode.DataValueField = "UN_CODE";
                ddlMetricDisposalCode.DataTextField  = "UN_CODE";
                ddlMetricDisposalCode.DataBind();
                ddlMetricDisposalCode.Items.Insert(0, new ListItem(""));

                ddlMetricRegStatus.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("regulatoryStatus"));
                ddlMetricRegStatus.Items.Insert(0, new ListItem(""));

                SQMBasePage.FillCurrencyDDL(ddlMetricCurrency, "EUR");
                ddlMetricCurrency.Items.Insert(0, "");

                ddlMetricCost.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("costType", "long"));
                ddlMetricCost.Items.Insert(0, "");

                if (UserContext.CheckUserPrivilege(SysPriv.config, SysScope.envdata))
                {
                    ddlMetricStatus.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("statusCodeDelete"));
                }
                else
                {
                    ddlMetricStatus.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("statusCode"));
                }

                ddlMetricCategory.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("measureCategoryEHS", 2, ""));
                ddlMetricCategory.Items.Insert(0, "");

                measureList = EHSModel.SelectEHSMeasureList("", true).OrderBy(l => l.MEASURE_NAME).ToList();
                foreach (EHS_MEASURE measure in measureList)
                {
                    ddlMetricID.Items.Add(new ListItem(measure.MEASURE_NAME.Trim(), WebSiteCommon.PackItemValue(measure.MEASURE_CATEGORY, measure.EFM_TYPE, measure.MEASURE_ID.ToString())));
                    if (measure.MEASURE_CATEGORY == "FACT")
                    {
                        ListItem item = new ListItem(measure.MEASURE_NAME.Trim(), measure.MEASURE_ID.ToString());
                        item.Attributes.Add("title", measure.MEASURE_DESC);
                        ddlNormFact.Items.Add(item);
                    }
                }
                ddlMetricID.Items.Insert(0, "");
                ddlNormFact.Items.Insert(0, "");

                if (ddlNormFact.Items.Count == 1)       // don't display normalize selects if no factors defined
                {
                    phNormFact.Visible = false;
                }

                foreach (UOM uom in SessionManager.UOMList.Where(l => l.OWNER_ID == null).OrderBy(l => l.UOM_NAME).ToList())
                {
                    ddlMetricUOM.Items.Add(new ListItem(uom.UOM_NAME, WebSiteCommon.PackItemValue(uom.UOM_CATEGORY, uom.EFM_TYPE, uom.UOM_ID.ToString())));
                }
                ddlMetricUOM.Items.Insert(0, "");
                ddlMetricUOM.SelectedIndex = 0;
            }
            divEHSProfile.Visible  = true;
            pnlCopyProfile.Visible = false;
            UpdateListTitles();
        }
Пример #11
0
        private void SearchIncidents()
        {
            string   selectedValue = "";
            DateTime fromDate      = Convert.ToDateTime(dmFromDate.SelectedDate);
            DateTime toDate        = Convert.ToDateTime(dmToDate.SelectedDate);

            if (toDate < fromDate)
            {
                return;
            }

            toDate = new DateTime(toDate.Year, toDate.Month, toDate.Day, 23, 59, 59);

            List <decimal> plantIDS = SQMBasePage.GetComboBoxCheckedItems(ddlPlantSelect).Select(i => Convert.ToDecimal(i.Value)).ToList();

            var           typeList   = new List <decimal>();
            List <string> statusList = new List <string>();

            if (Mode == IncidentMode.Incident)
            {
                if (HSCalcs() == null)
                {
                    foreach (RadComboBoxItem item in rcbIncidentType.Items)
                    {
                        item.Checked = true;
                    }
                }
                typeList      = rcbIncidentType.Items.Where(c => c.Checked).Select(c => Convert.ToDecimal(c.Value)).ToList();
                selectedValue = rcbStatusSelect.SelectedValue;
            }
            else if (Mode == IncidentMode.Prevent)
            {
                typeList   = EHSIncidentMgr.SelectPreventativeTypeList(SessionManager.PrimaryCompany().COMPANY_ID).Select(l => l.INCIDENT_TYPE_ID).ToList();
                statusList = SQMBasePage.GetComboBoxCheckedItems(rcbFindingsSelect).Select(l => l.Value).ToList();
            }

            SetHSCalcs(new SQMMetricMgr().CreateNew(SessionManager.PrimaryCompany(), "0", fromDate, toDate, new decimal[0]));
            HSCalcs().ehsCtl = new EHSCalcsCtl().CreateNew(1, DateSpanOption.SelectRange);
            HSCalcs().ObjAny = cbShowImage.Checked;

            if (selectedValue == "T")
            {
                HSCalcs().ehsCtl.SelectIncidentList(plantIDS, typeList, fromDate, toDate, "A", false);
                List <EHSIncidentData> actionList = new List <EHSIncidentData>();
                foreach (EHSIncidentData data in HSCalcs().ehsCtl.IncidentHst)
                {
                    if (data.EntryList.Where(l => l.INCIDENT_QUESTION_ID == (decimal)EHSQuestionId.Create8D && l.ANSWER_VALUE != "Yes").Count() > 0)
                    {
                        //	if (data.Incident.INCIDENT_ANSWER.Where(l => l.INCIDENT_QUESTION_ID == (decimal)EHSQuestionId.Create8D && l.ANSWER_VALUE != "Yes").Count() > 0)
                        actionList.Add(data);
                    }
                }
                HSCalcs().ehsCtl.IncidentHst = actionList;

                if (!UserContext.CheckUserPrivilege(SysPriv.admin, SysScope.incident))
                {
                    actionList = HSCalcs().ehsCtl.IncidentHst = (from i in HSCalcs().ehsCtl.IncidentHst where i.Incident.ISSUE_TYPE_ID != 10 select i).ToList();
                }

                if (actionList != null)
                {
                    uclIncidentList.BindIncidentActionList(actionList, "EHS");
                }
            }
            else
            {
                if (Mode == IncidentMode.Incident)
                {
                    HSCalcs().ehsCtl.SelectIncidentList(plantIDS, typeList, fromDate, toDate, selectedValue, cbShowImage.Checked);
                }
                else if (Mode == IncidentMode.Prevent)
                {
                    List <string> inspectionCatetoryList = new List <string>();
                    inspectionCatetoryList.AddRange(rcbInspectCatetory.Items.Where(c => c.Checked).Select(c => c.Value).ToList());
                    List <string> recommendationTypeList = new List <string>();
                    recommendationTypeList.AddRange(rcbRecommendationType.Items.Where(c => c.Checked).Select(c => c.Value).ToList());
                    HSCalcs().ehsCtl.SelectPreventativeList(plantIDS, typeList, inspectionCatetoryList, recommendationTypeList, fromDate, toDate, statusList, cbShowImage.Checked);
                }

                if (!UserContext.CheckUserPrivilege(SysPriv.admin, SysScope.incident))
                {
                    HSCalcs().ehsCtl.IncidentHst = (from i in HSCalcs().ehsCtl.IncidentHst where i.Incident.ISSUE_TYPE_ID != 10 select i).ToList();
                }

                if (HSCalcs().ehsCtl.IncidentHst != null)
                {
                    //HSCalcs().ehsCtl.IncidentHst.OrderByDescending(x => x.Incident.INCIDENT_DT);
                    if (Mode == IncidentMode.Incident)
                    {
                        uclIncidentList.BindIncidentListRepeater(HSCalcs().ehsCtl.IncidentHst.OrderByDescending(x => x.Incident.INCIDENT_ID).ToList(), "EHS", cbShowImage.Checked, false);
                    }
                    else if (Mode == IncidentMode.Prevent)
                    {
                        uclIncidentList.BindPreventativeListRepeater(HSCalcs().ehsCtl.IncidentHst.OrderByDescending(x => x.Incident.INCIDENT_ID).ToList(), "EHS", cbShowImage.Checked);
                    }
                }
            }

            if (HSCalcs().ehsCtl.IncidentHst != null && HSCalcs().ehsCtl.IncidentHst.Count > 0)
            {
                lblChartType.Visible = ddlChartType.Visible = true;
            }

            pnlIncidentDetails.Visible = lnkIncidentDetailsClose.Visible = false;

            if (ddlChartType.SelectedValue != "")
            {
                ddlChartTypeChange(null, null);
            }
        }
Пример #12
0
        private void DisplayCalendar(DateTime selectedDate)
        {
            // don't display task strip if tasklist is empty


            bool enableItemLinks = false;

            // get scheduled tasks
            respForList = new List <decimal>();
            respForList.Add(SessionManager.UserContext.Person.PERSON_ID);
            DateTime toDate   = SessionManager.UserContext.LocalTime.AddMonths(3);
            DateTime fromDate = SessionManager.UserContext.LocalTime.AddMonths(-3);

            string selectedValue = "0";

            if (ddlScheduleScope.SelectedIndex > -1)
            {
                selectedValue = ddlScheduleScope.SelectedValue;
            }
            else if (mnuScheduleScope.SelectedItem != null)
            {
                selectedValue = mnuScheduleScope.SelectedItem.Value;
            }

            respForList   = new List <decimal>();
            respPlantList = new List <decimal>();
            List <TaskItem> taskList         = new List <TaskItem>();
            List <TaskItem> taskScheduleList = new List <TaskItem>();

            if (selectedValue == "0" || selectedValue == "TOP")
            {
                respForList.Add(SessionManager.UserContext.Person.PERSON_ID);
            }
            else
            {
                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));
                    decimal[] busOrgPlantIDS = SQMModelMgr.SelectPlantList(entities, SessionManager.PrimaryCompany().COMPANY_ID, busOrgID).Select(l => l.PLANT_ID).ToArray();
                    foreach (decimal plantID in busOrgPlantIDS)
                    {
                        if (ddlScheduleScope.Visible && ddlScheduleScope.Items.FindItemByValue(plantID.ToString()) != null)
                        {
                            respPlantList.Add(plantID);
                        }
                        else if (mnuScheduleScope.Visible)
                        {
                            RadMenuItem miTop = mnuScheduleScope.Items[0];
                            foreach (RadMenuItem miBU in miTop.Items)
                            {
                                foreach (RadMenuItem miLoc in miBU.Items)
                                {
                                    if (miLoc.Value == plantID.ToString())
                                    {
                                        respPlantList.Add(plantID);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {                   // specific plant
                    respPlantList.Add(Convert.ToDecimal(selectedValue));
                }

                if (SessionManager.CheckUserPrivilege(SysPriv.config, SysScope.busorg))
                {
                    enableItemLinks = true;
                }
            }

            if (UserContext.CheckUserPrivilege(SysPriv.view, SysScope.inbox))
            {
                //taskList.AddRange(TaskMgr.ProfileInputStatus(new DateTime(fromDate.Year, fromDate.Month, 1), new DateTime(SessionManager.UserContext.LocalTime.Year, SessionManager.UserContext.LocalTime.Month, SessionManager.UserContext.LocalTime.Day), respForList, respPlantList));
                DateTime inputFromDate = new DateTime(DateTime.UtcNow.AddMonths(-1).Year, DateTime.Now.AddMonths(-1).Month, 1);
                taskScheduleList.AddRange(TaskMgr.ProfileInputSchedule(inputFromDate, toDate, respForList, respPlantList.ToArray(), SessionManager.CheckUserPrivilege(SysPriv.admin, SysScope.busorg)));
                taskList.AddRange(TaskMgr.IncidentTaskStatus(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, respForList, respPlantList, false));
            }
            taskScheduleList.AddRange(taskList);
            // MT - removed below logic because I don't know WTF
            //List<TaskItem> schedTasks = TaskMgr.IncidentTaskSchedule(SessionManager.PrimaryCompany().COMPANY_ID, DateTime.Now, toDate, respForList, respPlantList.ToArray(), false);
            //taskScheduleList.AddRange(TaskMgr.IncidentTaskSchedule(SessionManager.PrimaryCompany().COMPANY_ID, DateTime.Now, toDate, respForList, respPlantList.ToArray(), false));


            enableItemLinks = true;

            uclTaskSchedule.BindTaskSchedule(taskScheduleList, selectedDate, enableItemLinks);

            // get task escalations
            if (btnEscalateView.Visible)
            {
                respForList = new List <decimal>();
                respForList.AddRange(SQMModelMgr.SelectPersonListBySupvID(SessionManager.UserContext.Person.EMP_ID).Select(l => l.PERSON_ID).ToList());
                if (respForList.Count > 0)
                {
                    // has escalation persons
                    List <TaskItem> escalateList = TaskMgr.IncidentTaskStatus(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, respForList, new List <decimal>(), false);
                    uclTaskStrip.BindTaskStrip(escalateList.Where(l => !String.IsNullOrEmpty(l.LongTitle)).OrderBy(l => l.Task.DUE_DT).ToList());
                }
            }

            divTaskList.Visible = divEscalate.Visible = false;
            divCalendar.Visible = true;
        }
Пример #13
0
 public static bool CheckUserPrivilege(SysPriv priv, SysScope scope)
 {
     return(UserContext.CheckUserPrivilege(priv, scope));
 }
Пример #14
0
        private void SearchIncidents()
        {
            string selectedValue = "";

            // work-around for rad persistence manager being cleared upon re-build ??
            if (ddlPlantSelect.CheckedItems.Count == 0)
            {
                foreach (RadComboBoxItem item in ddlPlantSelect.Items)
                {
                    item.Checked = true;
                }
            }
            if (rcbIncidentType.CheckedItems.Count == 0)
            {
                foreach (RadComboBoxItem item in rcbIncidentType.Items)
                {
                    item.Checked = true;
                }
            }
            if (rcbStatusSelect.SelectedItem == null)
            {
                rcbStatusSelect.SelectedIndex = 0;
            }

            DateTime fromDate = Convert.ToDateTime(dmFromDate.SelectedDate);
            DateTime toDate   = Convert.ToDateTime(dmToDate.SelectedDate);

            if (toDate < fromDate)
            {
                return;
            }

            toDate = new DateTime(toDate.Year, toDate.Month, toDate.Day, 23, 59, 59);

            List <decimal> plantIDS = SQMBasePage.GetComboBoxCheckedItems(ddlPlantSelect).Select(i => Convert.ToDecimal(i.Value)).ToList();

            var           typeList            = new List <decimal>();
            List <string> severityList        = new List <string>();
            List <string> selectSeverityLevel = new List <string>();
            decimal       incidentID;

            if (HSCalcs() == null)
            {
                foreach (RadComboBoxItem item in rcbIncidentType.Items)
                {
                    item.Checked = true;
                }
            }
            typeList = rcbIncidentType.Items.Where(c => c.Checked).Select(c => Convert.ToDecimal(c.Value)).ToList();
            if (typeList.Contains((decimal)EHSIncidentTypeId.InjuryIllness))
            {
                severityList = rcbSeverity.Items.Where(c => c.Checked).Select(c => c.Value).ToList();
            }
            else
            {
                severityList.Clear();
                rcbSeverity.Items.ToList().ForEach(i => i.Checked = false);
            }
            //Get selected values of severity level filter dropdownlist.
            selectedValue       = rcbStatusSelect.SelectedValue;
            selectSeverityLevel = rcbSeverityLevel.Items.Where(c => c.Checked).Select(c => c.Value).ToList();

            string incidentid = RTXT_IncidentID.Text;

            incidentID = Convert.ToDecimal(incidentid == "" ?"0" : incidentid);

            SetHSCalcs(new SQMMetricMgr().CreateNew(SessionManager.PrimaryCompany(), "0", fromDate, toDate, new decimal[0]));
            HSCalcs().ehsCtl = new EHSCalcsCtl().CreateNew(1, DateSpanOption.SelectRange, "0");
            HSCalcs().ObjAny = cbShowImage.Checked;

            HSCalcs().ehsCtl.SelectIncidentList(plantIDS, typeList, severityList, fromDate, toDate, selectedValue, selectSeverityLevel, cbShowImage.Checked, cbCreatedByMe.Checked ? SessionManager.UserContext.Person.PERSON_ID : 0, incidentID);

            if (!UserContext.CheckUserPrivilege(SysPriv.admin, SysScope.incident))
            {
                HSCalcs().ehsCtl.IncidentHst = (from i in HSCalcs().ehsCtl.IncidentHst where i.Incident.ISSUE_TYPE_ID != 10 select i).ToList();
            }

            if (HSCalcs().ehsCtl.IncidentHst != null)
            {
                uclIncidentList.BindIncidentListRepeater(HSCalcs().ehsCtl.IncidentHst.OrderByDescending(x => x.Incident.INCIDENT_DT).ToList(), "EHS", cbShowImage.Checked, false);
            }


            if (HSCalcs().ehsCtl.IncidentHst != null && HSCalcs().ehsCtl.IncidentHst.Count > 0)
            {
                lblChartType.Visible = ddlChartType.Visible = true;
            }

            pnlIncidentDetails.Visible = lnkIncidentDetailsClose.Visible = false;

            if (ddlChartType.SelectedValue != "")
            {
                lnkCloseChart(null, null);
            }
        }