private void SetupPage() { DropDownList ddl; if (ddlPlantList.Items.Count == 0) { List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.EffLocation.Company.COMPANY_ID, 0, false); SQMBasePage.SetLocationList(ddlPlantList, locationList, SessionManager.UserContext.HRLocation.Plant.PLANT_ID); ddlPlantList.Items.Insert(0, new RadComboBoxItem(Resources.LocalizedText.All, "")); ddlRoleList.DataSource = SQMModelMgr.SelectPrivGroupList("", true); ddlRoleList.DataTextField = "DESCRIPTION"; ddlRoleList.DataValueField = "PRIV_GROUP"; ddlRoleList.DataBind(); ddlRoleList.ClearCheckedItems(); ddl = (DropDownList)hfBase.FindControl("ddlPrefListSize"); if (ddl != null) { ddl.Items.AddRange(WebSiteCommon.PopulateDropDownListNums(1, 50, 10)); } if (ddlJobCode.Items.Count == 0) { ddlJobCode.Items.Insert(0, new RadComboBoxItem("", "")); foreach (JOBCODE jc in SQMModelMgr.SelectJobcodeList("", "").OrderBy(j => j.JOB_DESC).ToList()) { ddlJobCode.Items.Add(new RadComboBoxItem(SQMModelMgr.FormatJobcode(jc), jc.JOBCODE_CD)); } ddlPrivGroup.Items.Insert(0, new RadComboBoxItem("", "")); foreach (PRIVGROUP pg in SQMModelMgr.SelectPrivGroupList("", true).OrderBy(g => g.DESCRIPTION).ToList()) { ddlPrivGroup.Items.Add(new RadComboBoxItem(SQMModelMgr.FormatPrivGroup(pg), pg.PRIV_GROUP)); } } ddlUserLanguage.DataSource = SQMModelMgr.SelectLanguageList(entities, true); ddlUserLanguage.DataTextField = "LANGUAGE_NAME"; ddlUserLanguage.DataValueField = "LANGUAGE_ID"; ddlUserLanguage.DataBind(); ddlUserLanguage.SelectedIndex = 0; ddlUserTimezone.DataSource = SQMSettings.TimeZone; ddlUserTimezone.DataTextField = "long_desc"; ddlUserTimezone.DataValueField = "code"; ddlUserTimezone.DataBind(); ddlUserTimezone.SelectedValue = "035"; ddlHRLocation.Items.Clear(); ddlPlantSelect.Items.Clear(); SQMBasePage.SetLocationList(ddlHRLocation, locationList, 0); ddlHRLocation.Items.Insert(0, new RadComboBoxItem("", "")); SQMBasePage.SetLocationList(ddlPlantSelect, locationList, 0); } }
private List <BusinessLocation> LocationList() { List <BusinessLocation> locationList = new List <BusinessLocation>(); locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true).ToList(); locationList = UserContext.FilterPlantAccessList(locationList); return(locationList); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { uclIssueSearch.BindCSTIssueSearch(true, "CST", new PSsqmEntities()); List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true); SQMBasePage.SetLocationList(uclIssueSearch.DDLPlantSelect, UserContext.FilterPlantAccessList(locationList, "SQM", ""), -1); } }
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 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 & Safety Audits"; lblPageInstructions.Text = "Add or update EH&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); } } }
private void SetupPage() { selectedFile = ""; btnUpload.Enabled = false; btnPreview.Enabled = false; gvErrorList.Visible = gvUpdateList.Visible = false; lblSummaryList.Visible = false; fileReader = null; if (ddlPlantSelect.Items.Count == 0) { SQMBasePage.SetLocationList(ddlPlantSelect, SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true), 0); ddlPlantSelect.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", "")); } }
private void SetupPage() { DropDownList ddl; ddl = (DropDownList)hfBase.FindControl("ddlPrefListSize"); if (ddl != null) { ddl.Items.AddRange(WebSiteCommon.PopulateDropDownListNums(1, 50, 10)); } ddlUserLanguage.DataSource = SQMModelMgr.SelectLanguageList(entities, false); ddlUserLanguage.DataTextField = "LANGUAGE_NAME"; ddlUserLanguage.DataValueField = "LANGUAGE_ID"; ddlUserLanguage.DataBind(); ddlUserLanguage.SelectedIndex = 0; ddlUserTimezone.DataSource = SQMSettings.TimeZone; ddlUserTimezone.DataTextField = "long_desc"; ddlUserTimezone.DataValueField = "code"; ddlUserTimezone.DataBind(); ddlUserTimezone.SelectedValue = "035"; List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.EffLocation.Company.COMPANY_ID, 0, false); ddlHRLocation.Items.Clear(); ddlPlantSelect.Items.Clear(); SQMBasePage.SetLocationList(ddlHRLocation, locationList, 0); ddlHRLocation.Items.Insert(0, new RadComboBoxItem("", "")); SQMBasePage.SetLocationList(ddlPlantSelect, locationList, 0); if (ddlCustPlantSelect.Items.Count < 1) { List <BusinessLocation> customerLocations = SQMModelMgr.SelectBusinessLocationList(0, 0, false, true, true).OrderBy(l => l.Plant.PLANT_NAME).ToList(); RadComboBoxItem item = null; ddlCustPlantSelect.Items.Insert(0, new RadComboBoxItem("", "")); foreach (BusinessLocation cust in customerLocations.GroupBy(l => l.Plant.PLANT_ID).Select(l => l.FirstOrDefault()).ToList()) { item = new RadComboBoxItem(cust.Plant.PLANT_NAME, cust.Plant.PLANT_ID.ToString()); if (cust.Address != null) { item.ToolTip = cust.Address.STREET1 + " " + cust.Address.CITY; } ddlCustPlantSelect.Items.Add(item); } } }
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("SQM", 2, true, true, ""); } RadComboBoxItem item; if (ddlSourceSelect.Items.Count == 5) { List <BusinessLocation> supplierLocations = SQMModelMgr.SelectBusinessLocationList(SessionManager.PrimaryCompany().COMPANY_ID, 0, true, true, false); supplierLocations.AddRange(SQMModelMgr.SelectBusinessLocationList(0, 0, true, false, false)); foreach (BusinessLocation supp in supplierLocations) { item = new RadComboBoxItem(supp.Plant.PLANT_NAME, supp.Plant.PLANT_ID.ToString()); if (supp.Address != null) { item.ToolTip = supp.Address.STREET1 + " " + supp.Address.CITY; } ddlSourceSelect.Items.Add(item); } } if (ddlUsedSelect.Items.Count == 5) { List <BusinessLocation> customerLocations = new List <BusinessLocation>(); // SQMModelMgr.SelectBusinessLocationList(SessionManager.PrimaryCompany().COMPANY_ID, 0, true, true); customerLocations.AddRange(SQMModelMgr.SelectBusinessLocationList(0, 0, false, true, false).OrderBy(l => l.Plant.PLANT_NAME).ToList()); foreach (BusinessLocation cust in customerLocations.GroupBy(l => l.Plant.PLANT_ID).Select(l => l.FirstOrDefault()).ToList()) { item = new RadComboBoxItem(cust.Plant.PLANT_NAME, cust.Plant.PLANT_ID.ToString()); if (cust.Address != null) { item.ToolTip = cust.Address.STREET1 + " " + cust.Address.CITY; } ddlUsedSelect.Items.Add(item); } } } }
private void OnLocationSelect(decimal plantID) { PLANT plant = SQMModelMgr.LookupPlant(plantID); if (plant == null) { DisplayProfileMessage(lblProfileNotExist); } else { List <BusinessLocation> locationList = new List <BusinessLocation>(); locationList.Add(new BusinessLocation().Initialize(plantID)); List <PERSON> responsibleList = SQMModelMgr.SelectPlantPersonList(locationList, "311", AccessMode.Update); SQMBasePage.SetPersonList(ddlMetricResponsible, responsibleList, ""); SQMBasePage.SetPersonList(ddlFinalApprover, responsibleList.Where(l => l.ROLE < SessionManager.AccessModeRoleXREF(AccessMode.Update)).ToList(), ""); LoadPlantProfile(plant); if (LocalProfile() != null && (LocalProfile().Profile.EHS_PROFILE_MEASURE == null || LocalProfile().Profile.EHS_PROFILE_MEASURE.Count == 0)) { if (UserContext.RoleAccess() > AccessMode.Plant) { List <EHS_PROFILE> profileList = EHSModel.SelectPlantProfileList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID); SQMBasePage.SetLocationList(ddlCopyProfile, SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true).Where(l => profileList.Select(p => p.PLANT_ID).ToArray().Contains(l.Plant.PLANT_ID)).ToList(), 0); ddlCopyProfile.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", "")); responsibleList = SQMModelMgr.SelectPersonList((decimal)plant.COMPANY_ID, (decimal)plant.BUS_ORG_ID, true, false).Where(p => p.ROLE >= SessionManager.AccessModeRoleXREF(AccessMode.Admin) && p.ROLE < SessionManager.AccessModeRoleXREF(AccessMode.View)).OrderBy(l => l.LAST_NAME).ToList(); ddlDefaultResponsible.Items.Clear(); foreach (PERSON person in responsibleList) { if (SQMModelMgr.PersonPlantAccess(person, plant.PLANT_ID)) { ddlDefaultResponsible.Items.Add(new Telerik.Web.UI.RadComboBoxItem(SQMModelMgr.FormatPersonListItem(person), person.PERSON_ID.ToString())); } } ddlDefaultResponsible.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", "")); pnlCopyProfile.Visible = true; } } pnlProfileEdit.Style.Add("display", "none"); } }
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"; } 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); } } if (rcbScheduleDay.Items.Count < 1) { IDictionary <int, string> days = GetAll <DayOfWeek>(); foreach (var day in days) { RadComboBoxItem item = new RadComboBoxItem(day.Value, day.Key.ToString()); item.Checked = true; rcbScheduleDay.Items.Add(item); } //rcbScheduleDay.DataSource = GetAll<DayOfWeek>(); //rcbScheduleDay.DataTextField = "Value"; //rcbScheduleDay.DataValueField = "Key"; //rcbScheduleDay.DataBind(); } divAuditList.Visible = true; lblViewEHSRezTitle.Text = "Manage Environmental Health & Safety Audit Schedules"; lblPageInstructions.Text = "Add or update EH&S Audit Schedule below."; rbNew.Text = "New Audit Schedule"; phAudit.Visible = true; }
private void OnLocationSelect(decimal plantID) { PLANT plant = SQMModelMgr.LookupPlant(plantID); if (plant == null) { DisplayProfileMessage(lblProfileNotExist); } else { List <BusinessLocation> locationList = new List <BusinessLocation>(); locationList.Add(new BusinessLocation().Initialize(plantID)); List <PERSON> responsibleList = SQMModelMgr.SelectPrivGroupPersonList(SysPriv.approve, SysScope.envdata, plant.PLANT_ID); responsibleList.AddRange(SQMModelMgr.SelectPrivGroupPersonList(SysPriv.admin, SysScope.system, 0)); // append any system administrators to the approval list SQMBasePage.SetPersonList(ddlFinalApprover, responsibleList, "", true); SQMBasePage.SetPersonList(ddlMetricResponsible, SQMModelMgr.SelectPrivGroupPersonList(SysPriv.originate, SysScope.envdata, plant.PLANT_ID), "", true); LoadPlantProfile(plant); if (LocalProfile() != null && (LocalProfile().Profile.EHS_PROFILE_MEASURE == null || LocalProfile().Profile.EHS_PROFILE_MEASURE.Count == 0)) { if (UserContext.GetMaxScopePrivilege(SysScope.envdata) <= SysPriv.config) { List <EHS_PROFILE> profileList = EHSModel.SelectPlantProfileList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID); SQMBasePage.SetLocationList(ddlCopyProfile, SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true).Where(l => profileList.Select(p => p.PLANT_ID).ToArray().Contains(l.Plant.PLANT_ID)).ToList(), 0); ddlCopyProfile.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", "")); responsibleList = SQMModelMgr.SelectPrivGroupPersonList(SysPriv.originate, SysScope.envdata, plant.PLANT_ID); SQMBasePage.SetPersonList(ddlDefaultResponsible, responsibleList, ""); ddlDefaultResponsible.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", "")); pnlCopyProfile.Visible = true; } } pnlProfileEdit.Style.Add("display", "none"); } }
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[5] { "INJURY_PART", "INJURY_TYPE", "MEDIA_VIDEO_SOURCE", "MEDIA_VIDEO_STATUS", "MEDIA_VIDEO_TYPE" }, 1); rcbVideoSource = SQMBasePage.SetComboBoxItemsFromXLAT(rcbVideoSource, xlatList.Where(l => l.XLAT_GROUP == "MEDIA_VIDEO_SOURCE" && l.STATUS == "A").OrderBy(h => h.SORT_ORDER).ToList(), "SHORT"); rcbVideoSource.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("All", "")); rcbVideoSource.SelectedIndex = 0; rcbVideoStatusSelect = SQMBasePage.SetComboBoxItemsFromXLAT(rcbVideoStatusSelect, xlatList.Where(l => l.XLAT_GROUP == "MEDIA_VIDEO_STATUS" && l.STATUS == "A").OrderBy(h => h.SORT_ORDER).ToList(), "SHORT"); rcbVideoStatusSelect.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("All", "")); rcbVideoStatusSelect.SelectedIndex = 0; rcbVideoType = SQMBasePage.SetComboBoxItemsFromXLAT(rcbVideoType, xlatList.Where(l => l.XLAT_GROUP == "MEDIA_VIDEO_TYPE" && l.STATUS == "A").OrderBy(h => h.SORT_ORDER).ToList(), "SHORT"); //rcbVideoStatusSelect.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("All", "")); //rcbVideoStatusSelect.SelectedIndex = 0; rcbInjuryType = SQMBasePage.SetComboBoxItemsFromXLAT(rcbInjuryType, xlatList.Where(l => l.XLAT_GROUP == "INJURY_TYPE" && l.STATUS == "A").OrderBy(h => h.SORT_ORDER).ToList(), "SHORT"); rcbInjuryType.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("All", "")); rcbInjuryType.SelectedIndex = 0; rcbBodyPart = SQMBasePage.SetComboBoxItemsFromXLAT(rcbBodyPart, xlatList.Where(l => l.XLAT_GROUP == "INJURY_PART" && l.STATUS == "A").OrderBy(h => h.SORT_ORDER).ToList(), "SHORT"); rcbBodyPart.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("All", "")); rcbBodyPart.SelectedIndex = 0; } divVideoList.Visible = true; rbNew.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); //lblStatus.Text = "Assessment Status:"; lblVideoDate.Visible = true; phVideo.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 { } //} }
private void SetupPage() { DropDownList ddl; ddl = (DropDownList)hfBase.FindControl("ddlPrefListSize"); if (ddl != null) { ddl.Items.AddRange(WebSiteCommon.PopulateDropDownListNums(1, 50, 10)); } if (ddlJobCode.Items.Count == 0) { ddlJobCode.Items.Insert(0, new RadComboBoxItem("", "")); foreach (JOBCODE jc in SQMModelMgr.SelectJobcodeList("", "").OrderBy(j => j.JOB_DESC).ToList()) { ddlJobCode.Items.Add(new RadComboBoxItem(SQMModelMgr.FormatJobcode(jc), jc.JOBCODE_CD)); } ddlPrivGroup.Items.Insert(0, new RadComboBoxItem("", "")); foreach (PRIVGROUP pg in SQMModelMgr.SelectPrivGroupList("", true).OrderBy(g => g.DESCRIPTION).ToList()) { ddlPrivGroup.Items.Add(new RadComboBoxItem(SQMModelMgr.FormatPrivGroup(pg), pg.PRIV_GROUP)); } } ddlUserLanguage.DataSource = SQMModelMgr.SelectLanguageList(entities, true); ddlUserLanguage.DataTextField = "LANGUAGE_NAME"; ddlUserLanguage.DataValueField = "LANGUAGE_ID"; ddlUserLanguage.DataBind(); ddlUserLanguage.SelectedIndex = 0; ddlUserTimezone.DataSource = SQMSettings.TimeZone; ddlUserTimezone.DataTextField = "long_desc"; ddlUserTimezone.DataValueField = "code"; ddlUserTimezone.DataBind(); ddlUserTimezone.SelectedValue = "035"; List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.EffLocation.Company.COMPANY_ID, 0, false); ddlHRLocation.Items.Clear(); ddlPlantSelect.Items.Clear(); SQMBasePage.SetLocationList(ddlHRLocation, locationList, 0); ddlHRLocation.Items.Insert(0, new RadComboBoxItem("", "")); SQMBasePage.SetLocationList(ddlPlantSelect, locationList, 0); /* quality module reference * if (ddlCustPlantSelect.Items.Count < 1) * { * List<BusinessLocation> customerLocations = SQMModelMgr.SelectBusinessLocationList(0, 0, false, true, true).OrderBy(l => l.Plant.PLANT_NAME).ToList(); * RadComboBoxItem item = null; * ddlCustPlantSelect.Items.Insert(0, new RadComboBoxItem("", "")); * foreach (BusinessLocation cust in customerLocations.GroupBy(l => l.Plant.PLANT_ID).Select(l => l.FirstOrDefault()).ToList()) * { * item = new RadComboBoxItem(cust.Plant.PLANT_NAME, cust.Plant.PLANT_ID.ToString()); * if (cust.Address != null) * item.ToolTip = cust.Address.STREET1 + " " + cust.Address.CITY; * * ddlCustPlantSelect.Items.Add(item); * } * } */ }
void InitializeForm(PSsqmEntities ctx) { lblStatusMsg.Visible = false; pnlAlert.Visible = true; //pnlBaseForm2.Visible = true; localCtx = ctx; LocalIncident = EHSIncidentMgr.SelectIncidentById(localCtx, IncidentId); //populate form when LocalIncident is not null //if (LocalIncident == null) //{ // return; //} if (LocalIncident != null) { GetAttachments(IncidentId); //To get Privilege information and if Privilege is CEO-Group then CEO-Comments section is editable. string PrivInfo = SessionManager.UserContext.Person.PRIV_GROUP.ToString(); if (PrivInfo == "CEO-GROUP") { tbCeoComments.ReadOnly = false; } INCFORM_ALERT incidentAlert = EHSIncidentMgr.LookupIncidentAlert(localCtx, IncidentId); SQMBasePage.SetLocationList(ddlLocations, SQMModelMgr.SelectBusinessLocationList(1m, 0, true), 0); ddlNotifyGroup.DataSource = SQMModelMgr.SelectPrivGroupList("A", true); ddlNotifyGroup.DataValueField = "PRIV_GROUP"; ddlNotifyGroup.DataTextField = "DESCRIPTION"; ddlNotifyGroup.DataBind(); ddlResponsibleGroup.DataSource = SQMModelMgr.SelectPrivGroupList("A", true); ddlResponsibleGroup.DataValueField = "PRIV_GROUP"; ddlResponsibleGroup.DataTextField = "DESCRIPTION"; ddlResponsibleGroup.DataBind(); rdpDueDate = SQMBasePage.SetRadDateCulture(rdpDueDate, ""); rdpDueDate.SelectedDate = DateTime.UtcNow.AddDays(1); List <NOTIFYACTION> notifyList = SQMModelMgr.SelectNotifyActionList(localCtx, null, null); NOTIFYACTION dfltNotify = notifyList.Where(l => l.NOTIFY_SCOPE == "IN-0" && l.SCOPE_TASK == "400").FirstOrDefault(); // get default alert notification groups btnSave.Enabled = false; pnlAlert.Enabled = btnSave.Visible = EHSIncidentMgr.CanUpdateIncident(LocalIncident, true, SysPriv.admin, LocalIncident.INCFORM_LAST_STEP_COMPLETED); if (incidentAlert == null) { if (dfltNotify != null) { ddlNotifyGroup.Items.Where(i => dfltNotify.NOTIFY_DIST.Split(',').Contains(i.Value)).ToList().ForEach(i => i.Checked = true); } lblAlertStatus.Text = ""; } else { ddlLocations.Items.Where(i => incidentAlert.LOCATION_LIST.Split(',').Contains(i.Value)).ToList().ForEach(i => i.Checked = true); // tbAlertDesc.Text = incidentAlert.ALERT_DESC; tbComments.Text = incidentAlert.COMMENTS; // Get CEO-comments value from database and display it. tbCeoComments.Text = incidentAlert.CEO_COMMENTS; ddlNotifyGroup.Items.Where(i => incidentAlert.ALERT_GROUP.Split(',').Contains(i.Value)).ToList().ForEach(i => i.Checked = true); if ((ddlResponsibleGroup.FindItemByValue(incidentAlert.RESPONSIBLE_GROUP)) != null) { ddlResponsibleGroup.SelectedValue = incidentAlert.RESPONSIBLE_GROUP; } rdpDueDate.SelectedDate = incidentAlert.DUE_DT; lblAlertStatus.Text = XLATList.Where(l => l.XLAT_GROUP == "TASK_STATUS" && l.XLAT_CODE == "0").FirstOrDefault().DESCRIPTION; } lblNotifyGroup.Text = ""; //Apply condotional code to desplay data in grid of Process Description if (LocalIncident.INCFORM_INJURYILLNESS != null) { if (string.IsNullOrEmpty(LocalIncident.INCFORM_INJURYILLNESS.BUSINESS_TYPE)) { BusinessType.Style.Add("display", "none"); } else { lblBusinessTypeVal.Text = XLATList.Where(p => p.XLAT_CODE == LocalIncident.INCFORM_INJURYILLNESS.BUSINESS_TYPE).Select(p => p.DESCRIPTION_SHORT).FirstOrDefault(); // display: block; // BusinessType.Style.Add("display", "block"); } } else { BusinessType.Style.Add("display", "none"); } if (LocalIncident.INCFORM_INJURYILLNESS != null) { if (string.IsNullOrEmpty(LocalIncident.INCFORM_INJURYILLNESS.MACRO_PROCESS_TYPE)) { MacroProcessType.Style.Add("display", "none"); } else { lblMacroProcessTypeVal.Text = XLATList.Where(p => p.XLAT_CODE == LocalIncident.INCFORM_INJURYILLNESS.MACRO_PROCESS_TYPE).Select(p => p.DESCRIPTION_SHORT).FirstOrDefault(); // MacroProcessType.Style.Add("display", "block"); } } else { MacroProcessType.Style.Add("display", "none"); } if (LocalIncident.INCFORM_INJURYILLNESS != null) { if (string.IsNullOrEmpty(LocalIncident.INCFORM_INJURYILLNESS.SPECIFIC_PROCESS_TYPE)) { SpecificProcessType.Style.Add("display", "none"); } else { lblSpecificProcessTypeVal.Text = XLATList.Where(p => p.XLAT_CODE == LocalIncident.INCFORM_INJURYILLNESS.SPECIFIC_PROCESS_TYPE).Select(p => p.DESCRIPTION_SHORT).FirstOrDefault(); //SpecificProcessType.Style.Add("display", "block"); } } else { SpecificProcessType.Style.Add("display", "none"); } if (LocalIncident.INCFORM_INJURYILLNESS != null) { if (string.IsNullOrEmpty(LocalIncident.INCFORM_INJURYILLNESS.EQUIPMENT_MANUFACTURER_NAME)) { EquipmentManufacturerName.Style.Add("display", "none"); } else { lblEquipmentManufacturerNameVal.Text = LocalIncident.INCFORM_INJURYILLNESS.EQUIPMENT_MANUFACTURER_NAME; // EquipmentManufacturerName.Style.Add("display", "block"); } } else { EquipmentManufacturerName.Style.Add("display", "none"); } foreach (RadComboBoxItem item in ddlNotifyGroup.Items.Where(i => i.Checked == true).ToList()) { lblNotifyGroup.Text += string.IsNullOrEmpty(lblNotifyGroup.Text) ? item.Text : (", " + item.Text); } if (BindTAlertaskList(EHSIncidentMgr.GetAlertTaskList(localCtx, LocalIncident.INCIDENT_ID)) > 0) { btnSave.Enabled = true; } } else { btnSave.Visible = false; pnlAlert.Visible = 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), 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"; 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; } }
public void LoadProfileSelectHdr(decimal companyID, decimal busOrgID, bool indicateUndefined, bool showExpanded) { ToggleVisible(pnlProfileSelectHdr); List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(companyID, busOrgID, true).Where(l => l.Plant.TRACK_EW_DATA == true).ToList(); locationList = UserContext.FilterPlantAccessList(locationList); int maxdesc = locationList.Select(l => l.Plant.PLANT_NAME.Length).Max(); if (showExpanded && locationList.Select(l => l.Plant.BUS_ORG_ID).Distinct().Count() > 1 && maxdesc < 41) { ddlBusLocSelect.Visible = false; mnuBusLocSelect.Visible = true; SQMBasePage.SetLocationList(mnuBusLocSelect, locationList, 0, "select a location ...", "TOP", false); if (indicateUndefined) { int undefinedCount = 0; List <string> profileList = EHSModel.SelectPlantProfileList(companyID).Select(l => l.PLANT_ID.ToString()).ToList(); RadMenuItem miTop = mnuBusLocSelect.Items[0]; foreach (RadMenuItem miBU in miTop.Items) { foreach (RadMenuItem miLoc in miBU.Items) { if (!profileList.Contains(miLoc.Value)) { ++undefinedCount; // miLoc.ImageUrl = "~/images/defaulticon/16x16/grid-dot.png"; miLoc.CssClass = "rcbItemEmphasis"; } else { miLoc.ImageUrl = "~/images/defaulticon/16x16/document.png"; } } } } } else { ddlBusLocSelect.Visible = true; mnuBusLocSelect.Visible = false; SQMBasePage.SetLocationList(ddlBusLocSelect, locationList, 0); if (indicateUndefined) { int undefinedCount = 0; List <string> profileList = EHSModel.SelectPlantProfileList(companyID).Select(l => l.PLANT_ID.ToString()).ToList(); foreach (RadComboBoxItem item in ddlBusLocSelect.Items) { if (!item.IsSeparator) { if (!profileList.Contains(item.Value)) { ++undefinedCount; item.ImageUrl = "~/images/defaulticon/16x16/blank.png"; item.CssClass = "rcbItemEmphasis"; item.ToolTip = "Metrics not defined"; } else { item.ImageUrl = "~/images/defaulticon/16x16/document.png"; } } } if (undefinedCount > 0) { ddlBusLocSelect.ToolTip += hfBusLocProfileUndefined.Value; } } ddlBusLocSelect.Items.Insert(0, new RadComboBoxItem("", "")); } }
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 & Safety Assessment Exceptions"; //lblPageInstructions.Text = "Review and update EH&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); } } } }
private void SetupPage() { hfViewOption.Value = ""; radDateFrom.Culture = System.Threading.Thread.CurrentThread.CurrentUICulture; radDateTo.Culture = System.Threading.Thread.CurrentThread.CurrentUICulture; radDateFrom.MinDate = new DateTime(2001, 1, 1); radDateTo.MinDate = new DateTime(2001, 1, 1); radDateFrom.MaxDate = SessionManager.UserContext.LocalTime.AddMonths(1); radDateTo.MaxDate = SessionManager.UserContext.LocalTime.AddMonths(1); radDateFrom.SelectedDate = SessionManager.UserContext.LocalTime.AddMonths(-11); radDateTo.SelectedDate = SessionManager.UserContext.LocalTime; PlantIDS = new decimal[0] { }; SetLocalDataset(null); List <BusinessLocation> locationList = SQMModelMgr.UserAccessibleLocations(SessionManager.UserContext.Person, SQMModelMgr.SelectBusinessLocationList(1, 0, true), true, false, "").Where(l => l.Plant.TRACK_EW_DATA != null && l.Plant.TRACK_EW_DATA == true).ToList(); if (locationList.Select(l => l.Plant.BUS_ORG_ID).Distinct().Count() > 1 && SessionManager.IsUserAgentType("ipad,iphone") == false) { mnuPlantSelect.Visible = true; SQMBasePage.SetLocationList(mnuPlantSelect, locationList.Where(l => l.Plant.TRACK_EW_DATA != null && l.Plant.TRACK_EW_DATA == true).ToList(), SessionManager.UserContext.HRLocation.Plant.PLANT_ID, "select a location ...", "TOP", false); mnuPlantSelect_Select(null, null); } else { ddlPlantSelect.Visible = lblPlantSelect.Visible = true; SQMBasePage.SetLocationList(ddlPlantSelect, locationList, SessionManager.UserContext.HRLocation.Plant.PLANT_ID); } uclExport.BindExport("", false, ""); DisplayOptions(); }
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; pnlChartSection.Style.Add("display", "none"); lblChartType.Visible = ddlChartType.Visible = false; 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); } } // 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); // } //} ddlChartType.Items.Clear(); ddlChartType.Items.Add(new RadComboBoxItem("", "")); ddlChartType.Items.Add(new RadComboBoxItem("Audit Summary", "charts")); ddlChartType.Items.Add(new RadComboBoxItem("Data Results", "report")); } }
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; } }
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); } }
protected void SelectActivityType(object sender, EventArgs e) { RadComboBoxItem item = null; switch (ddlIncidentType.SelectedValue) { case "CST": ddlReportedLocation.Items.Clear(); ddlReportedLocation.Items.Add(new RadComboBoxItem(SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME, SessionManager.UserContext.HRLocation.Plant.PLANT_ID.ToString())); List <BusinessLocation> custLocations = SQMModelMgr.UserAccessibleLocations(SessionManager.UserContext.Person, SQMModelMgr.SelectBusinessLocationList(0, 0, false, true, true), false, true, ddlIncidentType.SelectedValue); foreach (BusinessLocation loc in custLocations) { ddlReportedLocation.Items.Add(SQMBasePage.SetLocationItem(loc, true)); } break; case "RCV": ddlReportedLocation.Items.Clear(); List <BusinessLocation> locationList = UserContext.FilterPlantAccessList(SQMModelMgr.SelectBusinessLocationList(SessionManager.PrimaryCompany().COMPANY_ID, 0, true)); SQMBasePage.SetLocationList(ddlReportedLocation, locationList, 0); break; default: ddlReportedLocation.Items.Clear(); ddlReportedLocation.Items.Add(new RadComboBoxItem(SessionManager.UserContext.WorkingLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.WorkingLocation.Plant.PLANT_NAME, SessionManager.UserContext.WorkingLocation.Plant.PLANT_ID.ToString())); if (SessionManager.UserContext.WorkingLocation.Plant.PLANT_ID != SessionManager.UserContext.HRLocation.Plant.PLANT_ID) { ddlReportedLocation.Items.Add(new RadComboBoxItem(SessionManager.UserContext.HRLocation.Company.COMPANY_NAME + ", " + SessionManager.UserContext.HRLocation.Plant.PLANT_NAME, SessionManager.UserContext.HRLocation.Plant.PLANT_ID.ToString())); } break; } }
public void LoadProfileInputHdr(bool loadPlants, DateTime dateFrom, DateTime dateTo, decimal defaultPlantID, bool hideUndefined, bool showExpanded) { ToggleVisible(pnlProfileInputHdr); if (loadPlants && ddlPlantSelect.Items.Count == 0) { List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true).Where(l => l.Plant.TRACK_EW_DATA == true).ToList(); locationList = UserContext.FilterPlantAccessList(locationList); int maxdesc = locationList.Select(l => l.Plant.PLANT_NAME.Length).Max(); if (locationList.Count > 1 && showExpanded && locationList.Select(l => l.Plant.BUS_ORG_ID).Distinct().Count() > 1 && maxdesc < 41) { ddlPlantSelect.Visible = false; tdLocation.Visible = false; mnuPlantSelect.Visible = true; SQMBasePage.SetLocationList(mnuPlantSelect, locationList, 0, "select a location...", "TOP", false); int undefinedCount = 0; List <string> profileList = EHSModel.SelectPlantProfileList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID).Select(l => l.PLANT_ID.ToString()).ToList(); RadMenuItem miTop = mnuPlantSelect.Items[0]; foreach (RadMenuItem miBU in miTop.Items) { foreach (RadMenuItem miLoc in miBU.Items) { if (!profileList.Contains(miLoc.Value)) { ++undefinedCount; miLoc.ImageUrl = "~/images/defaulticon/16x16/grid-dot.png"; miLoc.CssClass = "rcbItemEmphasis"; if (hideUndefined) { miLoc.Visible = false; } } } } if (mnuPlantSelect.FindItemByValue(defaultPlantID.ToString()) != null) { mnuPlantSelect.FindItemByValue(defaultPlantID.ToString()).Selected = true; LocationSelect_Click(mnuPlantSelect, null); } } else { ddlPlantSelect.Visible = true; mnuPlantSelect.Visible = false; SQMBasePage.SetLocationList(ddlPlantSelect, locationList, 0); if (ddlPlantSelect.Items.Count == 1) { tdLocationSelect.Visible = false; tdLocation.Visible = true; lblPlantName_out.Text = ddlPlantSelect.SelectedItem.Text; LocationSelect_Click(ddlPlantSelect, null); } else { List <string> profileList = EHSModel.SelectPlantProfileList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID).Select(l => l.PLANT_ID.ToString()).ToList(); int undefinedCount = 0; foreach (RadComboBoxItem item in ddlPlantSelect.Items) { if (!item.IsSeparator && !profileList.Contains(item.Value)) { ++undefinedCount; //item.ImageUrl = "~/images/defaulticon/16x16/grid-dot.png"; item.CssClass = "rcbItemEmphasis"; item.ToolTip = "Metrics not defined"; if (hideUndefined) { item.Visible = false; } else { item.Enabled = false; } } } if (undefinedCount > 0 && !hideUndefined) { ddlPlantSelect.ToolTip += hfPlantProfileUndefined.Value; } tdLocationSelect.Visible = true; tdLocation.Visible = false; if (ddlPlantSelect.FindItemByValue(defaultPlantID.ToString()) != null) { ddlPlantSelect.SelectedValue = defaultPlantID.ToString(); LocationSelect_Click(ddlPlantSelect, null); } else { LocationSelect_Click(ddlPlantSelect, null); } } } } if (dateFrom > DateTime.MinValue) { radPeriodSelect.Visible = true; // radPeriodSelect.Culture = System.Threading.Thread.CurrentThread.CurrentUICulture; radPeriodSelect.MinDate = dateFrom; radPeriodSelect.MaxDate = dateTo; radPeriodSelect.ShowPopupOnFocus = true; if (dateFrom == dateTo) { radPeriodSelect.SelectedDate = dateFrom; radPeriodSelect.Enabled = false; } else { radPeriodSelect.SelectedDate = DateTime.Now; } radPeriodSelect.Culture = System.Threading.Thread.CurrentThread.CurrentUICulture; tdPeriod.Visible = false; tdPeriodSelect.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { this.hfLang.Value = SessionManager.UserContext.Language.NLS_LANGUAGE; string frequency; string frequencyName = this.Request.QueryString["type"]; if (frequencyName == null) { frequencyName = "Daily"; } if (frequencyName == "Weekly") { frequency = "W"; } else if (frequencyName == "Monthly") { frequency = "M"; } else { frequency = "D"; } if (frequency != "M") { this.spanMonth.Visible = false; } else { this.spanEndOfWeek.Visible = false; } this.entities = new PSsqmEntities(); var rgData = this.dataPanel.FindControl("rgData") as RadGrid; rgData.DataSource = from m in this.entities.EHS_MEASURE where m.MEASURE_CATEGORY == "SAFE" && m.MEASURE_SUBCATEGORY == "SAFE1" && m.STATUS == "A" && m.FREQUENCY == frequency orderby m.MEASURE_CD select new { m.MEASURE_NAME, m.MEASURE_ID, m.DATA_TYPE }; rgData.DataBind(); SQMBasePage.SetLocationList(this.rcbPlant, UserContext.FilterPlantAccessList(SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true)), this.Request.QueryString["plant"] != null ? decimal.Parse(this.Request.QueryString["plant"]) : SessionManager.UserContext.HRLocation.Plant.PLANT_ID); this.rdpEndOfWeek.SelectedDate = this.rmypMonth.SelectedDate = DateTime.Today; this.rcbPlant.OnClientSelectedIndexChanged = this.rdpEndOfWeek.DateInput.OnClientDateChanged = this.rmypMonth.DateInput.OnClientDateChanged = "get" + frequencyName + "Data"; this.btnSave.Attributes.Add("onclick", "save" + frequencyName + "Data()"); foreach (var freq in new[] { "Daily", "Weekly", "Monthly" }) { var btn = this.dataPanel.FindControl("btn" + freq) as HtmlInputButton; if (frequencyName == freq) { btn.Disabled = true; btn.Attributes.Add("class", "myButtonDisabled"); } else { btn.Attributes.Add("class", "myButton"); } } } }
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; } }