protected void ddlChartTypeChange(object sender, EventArgs e) { divChart.ViewStateMode = System.Web.UI.ViewStateMode.Disabled; if (ddlChartType.SelectedValue == "" || HSCalcs().ehsCtl.IncidentHst == null || HSCalcs().ehsCtl.IncidentHst.Count == 0) { pnlChartSection.Style.Add("display", "none"); lnkChartClose.Visible = lnkPrint.Visible = false; } else { PERSPECTIVE_VIEW view = null; divChart.Controls.Clear(); LOCAL_LANGUAGE lang = SQMModelMgr.LookupLanguage(entities, "", SessionManager.UserContext.Person.PREFERRED_LANG_ID.HasValue ? (int)SessionManager.UserContext.Person.PREFERRED_LANG_ID : 1, false); view = ViewModel.LookupView(entities, "HSIR", "HSIR", 0, lang.NLS_LANGUAGE); if (view != null) { PERSPECTIVE_VIEW_ITEM vi = view.PERSPECTIVE_VIEW_ITEM.Where(i => i.ITEM_SEQ.ToString() == ddlChartType.SelectedValue).FirstOrDefault(); if (vi != null) { GaugeDefinition ggCfg = new GaugeDefinition().Initialize().ConfigureControl(vi, null, "", false, !string.IsNullOrEmpty(hfwidth.Value) ? Convert.ToInt32(hfwidth.Value) - 62 : 0, 0); ggCfg.Position = null; HSCalcs().ehsCtl.SetCalcParams(vi.CALCS_METHOD, vi.CALCS_SCOPE, vi.CALCS_STAT, (int)vi.SERIES_ORDER, vi.FILTER, vi.OPTIONS).IncidentSeries((EHSCalcsCtl.SeriesOrder)vi.SERIES_ORDER, SQMBasePage.GetComboBoxCheckedItems(ddlPlantSelect).Select(i => Convert.ToDecimal(i.Value)).ToArray(), new DateTime(1900, 1, 1), SessionManager.UserContext.LocalTime.AddYears(100), HSCalcs().ehsCtl.GetIncidentTopics()); uclChart.CreateControl((SQMChartType)vi.CONTROL_TYPE, ggCfg, HSCalcs().ehsCtl.Results, divChart); pnlChartSection.Style.Add("display", "inline"); lnkChartClose.Visible = lnkPrint.Visible = true; // return; } } } }
protected void ddlChartTypeChange(object sender, EventArgs e) { divChart.ViewStateMode = System.Web.UI.ViewStateMode.Disabled; pnlChartSection.Style.Add("display", "none"); lnkChartClose.Visible = lnkPrint.Visible = false; if (ddlChartType.SelectedValue == "") { ; } else { divChart.Controls.Clear(); PERSPECTIVE_VIEW view = ViewModel.LookupView(entities, IssueCtl().Context, IssueCtl().Context, 0); if (view != null) { PERSPECTIVE_VIEW_ITEM vi = view.PERSPECTIVE_VIEW_ITEM.Where(i => i.ITEM_SEQ.ToString() == ddlChartType.SelectedValue).FirstOrDefault(); if (vi != null) { GaugeDefinition ggCfg = new GaugeDefinition().Initialize().ConfigureControl(vi, null, "", false, !string.IsNullOrEmpty(hfwidth.Value) ? Convert.ToInt32(hfwidth.Value) - 62 : 0, 0); ggCfg.Position = null; IssueCtl().CalcsCtl.SetCalcParams(vi.CALCS_METHOD, vi.CALCS_SCOPE, vi.CALCS_STAT, (int)vi.SERIES_ORDER).MetricSeries(uclIssueSearch.FromDate, uclIssueSearch.ToDate, uclIssueSearch.DDLPlantSelectIDS()); uclChart.CreateControl((SQMChartType)vi.CONTROL_TYPE, ggCfg, IssueCtl().CalcsCtl.Results, divChart); pnlChartSection.Style.Add("display", "inline"); lnkChartClose.Visible = lnkPrint.Visible = true; // return; } } } }
public static PERSPECTIVE_VIEW LookupView(PSsqmEntities ctx, string perspective, string viewName, decimal viewID) { PERSPECTIVE_VIEW view = null; try { if (viewID > 0) { view = (from v in ctx.PERSPECTIVE_VIEW.Include("PERSPECTIVE_VIEW_ITEM") where (v.VIEW_ID == viewID) select v).Single(); } else { view = (from v in ctx.PERSPECTIVE_VIEW.Include("PERSPECTIVE_VIEW_ITEM") where (v.PERSPECTIVE == perspective && v.VIEW_NAME == viewName) select v).Single(); } } catch (Exception ex) { //SQMLogger.LogException(ex); } return(view); }
public static PERSPECTIVE_VIEW LookupView(PSsqmEntities ctx, string perspective, string viewName, decimal viewID, string nlsLanguage) { PERSPECTIVE_VIEW view = null; try { if (viewID > 0) { view = (from v in ctx.PERSPECTIVE_VIEW.Include("PERSPECTIVE_VIEW_ITEM").Include("PERSPECTIVE_VIEW_LANG").Include("PERSPECTIVE_VIEW_ITEM.PERSPECTIVE_VIEW_ITEM_LANG") where (v.VIEW_ID == viewID) select v).SingleOrDefault(); } else { view = (from v in ctx.PERSPECTIVE_VIEW.Include("PERSPECTIVE_VIEW_ITEM").Include("PERSPECTIVE_VIEW_LANG").Include("PERSPECTIVE_VIEW_ITEM.PERSPECTIVE_VIEW_ITEM_LANG") where (v.PERSPECTIVE == perspective && v.VIEW_NAME == viewName) select v).SingleOrDefault(); } if (view != null && nlsLanguage.ToLower() != "en") { PERSPECTIVE_VIEW_LANG lang = view.PERSPECTIVE_VIEW_LANG.Where(v => v.NLS_LANGUAGE.ToLower() == nlsLanguage.ToLower()).FirstOrDefault(); if (lang != null) { view.VIEW_NAME = lang.VIEW_NAME; view.VIEW_DESC = lang.VIEW_DESC; PERSPECTIVE_VIEW_ITEM_LANG langItem = null; foreach (PERSPECTIVE_VIEW_ITEM item in view.PERSPECTIVE_VIEW_ITEM) { if ((langItem = item.PERSPECTIVE_VIEW_ITEM_LANG.Where(i => i.NLS_LANGUAGE.ToLower() == nlsLanguage.ToLower()).FirstOrDefault()) != null) { item.TITLE = langItem.TITLE; item.SCALE_LABEL = langItem.SCALE_LABEL; item.A_LABEL = langItem.A_LABEL; if (!string.IsNullOrEmpty(langItem.OPTIONS)) { item.OPTIONS = langItem.OPTIONS; } } } } } } catch (Exception ex) { //SQMLogger.LogException(ex); } return(view); }
public static bool HasSections(PERSPECTIVE_VIEW view) { // does the view contain any section areas ? bool hasArrays = false; foreach (PERSPECTIVE_VIEW_ITEM vi in view.PERSPECTIVE_VIEW_ITEM) { if (vi.CONTROL_TYPE == 1) { hasArrays = true; break; } } return(hasArrays); }
public static PERSPECTIVE_VIEW CreateView(string perspective, decimal companyID, decimal busOrgID, decimal plantID, decimal ownerID) { PERSPECTIVE_VIEW view = new PERSPECTIVE_VIEW(); view.PERSPECTIVE = perspective; view.COMPANY_ID = companyID; view.BUS_ORG_ID = busOrgID; view.PLANT_ID = plantID; view.OWNER_ID = ownerID; view.AVAILABILTY = 1; view.DFLT_OPTION = 0; view.STATUS = "N"; return(view); }
public static bool HasArrays(PERSPECTIVE_VIEW view) { // does the view contain any array controls ? bool hasArrays = false; foreach (PERSPECTIVE_VIEW_ITEM vi in view.PERSPECTIVE_VIEW_ITEM) { if (vi.DISPLAY_TYPE.HasValue && vi.DISPLAY_TYPE == 2) { hasArrays = true; break; } } return(hasArrays); }
public PERSPECTIVE_VIEW CreateCorpTargetView(decimal companyID, int effYear, string viewTitle) { PERSPECTIVE_VIEW targetView = new PERSPECTIVE_VIEW(); PERSPECTIVE_VIEW_ITEM vi = null; targetView.PERSPECTIVE = "0"; targetView.DFLT_TIMEFRAME = 1; targetView.VIEW_DESC = viewTitle; int seq = -1; string perspective = ""; foreach (PERSPECTIVE_TARGET pt in this.TargetList.OrderBy(l => l.PERSPECTIVE).ToList()) { vi = new PERSPECTIVE_VIEW_ITEM(); vi.ITEM_SEQ = ++seq; vi.DISPLAY_TYPE = 1; vi.SERIES_ORDER = 1; vi.MULTIPLIER = vi.SCALE_MIN = vi.SCALE_MAX = vi.SCALE_UNIT = 0; vi.CALCS_METHOD = pt.PERSPECTIVE; // important diff vi.CALCS_STAT = pt.SSTAT; vi.CALCS_SCOPE = pt.CALCS_SCOPE; vi.TITLE = vi.A_LABEL = pt.DESCR_SHORT; vi.SCALE_LABEL = pt.DESCR_SHORT; vi.DISPLAY_TARGET_ID = pt.TARGET_ID; // vi.INDICATOR_1_VALUE = vi.INDICATOR_2_VALUE = vi.INDICATOR_3_VALUE = 0; // vi.INDICATOR_1_COLOR = vi.INDICATOR_2_COLOR = vi.INDICATOR_3_COLOR = ""; vi.COLOR_PALLETE = vi.OPTIONS = ""; vi.STATUS = "0"; vi.ITEM_WIDTH = 280; // if (pt.PERSPECTIVE != perspective) // vi.NEW_ROW = true; // else vi.NEW_ROW = false; vi.CONTROL_TYPE = 60; // vi.CONTROL_TYPE = 1; vi.ITEM_WIDTH = 185; vi.ITEM_HEIGHT = 150; vi.OPTIONS = "N"; vi.SCALE_LABEL = ""; vi.SCALE_MIN = -100; vi.SCALE_MAX = 100; vi.SCALE_UNIT = 25; perspective = pt.PERSPECTIVE; targetView.PERSPECTIVE_VIEW_ITEM.Add(vi); } return(targetView); }
public static PERSPECTIVE_VIEW UpdateView(SQM.Website.PSsqmEntities ctx, PERSPECTIVE_VIEW view, string updateBy) { try { if (view.STATUS == "D") { ctx.DeleteObject(view); } else { view = (PERSPECTIVE_VIEW)SQMModelMgr.SetObjectTimestamp((object)view, updateBy, view.EntityState); if (view.EntityState == EntityState.Detached || view.EntityState == EntityState.Added) { view.STATUS = "A"; ctx.AddToPERSPECTIVE_VIEW(view); } foreach (PERSPECTIVE_VIEW_ITEM vi in view.PERSPECTIVE_VIEW_ITEM.ToList()) { if (vi.STATUS == "D" || vi.ITEM_SEQ < 1) { ctx.DeleteObject(vi); } else { if (vi.EntityState == EntityState.Detached || vi.EntityState == EntityState.Added) { vi.STATUS = "A"; vi.CALCS_SCOPE = view.PERSPECTIVE; ctx.AddToPERSPECTIVE_VIEW_ITEM(vi); } } } } ctx.SaveChanges(); } catch (Exception e) { //SQMLogger.LogException(e); } return(view); }
protected int GeneratePerspectiveView(decimal viewID) { int status = 0; //hfViewOption.Value = viewID.ToString(); divView.ViewStateMode = System.Web.UI.ViewStateMode.Disabled; divView.Controls.Clear(); PERSPECTIVE_VIEW view = LocalViewList.Where(v => v.VIEW_ID == viewID).FirstOrDefault(); if (view == null) { lblReportTitle.CssClass = "promptAlert"; lblReportTitle.Text = hfViewOpenErr.Value; return(-1); } lblReportTitle.CssClass = "labelTitle"; lblReportTitle.Text = PlantSelect + " - " + view.VIEW_DESC; DateTime fromDate = (DateTime)radDateFrom.SelectedDate; fromDate = new DateTime(fromDate.Year, fromDate.Month, 1); DateTime toDate = (DateTime)radDateTo.SelectedDate; toDate = new DateTime(toDate.Year, toDate.Month, DateTime.DaysInMonth(toDate.Year, toDate.Month)); SQMMetricMgr metricMgr = new SQMMetricMgr().CreateNew(SessionManager.PrimaryCompany(), "E", fromDate, toDate, ViewModel.AddFromYear(view), PlantIDS); metricMgr.Load(DateIntervalType.month, DateSpanOption.SelectRange); foreach (PERSPECTIVE_VIEW_ITEM vi in view.PERSPECTIVE_VIEW_ITEM.OrderBy(i => i.ITEM_SEQ).ToList()) { if (vi.STATUS != "I") { GaugeDefinition cfg = new GaugeDefinition().Initialize().ConfigureControl(vi, null, "", false, !string.IsNullOrEmpty(hfwidth.Value) ? Convert.ToInt32(hfwidth.Value) - 62 : 0, 0); uclView.CreateControl((SQMChartType)cfg.ControlType, cfg, metricMgr.CalcsMethods(PlantIDS, vi.CALCS_METHOD, vi.CALCS_SCOPE, vi.CALCS_STAT, vi.CONTROL_TYPE, (int)vi.SERIES_ORDER, vi.FILTER, vi.OPTIONS), divView); } } SetLocalDataset(metricMgr); divView.Visible = true; return(status); }
public static string GetViewImageURL(PERSPECTIVE_VIEW view) { string url = ""; if (view.PERSPECTIVE_VIEW_ITEM.Where(l => l.CONTROL_TYPE == 50).ToList().Count > 0) { url = "/images/defaulticon/16x16/statistics-pie-chart.png"; } else if (view.PERSPECTIVE_VIEW_ITEM.Where(l => l.CONTROL_TYPE == 10 || l.CONTROL_TYPE == 32 || l.CONTROL_TYPE == 34).ToList().Count > 0) { url = "/images/defaulticon/16x16/activity.png"; } else { url = "/images/defaulticon/16x16/statistics-chart.png"; } return(url); }
public static string GetViewImageStyle(PERSPECTIVE_VIEW view) { string style = ""; if (view.PERSPECTIVE_VIEW_ITEM.Where(l => l.CONTROL_TYPE == 50).ToList().Count > 0) { style = "buttonPie"; } else if (view.PERSPECTIVE_VIEW_ITEM.Where(l => l.CONTROL_TYPE == 10 || l.CONTROL_TYPE == 32 || l.CONTROL_TYPE == 34).ToList().Count > 0) { style = "buttonGraph"; } else { style = "buttonChart"; } return(style); }
public static int AddFromYear(PERSPECTIVE_VIEW view) { int numYears = 0; if (view.PERSPECTIVE == "0") { numYears = -1; } else { foreach (PERSPECTIVE_VIEW_ITEM vi in view.PERSPECTIVE_VIEW_ITEM) { if (vi.CALCS_STAT == SStat.pctChange.ToString() || vi.CALCS_STAT == SStat.pctReduce.ToString() || vi.SERIES_ORDER == Convert.ToInt16(EHSCalcsCtl.SeriesOrder.YearPlant) || vi.SERIES_ORDER == Convert.ToInt16(EHSCalcsCtl.SeriesOrder.YearPlantAvg) || vi.SERIES_ORDER == Convert.ToInt16(EHSCalcsCtl.SeriesOrder.PeriodMeasureYOY) | vi.SERIES_ORDER == Convert.ToInt16(EHSCalcsCtl.SeriesOrder.PeriodSumYOY)) { numYears = -1; } } } return(numYears); }
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; } }
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; } }
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); } }