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;
            }
        }
        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;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            decimal issueID = 0;

            if (!Page.IsPostBack)
            {
                //string appContext;
                if (!string.IsNullOrEmpty(Request.QueryString["c"]))
                {
                    appContext = Request.QueryString["c"];
                }
                else
                {
                    appContext = "RCV";
                }

                if (!string.IsNullOrEmpty(Request.QueryString["i"]))
                {
                    try
                    {
                        issueID = Convert.ToDecimal(EncryptionManager.Decrypt(Request.QueryString["i"]));
                    }
                    catch { }
                }

                SetIssueCtl(new QualityIssueCtl().Initialize(null, appContext));

                if (SessionManager.EffLocation.BusinessOrg == null)
                {
                    SessionManager.EffLocation = SessionManager.UserContext.WorkingLocation;
                }
                if (uclIssueSearch.DDLPlantSelect.Items.Count == 0)
                {
                    List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true);
                    SQMBasePage.SetLocationList(uclIssueSearch.DDLPlantSelect, UserContext.FilterPlantAccessList(locationList), -1);
                }

                PERSPECTIVE_VIEW view = ViewModel.LookupView(entities, appContext, appContext, 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);
                    }
                }

                pnlChartSection.Style.Add("display", "none");
                lblChartType.Visible = ddlChartType.Visible = false;

                uclSearchBar_OnListClick();  // display list options upon page entry
            }

            switch (IssueCtl().Context)
            {
            case "CST":
                uclSearchBar1.PageTitle.Text    = lblQICSTTitle.Text;
                uclSearchBar1.NewButton.ToolTip = "Create a new " + lblQICSTTitle.Text;
                foreach (RadComboBoxItem ci in ddlChartType.Items)
                {
                    if (ci.Value.Contains("RCV"))
                    {
                        ci.Visible = false;
                    }
                }
                break;

            case "RCV":
                uclSearchBar1.PageTitle.Text    = lblQIRCVTitle.Text;
                uclSearchBar1.NewButton.ToolTip = "Create a new " + lblQIRCVTitle.Text;
                foreach (RadComboBoxItem ci in ddlChartType.Items)
                {
                    if (ci.Value.Contains("CST"))
                    {
                        ci.Visible = false;
                    }
                }
                break;

            default:
                uclSearchBar1.PageTitle.Text = lblQIPRQTitle.Text;
                break;
            }

            if (issueID > 0)
            {
                OnIssue_Click(issueID);
            }
        }
예제 #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);

                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;
            }
        }