protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string appContext; if (Request.QueryString != null && Request.QueryString.Get("c") != null) { appContext = Request.QueryString.Get("c").ToString(); } else { appContext = ""; } SetCaseCtl(new ProblemCaseCtl().Initialize(null, appContext)); IsCurrentPage(); uclSearchBar.SetButtonsVisible(false, false, (UserContext.CheckAccess("SQM", "221") >= AccessMode.Update || UserContext.CheckAccess("EHS", "321") >= AccessMode.Update) && CaseCtl().Context != "EHS" ? true : false, false, false, false); uclSearchBar.SetButtonsEnabled(false, false, CaseCtl().Context == "EHS" ? false : true, false, false, false); lblProbCaseInstructions.Visible = (CaseCtl().Context == "EHS") ? false : true; lblProbCaseInstructionsEHS.Visible = (CaseCtl().Context == "EHS") ? true : false; if (string.IsNullOrEmpty(SessionManager.CurrentSecondaryTab)) { CaseCtl().Clear(); } if (CaseCtl().IsClear()) { uclCaseHdr.ProblemCaseHdr.Visible = false; uclPageTabs.TabsPanel.Visible = false; } } }
private void uclSearchBar_OnSearchClick() { decimal caseID = 0; pnlSearchList.Visible = true; divPageBody.Visible = divNavArea.Visible = false; if (CaseCtl().Context == "EHS") { uclCaseList.LinksDisabled = UserContext.CheckAccess("EHS", "321") < AccessMode.Update ? true : false; } else { uclCaseList.LinksDisabled = UserContext.CheckAccess("SQM", "221") < AccessMode.Update ? true : false; uclSearchBar.NewButton.Visible = true; } string[] plantArray = ddlPlantSelect.Items.Where(i => i.Checked == true).Select(i => i.Value).ToArray(); decimal[] plantIDS = Array.ConvertAll(plantArray, new Converter <string, decimal>(decimal.Parse)); CaseCtl().CaseList = ProblemCase.SelectProblemCaseList(SessionManager.PrimaryCompany().COMPANY_ID, CaseCtl().Context, ddlStatusSelect.SelectedValue); uclCaseList.BindProblemCaseListRepeater(ProblemCase.QualifyCaseList(CaseCtl().CaseList, plantIDS).OrderByDescending(l => l.ProbCase.CREATE_DT).ToList(), CaseCtl().Context); uclSearchBar.ReturnButton.Visible = false; }
public void LoadProfileInput() { divProfilePeriodScrollRepeater.Visible = true; SetLocalProfileList(new List <EHSProfile>()); foreach (RadComboBoxItem item in SQMBasePage.GetComboBoxCheckedItems(ddlExportPlantSelect)) { if (radExportDateSelect1.SelectedDate != null) { EHSProfile profile = new EHSProfile().Load(Convert.ToDecimal(item.Value), false, true); if (profile.Profile != null) { profile.LoadPeriod((DateTime)radExportDateSelect1.SelectedDate); profile.MapPlantAccountingInputs(true, true); LocalProfileList().Add(profile); } } } rptProfile.DataSource = LocalProfileList(); rptProfile.DataBind(); if (UserContext.CheckAccess("EHS", "301") > AccessMode.Plant) { btnRollupAll.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { uclSearchBar.SetButtonsVisible(true, false, UserContext.CheckAccess("SQM", "201") >= AccessMode.Update ? true : false, UserContext.CheckAccess("SQM", "201") >= AccessMode.Update ? true : false, false, false); uclSearchBar.SetButtonsEnabled(true, false, true, false, false, false); } }
protected void tab_Click(string tabID, string cmdArg) { pnlSubLists.Visible = pnlPartProgram.Visible = pnlBusOrgEdit.Visible = pnlAdminEdit.Visible = pnlEscalation.Visible = false; if (tabID != null) { SetActiveTab(SessionManager.CurrentSecondaryTab = tabID); BUSINESS_ORG busOrg = (BUSINESS_ORG)SessionManager.EffLocation.BusinessOrg; switch (cmdArg) { case "dept": DoDeptList(); pnlSubLists.Visible = true; break; case "labor": DoLaborList(); pnlSubLists.Visible = true; break; case "prog": isEditMode = true; uclProgramList.BindProgramList(SQMModelMgr.SelectPartProgramList(0, busOrg.BUS_ORG_ID)); pnlPartProgram.Visible = true; break; case "notify": pnlEscalation.Visible = true; List <TaskRecordType> recordTypeList = new List <TaskRecordType>(); if (UserContext.CheckAccess("SQM", "") >= AccessMode.Update) { recordTypeList.Add(TaskRecordType.InternalQualityIncident); recordTypeList.Add(TaskRecordType.CustomerQualityIncident); recordTypeList.Add(TaskRecordType.SupplierQualityIncident); } if (UserContext.CheckAccess("EHS", "") >= AccessMode.Admin) { recordTypeList.Add(TaskRecordType.ProfileInput); recordTypeList.Add(TaskRecordType.ProfileInputApproval); recordTypeList.Add(TaskRecordType.HealthSafetyIncident); recordTypeList.Add(TaskRecordType.PreventativeAction); } if (recordTypeList.Count > 0 && !recordTypeList.Contains(TaskRecordType.ProblemCase)) { recordTypeList.Add(TaskRecordType.ProblemCase); } uclNotifyList.BindNotifyList(entities, SessionManager.EffLocation.Company.COMPANY_ID, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, 0, recordTypeList); break; default: pnlBusOrgEdit.Visible = true; DisplayBusOrg(); break; } } }
private void BindProfile(EHSProfile profile) { if (profile != null) { ddlDayDue.SelectedValue = LocalProfile().Profile.DAY_DUE.ToString(); ddlWarningDays.SelectedValue = LocalProfile().Profile.REMINDER_DAYS.ToString(); if (LocalProfile().Profile.APPROVER_ID > 0 && ddlFinalApprover.Items.FindByValue(LocalProfile().Profile.APPROVER_ID.ToString()) != null) { ddlFinalApprover.SelectedValue = LocalProfile().Profile.APPROVER_ID.ToString(); } else { ddlFinalApprover.SelectedIndex = 0; } if (LocalProfile().Profile.DISPLAY_OPTION.HasValue) { ddlDisplayOrder.SelectedIndex = (int)LocalProfile().Profile.DISPLAY_OPTION; } if (LocalProfile().Profile.EHS_PROFILE_FACT != null && LocalProfile().Profile.EHS_PROFILE_FACT.Count > 0) { if (ddlNormFact.Items.FindByValue(LocalProfile().Profile.EHS_PROFILE_FACT.FirstOrDefault().FACTOR_ID.ToString()) != null) { ddlNormFact.SelectedValue = LocalProfile().Profile.EHS_PROFILE_FACT.FirstOrDefault().FACTOR_ID.ToString(); } } else { EHS_PROFILE_MEASURE factMetric = profile.Profile.EHS_PROFILE_MEASURE.Where(l => l.EHS_MEASURE.MEASURE_CATEGORY == "FACT").FirstOrDefault(); if (factMetric != null && ddlNormFact.Items.FindByValue(factMetric.EHS_MEASURE.MEASURE_ID.ToString()) != null) { ddlNormFact.SelectedValue = factMetric.EHS_MEASURE.MEASURE_ID.ToString(); } else { ddlNormFact.SelectedIndex = 0; } } if (ddlMetricCurrency.Items.FindByValue(LocalProfile().Plant.CURRENCY_CODE) != null) { ddlMetricCurrency.SelectedValue = LocalProfile().Plant.CURRENCY_CODE; } pnlMetricEdit.Enabled = btnMetricCancel.Enabled = btnMetricSave.Enabled = false; lnkMeasureAdd.Enabled = btnMetricSave.Enabled = UserContext.CheckAccess("EHS", "311") >= AccessMode.Plant ? true : false; UpdateMetricList(profile); pnlMetricEdit.Visible = false; //pnlProfileEdit.Visible = true; } }
private void SetupPage() { uclExport.BindExport("", false, hfExportText.Value); btnSave1.Enabled = btnSave2.Enabled = UserContext.CheckAccess("EHS", "311") >= AccessMode.Update ? true : false; if (LocalProfile() == null || IsCurrentPage() == false) { btnSave1.Enabled = btnSave2.Enabled = false; } uclInputHdr.LoadProfileInputHdr(true, DateTime.MinValue, DateTime.MinValue, SessionManager.UserContext.HRLocation.Plant.PLANT_ID, true, true); }
protected void Page_PreRender(object sender, EventArgs e) { RegisterAppPage(WebSiteCommon.CleanPageName(Request.Path)); // mt - testing the page access scheme ... lbCreateUser.Enabled = UserContext.CheckAccess("admin", "user", "add"); lbUploadData.Enabled = UserContext.CheckAccess("admin", "user", "upload"); lbSearchUser.Enabled = UserContext.CheckAccess("admin", "user", "search"); if (!UserContext.CheckAccess("admin", "user", "search") && !lbUploadData.Enabled) { lbMyUser_Click(sender, null); } }
private void uclSearchBar_OnNewClick() { IssueCtl().CreateNew(Session.SessionID, IssueCtl().Context, SessionManager.UserContext.Person.PERSON_ID); IssueCtl().UserPageMode(SessionManager.UserContext.Person, UserContext.CheckAccess("SQM", "")); uclSearchBar1.TitleItem.Text = ""; uclSearchBar1.SetButtonsVisible(false, false, false, true, false, true, lblReturnLabel.Text); uclSearchBar1.SetButtonsEnabled(false, false, false, true, false, true); uclSearchBar2.SetButtonsVisible(false, false, false, true, false, true, lblReturnLabel.Text); uclSearchBar2.SetButtonsEnabled(false, false, false, true, false, true); divSearchList.Visible = false; uclQualityIssue.ToggleDisplay(true); uclQualityIssue.NewIssue(); }
private void uclSearchBar_OnListClick() { uclQualityIssue.ToggleDisplay(false); divSearchList.Visible = true; uclSearchBar1.TitleItem.Text = ""; uclIssueList.LinksDisabled = false; uclSearchBar1.SetButtonsVisible(false, false, UserContext.CheckAccess("SQM", "") >= AccessMode.Update ? true : false, false, false, false); uclSearchBar1.SetButtonsEnabled(false, false, true, false, false, false); uclSearchBar1.NewButton.Text = "New Issue "; uclSearchBar2.SetButtonsVisible(false, false, false, false, false, false); uclSearchBar2.SetButtonsEnabled(false, false, false, false, false, false); uclIssueSearch.BindCSTIssueSearch(true, IssueCtl().Context, entities); uclIssueSearch.BTNReceiptSearch.Visible = UserContext.CheckAccess("SQM", "") == AccessMode.Partner ? false : true; SearchList(""); }
private void SetupPage() { if (langList == null || langList.Count == 0) { langList = SQMModelMgr.SelectLanguageList(new PSsqmEntities(), true); uclPrefsEdit.SetLanguageList(langList); } BusinessLocation businessLocation = new BusinessLocation(); businessLocation = SessionManager.UserContext.HRLocation; uclPrefsEdit.BindUser(null, SessionManager.UserContext.HRLocation, SessionManager.UserContext.WorkingLocation); if (UserContext.CheckAccess("CQM", "home", "92") == AccessMode.None) { uclPrefsEdit.DelegateList.Attributes.Add("disabled", "true"); } // quality tasks if (uclTaskList.TaskListRepeater.Items.Count < 1) { bool hasDelegates; List <TaskItem> taskList = new List <TaskItem>(); // taskList = QualityIssue.IncidentTaskList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, SessionManager.UserContext.Person.PERSON_ID, false, out hasDelegates); // EHS inputs if (UserContext.CheckAccess("EHS", "input", "301") > AccessMode.View) { if (respForList == null || respForList.Count == 0) { respForList = SQMModelMgr.SelectDelegateList(SessionManager.UserContext.Person.PERSON_ID); respForList.Insert(0, SessionManager.UserContext.Person); } decimal[] pids = respForList.Select(l => l.PERSON_ID).ToArray(); taskList.AddRange(EHSModel.ProfileTaskList(EHSModel.GetIncompleteInputs(pids, DateTime.Now.AddMonths(-12)))); } // Problem cases if (UserContext.CheckAccess("CQM", "prob", "151") > AccessMode.View) { taskList.AddRange(ProblemCase.CaseTaskList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, SessionManager.UserContext.Person.PERSON_ID, false, out hasDelegates)); } // taskList = taskList.OrderBy(l => l.RecordType).ThenBy(l => l.RecordID).ToList(); uclTaskList.BindTaskList(taskList); } }
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); } }
public void LoadProfileInput(DateTime targetDate, EHSProfileStatus selectStatus) { AccessMode accessMode = UserContext.CheckAccess("EHS", "311"); LocalProfile().LoadPeriod(targetDate); if (LocalProfile().InputPeriod != null) { LocalProfile().MapPlantAccountingInputs(true, false); uclInputHdr.BindProfileInputHdr(LocalProfile()); EHSProfileStatus status = BindProfileInputList(LocalProfile().MeasureList(true, accessMode).ToList(), LocalProfile().Profile); if (status == EHSProfileStatus.Normal) { if (LocalProfile().Profile.APPROVER_ID == SessionManager.UserContext.Person.PERSON_ID || accessMode >= AccessMode.Admin) { cbFinalApproval.Enabled = true; } if (LocalProfile().InputPeriod.PlantAccounting.APPROVER_ID.HasValue&& LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT.HasValue) { cbFinalApproval.Checked = true; cbFinalApproval.Enabled = false; hfWasApproved.Value = lblFinalApprovalBy.Text = SQMModelMgr.FormatPersonListItem(SQMModelMgr.LookupPerson((decimal)LocalProfile().InputPeriod.PlantAccounting.APPROVER_ID, "")); lblFinalApprovalBy.Text += (" " + SQMBasePage.FormatDate((DateTime)LocalProfile().InputPeriod.PlantAccounting.APPROVAL_DT, "", false)); } else { cbFinalApproval.Checked = false; hfWasApproved.Value = lblFinalApprovalBy.Text = ""; } } MessageDisplay(selectStatus == EHSProfileStatus.Normal ? status : selectStatus); btnSave1.Enabled = btnSave2.Enabled = btnCancel1.Enabled = btnCancel2.Enabled = UserContext.CheckAccess("EHS", "311") >= AccessMode.Update ? true : false; } else { MessageDisplay(EHSProfileStatus.NoInputs); } }
protected void OnIssue_Click(decimal issueID) { IssueCtl().Load(issueID); IssueCtl().UserPageMode(SessionManager.UserContext.Person, UserContext.CheckAccess("SQM", "")); divSearchList.Visible = false; uclQualityIssue.ToggleDisplay(true); uclSearchBar1.TitleItem.Text = IssueCtl().qualityIssue.IssueID; if (isDirected) { uclSearchBar1.SetButtonsVisible(false, false, false, IssueCtl().PageMode == PageUseMode.ViewOnly ? false : true, false, false, lblReturnLabel.Text); uclSearchBar1.SetButtonsEnabled(false, false, false, IssueCtl().PageMode == PageUseMode.ViewOnly ? false : true, false, false); uclSearchBar2.SetButtonsVisible(false, false, false, IssueCtl().PageMode == PageUseMode.ViewOnly ? false : true, false, false, lblReturnLabel.Text); uclSearchBar2.SetButtonsEnabled(false, false, false, IssueCtl().PageMode == PageUseMode.ViewOnly ? false : true, false, false); } else { uclSearchBar1.SetButtonsVisible(false, false, false, IssueCtl().PageMode == PageUseMode.ViewOnly ? false : true, false, true, lblReturnLabel.Text); uclSearchBar1.SetButtonsEnabled(false, false, false, IssueCtl().PageMode == PageUseMode.ViewOnly ? false : true, false, true); uclSearchBar2.SetButtonsVisible(false, false, false, IssueCtl().PageMode == PageUseMode.ViewOnly ? false : true, false, true, lblReturnLabel.Text); uclSearchBar2.SetButtonsEnabled(false, false, false, IssueCtl().PageMode == PageUseMode.ViewOnly ? false : true, false, true); } uclQualityIssue.BindIssue(); }
private void SetupProfilePanel() { if (ddlMetricDisposalCode.Items.Count == 0) { ddlDayDue.Items.AddRange(WebSiteCommon.PopulateDropDownListNums(1, 31)); ddlWarningDays.Items.AddRange(WebSiteCommon.PopulateDropDownListNums(0, 11)); ddlMetricDisposalCode.DataSource = SessionManager.DisposalCodeList; ddlMetricDisposalCode.DataValueField = "UN_CODE"; ddlMetricDisposalCode.DataTextField = "UN_CODE"; ddlMetricDisposalCode.DataBind(); ddlMetricDisposalCode.Items.Insert(0, new ListItem("")); ddlMetricRegStatus.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("regulatoryStatus")); ddlMetricRegStatus.Items.Insert(0, new ListItem("")); SQMBasePage.FillCurrencyDDL(ddlMetricCurrency, "EUR"); ddlMetricCurrency.Items.Insert(0, ""); ddlMetricCost.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("costType", "long")); ddlMetricCost.Items.Insert(0, ""); if (UserContext.CheckAccess("EHS", "") >= AccessMode.Admin) { ddlMetricStatus.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("statusCodeDelete")); } else { ddlMetricStatus.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("statusCode")); } ddlMetricCategory.Items.AddRange(WebSiteCommon.PopulateDropDownListItems("measureCategoryEHS", 2, "")); ddlMetricCategory.Items.Insert(0, ""); measureList = EHSModel.SelectEHSMeasureList("", true).OrderBy(l => l.MEASURE_NAME).ToList(); foreach (EHS_MEASURE measure in measureList) { ddlMetricID.Items.Add(new ListItem(measure.MEASURE_NAME.Trim(), WebSiteCommon.PackItemValue(measure.MEASURE_CATEGORY, measure.EFM_TYPE, measure.MEASURE_ID.ToString()))); if (measure.MEASURE_CATEGORY == "FACT") { ListItem item = new ListItem(measure.MEASURE_NAME.Trim(), measure.MEASURE_ID.ToString()); item.Attributes.Add("title", measure.MEASURE_DESC); ddlNormFact.Items.Add(item); } } ddlMetricID.Items.Insert(0, ""); ddlNormFact.Items.Insert(0, ""); if (ddlNormFact.Items.Count == 1) // don't display normalize selects if no factors defined { phNormFact.Visible = false; } foreach (UOM uom in SessionManager.UOMList.Where(l => l.OWNER_ID == null).OrderBy(l => l.UOM_NAME).ToList()) { ddlMetricUOM.Items.Add(new ListItem(uom.UOM_NAME, WebSiteCommon.PackItemValue(uom.UOM_CATEGORY, uom.EFM_TYPE, uom.UOM_ID.ToString()))); } ddlMetricUOM.Items.Insert(0, ""); ddlMetricUOM.SelectedIndex = 0; } divEHSProfile.Visible = true; pnlCopyProfile.Visible = false; UpdateListTitles(); }
protected void Page_PreRender(object sender, EventArgs e) { accessLevel = UserContext.CheckAccess("EHS", ""); if (accessLevel < AccessMode.Update) { rbNew.Visible = false; } if (IsPostBack) { if (!uclIncidentForm.IsEditContext) { RadPersistenceManager1.SaveState(); } if (SessionManager.ReturnStatus == true) { if (SessionManager.ReturnObject is string) { string type = SessionManager.ReturnObject as string; switch (type) { case "DisplayIncidents": UpdateDisplayState(DisplayState.IncidentList); break; case "Notification": //UpdateDisplayState(DisplayState.IncidentNotificationEdit); //UpdateDisplayState(DisplayState.IncidentReportEdit); uclIncidentForm.EditIncidentId = SessionManager.ReturnRecordID; UpdateDisplayState(DisplayState.IncidentNotificationEdit); if (isDirected) { rbNew.Visible = false; uclIncidentForm.EnableReturnButton(false); } break; case "Report": uclIncidentForm.EditIncidentId = SessionManager.ReturnRecordID; UpdateDisplayState(DisplayState.IncidentReportEdit); break; } } SessionManager.ClearReturns(); } } else { if (SessionManager.ReturnStatus == true && SessionManager.ReturnObject is string) { try { // from inbox DisplayNonPostback(); SessionManager.ReturnRecordID = Convert.ToDecimal(SessionManager.ReturnObject.ToString()); SessionManager.ReturnObject = "Notification"; SessionManager.ReturnStatus = true; isDirected = true; StringBuilder sbScript = new StringBuilder(); ClientScriptManager cs = Page.ClientScript; sbScript.Append("<script language='JavaScript' type='text/javascript'>\n"); sbScript.Append("<!--\n"); sbScript.Append(cs.GetPostBackEventReference(this, "PBArg") + ";\n"); sbScript.Append("// -->\n"); sbScript.Append("</script>\n"); cs.RegisterStartupScript(this.GetType(), "AutoPostBackScript", sbScript.ToString()); } catch { // not a number, parse as type DisplayNonPostback(); } } else { DisplayNonPostback(); } } }
protected void tab_Click(string tabID, string cmdArg) { uclAdminTabs.PlantPanel.Visible = true; uclSubLists.ToggleVisible(null); pnlAdminEdit.Visible = pnlPlantEdit.Visible = pnlPlantDocs.Visible = pnlEscalation.Visible = pnlB2B.Visible = false; SetActiveTab(SessionManager.CurrentSecondaryTab = tabID); if (tabID != null) { isEditMode = false; // setup for ps_admin.js to toggle the tab active/inactive display SessionManager.CurrentSecondaryTab = tabID; switch (cmdArg) { case "dept": DoDeptList(); pnlSubLists.Visible = true; break; case "labor": DoLaborList(); pnlSubLists.Visible = true; break; case "line": DoLineList(); pnlSubLists.Visible = true; break; case "cust": DoCustList(); pnlSubLists.Visible = true; break; case "supp": DoSuppList(); pnlSubLists.Visible = true; break; case "notify": pnlEscalation.Visible = true; List <TaskRecordType> recordTypeList = new List <TaskRecordType>(); if (UserContext.CheckAccess("SQM", "") >= AccessMode.Update) { recordTypeList.Add(TaskRecordType.InternalQualityIncident); recordTypeList.Add(TaskRecordType.CustomerQualityIncident); recordTypeList.Add(TaskRecordType.SupplierQualityIncident); } if (UserContext.CheckAccess("EHS", "") >= AccessMode.Admin) { recordTypeList.Add(TaskRecordType.ProfileInput); recordTypeList.Add(TaskRecordType.ProfileInputApproval); recordTypeList.Add(TaskRecordType.HealthSafetyIncident); recordTypeList.Add(TaskRecordType.PreventativeAction); } if (recordTypeList.Count > 0 && !recordTypeList.Contains(TaskRecordType.ProblemCase)) { recordTypeList.Add(TaskRecordType.ProblemCase); } uclNotifyList.BindNotifyList(entities, SessionManager.EffLocation.Company.COMPANY_ID, 0, SessionManager.EffLocation.Plant.PLANT_ID, recordTypeList); break; case "docs": pnlPlantDocs.Visible = true; uclDocMgr.BindDocMgr("BLI", 0, SessionManager.EffLocation.Plant.PLANT_ID); break; default: pnlPlantEdit.Visible = true; if (SessionManager.EffLocation.Plant != null) { lnkPlantView_Click(null, null); } break; } } }
private void SearchIncidents() { string selectedValue = ""; DateTime fromDate = Convert.ToDateTime(dmFromDate.SelectedDate); DateTime toDate = Convert.ToDateTime(dmToDate.SelectedDate); if (toDate < fromDate) { return; } toDate = new DateTime(toDate.Year, toDate.Month, toDate.Day, 23, 59, 59); accessLevel = UserContext.CheckAccess("EHS", ""); List <decimal> plantIDS = SQMBasePage.GetComboBoxCheckedItems(ddlPlantSelect).Select(i => Convert.ToDecimal(i.Value)).ToList(); var typeList = new List <decimal>(); List <string> statusList = new List <string>(); if (Mode == IncidentMode.Incident) { if (HSCalcs() == null) { foreach (RadComboBoxItem item in rcbIncidentType.Items) { item.Checked = true; } } typeList = rcbIncidentType.Items.Where(c => c.Checked).Select(c => Convert.ToDecimal(c.Value)).ToList(); selectedValue = rcbStatusSelect.SelectedValue; } else if (Mode == IncidentMode.Prevent) { typeList = EHSIncidentMgr.SelectPreventativeTypeList(SessionManager.PrimaryCompany().COMPANY_ID).Select(l => l.INCIDENT_TYPE_ID).ToList(); statusList = SQMBasePage.GetComboBoxCheckedItems(rcbFindingsSelect).Select(l => l.Value).ToList(); } SetHSCalcs(new SQMMetricMgr().CreateNew(SessionManager.PrimaryCompany(), "0", fromDate, toDate, new decimal[0])); HSCalcs().ehsCtl = new EHSCalcsCtl().CreateNew(1, DateSpanOption.SelectRange); HSCalcs().ObjAny = cbShowImage.Checked; if (selectedValue == "T") { HSCalcs().ehsCtl.SelectIncidentList(plantIDS, typeList, fromDate, toDate, "A", false); List <EHSIncidentData> actionList = new List <EHSIncidentData>(); foreach (EHSIncidentData data in HSCalcs().ehsCtl.IncidentHst) { if (data.EntryList.Where(l => l.INCIDENT_QUESTION_ID == (decimal)EHSQuestionId.Create8D && l.ANSWER_VALUE != "Yes").Count() > 0) { // if (data.Incident.INCIDENT_ANSWER.Where(l => l.INCIDENT_QUESTION_ID == (decimal)EHSQuestionId.Create8D && l.ANSWER_VALUE != "Yes").Count() > 0) actionList.Add(data); } } HSCalcs().ehsCtl.IncidentHst = actionList; if (accessLevel < AccessMode.Admin) { actionList = HSCalcs().ehsCtl.IncidentHst = (from i in HSCalcs().ehsCtl.IncidentHst where i.Incident.ISSUE_TYPE_ID != 10 select i).ToList(); } if (actionList != null) { uclIncidentList.BindIncidentActionList(actionList, "EHS"); } } else { if (Mode == IncidentMode.Incident) { HSCalcs().ehsCtl.SelectIncidentList(plantIDS, typeList, fromDate, toDate, selectedValue, cbShowImage.Checked); } else if (Mode == IncidentMode.Prevent) { List <string> inspectionCatetoryList = new List <string>(); inspectionCatetoryList.AddRange(rcbInspectCatetory.Items.Where(c => c.Checked).Select(c => c.Value).ToList()); List <string> recommendationTypeList = new List <string>(); recommendationTypeList.AddRange(rcbRecommendationType.Items.Where(c => c.Checked).Select(c => c.Value).ToList()); HSCalcs().ehsCtl.SelectPreventativeList(plantIDS, typeList, inspectionCatetoryList, recommendationTypeList, fromDate, toDate, statusList, cbShowImage.Checked); } if (accessLevel < AccessMode.Admin) { HSCalcs().ehsCtl.IncidentHst = (from i in HSCalcs().ehsCtl.IncidentHst where i.Incident.ISSUE_TYPE_ID != 10 select i).ToList(); } if (HSCalcs().ehsCtl.IncidentHst != null) { HSCalcs().ehsCtl.IncidentHst.OrderByDescending(x => x.Incident.INCIDENT_DT); if (Mode == IncidentMode.Incident) { uclIncidentList.BindIncidentListRepeater(HSCalcs().ehsCtl.IncidentHst, "EHS", cbShowImage.Checked); } else if (Mode == IncidentMode.Prevent) { uclIncidentList.BindPreventativeListRepeater(HSCalcs().ehsCtl.IncidentHst, "EHS", cbShowImage.Checked); } } } if (HSCalcs().ehsCtl.IncidentHst != null && HSCalcs().ehsCtl.IncidentHst.Count > 0) { lblChartType.Visible = ddlChartType.Visible = true; } pnlIncidentDetails.Visible = lnkIncidentDetailsClose.Visible = false; if (ddlChartType.SelectedValue != "") { ddlChartTypeChange(null, null); } }
public int BindProfileMeasure(EHS_PROFILE_MEASURE pm) { int status = 0; pnlMetricEdit.Visible = true; spUOMFactor.Visible = false; pnlMetricEdit.Visible = true; btnMetricCancel.Enabled = true; DisplayErrorMessage(null); if (pm == null) { ddlMetricID.Enabled = ddlMetricCost.Enabled = ddlMetricDisposalCode.Enabled = ddlMetricRegStatus.Enabled = ddlMetricUOM.Enabled = ddlMetricCurrency.Enabled = ddlMetricResponsible.Enabled = false; ddlMetricCategory.SelectedIndex = ddlMetricID.SelectedIndex = ddlMetricDisposalCode.SelectedIndex = ddlMetricRegStatus.SelectedIndex = ddlMetricUOM.SelectedIndex = ddlMetricCost.SelectedIndex = ddlMetricResponsible.SelectedIndex = 0; if (ddlMetricCurrency.Items.FindByValue(LocalProfile().Plant.CURRENCY_CODE) != null) { ddlMetricCurrency.SelectedValue = LocalProfile().Plant.CURRENCY_CODE; } lblMetricName.Text = lblDisposalDesc.Text = ""; tbMetricPrompt.Text = tbUOMFactor.Text = tbWasteCode.Text = ""; winMetricEdit.Title = hfAddMetric.Value; tbValueDflt.Text = tbCostDflt.Text = ""; cbEnableOverride.Checked = false; cbMetricRequired.Checked = true; } else { winMetricEdit.Title = hfUpdateMetric.Value; LocalProfile().CurrentProfileMeasure = pm; LocalProfile().CurrentEHSMeasure = pm.EHS_MEASURE; if (pm.EHS_MEASURE != null && ddlMetricCategory.Items.FindByValue(pm.EHS_MEASURE.MEASURE_CATEGORY) != null) { ddlMetricCategory.SelectedValue = pm.EHS_MEASURE.MEASURE_CATEGORY; ddlCategoryChanged(ddlMetricCategory, null); ddlMetricID.SelectedValue = WebSiteCommon.PackItemValue(pm.EHS_MEASURE.MEASURE_CATEGORY, pm.EHS_MEASURE.EFM_TYPE, pm.EHS_MEASURE.MEASURE_ID.ToString()); lblMetricName.Text = pm.EHS_MEASURE.MEASURE_CD; if (pm.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && pm.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && pm.EHS_MEASURE.MEASURE_CATEGORY != "FACT" && ddlMetricCurrency.Items.FindByValue(pm.DEFAULT_CURRENCY_CODE) != null) { ddlMetricCurrency.SelectedValue = pm.DEFAULT_CURRENCY_CODE; } if (pm.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && pm.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && pm.EHS_MEASURE.MEASURE_CATEGORY != "FACT" && pm.DEFAULT_UOM > 0) { UOM uom = SessionManager.UOMList.FirstOrDefault(l => l.UOM_ID == pm.DEFAULT_UOM); if (uom != null) { if (ddlMetricUOM.Items.FindByValue(WebSiteCommon.PackItemValue(uom.UOM_CATEGORY, uom.EFM_TYPE, uom.UOM_ID.ToString())) != null) { ddlMetricUOM.SelectedValue = WebSiteCommon.PackItemValue(uom.UOM_CATEGORY, uom.EFM_TYPE, uom.UOM_ID.ToString()); } else { ddlMetricUOM.SelectedIndex = 0; } if (uom.UOM_CATEGORY == "CUST") { spUOMFactor.Visible = true; } } if (pm.UOM_FACTOR.HasValue) { tbUOMFactor.Text = SQMBasePage.FormatValue((decimal)pm.UOM_FACTOR, 5); } } if (pm.EHS_MEASURE.MEASURE_CATEGORY != "PROD" && pm.EHS_MEASURE.MEASURE_CATEGORY != "SAFE" && pm.EHS_MEASURE.MEASURE_CATEGORY != "FACT") { if (pm.NEG_VALUE_ALLOWED.HasValue && (bool)pm.NEG_VALUE_ALLOWED) { ddlMetricCost.SelectedValue = "CREDIT"; } else { ddlMetricCost.SelectedValue = "COST"; } } } tbMetricPrompt.Text = pm.MEASURE_PROMPT; ddlMetricRegStatus.SelectedValue = pm.REG_STATUS; ddlMetricDisposalCode.SelectedValue = pm.UN_CODE; if (!string.IsNullOrEmpty(pm.UN_CODE)) { lblDisposalDesc.Text = SessionManager.DisposalCodeList.FirstOrDefault(l => l.UN_CODE == pm.UN_CODE).DESCRIPTION; } else { lblDisposalDesc.Text = ""; } tbWasteCode.Text = pm.WASTE_CODE; if (pm.RESPONSIBLE_ID > 0 && ddlMetricResponsible.Items.FindByValue(pm.RESPONSIBLE_ID.ToString()) != null) { ddlMetricResponsible.SelectedValue = pm.RESPONSIBLE_ID.ToString(); } else { ddlMetricResponsible.SelectedIndex = 0; } ddlUOMChanged(ddlMetricUOM, null); ddlMetricStatus.SelectedValue = pm.STATUS; cbMetricRequired.Checked = (bool)pm.IS_REQUIRED; tbValueDflt.Text = tbCostDflt.Text = ""; cbEnableOverride.Checked = false; // radEffEndDate.ShowPopupOnFocus = true; //radEffEndDate.SelectedDate = null; if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT.HasValue) { tbValueDflt.Text = SQMBasePage.FormatValue((decimal)pm.EHS_PROFILE_MEASURE_EXT.VALUE_DEFAULT, 2); } if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT.HasValue) { tbCostDflt.Text = SQMBasePage.FormatValue((decimal)pm.EHS_PROFILE_MEASURE_EXT.COST_DEFAULT, 2); } if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.OVERRIDE_ALLOWED.HasValue) { cbEnableOverride.Checked = (bool)pm.EHS_PROFILE_MEASURE_EXT.OVERRIDE_ALLOWED; } //if (pm.EHS_PROFILE_MEASURE_EXT != null && pm.EHS_PROFILE_MEASURE_EXT.EFF_END_DT.HasValue) // radEffEndDate.SelectedDate = pm.EHS_PROFILE_MEASURE_EXT.EFF_END_DT; } UpdateListTitles(); pnlMetricEdit.Enabled = btnMetricCancel.Enabled = btnMetricSave.Enabled = UserContext.CheckAccess("EHS", "311") >= AccessMode.Plant ? true : false; string script = "function f(){OpenMetricEditWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); return(status); }
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); } }
protected void Page_PreRender(object sender, EventArgs e) { if (!Page.IsPostBack) { Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect"); if (ucl != null) { ucl.BindDocumentSelect("EHS", 2, true, true, ""); } uclSearchBar.SetButtonsVisible(false, false, false, false, false, false); uclSearchBar.PageTitle.Text = lblTitle.Text; btnMetricSave.Enabled = lnkMeasureAdd.Enabled = btnMetricCancel.Enabled = UserContext.CheckAccess("EHS", "311") >= AccessMode.Plant ? true : false; } }
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, "EHS", ""), 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 & Safety Incidents"; lblPageInstructions.Text = "Add or update EH&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"; if (accessLevel < AccessMode.Admin) { rbNew.Visible = false; } 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.CheckAccess("EHS", "301") >= AccessMode.Plant) { uclExport.Visible = true; } else { uclExport.Visible = false; } }