public int BindUserList(List <PERSON> userList, decimal companyID)
        {
            int status = 0;

            if (companyID > 0)
            {
                SETTINGS sets = SQMSettings.GetSetting("COMPANY", "PLANTUSER");
                if (sets == null || sets.VALUE.ToUpper() != "N")
                {
                    SetPlantList(SQMModelMgr.SelectPlantList(new PSsqmEntities(), companyID, 0));
                }
            }
            else
            {
                SetPlantList(new List <PLANT>());
            }

            ToggleVisible(pnlUserList);
            rgUserList.DataSource = userList;
            rgUserList.DataBind();
            if (userList.Count == 0)
            {
                lblUserListEmpty.Visible = true;
            }

            return(status);
        }
Esempio n. 2
0
        private void SetupPage()
        {
            if (ddlPlantSelect.Items.Count < 1)
            {
                List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true);
                SQMBasePage.SetLocationList(ddlPlantSelect, UserContext.FilterPlantAccessList(locationList), 0);

                rcbStatusSelect.SelectedValue = "A";
            }
            divAuditList.Visible = true;

            dmFromDate.ShowPopupOnFocus = dmToDate.ShowPopupOnFocus = true;
            // ABW 1/5/16 - use user's default plant local time for search default
            DateTime localTime = SessionManager.UserContext.LocalTime;

            dmFromDate.SelectedDate = localTime.AddMonths(-1);
            dmToDate.SelectedDate   = localTime.AddMonths(1);

            if (Mode == AuditMode.Audit)
            {
                lblViewEHSRezTitle.Text  = GetLocalResourceObject("lblViewEHSRezTitleResource1.Text").ToString();
                lblPageInstructions.Text = GetLocalResourceObject("lblPageInstructionsResource1.Text").ToString();
                //lblStatus.Text = "Assessment Status:";
                rbNew.Text           = GetLocalResourceObject("rbNewResource1.Text").ToString();
                lblAuditDate.Visible = true;
                phAudit.Visible      = true;

                SETTINGS sets = SQMSettings.GetSetting("EHS", "AUDITSEARCHFROM");
                if (sets != null)
                {
                    try
                    {
                        string[] args = sets.VALUE.Split('-');
                        if (args.Length > 1)
                        {
                            dmFromDate.SelectedDate = new DateTime(Convert.ToInt32(args[0]), Convert.ToInt32(args[1]), Convert.ToInt32(args[2]));
                        }
                        else
                        {
                            dmFromDate.SelectedDate = SessionManager.UserContext.LocalTime.AddMonths(Convert.ToInt32(args[0]) * -1);
                        }
                    }
                    catch { }
                }

                if (rcbAuditType.Items.Count < 1)
                {
                    foreach (AUDIT_TYPE ip in EHSAuditMgr.SelectAuditTypeList(SessionManager.PrimaryCompany().COMPANY_ID, false))
                    {
                        RadComboBoxItem item = new RadComboBoxItem(ip.TITLE, ip.AUDIT_TYPE_ID.ToString());
                        item.Checked = true;
                        rcbAuditType.Items.Add(item);
                    }
                }
            }
        }
        private void MessageDisplay(EHSProfileStatus status)
        {
            lblInputError.Visible = lblPeriodLimit.Visible = lblProfileNotExist.Visible = lblNoMetrics.Visible = lblNoInputs.Visible = lblRangeWarning.Visible = lblIncompleteInputs.Visible = false;
            uclExport.Visible     = phApproval.Visible = true;

            // suppress local approval input when auto-rollup settings are active
            SETTINGS sets = SQMSettings.GetSetting("EHS", "INPUTFINALIZE");

            if (sets != null && !string.IsNullOrEmpty(sets.VALUE))
            {
                phApproval.Visible = false;
            }

            if (LocalProfile() != null)
            {
                LocalProfile().CurrentStatus = status;
                BindSharedCalendars();
            }
            switch (status)
            {
            case EHSProfileStatus.NonExist:
                lblProfileNotExist.Visible = true;
                uclExport.Visible          = phApproval.Visible = false;
                break;

            case EHSProfileStatus.PeriodLimit:
                lblPeriodLimit.Visible = true;
                break;

            case EHSProfileStatus.InputError:
                lblInputError.Visible = true;
                break;

            case EHSProfileStatus.NoMeasures:
                lblNoMetrics.Visible = true;
                uclExport.Visible    = phApproval.Visible = false;
                break;

            case EHSProfileStatus.NoInputs:
                lblNoInputs.Visible = true;
                break;

            case EHSProfileStatus.OutOFRange:
                lblRangeWarning.Visible = true;
                break;

            case EHSProfileStatus.Incomplete:
                lblIncompleteInputs.Visible = true;
                break;

            default:
                break;
            }
        }
Esempio n. 4
0
        private void SetupPage()
        {
            if (ddlPlantSelect.Items.Count < 1)
            {
                List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true);
                SQMBasePage.SetLocationList(ddlPlantSelect, UserContext.FilterPlantAccessList(locationList), 0);

                rcbStatusSelect.SelectedValue = "A";
            }
            divAuditList.Visible = true;

            dmFromDate.ShowPopupOnFocus = dmToDate.ShowPopupOnFocus = true;
            dmFromDate.SelectedDate     = DateTime.Now.AddMonths(-1);
            dmToDate.SelectedDate       = DateTime.Now.AddMonths(1);

            if (Mode == AuditMode.Audit)
            {
                lblViewEHSRezTitle.Text  = "Manage Environmental Health &amp; Safety Audits";
                lblPageInstructions.Text = "Add or update EH&amp;S Audits below.";
                //lblStatus.Text = "Audit Status:";
                rbNew.Text           = "New Audit";
                lblAuditDate.Visible = true;
                phAudit.Visible      = true;

                SETTINGS sets = SQMSettings.GetSetting("EHS", "AUDITSEARCHFROM");
                if (sets != null)
                {
                    try
                    {
                        string[] args = sets.VALUE.Split('-');
                        if (args.Length > 1)
                        {
                            dmFromDate.SelectedDate = new DateTime(Convert.ToInt32(args[0]), Convert.ToInt32(args[1]), Convert.ToInt32(args[2]));
                        }
                        else
                        {
                            dmFromDate.SelectedDate = DateTime.Now.AddMonths(Convert.ToInt32(args[0]) * -1);
                        }
                    }
                    catch { }
                }

                foreach (AUDIT_TYPE ip in EHSAuditMgr.SelectAuditTypeList(SessionManager.PrimaryCompany().COMPANY_ID, false))
                {
                    RadComboBoxItem item = new RadComboBoxItem(ip.TITLE, ip.AUDIT_TYPE_ID.ToString());
                    item.Checked = true;
                    rcbAuditType.Items.Add(item);
                }
            }
        }
        protected void OnPlantProfileSelect(decimal plantID)
        {
            ClearInput();

            if (directedPlantID > 0)  // override plant select ddl when directed from inbox, etc...
            {
                SetLocalProfile(new EHSProfile().Load(directedPlantID, false, true));
            }
            else
            {
                SetLocalProfile(new EHSProfile().Load(plantID, false, true));
            }

            MessageDisplay(LocalProfile().Status);
            if (LocalProfile().Status != EHSProfileStatus.Normal)
            {
                return;
            }

            AccessMode accessMode = UserContext.CheckAccess("EHS", "311");

            if (accessMode > AccessMode.Update)
            {
                LocalProfile().FilterByResponsibleID = 0;
                LocalProfile().MinPeriodDate         = new DateTime(2001, 1, 1);
                uclInputHdr.LoadProfileInputHdr(false, LocalProfile().MinPeriodDate, DateTime.Now, SessionManager.UserContext.HRLocation.Plant.PLANT_ID, true, true);
            }
            else
            {
                LocalProfile().FilterByResponsibleID = SessionManager.UserContext.Person.PERSON_ID;
                SETTINGS sets = SQMSettings.GetSetting("EHS", "INPUTLIMIT");
                LocalProfile().MinPeriodDate = DateTime.Now.AddMonths(sets != null ? Convert.ToInt32(sets.VALUE) * -1 : -5);
                uclInputHdr.LoadProfileInputHdr(false, LocalProfile().MinPeriodDate, DateTime.Now, SessionManager.UserContext.HRLocation.Plant.PLANT_ID, true, true);
            }

            if (directedPlantID > 0)  // override plant select ddl when directed from inbox, etc...
            {
                uclInputHdr.SelectLocation(LocalProfile().Plant);
            }

            if (LocalProfile() != null && LocalProfile().Status == EHSProfileStatus.Normal)
            {
                OnInputPeriodSelect(uclInputHdr.SelectedPeriodDate);
            }
        }
Esempio n. 6
0
        protected void OnPlantProfileSelect(decimal plantID)
        {
            ClearInput();

            if (directedPlantID > 0)  // override plant select ddl when directed from inbox, etc..
            {
                SetLocalProfile(new EHSProfile().Load(directedPlantID, false, true));
            }
            else
            {
                SetLocalProfile(new EHSProfile().Load(plantID, false, true));
            }

            MessageDisplay(LocalProfile().Status);
            if (LocalProfile().Status != EHSProfileStatus.Normal)
            {
                return;
            }

            if (UserContext.GetMaxScopePrivilege(SysScope.envdata) < SysPriv.originate)              // allow approvers and admins to see all metrics
            {
                LocalProfile().FilterByResponsibleID = 0;
                LocalProfile().MinPeriodDate         = new DateTime(2001, 1, 1);
                uclInputHdr.LoadProfileInputHdr(false, LocalProfile().MinPeriodDate, DateTime.Now, SessionManager.UserContext.HRLocation.Plant.PLANT_ID, true, true);
            }
            else
            {
                LocalProfile().FilterByResponsibleID = SessionManager.UserContext.Person.PERSON_ID;
                SETTINGS sets = SQMSettings.GetSetting("EHS", "INPUTLIMIT");
                LocalProfile().MinPeriodDate = DateTime.Now.AddMonths(sets != null ? Convert.ToInt32(sets.VALUE) * -1 : -5);
                uclInputHdr.LoadProfileInputHdr(false, LocalProfile().MinPeriodDate, DateTime.Now, SessionManager.UserContext.HRLocation.Plant.PLANT_ID, true, true);
            }

            if (directedPlantID > 0)  // override plant select ddl when directed from inbox, etc...
            {
                uclInputHdr.SelectLocation(LocalProfile().Plant);
            }

            if (LocalProfile() != null && LocalProfile().Status == EHSProfileStatus.Normal)
            {
                OnInputPeriodSelect(uclInputHdr.SelectedPeriodDate);
            }
        }
 public void BindOrgListRepeater(List <BUSINESS_ORG> theList)
 {
     if (theList.Count > 0)
     {
         SETTINGS sets = SQMSettings.GetSetting("COMPANY", "PLANTUSER");
         if (sets == null || sets.VALUE.ToUpper() != "N")
         {
             SetUserList(SQMModelMgr.SelectPersonList(theList[0].COMPANY_ID, 0, true, false));
         }
     }
     else
     {
         SetUserList(new List <PERSON>());
     }
     ToggleVisible(pnlOrgListRepeater);
     totalRowCount            = 0;
     rptBusOrgList.DataSource = theList;
     rptBusOrgList.DataBind();
     SetRepeaterDisplay(rptBusOrgList, lblBusOrgListEmptyRepeater, divGVScrollOrgListRepeater, 8, (TotalRowCount += rptBusOrgList.Items.Count), "scrollAreaLarge");
 }
        public void gvPlantList_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString())))
            {
                System.Web.UI.WebControls.Label       lbl     = new Label();
                System.Web.UI.WebControls.HiddenField hfField = new HiddenField();

                try
                {
                    lbl      = (Label)e.Row.Cells[0].FindControl("lblLocationType_out");
                    hfField  = (HiddenField)e.Row.Cells[0].FindControl("hfLocationType");
                    lbl.Text = WebSiteCommon.GetXlatValue("locationType", hfField.Value);

                    lbl      = (Label)e.Row.Cells[0].FindControl("lblStatus_out");
                    hfField  = (HiddenField)e.Row.Cells[0].FindControl("hfStatus_out");
                    lbl.Text = WebSiteCommon.GetStatusString(hfField.Value);

                    SETTINGS sets = SQMSettings.GetSetting("COMPANY", "PLANTUSER");
                    if (sets == null || sets.VALUE.ToUpper() != "N")
                    {
                        LinkButton  lnk     = (LinkButton)e.Row.Cells[0].FindControl("lnkView_out");
                        decimal     plantID = Convert.ToDecimal(lnk.CommandArgument);
                        HiddenField hf      = (HiddenField)e.Row.Cells[0].FindControl("hfPlantCompanyID");
                        lnk.ToolTip = "";
                        foreach (PERSON person in UserList())
                        {
                            if (person.ROLE > 1 && SQMModelMgr.PersonPlantAccess(person, plantID))
                            {
                                lnk.ToolTip += (" " + person.FIRST_NAME + " " + person.LAST_NAME + ",");
                            }
                        }
                        lnk.ToolTip = lnk.ToolTip.TrimEnd(',');
                    }
                }
                catch
                {
                }
            }
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SETTINGS sets = null;

            if (IsPostBack)
            {
                // Save the current view port width (used for responsive design later)
                var vpWidth = viewPortWidth.Value;
                if (!string.IsNullOrEmpty(vpWidth))
                {
                    Session["vpWidth"] = vpWidth;
                }
                else
                {
                    Session["vpWidth"] = "1000";
                }
            }
            else
            {
                // if (LoginAttempts == 0)
                //     SessionManager.Clear();
                try
                {
                    string info = System.Configuration.ConfigurationManager.AppSettings["MainInfo"];
                    if (!string.IsNullOrEmpty(info))
                    {
                        lblMainInfo.Text    = info;
                        lblMainInfo.Visible = true;
                    }

                    System.Web.HttpBrowserCapabilities browser = Request.Browser;

                    // url format login.aspx/?t=ltc:60&p=EHS
                    // execOverride == override query params to force ticker and image posting

                    System.Collections.Specialized.NameValueCollection qry = new System.Collections.Specialized.NameValueCollection();
                    string execOverride = System.Configuration.ConfigurationManager.AppSettings["LoginOverride"];
                    if (execOverride != null && execOverride == "QAI")
                    {
                        qry.Add("t", "ltc");
                        qry.Add("p", "EHS,QS");
                    }
                    else
                    {
                        sets = SQMSettings.GetSetting("ENV", "LOGINIMAGE");                          // force login splash page display
                        if (sets != null && sets.VALUE.ToUpper() == "Y")
                        {
                            qry.Add("p", "EHS,QS");
                        }
                        sets = SQMSettings.GetSetting("ENV", "LOGINSTAT");
                        if (sets != null && sets.VALUE.ToUpper() == "LTC")
                        {
                            qry.Add("t", "ltc");
                        }
                    }

                    sets = SQMSettings.GetSetting("ENV", "LOGINMESSAGE");
                    if (sets != null && !string.IsNullOrEmpty(sets.VALUE))
                    {
                        lblLoginMessage.Text    = sets.VALUE;
                        divLoginMessage.Visible = true;
                    }


                    if (Request.QueryString.Count > 0)
                    {
                        qry = Request.QueryString;
                    }

                    if (qry.Get("t") != null)
                    {
                        string[] args = qry.Get("t").ToString().Split(':');

                        COMPANY      company  = new COMPANY();
                        decimal[]    plantIDS = SQMModelMgr.SelectPlantList(entities, 1, 0).Where(l => l.LOCATION_TYPE == "P").OrderBy(l => l.PLANT_NAME).Select(l => l.PLANT_ID).ToArray();
                        SQMMetricMgr stsmgr   = new SQMMetricMgr().CreateNew(company, "0", DateTime.Now, DateTime.Now, plantIDS);
                        stsmgr.ehsCtl = new EHSCalcsCtl().CreateNew(1, DateSpanOption.SelectRange);
                        stsmgr.ehsCtl.ElapsedTimeSeries(plantIDS, new decimal[1] {
                            8
                        }, new decimal[1] {
                            63
                        }, "YES", true);

                        GaugeDefinition tikCfg = new GaugeDefinition().Initialize();
                        tikCfg.Width       = 0;
                        tikCfg.Unit        = args.Length > 1 ? Convert.ToInt32(args[1]) : 80;
                        tikCfg.Position    = "none";
                        tikCfg.NewRow      = false;
                        pnlPosting.Visible = true;
                        divTicker.Visible  = true;
                        uclGauge.CreateTicker(tikCfg, stsmgr.ehsCtl.Results.metricSeries, divTicker);
                    }

                    if (qry.Get("p") != null)
                    {
                        string[] args = qry.Get("p").ToString().Split(',');
                        if (args.Contains("EHS"))
                        {
                            pnlPosting.Visible = true;
                            imgPostingEHS.Style.Add("MARGIN-TOP", "8px");
                            imgPostingEHS.Src = SQM.Website.Classes.SQMDocumentMgr.GetImageSourceString(SQM.Website.Classes.SQMDocumentMgr.FindCurrentDocument("SYS", 31));
                        }
                        if (args.Contains("QS"))
                        {
                            pnlPosting.Visible = true;
                            imgPostingQS.Style.Add("MARGIN-TOP", "8px");
                            imgPostingQS.Src = SQM.Website.Classes.SQMDocumentMgr.GetImageSourceString(SQM.Website.Classes.SQMDocumentMgr.FindCurrentDocument("SYS", 32));
                        }
                    }

                    string externalLinks = System.Configuration.ConfigurationManager.AppSettings["ExternalLinks"];
                    if (!string.IsNullOrEmpty(externalLinks))
                    {
                        string[] linkArray = externalLinks.Split(',');
                        foreach (string link in linkArray)
                        {
                            divLinks.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;"));
                            HyperLink hlk = new HyperLink();
                            hlk.NavigateUrl = hlk.Text = link;
                            hlk.Target      = "_blank";
                            hlk.CssClass    = "linkUnderline";
                            divLinks.Controls.Add(hlk);
                        }
                        divLinks.Visible = true;
                    }
                }
                catch
                {
                    divAnnouncements.Visible = false;
                }

                if (Request.QueryString["rdp"] != null)
                {
                    ViewState["RedirectPath"] = Request.QueryString["rdp"];
                }
            }
        }
Esempio n. 10
0
        protected void DisplayUser()
        {
            PERSON           person = LocalPerson();
            BusinessLocation businessLocation;
            SETTINGS         sets      = SQMSettings.GetSetting("COMPANY", "ESCALATEANYUSER");
            SQM_ACCESS       sysAccess = SQMModelMgr.LookupCredentials(entities, person.SSO_ID, "", false);

            divPageBody.Visible = true;
            ddlPlantSelect.ClearCheckedItems();
            ddlCustPlantSelect.ClearCheckedItems();

            DisplayErrorMessage(null);

            if (person == null || string.IsNullOrEmpty(person.STATUS))                 // new user
            {
                winUserEdit.Title        = hfAddUser.Value;
                businessLocation         = new BusinessLocation();
                businessLocation.Company = SessionManager.EffLocation.Company;
                SetStatusList("ddlUserStatus", "A", true);
                tbUserSSOID.Enabled = true;
                tbUserSSOID.Text    = "";
                tbUserSSOID.Focus();
            }
            else
            {
                winUserEdit.Title   = hfUpdateUser.Value;
                tbUserSSOID.Enabled = false;
                tbUserFirstName.Focus();

                lblPlantAccess.Text = "";
                if (person.PLANT_ID > 0)
                {
                    ddlHRLocation.SelectedValue = person.PLANT_ID.ToString();
                    if (ddlPlantSelect.Items.FindItemByValue(person.PLANT_ID.ToString()) != null)
                    {
                        ddlPlantSelect.Items.FindItemByValue(person.PLANT_ID.ToString()).Checked = true;
                    }
                }

                if (!string.IsNullOrEmpty(person.NEW_LOCATION_CD))
                {
                    RadComboBoxItem plantItem = null;
                    string[]        locs      = person.NEW_LOCATION_CD.Split(',');
                    foreach (string locid in locs)
                    {
                        if ((plantItem = ddlPlantSelect.Items.FindItemByValue(locid)) != null)
                        {
                            ddlPlantSelect.Items.FindItemByValue(locid).Checked = true;
                            if (locs.Length > 2)
                            {
                                lblPlantAccess.Text += lblPlantAccess.Text.Length == 0 ? plantItem.Text : (", " + plantItem.Text);
                            }
                        }
                    }
                }

                if (!string.IsNullOrEmpty(person.OLD_LOCATION_CD))
                {
                    string[] locs = person.OLD_LOCATION_CD.Split(',');
                    foreach (string locid in locs)
                    {
                        if (ddlCustPlantSelect.Items.FindItemByValue(locid) != null)
                        {
                            ddlCustPlantSelect.Items.FindItemByValue(locid).Checked = true;
                        }
                    }
                }
            }

            // AW20131106 - do not want to be able to change a SSO ID once a person has been added
            if (!string.IsNullOrEmpty(person.SSO_ID.Trim()))
            {
                tbUserSSOID.Text = person.SSO_ID;
            }

            tbUserFirstName.Text = person.FIRST_NAME;
            tbUserLastName.Text  = person.LAST_NAME;
            tbUserTitle.Text     = person.JOB_TITLE;
            tbUserPhone.Text     = person.PHONE;
            tbUserEmail.Text     = person.EMAIL;
            SetStatusList("ddlUserStatus", person.STATUS, true);
            if (sysAccess != null && sysAccess.LAST_LOGON_DT.HasValue)
            {
                lblUserLoginDate_out.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)sysAccess.LAST_LOGON_DT, WebSiteCommon.GetXlatValue("timeZone", person.PREFERRED_TIMEZONE)), "g", true);
            }
            else
            {
                lblUserLoginDate_out.Text = "";
            }
            lblUserLastUpdate.Text = person.LAST_UPD_BY + "  " + SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)person.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "g", true);

            if (ddlUserLanguage.Items.FindByValue(person.PREFERRED_LANG_ID.ToString()) != null)
            {
                ddlUserLanguage.SelectedValue = person.PREFERRED_LANG_ID.ToString();
            }
            if (ddlUserTimezone.Items.FindByValue(person.PREFERRED_TIMEZONE) != null)
            {
                ddlUserTimezone.SelectedValue = person.PREFERRED_TIMEZONE;
            }

            ddlUserRole.Items.Clear();
            ddlUserRole.Items.AddRange(WebSiteCommon.PopulateRadListItems("userRole"));
            for (int i = ddlUserRole.Items.Count - 1; i >= 0; i--)
            {
                AccessMode roleMode = SessionManager.RoleAccessMode(Convert.ToInt32(ddlUserRole.Items[i].Value));
                if (SessionManager.IsEffLocationPrimary() && roleMode == AccessMode.Partner)
                {
                    ddlUserRole.Items.Remove(i);
                }
                if (!SessionManager.IsEffLocationPrimary() && roleMode != AccessMode.Partner)               // restrict roles of non-primary company users
                {
                    ddlUserRole.Items.Remove(i);
                }
                else if (UserContext.RoleAccess() < AccessMode.SA && roleMode > AccessMode.Admin)      // only QAI admin may see or edit sys admin role
                {
                    ddlUserRole.Items.Remove(i);
                }
            }

            string rolesDesc = "";

            if (ddlUserRole.Items.FindItemByValue(person.ROLE.ToString()) != null)
            {
                ddlUserRole.SelectedValue = person.ROLE.ToString();
            }

            if (sets == null || sets.VALUE.ToUpper() != "Y")      // prompt for user escalation
            {
                cbUserRcvEscalation.Visible = true;
                if (person.RCV_ESCALATION.HasValue)
                {
                    cbUserRcvEscalation.Checked = (bool)person.RCV_ESCALATION;
                }
            }
            else
            {
                cbUserRcvEscalation.Visible = false;        // enable escalation for anyone
                cbUserRcvEscalation.Checked = true;
            }

            if (person.ROLE <= 100 || person.PERSON_ACCESS.Where(a => a.ACCESS_PROD == "SQM").Count() > 0)
            {
                ddlCustPlantSelect.Enabled = true;
            }
            else
            {
                ddlCustPlantSelect.Enabled       = false;
                ddlCustPlantSelect.SelectedIndex = 0;
            }

            List <SysModule> sysmodList = SQMSettings.SystemModuleItems();
            string           prod = "";
            RadComboBoxItem  item = null; RadComboBoxItem itemSep = null;

            ddlModuleAccess.Items.Clear();
            lblModuleAccess.Text = "";
            foreach (SysModule sysmod in sysmodList.Where(l => l.prod != "CQM").ToList())
            {
                if (string.IsNullOrEmpty(sysmod.mod))
                {
                    prod                = sysmod.prod;
                    itemSep             = new RadComboBoxItem(((HiddenField)pnlUserEdit.FindControl("hf" + prod)).Value, prod);
                    itemSep.IsSeparator = true;
                    ddlModuleAccess.Items.Add(itemSep);
                }
                else
                {
                    item = new RadComboBoxItem(sysmod.desc, sysmod.topic);
                    ddlModuleAccess.Items.Add(item);
                    if (GetSelectedUserRole() <= 100)
                    {
                        item.Checked = true;
                    }
                    else if ((sysmod.prod == "SQM" && person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == "201").Count() > 0) ||
                             (sysmod.prod == "EHS" && person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == "301").Count() > 0))
                    {
                        item.Checked = true;
                    }
                    else if (person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == sysmod.topic).Count() > 0)
                    {
                        item.Checked = true;
                    }
                    // exclusions
                    if (!SessionManager.IsEffLocationPrimary())  // restrict module selections if not primary company user
                    {
                        if (sysmod.prod != "SQM")
                        {
                            itemSep.Enabled        = item.Enabled = item.Checked = false;
                            ddlModuleAccess.Height = 120;
                        }
                    }
                    if (item.Checked)
                    {
                        lblModuleAccess.Text += lblModuleAccess.Text.Length == 0 ? item.Text : (", " + item.Text);
                    }
                }
            }

            if (!SessionManager.IsEffLocationPrimary())
            {
                ddlCustPlantSelect.Enabled  = false;
                cbUserRcvEscalation.Visible = cbUserRcvEscalation.Checked = false;
            }

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

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
        }
        private void SetupPage()
        {
            if (ddlPlantSelect.Items.Count < 1)
            {
                List <XLAT> xlatList = SQMBasePage.SelectXLATList(new string[2] {
                    "STATUS_SELECT", "INCIDENT_SEVERITY"
                }, 1);
                List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true);
                SQMBasePage.SetLocationList(ddlPlantSelect, UserContext.FilterPlantAccessList(locationList), 0);
                rcbStatusSelect = SQMBasePage.SetComboBoxItemsFromXLAT(rcbStatusSelect, xlatList.Where(l => l.XLAT_GROUP == "STATUS_SELECT" && new string[3] {
                    "", "A", "C"
                }.Contains(l.XLAT_CODE)).ToList(), "SHORT");
                rcbStatusSelect.SelectedValue = "A";
                rcbSeverity = SQMBasePage.SetComboBoxItemsFromXLAT(rcbSeverity, xlatList.Where(l => l.XLAT_GROUP == "INCIDENT_SEVERITY").OrderBy(l => l.SORT_ORDER).ToList(), "SHORT");
            }
            divIncidentList.Visible = true;
            pnlChartSection.Style.Add("display", "none");
            lblChartType.Visible = ddlChartType.Visible = false;

            //Bind data with severity level dropdown.
            var severityList = EHSIncidentMgr.PopulateSeverityLevel();

            rcbSeverityLevel = SQMBasePage.SetComboBoxItemsFromXLAT(rcbSeverityLevel, severityList, "SHORT");


            SQMBasePage.SetRadDateCulture(dmFromDate, "");
            SQMBasePage.SetRadDateCulture(dmToDate, "");

            dmFromDate.ShowPopupOnFocus = dmToDate.ShowPopupOnFocus = true;
            dmFromDate.SelectedDate     = SessionManager.UserContext.LocalTime.AddMonths(-11);
            dmToDate.SelectedDate       = SessionManager.UserContext.LocalTime;

            lblViewEHSRezTitle.Text  = GetLocalResourceObject("lblViewEHSRezTitleResource1.Text").ToString();
            lblPageInstructions.Text = GetLocalResourceObject("lblPageInstructionsResource1.Text").ToString();
            //lblStatus.Text = "Incident Status:";
            rbNew.Text = GetLocalResourceObject("rbNewResource1.Text").ToString();
            lblIncidentDate.Visible   = true;
            lblInspectionDate.Visible = false;
            phIncident.Visible        = true;

            SETTINGS sets = SQMSettings.GetSetting("EHS", "INCIDENTSEARCHFROM");

            if (sets != null)
            {
                try
                {
                    string[] args = sets.VALUE.Split('-');
                    if (args.Length > 1)
                    {
                        dmFromDate.SelectedDate = new DateTime(Convert.ToInt32(args[0]), Convert.ToInt32(args[1]), Convert.ToInt32(args[2]));
                    }
                    else
                    {
                        dmFromDate.SelectedDate = SessionManager.UserContext.LocalTime.AddMonths(Convert.ToInt32(args[0]) * -1);
                    }
                }
                catch { }
            }

            foreach (INCIDENT_TYPE ip in EHSIncidentMgr.SelectIncidentTypeList(SessionManager.PrimaryCompany().COMPANY_ID, SessionManager.UserContext.Language.NLS_LANGUAGE))
            {
                RadComboBoxItem item = new RadComboBoxItem(ip.TITLE, ip.INCIDENT_TYPE_ID.ToString());
                item.Checked = true;
                rcbIncidentType.Items.Add(item);
            }

            // lookup charts defined for this module & app context
            PERSPECTIVE_VIEW view = ViewModel.LookupView(entities, "HSIR", "HSIR", 0, SessionManager.UserContext.Language.NLS_LANGUAGE);

            if (view != null)
            {
                ddlChartType.Items.Clear();
                ddlChartType.Items.Add(new RadComboBoxItem("", ""));
                foreach (PERSPECTIVE_VIEW_ITEM vi in view.PERSPECTIVE_VIEW_ITEM.Where(l => l.STATUS != "I").OrderBy(l => l.ITEM_SEQ).ToList())
                {
                    RadComboBoxItem item = new RadComboBoxItem();
                    item.Text     = vi.TITLE;
                    item.Value    = vi.ITEM_SEQ.ToString();
                    item.ImageUrl = ViewModel.GetViewItemImageURL(vi);
                    ddlChartType.Items.Add(item);
                }
            }

            if (UserContext.GetMaxScopePrivilege(SysScope.incident) <= SysPriv.action)
            {
                uclExport.Visible = true;
            }
            else
            {
                uclExport.Visible = false;
            }
        }
Esempio n. 12
0
        protected void ddlCategoryChanged(object sender, EventArgs e)
        {
            DropDownList ddlSender      = (DropDownList)sender;
            string       key            = ddlSender.SelectedValue;
            bool         enableDefaults = false;
            SETTINGS     sets           = SQMSettings.GetSetting("EHS", "INPUTDEFAULT");

            if (sets != null && sets.VALUE.ToUpper() == "Y")
            {
                enableDefaults = true;
            }

            ddlMetricID.Enabled = ddlMetricResponsible.Enabled = true;
            // disable country waste code for non-waste measure categories
            tbWasteCode.Enabled           = true;
            ddlMetricDisposalCode.Enabled = true;
            ddlMetricRegStatus.Enabled    = true;
            ddlMetricUOM.Enabled          = true;
            ddlMetricCurrency.Enabled     = true;
            ddlMetricUOM.Enabled          = true;
            ddlMetricCurrency.Enabled     = true;
            ddlMetricCost.Enabled         = true;

            ddlMetricDisposalCode.Visible = ddlMetricRegStatus.Visible = tbWasteCode.Visible = true;
            tdRegStatusHdr.Visible        = tdRegStatus.Visible = ddlMetricRegStatus.Visible = true;
            tdWasteCodeHdr.Visible        = tdDisposalHdr.Visible = true;
            phCostWaste.Visible           = true;
            phMetricExt.Visible           = false;
            tdDisposal.Attributes.Add("Class", "required");
            tdRegStatus.Attributes.Add("Class", "required");
            tdUOM.Attributes.Add("Class", "required");
            tdCurrency.Attributes.Add("Class", "required");
            tdMetricCost.Attributes.Add("Class", "required");

            if (LocalProfile().CurrentEHSMeasure == null)
            {
                UpdateUOMSelects(key, "");
            }
            else
            {
                UpdateUOMSelects(key, LocalProfile().CurrentEHSMeasure.EFM_TYPE);
            }

            switch (key)
            {
            case "PROD":
            case "FACT":
                tbWasteCode.Text = "";
                ddlMetricDisposalCode.SelectedIndex = 0;
                ddlMetricRegStatus.SelectedIndex    = 0;
                ddlMetricCurrency.SelectedIndex     = 0;
                ddlMetricCost.SelectedIndex         = 0;
                ddlMetricUOM.SelectedIndex          = ddlMetricCost.SelectedIndex = ddlMetricCurrency.SelectedIndex = 0;
                tdRegStatusHdr.Visible = tdRegStatus.Visible = ddlMetricRegStatus.Visible = false;
                phCostWaste.Visible    = false;
                phMetricExt.Visible    = enableDefaults;
                break;

            case "SAFE":
                tbWasteCode.Text = "";
                ddlMetricDisposalCode.SelectedIndex = 0;
                ddlMetricRegStatus.SelectedIndex    = 0;
                ddlMetricCurrency.SelectedIndex     = 0;
                ddlMetricCost.SelectedIndex         = 0;
                ddlMetricUOM.SelectedIndex          = ddlMetricCost.SelectedIndex = ddlMetricCurrency.SelectedIndex = 0;
                tdRegStatusHdr.Visible = tdRegStatus.Visible = ddlMetricRegStatus.Visible = false;
                phCostWaste.Visible    = false;
                break;

            case "ENGY":
            case "EUTL":
                tbWasteCode.Enabled = false;
                tbWasteCode.Text    = "";
                ddlMetricDisposalCode.SelectedIndex = 0;
                ddlMetricDisposalCode.Enabled       = false;
                ddlMetricRegStatus.Enabled          = false;
                ddlMetricRegStatus.SelectedIndex    = 0;
                tdDisposal.Attributes.Remove("Class");
                tdRegStatus.Attributes.Remove("Class");
                ddlMetricDisposalCode.Visible = ddlMetricRegStatus.Visible = tbWasteCode.Visible = false;
                tdRegStatusHdr.Visible        = tdWasteCodeHdr.Visible = tdDisposalHdr.Visible = false;
                break;

            default:            // wastes
                phMetricExt.Visible = enableDefaults;
                break;
            }

            foreach (ListItem item in ddlMetricID.Items)
            {
                string[] parms = item.Value.Split('|');
                if (string.IsNullOrEmpty(item.Value) || parms[0] == key)
                {
                    item.Enabled = true;
                }
                else
                {
                    item.Enabled = false;
                }
            }

            if (e == null)      // from  measure binding
            {
                UpdateListTitles();
                udpMain.Update();
            }
        }
        private int SaveInputs(decimal targetPrmrID, bool commitChanges)
        {
            int              status = 0;
            LinkButton       lnk;
            HiddenField      hf;
            TextBox          tbValue, tbCost, tbCredit;
            CheckBox         cbDelete;
            decimal          decimalValue;
            DateTime         dateValue;
            decimal          prmrID;
            bool             hasReqdInputs  = true;
            bool             hasSaveWarning = false;
            bool             hasSaveError   = false;
            EHSProfileStatus saveStatus     = EHSProfileStatus.Normal;

            try
            {
                foreach (RepeaterItem item in rptProfilePeriod.Items)
                {
                    lnk    = (LinkButton)item.FindControl("lnkMetricCD");
                    prmrID = Convert.ToDecimal(lnk.CommandArgument);
                    EHS_PROFILE_MEASURE metric = LocalProfile().GetMeasure((decimal)prmrID);

                    if (prmrID == targetPrmrID || commitChanges)
                    {
                        Repeater rpt      = (Repeater)item.FindControl("rptProfileInput");
                        int      numInput = 0;
                        foreach (RepeaterItem inputItem in rpt.Items)
                        {
                            hf = (HiddenField)inputItem.FindControl("hfInputDate");
                            EHS_PROFILE_INPUT input = LocalProfile().InputPeriod.GetPeriodInput(prmrID, Convert.ToDateTime(hf.Value));
                            if (input != null)
                            {
                                RadDatePicker dtpFrom = (RadDatePicker)inputItem.FindControl("radDateFrom");
                                RadDatePicker dtpTo   = (RadDatePicker)inputItem.FindControl("radDateTo");
                                tbValue  = (TextBox)inputItem.FindControl("tbMetricValue");
                                tbCost   = (TextBox)inputItem.FindControl("tbMetricCost");
                                tbCredit = (TextBox)inputItem.FindControl("tbMetricCredit");
                                cbDelete = (CheckBox)inputItem.FindControl("cbDelete");
                                hf       = (HiddenField)inputItem.FindControl("hfStatus");
                                Control tr = new Control();

                                EHSProfileStatus inputStatus = EHSProfileStatus.Normal;
                                switch (metric.EHS_MEASURE.MEASURE_CATEGORY)
                                {
                                case "PROD":
                                case "SAFE":
                                case "FACT":
                                    if (dtpFrom.SelectedDate == null || dtpTo.SelectedDate == null)
                                    {
                                        inputStatus = EHSProfileStatus.Incomplete;
                                    }
                                    else if (string.IsNullOrEmpty(tbValue.Text.Trim()))
                                    {
                                        inputStatus = EHSProfileStatus.NoInputs;
                                    }
                                    break;

                                default:
                                    if (string.IsNullOrEmpty(tbValue.Text.Trim()))
                                    {
                                        if (string.IsNullOrEmpty(tbCost.Text.Trim() + tbCredit.Text.Trim()))
                                        {
                                            inputStatus = EHSProfileStatus.NoInputs;
                                        }
                                        else
                                        {
                                            inputStatus = EHSProfileStatus.Incomplete;
                                        }
                                    }
                                    else if (string.IsNullOrEmpty(tbCost.Text.Trim() + tbCredit.Text.Trim()))
                                    {
                                        inputStatus = EHSProfileStatus.Incomplete;
                                    }
                                    else if (dtpFrom.SelectedDate == null || dtpTo.SelectedDate == null)
                                    {
                                        inputStatus = EHSProfileStatus.Incomplete;
                                    }

                                    if (metric.EHS_PROFILE_MEASURE_EXT != null && (metric.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT.HasValue || metric.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT.HasValue))
                                    {
                                        if (inputStatus == EHSProfileStatus.Incomplete && (dtpFrom.SelectedDate == null || dtpTo.SelectedDate == null))
                                        {
                                            inputStatus = EHSProfileStatus.NoInputs;
                                        }
                                    }

                                    break;
                                }

                                if (inputStatus == EHSProfileStatus.NoInputs)
                                {
                                    LocalProfile().InputPeriod.DeletePeriodInput(input);
                                }
                                else if (inputStatus == EHSProfileStatus.Incomplete)
                                {
                                    hasSaveError = true;
                                    saveStatus   = EHSProfileStatus.Incomplete;
                                    dtpFrom.DateInput.Style.Add("BACKGROUND-COLOR", "LIGHTCORAL");
                                    dtpTo.DateInput.Style.Add("BACKGROUND-COLOR", "LIGHTCORAL");
                                    tbValue.Style.Add("BACKGROUND-COLOR", "LIGHTCORAL");
                                    if (tbCost.Enabled)
                                    {
                                        tbCost.Style.Add("BACKGROUND-COLOR", "LIGHTCORAL");
                                    }
                                    if (tbCredit.Enabled)
                                    {
                                        tbCredit.Style.Add("BACKGROUND-COLOR", "LIGHTCORAL");
                                    }
                                }

                                //if ((string.IsNullOrEmpty(tbValue.Text) || dtpFrom.SelectedDate == null || dtpTo.SelectedDate == null) || (string.IsNullOrEmpty(tbCost.Text + tbCredit.Text) && metric.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && metric.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && metric.EHS_MEASURE.MEASURE_CATEGORY != "FACT"))
                                //{
                                //    LocalProfile().InputPeriod.DeletePeriodInput(input);
                                //}
                                else
                                {
                                    ++numInput;

                                    if (cbDelete.Checked)
                                    {
                                        input.STATUS = "D";
                                    }
                                    else if (input.STATUS == "D")
                                    {
                                        input.STATUS = "A";
                                    }

                                    if (input.EFF_FROM_DT > DateTime.MinValue || input.EFF_FROM_DT != dtpFrom.SelectedDate)
                                    {
                                        input.EFF_FROM_DT = (DateTime)dtpFrom.SelectedDate;
                                    }

                                    if (input.EFF_TO_DT > DateTime.MinValue || input.EFF_TO_DT != dtpTo.SelectedDate)
                                    {
                                        input.EFF_TO_DT = (DateTime)dtpTo.SelectedDate;
                                    }

                                    if (SQMBasePage.ParseToDecimal(tbValue.Text, out decimalValue))
                                    {
                                        if (input.MEASURE_VALUE != decimalValue)
                                        {
                                            input.MEASURE_VALUE = decimalValue;
                                        }
                                    }
                                    if (!string.IsNullOrEmpty(tbCredit.Text))
                                    {
                                        SQMBasePage.ParseToDecimal(tbCredit.Text, out decimalValue);
                                        decimalValue = Math.Abs(decimalValue) * -1;
                                        if (!input.MEASURE_COST.HasValue || input.MEASURE_COST != decimalValue)
                                        {
                                            input.MEASURE_COST = decimalValue;
                                        }
                                    }
                                    else
                                    {
                                        SQMBasePage.ParseToDecimal(tbCost.Text, out decimalValue);
                                        decimalValue = Math.Abs(decimalValue);
                                        if (!input.MEASURE_COST.HasValue || input.MEASURE_COST != decimalValue)
                                        {
                                            input.MEASURE_COST = decimalValue;
                                        }
                                    }

                                    if (commitChanges && metric.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && metric.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && metric.EHS_MEASURE.MEASURE_CATEGORY != "FACT" && LocalProfile().CurrentStatus != EHSProfileStatus.OutOFRange)
                                    {
                                        if (!EHSModel.IsMeasureValueInRange(metric, (double)input.MEASURE_VALUE, 1.0))
                                        {
                                            hasSaveWarning = true;
                                            saveStatus     = EHSProfileStatus.OutOFRange;
                                            tbValue.Style.Add("BACKGROUND-COLOR", "CORNSILK");
                                        }
                                    }
                                }
                            }
                            if (metric != null && (bool)metric.IS_REQUIRED && numInput == 0)
                            {
                                hasReqdInputs = false;
                            }
                        }
                    }
                }

                if (commitChanges)
                {
                    if (hasSaveError)
                    {
                        MessageDisplay(saveStatus);
                        return(0);
                    }

                    if (hasSaveWarning)
                    {
                        MessageDisplay(saveStatus);
                        return(0);
                    }

                    // deleted inputs after approval
                    if ((!string.IsNullOrEmpty(hfNumDelete.Value) && hfNumDelete.Value != "0") && LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT.HasValue)
                    {
                        cbFinalApproval.Checked = false;
                    }
                    // changed inputs after approval
                    if ((!string.IsNullOrEmpty(hfNumChanged.Value) && hfNumChanged.Value != "0") && LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT.HasValue)
                    {
                        cbFinalApproval.Checked = false;
                    }

                    status = LocalProfile().UpdatePeriod(true, "", cbFinalApproval.Checked, SessionManager.UserContext.UserName());

                    if (status >= 0)
                    {
                        // option to finalize metrics
                        SETTINGS sets = SQMSettings.GetSetting("EHS", "INPUTFINALIZE");
                        if (sets != null)
                        {
                            bool     doRollup = false;
                            DateTime lastUpdateDate;
                            LocalProfile().PeriodStatus(new string[0] {
                            }, false, out lastUpdateDate);
                            switch (sets.VALUE.ToUpper())
                            {
                            case "ANY":         // finalize any inputs
                                doRollup = true;
                                break;

                            case "ANY_CURRENCY":           // finalize any inputs and if the exchange rate for the period exists
                                if (LocalProfile().InputPeriod.PeriodExchangeRate(LocalProfile().Plant) != null)
                                {
                                    doRollup = true;
                                }
                                break;

                            case "REQD":        // finalize only when all required inputs have been entered
                                if (LocalProfile().InputPeriod.IsRequiredComplete())
                                {
                                    doRollup = true;
                                }
                                break;

                            case "REQD_CURRENCY":           // finalize only when all required inputs are entered and exchange rate for the period exists
                                if (LocalProfile().InputPeriod.IsRequiredComplete() && LocalProfile().InputPeriod.PeriodExchangeRate(LocalProfile().Plant) != null)
                                {
                                    doRollup = true;
                                }
                                break;

                            default:
                                break;
                            }
                            if (doRollup && LocalProfile().ValidPeriod())
                            {
                                status = LocalProfile().UpdateMetricHistory(LocalProfile().InputPeriod.PeriodDate);  // new roll-up logic
                            }
                        }
                    }

                    if (status >= 0)
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveSuccess');", true);
                        hasSaveWarning = false;  // cancel warning to allow re-save
                        MessageDisplay(0);
                        LoadProfileInput(LocalProfile().InputPeriod.PeriodDate, EHSProfileStatus.Normal);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveError');", true);
                        MessageDisplay(0);
                        ClearInput();
                    }
                }
            }
            catch (Exception ex)
            {
                //   SQMLogger.LogException(ex);
                status = -1;
            }

            BindSharedCalendars();

            return(status);
        }
        public void rptProfileInput_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                try
                {
                    EHS_PROFILE_INPUT   input  = (EHS_PROFILE_INPUT)e.Item.DataItem;
                    EHS_PROFILE_MEASURE metric = LocalProfile().GetMeasure((decimal)input.PRMR_ID);

                    Label      lbl;
                    LinkButton lnk;
                    //TextBox tb;
                    DropDownList ddl;

                    // bool enabled = input.STATUS == "C" ? false : true;
                    bool enabled = true;
                    sharedCalendar.Visible = true;

                    RadDatePicker dtp1 = (RadDatePicker)e.Item.FindControl("radDateFrom");
                    dtp1.SharedCalendar   = sharedCalendar;
                    dtp1.Enabled          = enabled;
                    dtp1.ShowPopupOnFocus = true;

                    RadDatePicker dtp2 = (RadDatePicker)e.Item.FindControl("radDateTo");
                    dtp2.SharedCalendar   = sharedCalendar;
                    dtp2.Enabled          = enabled;
                    dtp2.ShowPopupOnFocus = true;

                    SETTINGS sets       = SQMSettings.GetSetting("EHS", "INPUTSPAN");
                    int      inputspan  = 0;
                    int      monthSpan1 = Convert.ToInt32(WebSiteCommon.GetXlatValue("invoiceSpan", "MINDATE"));
                    int      monthSpan2 = monthSpan1;
                    if (sets != null && int.TryParse(sets.VALUE, out inputspan))
                    {
                        monthSpan2 = monthSpan1 = inputspan;
                    }
                    dtp1.MinDate = LocalProfile().InputPeriod.PeriodDate.AddMonths(monthSpan1 * -1);
                    dtp2.MinDate = LocalProfile().InputPeriod.PeriodDate.AddMonths(monthSpan2 * -1);

                    if (inputspan > 0)
                    {
                        dtp1.MaxDate = dtp2.MaxDate = LocalProfile().InputPeriod.PeriodDate.AddMonths(inputspan);
                    }
                    else
                    {
                        dtp1.MaxDate = dtp2.MaxDate = LocalProfile().InputPeriod.PeriodDate.AddMonths(Convert.ToInt32(WebSiteCommon.GetXlatValue("invoiceSpan", "MAXDATE")));
                    }

                    dtp1.Culture = System.Threading.Thread.CurrentThread.CurrentUICulture;
                    if (input != null)
                    {
                        if (input.STATUS == "N")
                        {
                            dtp1.Focus();
                        }
                        if (input.EFF_FROM_DT > DateTime.MinValue)
                        {
                            dtp1.SelectedDate = input.EFF_FROM_DT;
                        }
                        else
                        {
                            dtp1.FocusedDate = new DateTime(LocalProfile().InputPeriod.PeriodYear, LocalProfile().InputPeriod.PeriodMonth, 1);
                        }
                    }

                    dtp2.Culture = System.Threading.Thread.CurrentThread.CurrentUICulture;
                    if (input != null && input.EFF_TO_DT > DateTime.MinValue)
                    {
                        dtp2.SelectedDate = input.EFF_TO_DT;
                    }
                    else
                    {
                        dtp2.FocusedDate = new DateTime(LocalProfile().InputPeriod.PeriodYear, LocalProfile().InputPeriod.PeriodMonth, 1);
                    }


                    UOM uom = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == input.UOM);
                    if (uom != null)
                    {
                        lbl      = (Label)e.Item.FindControl("lblMetricUOM");
                        lbl.Text = uom.UOM_CD;
                    }

                    lbl      = (Label)e.Item.FindControl("lblMetricCurrency");
                    lbl.Text = metric.DEFAULT_CURRENCY_CODE;

                    if (input != null)
                    {
                        lbl.Text = input.CURRENCY_CODE;
                    }

                    TextBox tbValue = (TextBox)e.Item.FindControl("tbMetricValue");
                    tbValue.Enabled = enabled;
                    if (input != null && (dtp1.SelectedDate != null && dtp2.SelectedDate != null))
                    {
                        //if (input != null && input.MEASURE_VALUE != null)
                        tbValue.Text = SQMBasePage.FormatValue((decimal)input.MEASURE_VALUE, 2);
                    }

                    TextBox tbCost   = (TextBox)e.Item.FindControl("tbMetricCost");
                    TextBox tbCredit = (TextBox)e.Item.FindControl("tbMetricCredit");

                    if ((bool)metric.NEG_VALUE_ALLOWED)
                    {
                        tbCredit.Visible = tbCredit.Enabled = enabled;
                        tbCost.Enabled   = false;
                    }
                    else
                    {
                        tbCredit.Visible = false;
                        tbCost.Enabled   = true;
                    }

                    if (input != null && input.MEASURE_COST.HasValue && input.MEASURE_COST < 0)
                    {
                        tbCredit.Text = SQMBasePage.FormatValue((decimal)input.MEASURE_COST * -1, 2);
                    }

                    if (input != null && input.MEASURE_COST.HasValue && input.MEASURE_COST >= 0)
                    {
                        tbCost.Text = SQMBasePage.FormatValue((decimal)input.MEASURE_COST, 2);
                    }

                    if (metric.EHS_MEASURE.MEASURE_CATEGORY == "PROD" || metric.EHS_MEASURE.MEASURE_CATEGORY == "SAFE" || metric.EHS_MEASURE.MEASURE_CATEGORY == "FACT")
                    {
                        dtp1.SelectedDate = new DateTime(LocalProfile().InputPeriod.PeriodYear, LocalProfile().InputPeriod.PeriodMonth, 1);
                        dtp1.Enabled      = false;
                        dtp2.SelectedDate = new DateTime(LocalProfile().InputPeriod.PeriodYear, LocalProfile().InputPeriod.PeriodMonth, DateTime.DaysInMonth(LocalProfile().InputPeriod.PeriodYear, LocalProfile().InputPeriod.PeriodMonth));
                        dtp2.Enabled      = false;
                        tbCost.Visible    = false;
                        tbCredit.Visible  = false;
                        lbl         = (Label)e.Item.FindControl("lblMetricCurrency");
                        lbl.Visible = false;
                    }

                    if (LocalProfile().GetMeasureExt(metric, DateTime.Now) != null && metric.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT.HasValue)
                    {
                        tbValue.CssClass = "defaultText";
                        tbValue.ToolTip  = hfDefaultValue.Value + metric.EHS_PROFILE_MEASURE_EXT.NOTE;
                        tbValue.ReadOnly = metric.EHS_PROFILE_MEASURE_EXT.OVERRIDE_ALLOWED == true ? false : true;
                        if (string.IsNullOrEmpty(tbValue.Text))
                        {
                            tbValue.Text = SQMBasePage.FormatValue((decimal)metric.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT, 2);
                        }
                    }
                    if (LocalProfile().GetMeasureExt(metric, DateTime.Now) != null && metric.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT.HasValue)
                    {
                        tbCost.CssClass = "defaultText";
                        tbCost.ToolTip  = hfDefaultValue.Value + metric.EHS_PROFILE_MEASURE_EXT.NOTE;
                        tbCost.ReadOnly = metric.EHS_PROFILE_MEASURE_EXT.OVERRIDE_ALLOWED == true ? false : true;
                        if (string.IsNullOrEmpty(tbCost.Text))
                        {
                            tbCost.Text = SQMBasePage.FormatValue((decimal)metric.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT, 2);
                        }
                    }

                    CheckBox cbDelete = (CheckBox)e.Item.FindControl("cbDelete");
                    //string cbId = "ctl00_ContentPlaceHolder_Body_rptProfilePeriod_ctl06_rptProfileInput_ctl01_cbDelete";
                    cbDelete.Attributes.Add("onClick", "CheckInputDelete('" + cbDelete.ClientID + "');");
                    if (input.STATUS == "A" || input.STATUS == "D")
                    {
                        cbDelete.Enabled = true;
                    }

                    if (input.STATUS == "D")
                    {
                        cbDelete.Checked  = true;
                        cbDelete.ToolTip  = hfDeleteText.Value;
                        hfNumDelete.Value = (Convert.ToInt32(hfNumDelete.Value) + 1).ToString();
                    }
                }
                catch (Exception ex)
                {
                    ;
                }
            }
        }
        private void SetupPage()
        {
            if (ddlPlantSelect.Items.Count < 1)
            {
                List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true);
                SQMBasePage.SetLocationList(ddlPlantSelect, UserContext.FilterPlantAccessList(locationList), 0);

                rcbStatusSelect.SelectedValue = "A";
                rcbFindingsSelect.FindItemByValue("A").Checked = true;
            }
            divIncidentList.Visible = true;
            pnlChartSection.Style.Add("display", "none");
            lblChartType.Visible = ddlChartType.Visible = false;

            dmFromDate.ShowPopupOnFocus = dmToDate.ShowPopupOnFocus = true;
            dmFromDate.SelectedDate     = DateTime.Now.AddMonths(-11);
            dmToDate.SelectedDate       = DateTime.Now;

            if (Mode == IncidentMode.Incident)
            {
                lblViewEHSRezTitle.Text  = "Manage Environmental Health &amp; Safety Incidents";
                lblPageInstructions.Text = "Add or update EH&amp;S Incidents below.";
                //lblStatus.Text = "Incident Status:";
                rbNew.Text = "New Incident";
                lblIncidentDate.Visible   = true;
                lblInspectionDate.Visible = false;
                phPrevent.Visible         = false;
                phIncident.Visible        = true;

                SETTINGS sets = SQMSettings.GetSetting("EHS", "INCIDENTSEARCHFROM");
                if (sets != null)
                {
                    try
                    {
                        string[] args = sets.VALUE.Split('-');
                        if (args.Length > 1)
                        {
                            dmFromDate.SelectedDate = new DateTime(Convert.ToInt32(args[0]), Convert.ToInt32(args[1]), Convert.ToInt32(args[2]));
                        }
                        else
                        {
                            dmFromDate.SelectedDate = DateTime.Now.AddMonths(Convert.ToInt32(args[0]) * -1);
                        }
                    }
                    catch { }
                }

                foreach (INCIDENT_TYPE ip in EHSIncidentMgr.SelectIncidentTypeList(SessionManager.PrimaryCompany().COMPANY_ID))
                {
                    RadComboBoxItem item = new RadComboBoxItem(ip.TITLE, ip.INCIDENT_TYPE_ID.ToString());
                    item.Checked = true;
                    rcbIncidentType.Items.Add(item);
                }

                // lookup charts defined for this module & app context
                PERSPECTIVE_VIEW view = ViewModel.LookupView(entities, "HSIR", "HSIR", 0);
                if (view != null)
                {
                    ddlChartType.Items.Clear();
                    ddlChartType.Items.Add(new RadComboBoxItem("", ""));
                    foreach (PERSPECTIVE_VIEW_ITEM vi in view.PERSPECTIVE_VIEW_ITEM.Where(l => l.STATUS != "I").OrderBy(l => l.ITEM_SEQ).ToList())
                    {
                        RadComboBoxItem item = new RadComboBoxItem();
                        item.Text     = vi.TITLE;
                        item.Value    = vi.ITEM_SEQ.ToString();
                        item.ImageUrl = ViewModel.GetViewItemImageURL(vi);
                        ddlChartType.Items.Add(item);
                    }
                }
            }
            else if (Mode == IncidentMode.Prevent)
            {
                lblViewEHSRezTitle.Text  = "Manage Preventative Actions";
                lblPageInstructions.Text = "Add or update preventative actions below.";
                //lblStatus.Text = "Findings Status:";
                rbNew.Text = "New Preventative Action";
                lblIncidentDate.Visible   = false;
                lblInspectionDate.Visible = true;
                phPrevent.Visible         = true;
                phIncident.Visible        = false;

                SETTINGS sets = SQMSettings.GetSetting("EHS", "ACTIONSEARCHFROM");
                if (sets != null)
                {
                    try
                    {
                        string[] args = sets.VALUE.Split('-');
                        if (args.Length > 1)
                        {
                            dmFromDate.SelectedDate = new DateTime(Convert.ToInt32(args[0]), Convert.ToInt32(args[1]), Convert.ToInt32(args[2]));
                        }
                        else
                        {
                            dmFromDate.SelectedDate = DateTime.Now.AddMonths(Convert.ToInt32(args[0]) * -1);
                        }
                    }
                    catch { }
                }

                // workaround for persistance mgr not supporting raddate controls
                if (HSCalcs() != null)
                {
                    dmFromDate.SelectedDate = HSCalcs().FromDate;
                    dmToDate.SelectedDate   = HSCalcs().ToDate;
                    if (HSCalcs().ObjAny != null && HSCalcs().ObjAny is bool)
                    {
                        cbShowImage.Checked = (bool)HSCalcs().ObjAny;
                    }
                }

                // lookup charts defined for this module & app context
                PERSPECTIVE_VIEW view = ViewModel.LookupView(entities, "HSCA", "HSCA", 0);
                if (view != null)
                {
                    ddlChartType.Items.Clear();
                    ddlChartType.Items.Add(new RadComboBoxItem("", ""));
                    foreach (PERSPECTIVE_VIEW_ITEM vi in view.PERSPECTIVE_VIEW_ITEM.Where(l => l.STATUS != "I").OrderBy(l => l.ITEM_SEQ).ToList())
                    {
                        RadComboBoxItem item = new RadComboBoxItem();
                        item.Text     = vi.TITLE;
                        item.Value    = vi.ITEM_SEQ.ToString();
                        item.ImageUrl = ViewModel.GetViewItemImageURL(vi);
                        ddlChartType.Items.Add(item);
                    }
                }
            }

            if (UserContext.GetMaxScopePrivilege(SysScope.incident) <= SysPriv.action)
            {
                uclExport.Visible = true;
            }
            else
            {
                uclExport.Visible = false;
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            bool createIncidentAccess = SessionManager.CheckUserPrivilege(SysPriv.originate, SysScope.incident);

            if (rbNew.Visible)
            {
                rbNew.Visible = createIncidentAccess;
            }

            if (SessionManager.UserContext.Person.PERSON_ID == 1)
            {
                SETTINGS sets = SQMSettings.GetSetting("EHS", "CONVERSION");
                if (sets != null && (sets.VALUE.ToUpper() == "Y" || sets.VALUE.ToUpper() == "TRUE"))
                {
                    btnConversion.Visible = true;
                }
            }


            if (IsPostBack)
            {
                RadPersistenceManager1.StorageProviderKey = SessionManager.UserContext.Person.PERSON_ID.ToString();
                RadPersistenceManager1.SaveState();

                if (SessionManager.ReturnStatus == true)
                {
                    if (SessionManager.ReturnObject is string)
                    {
                        string type = SessionManager.ReturnObject as string;
                        switch (type)
                        {
                        case "DisplayIncidents":
                            UpdateDisplayState(DisplayState.IncidentList, 0);
                            break;

                        default:
                            break;
                        }
                    }
                    SessionManager.ClearReturns();
                }
            }
            else
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("EHS", 2, true, true, "");
                }

                if (!string.IsNullOrEmpty(Request.QueryString["r"]))                   // incident Record id is supplied from email notification
                {
                    string  targetRec = Request.QueryString["r"];
                    decimal targetRecID;
                    if (decimal.TryParse(targetRec, out targetRecID))
                    {
                        UpdateDisplayState(DisplayState.IncidentNotificationEdit, targetRecID);
                    }
                }
                else if (!string.IsNullOrEmpty(Request.QueryString["a"]))                   // incident Record id is supplied from incident ALERT email notification
                {
                    string  targetRec = Request.QueryString["a"];
                    decimal targetRecID;
                    if (decimal.TryParse(targetRec, out targetRecID))
                    {
                        // Change this from alert mode to edit mode on email url requiest because of client requirement.
                        //UpdateDisplayState(DisplayState.IncidentAlert, targetRecID);
                        UpdateDisplayState(DisplayState.IncidentNotificationEdit, targetRecID);
                    }
                }
                else if (SessionManager.ReturnStatus == true && SessionManager.ReturnObject is string)
                {
                    // from inbox ?
                    decimal targetRecID;
                    if (decimal.TryParse(SessionManager.ReturnObject.ToString(), out targetRecID))
                    {
                        SessionManager.ClearReturns();
                        UpdateDisplayState(DisplayState.IncidentNotificationEdit, targetRecID);
                    }
                    else
                    {
                        DisplayNonPostback();
                    }
                }
                else
                {
                    DisplayNonPostback();
                }
            }
        }
Esempio n. 17
0
        public void gvNotifyList_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString())))
            {
                RadComboBox rdl1, rdl2;

                System.Web.UI.WebControls.HiddenField hfField = new HiddenField();
                try
                {
                    HiddenField hf  = (HiddenField)e.Row.Cells[0].FindControl("hfScope");
                    Label       lbl = (Label)e.Row.Cells[0].FindControl("lblScope");
                    lbl.Text = WebSiteCommon.GetXlatValue("taskRecordType", hf.Value);
                    lbl      = (Label)e.Row.Cells[0].FindControl("lblScopeDesc");
                    lbl.Text = WebSiteCommon.GetXlatValueLong("taskRecordType", hf.Value);

                    TaskRecordType scope = (TaskRecordType)Enum.Parse(typeof(TaskRecordType), hf.Value, true);

                    if (scope == TaskRecordType.InternalQualityIncident ||
                        scope == TaskRecordType.CustomerQualityIncident ||
                        scope == TaskRecordType.SupplierQualityIncident ||
                        scope == TaskRecordType.HealthSafetyIncident ||
                        scope == TaskRecordType.PreventativeAction)
                    {
                        rdl1 = (RadComboBox)e.Row.Cells[0].FindControl("ddlNotify1");
                        hf   = (HiddenField)e.Row.Cells[0].FindControl("hfNotify1");
                        if (scope == TaskRecordType.HealthSafetyIncident || scope == TaskRecordType.PreventativeAction)
                        {
                            SQMBasePage.SetPersonList(rdl1, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "EHS"), "", 20);
                        }
                        else
                        {
                            SQMBasePage.SetPersonList(rdl1, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "SQM"), "", 20);
                        }

                        SQMBasePage.DisplayControlValue(rdl1, hf.Value, PageUseMode.EditEnabled, "");
                        rdl1.Visible = true;

                        rdl2 = (RadComboBox)e.Row.Cells[0].FindControl("ddlNotify2");
                        hf   = (HiddenField)e.Row.Cells[0].FindControl("hfNotify2");
                        if (scope == TaskRecordType.HealthSafetyIncident || scope == TaskRecordType.PreventativeAction)
                        {
                            SQMBasePage.SetPersonList(rdl2, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "EHS"), "", 20);
                        }
                        else
                        {
                            SQMBasePage.SetPersonList(rdl2, SQMModelMgr.FilterPersonListByAppContext(staticPersonList, "SQM"), "", 20);
                        }
                        SQMBasePage.DisplayControlValue(rdl2, hf.Value, PageUseMode.EditEnabled, "");
                        rdl2.Visible = true;
                    }

                    if (scope == TaskRecordType.ProfileInput ||
                        scope == TaskRecordType.ProfileInputApproval ||
                        scope == TaskRecordType.HealthSafetyIncident ||
                        scope == TaskRecordType.PreventativeAction ||
                        scope == TaskRecordType.ProblemCase)
                    {
                        SETTINGS sets = SQMSettings.GetSetting("COMPANY", "ESCALATEANYUSER");

                        rdl1 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalate1");
                        hf   = (HiddenField)e.Row.Cells[0].FindControl("hfEscalate1");
                        SQMBasePage.SetPersonList(rdl1, staticPersonList.Where(l => l.RCV_ESCALATION == true || (sets != null && sets.VALUE.ToUpper() == "Y")).ToList(), "", 20);
                        SQMBasePage.DisplayControlValue(rdl1, hf.Value, PageUseMode.EditEnabled, "");
                        rdl1.Visible = true;

                        rdl2 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalate2");
                        hf   = (HiddenField)e.Row.Cells[0].FindControl("hfEscalate2");
                        SQMBasePage.SetPersonList(rdl2, staticPersonList.Where(l => l.RCV_ESCALATION == true || (sets != null && sets.VALUE.ToUpper() == "Y")).ToList(), "", 20);
                        SQMBasePage.DisplayControlValue(rdl2, hf.Value, PageUseMode.EditEnabled, "");
                        rdl2.Visible = true;

                        rdl1 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalateDays1");
                        hf   = (HiddenField)e.Row.Cells[0].FindControl("hfEscalateDays1");
                        rdl1.Items.Add(new RadComboBoxItem("", ""));
                        rdl1.Items.AddRange(WebSiteCommon.PopulateComboBoxListNums(1, 14, rdl1.EmptyMessage));
                        SQMBasePage.DisplayControlValue(rdl1, hf.Value, PageUseMode.EditEnabled, "");
                        rdl1.Visible = true;

                        rdl2 = (RadComboBox)e.Row.Cells[0].FindControl("ddlEscalateDays2");
                        hf   = (HiddenField)e.Row.Cells[0].FindControl("hfEscalateDays2");
                        rdl2.Items.Add(new RadComboBoxItem("", ""));
                        rdl2.Items.AddRange(WebSiteCommon.PopulateComboBoxListNums(1, 14, rdl2.EmptyMessage));
                        SQMBasePage.DisplayControlValue(rdl2, hf.Value, PageUseMode.EditEnabled, "");
                        rdl2.Visible = true;
                    }
                }
                catch
                {
                }
            }
        }
Esempio n. 18
0
        protected void DisplayUser()
        {
            PERSON           person = LocalPerson();
            BusinessLocation businessLocation;
            SETTINGS         sets      = SQMSettings.GetSetting("COMPANY", "ESCALATEANYUSER");
            SQM_ACCESS       sysAccess = SQMModelMgr.LookupCredentials(entities, person.SSO_ID, "", false);

            divPageBody.Visible = true;
            ddlPlantSelect.ClearCheckedItems();

            DisplayErrorMessage(null);

            if (person == null || string.IsNullOrEmpty(person.STATUS))                 // new user
            {
                winUserEdit.Title        = hfAddUser.Value;
                businessLocation         = new BusinessLocation();
                businessLocation.Company = SessionManager.EffLocation.Company;
                SetStatusList("ddlUserStatus", "A", true);
                tbUserSSOID.Enabled = true;
                tbUserSSOID.Text    = "";
                tbUserSSOID.Focus();
            }
            else
            {
                winUserEdit.Title   = hfUpdateUser.Value;
                tbUserSSOID.Enabled = false;
                tbUserFirstName.Focus();

                lblPlantAccess.Text = "";
                if (person.PLANT_ID > 0)
                {
                    ddlHRLocation.SelectedValue = person.PLANT_ID.ToString();
                    if (ddlPlantSelect.Items.FindItemByValue(person.PLANT_ID.ToString()) != null)
                    {
                        ddlPlantSelect.Items.FindItemByValue(person.PLANT_ID.ToString()).Checked = true;
                    }
                }

                if (!string.IsNullOrEmpty(person.NEW_LOCATION_CD))
                {
                    RadComboBoxItem plantItem = null;
                    string[]        locs      = person.NEW_LOCATION_CD.Split(',');
                    foreach (string locid in locs)
                    {
                        if ((plantItem = ddlPlantSelect.Items.FindItemByValue(locid)) != null)
                        {
                            ddlPlantSelect.Items.FindItemByValue(locid).Checked = true;
                            if (locs.Length > 2)
                            {
                                lblPlantAccess.Text += lblPlantAccess.Text.Length == 0 ? plantItem.Text : (", " + plantItem.Text);
                            }
                        }
                    }
                }
            }

            // AW20131106 - do not want to be able to change a SSO ID once a person has been added
            if (!string.IsNullOrEmpty(person.SSO_ID.Trim()))
            {
                tbUserSSOID.Text = person.SSO_ID;
            }

            tbUserFirstName.Text  = person.FIRST_NAME;
            tbUserLastName.Text   = person.LAST_NAME;
            tbUserMiddleName.Text = !string.IsNullOrEmpty(person.MIDDLE_NAME) ? person.MIDDLE_NAME : "";
            if (ddlJobCode.Items.FindItemByValue(person.JOBCODE_CD) != null)
            {
                ddlJobCode.SelectedValue = person.JOBCODE_CD;
            }
            else
            {
                ddlJobCode.SelectedValue = "";
            }

            if (ddlPrivGroup.Items.FindItemByValue(person.PRIV_GROUP) != null)
            {
                ddlPrivGroup.SelectedValue = person.PRIV_GROUP;
            }
            else
            {
                ddlPrivGroup.SelectedValue = "";
            }

            tbUserPhone.Text = person.PHONE;
            tbUserEmail.Text = person.EMAIL;
            tbEmpID.Text     = person.EMP_ID;
            tbSupvEmpID.Text = person.SUPV_EMP_ID;
            SetStatusList("ddlUserStatus", person.STATUS, true);
            if (sysAccess != null && sysAccess.LAST_LOGON_DT.HasValue)
            {
                lblUserLoginDate_out.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)sysAccess.LAST_LOGON_DT, WebSiteCommon.GetXlatValue("timeZone", person.PREFERRED_TIMEZONE)), "g", true);
            }
            else
            {
                lblUserLoginDate_out.Text = "";
            }
            lblUserLastUpdate.Text = person.LAST_UPD_BY + "  " + SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)person.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "g", true);

            if (ddlUserLanguage.Items.FindByValue(person.PREFERRED_LANG_ID.ToString()) != null)
            {
                ddlUserLanguage.SelectedValue = person.PREFERRED_LANG_ID.ToString();
            }
            if (ddlUserTimezone.Items.FindByValue(person.PREFERRED_TIMEZONE) != null)
            {
                ddlUserTimezone.SelectedValue = person.PREFERRED_TIMEZONE;
            }


            List <SysModule> sysmodList = SQMSettings.SystemModuleItems();
            string           prod = "";
            RadComboBoxItem  item = null; RadComboBoxItem itemSep = null;

            lblPrivScope.Text = "";
            if (person.PRIV_GROUP != null)
            {
                foreach (PRIVLIST jp in SQMModelMgr.SelectPrivList(person.PRIV_GROUP).ToList())
                {
                    lblPrivScope.Text += (" " + ((SysPriv)jp.PRIV).ToString() + ": " + jp.SCOPE + ",");
                }
            }
            lblPrivScope.Text = lblPrivScope.Text.TrimEnd(',');

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

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
        }
Esempio n. 19
0
        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();

                    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;

                    if (UserContext.RoleAccess() > AccessMode.None)
                    {
                        RadMenuItem HomeMenu = new RadMenuItem("Home");
                        RadMenu1.Items.Add(HomeMenu);
                        if (UserContext.RoleAccess() != AccessMode.Partner)
                        {
                            HomeMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Dashboard", "/Home/Dashboard.aspx"));
                        }
                        HomeMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Calendar", "/Home/Calendar.aspx"));
                        // HomeMenu.Items.Add(new Telerik.Web.UI.RadMenuItem(inboxLabel, "/Home/Inbox.aspx"));
                    }

                    if (UserContext.CheckAccess("CQM", "101") >= AccessMode.Admin)
                    {
                        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.RoleAccess() == AccessMode.SA)
                        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.CheckAccess("SQM", "") > AccessMode.Limited)
                    {
                        RadMenuItem SQMMenu = new RadMenuItem("Quality");
                        RadMenu1.Items.Add(SQMMenu);
                        if (UserContext.CheckAccess("SQM", "201") > AccessMode.Plant)
                        {
                            SQMMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Library", "/Quality/Quality_Resources.aspx"));
                        }
                        if (UserContext.CheckAccess("SQM", "201") > AccessMode.Plant)
                        {
                            SQMMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Parts", "/Admin/Administrate_ViewPart.aspx"));
                        }
                        if (UserContext.CheckAccess("SQM", "211") > AccessMode.Limited)
                        {
                            SQMMenu.Items.Add(new Telerik.Web.UI.RadMenuItem(SQMSettings.GetSetting("QS", "3").XLAT_SHORT, "/Quality/Quality_Issue.aspx?c=RCV"));
                        }
                        if (UserContext.CheckAccess("SQM", "212") > AccessMode.Limited)
                        {
                            SQMMenu.Items.Add(new Telerik.Web.UI.RadMenuItem(SQMSettings.GetSetting("QS", "4").XLAT_SHORT, "/Quality/Quality_Issue.aspx?c=CST"));
                        }
                        if (UserContext.CheckAccess("SQM", "220") > AccessMode.Admin)
                        {
                            SQMMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Cost Reporting", "/Quality/Quality_CostRecord.aspx"));
                        }
                        if (UserContext.CheckAccess("SQM", "221") > AccessMode.Limited)
                        {
                            SQMMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Problem Control", "/Problem/Problem_Case.aspx?c=QI"));
                        }
                    }

                    if (UserContext.CheckAccess("EHS", "") > AccessMode.Limited)
                    {
                        RadMenuItem EHSMenu = new RadMenuItem("Environmental, Health & Safety");
                        RadMenu1.Items.Add(EHSMenu);
                        if (UserContext.CheckAccess("EHS", "301") > AccessMode.Plant)
                        {
                            EHSMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Library", "/EHS/EHS_Resources.aspx"));
                        }
                        if (UserContext.CheckAccess("EHS", "301") >= AccessMode.Plant)
                        {
                            EHSMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Metric Profiles", "/EHS/EHS_Profile.aspx"));
                        }
                        if (UserContext.CheckAccess("EHS", "311") > AccessMode.Limited)
                        {
                            EHSMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Data Input", "/EHS/EHS_MetricInput.aspx"));
                        }
                        if (UserContext.CheckAccess("EHS", "311") > AccessMode.Limited)
                        {
                            EHSMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Plant Analytics", "/EHS/EHS_ENVReport.aspx"));
                        }
                        if (UserContext.CheckAccess("EHS", "312") > AccessMode.Limited)
                        {
                            EHSMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Incidents", "/EHS/EHS_Incidents.aspx"));
                        }
                        if (UserContext.CheckAccess("EHS", "313") > AccessMode.Limited)
                        {
                            EHSMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Preventative Actions", "/EHS/EHS_Incidents.aspx?mode=prevent"));
                        }
                        if (UserContext.CheckAccess("EHS", "301") > AccessMode.Plant)
                        {
                            EHSMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Console", "/EHS/EHS_Console.aspx?c=EHS"));
                        }
                    }

                    /*
                     * if (UserContext.CheckAccess("EHS", "") > AccessMode.Limited)
                     * {
                     *  RadMenuItem ENVMenu = new RadMenuItem("Environmental");
                     *  RadMenu1.Items.Add(ENVMenu);
                     *  if (UserContext.CheckAccess("EHS", "301") > AccessMode.Plant)
                     *      ENVMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Library", "/EHS/EHS_Resources.aspx"));
                     *  if (UserContext.CheckAccess("EHS", "301") >= AccessMode.Plant)
                     *      ENVMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Metric Profiles", "/EHS/EHS_Profile.aspx"));
                     *  if (UserContext.CheckAccess("EHS", "311") > AccessMode.Limited)
                     *      ENVMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Metric Input", "/EHS/EHS_MetricInput.aspx"));
                     *  if (UserContext.CheckAccess("EHS", "311") > AccessMode.Limited)
                     *      ENVMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Plant Analytics", "/EHS/EHS_ENVReport.aspx"));
                     *  if (UserContext.CheckAccess("EHS", "301") > AccessMode.Plant)
                     *      ENVMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Console", "/EHS/EHS_Console.aspx?c=EHS"));
                     *
                     *  RadMenuItem EHSMenu = new RadMenuItem("Health & Safety");
                     *  RadMenu1.Items.Add(EHSMenu);
                     *  if (UserContext.CheckAccess("EHS", "312") > AccessMode.Limited)
                     *      EHSMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Incidents", "/EHS/EHS_Incidents.aspx"));
                     *  if (UserContext.CheckAccess("EHS", "313") > AccessMode.Limited)
                     *                               EHSMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Preventative Actions", "/EHS/EHS_Incidents.aspx?mode=prevent"));
                     *  if (UserContext.CheckAccess("EHS", "301") > AccessMode.Plant)
                     *      EHSMenu.Items.Add(new Telerik.Web.UI.RadMenuItem("Console", "/EHS/EHS_Console.aspx?c=EHS"));
                     * }
                     */

                    string menuQualityActive = System.Configuration.ConfigurationManager.AppSettings["MenuQualityActive"];
                    if (!string.IsNullOrEmpty(menuQualityActive) && menuQualityActive.ToUpper() == "FALSE")
                    {
                        foreach (RadMenuItem mi in RadMenu1.Items)
                        {
                            if (mi.Text.Contains("Quality"))
                            {
                                mi.Visible = false;
                            }
                        }
                    }

                    string menuEHSActive = System.Configuration.ConfigurationManager.AppSettings["MenuEHSActive"];
                    if (!string.IsNullOrEmpty(menuEHSActive) && menuEHSActive.ToUpper() == "FALSE")
                    {
                        foreach (RadMenuItem mi in RadMenu1.Items)
                        {
                            if (mi.Text.Contains("Environ"))
                            {
                                mi.Visible = false;
                            }
                        }
                    }

                    string menuENVReportActive = System.Configuration.ConfigurationManager.AppSettings["MenuENVReportActive"];
                    if (!string.IsNullOrEmpty(menuENVReportActive) && menuENVReportActive.ToUpper() == "FALSE")
                    {
                        foreach (RadMenuItem mi in RadMenu1.Items)
                        {
                            foreach (RadMenuItem ms in mi.Items)
                            {
                                if (ms.NavigateUrl.EndsWith("EHS_ENVReport.aspx"))
                                {
                                    ms.Visible = false;
                                }
                            }
                        }
                    }

                    string menuEHSIncidentActive = System.Configuration.ConfigurationManager.AppSettings["MenuEHSIncidentActive"];
                    if (!string.IsNullOrEmpty(menuEHSIncidentActive) && menuEHSIncidentActive.ToUpper() == "FALSE")
                    {
                        foreach (RadMenuItem mi in RadMenu1.Items)
                        {
                            foreach (RadMenuItem ms in mi.Items)
                            {
                                if (ms.NavigateUrl.EndsWith("EHS_Incidents.aspx"))
                                {
                                    ms.Visible = false;
                                }
                            }
                        }
                    }

                    string menuPreventativeActive = System.Configuration.ConfigurationManager.AppSettings["MenuPreventativeActive"];
                    if (string.IsNullOrEmpty(menuPreventativeActive) ||
                        (!string.IsNullOrEmpty(menuPreventativeActive) && menuPreventativeActive.ToUpper() == "FALSE"))
                    {
                        foreach (RadMenuItem mi in RadMenu1.Items)
                        {
                            foreach (RadMenuItem ms in mi.Items)
                            {
                                if (ms.NavigateUrl.EndsWith("EHS_Incidents.aspx?mode=prevent"))
                                {
                                    ms.Visible = false;
                                }
                            }
                        }
                    }

                    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);
            }
        }
Esempio n. 20
0
        public void rptProfileStatus_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                Label lbl;
                try
                {
                    EHSProfile profile = (EHSProfile)e.Item.DataItem;

                    Button btn = (Button)e.Item.FindControl("btnRollup");
                    btn.CommandArgument = profile.Plant.PLANT_ID.ToString();
                    btn = (Button)e.Item.FindControl("btnRollupYTD");
                    btn.CommandArgument = profile.Plant.PLANT_ID.ToString();

                    DateTime   lastUpdateDate;
                    TaskStatus status = profile.PeriodStatus(new string[0] {
                    }, true, out lastUpdateDate);

                    lbl       = (Label)e.Item.FindControl("lblInputs");
                    lbl.Text += profile.InputPeriod.NumComplete + " of " + profile.MeasureList(false).Count + " (Total)";
                    lbl       = (Label)e.Item.FindControl("lblReqdInputs");
                    lbl.Text  = profile.InputPeriod.NumRequiredComplete.ToString() + " of " + profile.InputPeriod.NumRequired.ToString() + " (Required)";
                    LinkButton lnk = (LinkButton)e.Item.FindControl("lnkInputs");
                    lnk.CommandArgument = profile.Plant.PLANT_ID.ToString();

                    lbl = (Label)e.Item.FindControl("lblRollupStatus");
                    lnk = (LinkButton)e.Item.FindControl("lnkHistory");
                    lnk.CommandArgument = profile.Plant.PLANT_ID.ToString();
                    if (profile.InputPeriod.PlantAccounting != null && profile.InputPeriod.PlantAccounting.FINALIZE_DT != null)
                    {
                        lbl.Text    = SQMModelMgr.FormatPersonListItem(SQMModelMgr.LookupPerson((decimal)profile.InputPeriod.PlantAccounting.FINALIZE_ID, ""));
                        lbl.Text   += " ";
                        lbl.Text   += SQMBasePage.FormatDate((DateTime)profile.InputPeriod.PlantAccounting.FINALIZE_DT, "d", false);
                        lnk.Visible = true;
                    }

                    string currencyCode = SQMModelMgr.LookupPlant(profile.Plant.PLANT_ID).CURRENCY_CODE;
                    lbl      = (Label)e.Item.FindControl("lblRateStatus");
                    lbl.Text = currencyCode + ": ";
                    CURRENCY_XREF currentRate = CurrencyConverter.CurrentRate(currencyCode, profile.InputPeriod.PeriodYear, profile.InputPeriod.PeriodMonth);
                    if (currentRate != null && currentRate.EFF_MONTH > 0)
                    {
                        lbl.Text += (System.Environment.NewLine + SQMBasePage.FormatDate(new DateTime(currentRate.EFF_YEAR, currentRate.EFF_MONTH, DateTime.DaysInMonth(currentRate.EFF_YEAR, currentRate.EFF_MONTH)), "d", false));
                    }

                    if (profile.InputPeriod.PlantAccounting != null)
                    {
                        SETTINGS    sets = SQMSettings.GetSetting("EHS", "ACCTFIELDS"); // try to retrieve fields to display for this client
                        Ucl_EHSList ucl  = (Ucl_EHSList)e.Item.FindControl("uclProdList");
                        ucl.BindProdFieldsList(profile, sets == null ? "" : sets.VALUE);

                        if (profile.InputPeriod.PlantAccounting.APPROVER_ID.HasValue && profile.InputPeriod.PlantAccounting.APPROVAL_DT.HasValue)
                        {
                            lbl       = (Label)e.Item.FindControl("lblFinalStatus");
                            lbl.Text  = SQMModelMgr.FormatPersonListItem(SQMModelMgr.LookupPerson((decimal)profile.InputPeriod.PlantAccounting.APPROVER_ID, ""));
                            lbl.Text += " ";
                            lbl.Text += SQMBasePage.FormatDate((DateTime)profile.InputPeriod.PlantAccounting.APPROVAL_DT, "", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ;
                }
            }
        }
        private void SetupPage()
        {
            if (ddlPlantSelect.Items.Count < 1)
            {
                List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true);
                SQMBasePage.SetLocationList(ddlPlantSelect, UserContext.FilterPlantAccessList(locationList), 0);

                rcbStatusSelect.SelectedValue = "A";
            }
            divAuditList.Visible = true;

            dmFromDate.ShowPopupOnFocus = dmToDate.ShowPopupOnFocus = true;

            // we want the start date to be the previous week Monday
            // ABW 1/5/16 - use user's default plant local time for search default
            DateTime localTime = SessionManager.UserContext.LocalTime;
            int      dayofweek = (int)localTime.DayOfWeek;
            DateTime fromDate  = localTime.AddDays(-7);

            while ((int)(fromDate.DayOfWeek) > 1)
            {
                fromDate = fromDate.AddDays(-1);
            }
            // we want the end date to be the next week Monday (so we can see audits in progress)
            DateTime toDate = localTime;

            while ((int)(toDate.DayOfWeek) > 1)
            {
                toDate = toDate.AddDays(1);
            }

            dmFromDate.SelectedDate = fromDate;
            dmToDate.SelectedDate   = toDate;

            if (Mode == AuditMode.Audit)
            {
                //lblViewEHSRezTitle.Text = "Environmental Health &amp; Safety Assessment Exceptions";
                //lblPageInstructions.Text = "Review and update EH&amp;S Assessment Exceptions below.";
                //lblStatus.Text = "Assessment Status:";
                lblAuditDate.Visible = true;
                phAudit.Visible      = true;

                SETTINGS sets = SQMSettings.GetSetting("EHS", "AUDITEXCEPTIONSEARCHFROM");
                if (sets != null)
                {
                    try
                    {
                        string[] args = sets.VALUE.Split('-');
                        if (args.Length > 1)
                        {
                            dmFromDate.SelectedDate = new DateTime(Convert.ToInt32(args[0]), Convert.ToInt32(args[1]), Convert.ToInt32(args[2]));
                        }
                        else
                        {
                            dmFromDate.SelectedDate = SessionManager.UserContext.LocalTime.AddMonths(Convert.ToInt32(args[0]) * -1);
                        }
                    }
                    catch { }
                }

                if (rcbAuditType.Items.Count < 1)
                {
                    foreach (AUDIT_TYPE ip in EHSAuditMgr.SelectAuditTypeList(SessionManager.PrimaryCompany().COMPANY_ID, false))
                    {
                        RadComboBoxItem item = new RadComboBoxItem(ip.TITLE, ip.AUDIT_TYPE_ID.ToString());
                        item.Checked = true;
                        rcbAuditType.Items.Add(item);
                    }
                }
            }
        }
        protected void rgUserList_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                try
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    PERSON       user = (PERSON)e.Item.DataItem;

                    if (user.STATUS == "I")
                    {
                        Image img = (Image)e.Item.FindControl("imgStatus");
                        img.ImageUrl = "/images/defaulticon/16x16/no.png";
                        img.Visible  = true;
                    }

                    SETTINGS sets = SQMSettings.GetSetting("COMPANY", "PLANTUSER");
                    if (sets == null || sets.VALUE.ToUpper() != "N")
                    {
                        Label lbl = (Label)e.Item.FindControl("lblUserStatus");
                        lbl.Text = WebSiteCommon.GetXlatValue("statusCodeDelete", lbl.Text);

                        lbl = (Label)e.Item.FindControl("lblUserRole");
                        if (user.JOBCODE != null)
                        {
                            lbl.Text = (user.JOBCODE_CD + " / " + user.JOBCODE.JOB_DESC);
                        }
                        //lbl.Text = WebSiteCommon.GetXlatValue("userRole", user.ROLE.ToString());

                        LinkButton lnk = (LinkButton)e.Item.FindControl("lnkHRLocation");
                        lnk.ToolTip = "";
                        PLANT plant = null;

                        if ((plant = PlantList().Where(l => l.PLANT_ID == user.PLANT_ID).FirstOrDefault()) != null)
                        {
                            lnk.Text = plant.PLANT_NAME;
                        }

                        if (user.ROLE == 1 || user.ROLE == 100)
                        {
                            if ((plant = PlantList().Where(l => l.PLANT_ID == user.PLANT_ID).FirstOrDefault()) != null)
                            {
                                lnk.ToolTip = plant.PLANT_NAME + " ...";
                            }
                        }
                        else
                        {
                            string[] args = (user.PLANT_ID.ToString() + "," + user.NEW_LOCATION_CD).Split(',');
                            foreach (string loc in args.Distinct().ToArray())
                            {
                                if ((plant = PlantList().Where(l => l.PLANT_ID.ToString() == loc).FirstOrDefault()) != null)
                                {
                                    lnk.ToolTip += (" " + plant.PLANT_NAME + ",");
                                }
                            }
                        }
                        lnk.ToolTip = lnk.ToolTip.TrimEnd(',');
                    }
                }
                catch
                {
                    ;
                }
            }
        }
Esempio n. 23
0
        private void SetupPage()
        {
            if (ddlPlantSelect.Items.Count < 1)
            {
                List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true);
                SQMBasePage.SetLocationList(ddlPlantSelect, UserContext.FilterPlantAccessList(locationList), 0);

                List <XLAT> xlatList = SQMBasePage.SelectXLATList(new string[4] {
                    "IQ_81", "IQ_82", "IQ_83", "STATUS_SELECT"
                }, 1);
                rcbInspectionType             = SQMBasePage.SetComboBoxItemsFromXLAT(rcbInspectionType, xlatList.Where(l => l.XLAT_GROUP == "IQ_81" && l.STATUS == "A").ToList(), "SHORT");
                rcbRecommendType              = SQMBasePage.SetComboBoxItemsFromXLAT(rcbRecommendType, xlatList.Where(l => l.XLAT_GROUP == "IQ_83").ToList(), "SHORT");
                rcbStatusSelect               = SQMBasePage.SetComboBoxItemsFromXLAT(rcbStatusSelect, xlatList.Where(l => l.XLAT_GROUP == "STATUS_SELECT").Where(l => new string[] { "A", "C", "P", "U" }.Contains(l.XLAT_CODE)).ToList(), "SHORT");
                rcbStatusSelect.SelectedValue = "A";

                // work-around for problem w/ radwindow combobox not retaining items created/set from a basepage method ?
                SQMBasePage.SetLocationList(ddlActionLocation, locationList, 0, true);

                rddlNewActionType.DataSource     = xlatList.Where(l => l.XLAT_GROUP == "IQ_81" && l.STATUS == "A").ToList();
                rddlNewActionType.DataTextField  = "DESCRIPTION_SHORT";
                rddlNewActionType.DataValueField = "XLAT_CODE";
                rddlNewActionType.DataBind();
            }
            divIncidentList.Visible = true;
            pnlChartSection.Style.Add("display", "none");
            lblChartType.Visible = ddlChartType.Visible = false;

            SQMBasePage.SetRadDateCulture(dmFromDate, "");
            SQMBasePage.SetRadDateCulture(dmToDate, "");

            dmFromDate.ShowPopupOnFocus = dmToDate.ShowPopupOnFocus = true;
            dmFromDate.SelectedDate     = SessionManager.UserContext.LocalTime.AddMonths(-11);
            dmToDate.SelectedDate       = SessionManager.UserContext.LocalTime;

            //lblViewEHSRezTitle.Text = GetLocalResourceObject("lblViewEHSRezTitleResource1.Text").ToString();
            //lblPageInstructions.Text = GetLocalResourceObject("lblPageInstructionsResource1.Text").ToString();
            //lblStatus.Text = "Incident Status:";
            //rbNew.Text = GetLocalResourceObject("rbNewResource1.Text").ToString();
            lblIncidentDate.Visible   = true;
            lblInspectionDate.Visible = false;

            SETTINGS sets = SQMSettings.GetSetting("EHS", "INCIDENTSEARCHFROM");

            if (sets != null)
            {
                try
                {
                    string[] args = sets.VALUE.Split('-');
                    if (args.Length > 1)
                    {
                        dmFromDate.SelectedDate = new DateTime(Convert.ToInt32(args[0]), Convert.ToInt32(args[1]), Convert.ToInt32(args[2]));
                    }
                    else
                    {
                        dmFromDate.SelectedDate = SessionManager.UserContext.LocalTime.AddMonths(Convert.ToInt32(args[0]) * -1);
                    }
                }
                catch { }
            }

            // lookup charts defined for this module & app context
            PERSPECTIVE_VIEW view = ViewModel.LookupView(entities, "HSCA", "HSCA", 0, SessionManager.UserContext.Language.NLS_LANGUAGE);

            if (view != null)
            {
                ddlChartType.Items.Clear();
                ddlChartType.Items.Add(new RadComboBoxItem("", ""));
                foreach (PERSPECTIVE_VIEW_ITEM vi in view.PERSPECTIVE_VIEW_ITEM.Where(l => l.STATUS != "I").OrderBy(l => l.ITEM_SEQ).ToList())
                {
                    RadComboBoxItem item = new RadComboBoxItem();
                    item.Text     = vi.TITLE;
                    item.Value    = vi.ITEM_SEQ.ToString();
                    item.ImageUrl = ViewModel.GetViewItemImageURL(vi);
                    ddlChartType.Items.Add(item);
                }
            }

            if (UserContext.GetMaxScopePrivilege(SysScope.prevent) <= SysPriv.action)
            {
                uclExport.Visible = true;
            }
            else
            {
                uclExport.Visible = false;
            }
        }