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; } } } }
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; } } } }
private int DisplayResults(string cmdID) { int status = 0; SQMMetricMgr metricMgr = null; try { if (!string.IsNullOrEmpty(cmdID)) { EHS_PROFILE_MEASURE metric = EHSModel.LookupEHSProfileMeasure(new PSsqmEntities(), Convert.ToDecimal(cmdID)); decimal calcScopeID = EHSModel.ConvertPRODMeasure(metric.EHS_MEASURE, metric.PRMR_ID); decimal plantID = Convert.ToDecimal(hfInputsListPlantID.Value); DateTime periodDate = Convert.ToDateTime(hfInputsListPeriodDate.Value); divInputsListReviewArea.Visible = true; divInputsListReviewArea.ViewStateMode = System.Web.UI.ViewStateMode.Disabled; if (metricMgr == null) { metricMgr = new SQMMetricMgr().CreateNew(SessionManager.PrimaryCompany(), "I", periodDate.AddMonths(-12), periodDate, new decimal[1] { plantID }); metricMgr.Load(DateIntervalType.month, DateSpanOption.SelectRange); } GaugeDefinition ggCfg = new GaugeDefinition().Initialize(); ggCfg.Title = metric.EHS_MEASURE.MEASURE_NAME.Trim() + " - Input History"; ggCfg.Height = 250; ggCfg.Width = 650; ggCfg.NewRow = true; ggCfg.DisplayLabel = true; ggCfg.DisplayLegend = false; ggCfg.LabelV = "Quantity"; status = uclGauge.CreateControl(SQMChartType.MultiLine, ggCfg, metricMgr.CalcsMethods(new decimal[1] { plantID }, "I", calcScopeID.ToString(), "sum", 32, (int)EHSCalcsCtl.SeriesOrder.PeriodMeasure), divInputsListReviewArea); if (string.IsNullOrEmpty(metric.EHS_MEASURE.PLANT_ACCT_FIELD) && metric.EHS_MEASURE.MEASURE_CATEGORY != "FACT") { ggCfg.Height = 165; ggCfg.Width = 650; ggCfg.Title = ""; ggCfg.DisplayLabel = false; ggCfg.LabelV = "Cost"; status = uclGauge.CreateControl(SQMChartType.MultiLine, ggCfg, metricMgr.CalcsMethods(new decimal[1] { plantID }, "I", calcScopeID.ToString(), "cost", 32, (int)EHSCalcsCtl.SeriesOrder.PeriodMeasure), divInputsListReviewArea); } } } catch { ; } return(status); }
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); }
private int DisplayResults(string cmdID) { int status = 0; SQMMetricMgr metricMgr = null; foreach (RepeaterItem item in rptProfilePeriod.Items) { try { LinkButton lnk = (LinkButton)item.FindControl("lnkMetricCD"); CheckBox cb = (CheckBox)item.FindControl("cbMetricSelect"); if (cb.Checked) // || cmdID == "0") { EHS_PROFILE_MEASURE metric = LocalProfile().GetMeasure(Convert.ToDecimal(lnk.CommandArgument)); decimal calcScopeID = EHSModel.ConvertPRODMeasure(metric.EHS_MEASURE, metric.PRMR_ID); System.Web.UI.HtmlControls.HtmlGenericControl reviewArea = (System.Web.UI.HtmlControls.HtmlGenericControl)item.FindControl("divReviewArea"); LinkButton lnkClose = (LinkButton)item.FindControl("lnkReviewAreaClose"); lnkClose.Visible = reviewArea.Visible = true; lnk.Visible = false; reviewArea.ViewStateMode = System.Web.UI.ViewStateMode.Disabled; if (metricMgr == null) { metricMgr = new SQMMetricMgr().CreateNew(SessionManager.PrimaryCompany(), "I", LocalProfile().InputPeriod.PeriodDate.AddMonths(-12), LocalProfile().InputPeriod.PeriodDate, new decimal[1] { LocalProfile().Profile.PLANT_ID }); metricMgr.Load(DateIntervalType.month, DateSpanOption.SelectRange); } GaugeDefinition ggCfg = new GaugeDefinition().Initialize(); ggCfg.Title = metric.EHS_MEASURE.MEASURE_NAME.Trim() + " - Input History"; ggCfg.Height = 250; ggCfg.Width = 700; ggCfg.NewRow = true; ggCfg.DisplayLabel = true; ggCfg.DisplayLegend = false; ggCfg.LabelV = "Quantity"; status = uclGauge.CreateControl(SQMChartType.MultiLine, ggCfg, metricMgr.CalcsMethods(new decimal[1] { LocalProfile().Profile.PLANT_ID }, "I", calcScopeID.ToString(), "sum", 32, (int)EHSCalcsCtl.SeriesOrder.PeriodMeasure), reviewArea); if (string.IsNullOrEmpty(metric.EHS_MEASURE.PLANT_ACCT_FIELD) && metric.EHS_MEASURE.MEASURE_CATEGORY != "FACT") { ggCfg.Height = 180; ggCfg.Width = 700; ggCfg.Title = ""; ggCfg.DisplayLabel = false; ggCfg.LabelV = "Cost"; status = uclGauge.CreateControl(SQMChartType.MultiLine, ggCfg, metricMgr.CalcsMethods(new decimal[1] { LocalProfile().Profile.PLANT_ID }, "I", calcScopeID.ToString(), "cost", 32, (int)EHSCalcsCtl.SeriesOrder.PeriodMeasure), reviewArea); } } } catch { ; } } BindSharedCalendars(); return(status); }
protected void Page_Load(object sender, EventArgs e) { SETTINGS sets = null; if (IsPostBack) { // Save the current view port width (used for responsive design later) var vpWidth = viewPortWidth.Value; if (!string.IsNullOrEmpty(vpWidth)) { Session["vpWidth"] = vpWidth; } else { Session["vpWidth"] = "1000"; } } else { // if (LoginAttempts == 0) // SessionManager.Clear(); try { string info = System.Configuration.ConfigurationManager.AppSettings["MainInfo"]; if (!string.IsNullOrEmpty(info)) { lblMainInfo.Text = info; lblMainInfo.Visible = true; } System.Web.HttpBrowserCapabilities browser = Request.Browser; // url format login.aspx/?t=ltc:60&p=EHS // execOverride == override query params to force ticker and image posting System.Collections.Specialized.NameValueCollection qry = new System.Collections.Specialized.NameValueCollection(); string execOverride = System.Configuration.ConfigurationManager.AppSettings["LoginOverride"]; if (execOverride != null && execOverride == "QAI") { qry.Add("t", "ltc"); qry.Add("p", "EHS,QS"); } else { sets = SQMSettings.GetSetting("ENV", "LOGINIMAGE"); // force login splash page display if (sets != null && sets.VALUE.ToUpper() == "Y") { qry.Add("p", "EHS,QS"); } sets = SQMSettings.GetSetting("ENV", "LOGINSTAT"); if (sets != null && sets.VALUE.ToUpper() == "LTC") { qry.Add("t", "ltc"); } } sets = SQMSettings.GetSetting("ENV", "LOGINMESSAGE"); if (sets != null && !string.IsNullOrEmpty(sets.VALUE)) { lblLoginMessage.Text = sets.VALUE; divLoginMessage.Visible = true; } if (Request.QueryString.Count > 0) { qry = Request.QueryString; } if (qry.Get("t") != null) { string[] args = qry.Get("t").ToString().Split(':'); COMPANY company = new COMPANY(); decimal[] plantIDS = SQMModelMgr.SelectPlantList(entities, 1, 0).Where(l => l.LOCATION_TYPE == "P").OrderBy(l => l.PLANT_NAME).Select(l => l.PLANT_ID).ToArray(); SQMMetricMgr stsmgr = new SQMMetricMgr().CreateNew(company, "0", DateTime.Now, DateTime.Now, plantIDS); stsmgr.ehsCtl = new EHSCalcsCtl().CreateNew(1, DateSpanOption.SelectRange); stsmgr.ehsCtl.ElapsedTimeSeries(plantIDS, new decimal[1] { 8 }, new decimal[1] { 63 }, "YES", true); GaugeDefinition tikCfg = new GaugeDefinition().Initialize(); tikCfg.Width = 0; tikCfg.Unit = args.Length > 1 ? Convert.ToInt32(args[1]) : 80; tikCfg.Position = "none"; tikCfg.NewRow = false; pnlPosting.Visible = true; divTicker.Visible = true; uclGauge.CreateTicker(tikCfg, stsmgr.ehsCtl.Results.metricSeries, divTicker); } if (qry.Get("p") != null) { string[] args = qry.Get("p").ToString().Split(','); if (args.Contains("EHS")) { pnlPosting.Visible = true; imgPostingEHS.Style.Add("MARGIN-TOP", "8px"); imgPostingEHS.Src = SQM.Website.Classes.SQMDocumentMgr.GetImageSourceString(SQM.Website.Classes.SQMDocumentMgr.FindCurrentDocument("SYS", 31)); } if (args.Contains("QS")) { pnlPosting.Visible = true; imgPostingQS.Style.Add("MARGIN-TOP", "8px"); imgPostingQS.Src = SQM.Website.Classes.SQMDocumentMgr.GetImageSourceString(SQM.Website.Classes.SQMDocumentMgr.FindCurrentDocument("SYS", 32)); } } string externalLinks = System.Configuration.ConfigurationManager.AppSettings["ExternalLinks"]; if (!string.IsNullOrEmpty(externalLinks)) { string[] linkArray = externalLinks.Split(','); foreach (string link in linkArray) { divLinks.Controls.Add(new LiteralControl(" ")); HyperLink hlk = new HyperLink(); hlk.NavigateUrl = hlk.Text = link; hlk.Target = "_blank"; hlk.CssClass = "linkUnderline"; divLinks.Controls.Add(hlk); } divLinks.Visible = true; } } catch { divAnnouncements.Visible = false; } if (Request.QueryString["rdp"] != null) { ViewState["RedirectPath"] = Request.QueryString["rdp"]; } } }
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) if (ddlChartType.SelectedValue == "") { pnlChartSection.Style.Add("display", "none"); lnkChartClose.Visible = lnkPrint.Visible = false; } else { //PERSPECTIVE_VIEW view = null; //divSummaryCharts.Controls.Clear(); //view = ViewModel.LookupView(entities, "HSIR", "HSIR", 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; // HSCalcs().ehsCtl.SetCalcParams(vi.CALCS_METHOD, vi.CALCS_SCOPE, vi.CALCS_STAT, (int)vi.SERIES_ORDER).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, divSummaryCharts); // pnlChartSection.Style.Add("display", "inline"); // lnkChartClose.Visible = lnkPrint.Visible = true; // // return; // } //} divChart.Controls.Clear(); switch (ddlChartType.SelectedValue) { case "charts": decimal protection = 0; decimal protectionTotal = 0; decimal surveillance = 0; decimal surveillanceTotal = 0; decimal manualresponse = 0; decimal manualresponseTotal = 0; decimal humanelement = 0; decimal humanelementTotal = 0; decimal hazards = 0; decimal hazardsTotal = 0; decimal maintenence = 0; decimal maintenenceTotal = 0; int iTopic = 0; decimal answerValue; // get the current year results foreach (EHSAuditData audit in HSCalcs().ehsCtl.AuditHst) { foreach (AUDIT_ANSWER answer in audit.Audit.AUDIT_ANSWER) { try { answerValue = Convert.ToInt16(answer.ANSWER_VALUE); } catch { answerValue = 0; } EHSAuditQuestion question = EHSAuditMgr.SelectAuditQuestion(audit.Audit.AUDIT_ID, answer.AUDIT_QUESTION_ID); iTopic = Convert.ToInt16(question.TopicId); switch (iTopic) { case 3: protection += answerValue; protectionTotal += 3; break; case 4: surveillance += answerValue; surveillanceTotal += 3; break; case 5: manualresponse += answerValue; manualresponseTotal += 3; break; case 6: humanelement += answerValue; humanelementTotal += 3; break; case 7: hazards += answerValue; hazardsTotal += 3; break; case 8: maintenence += answerValue; maintenenceTotal += 3; break; } } } List <GaugeSeries> gaugeSeries = new List <GaugeSeries>(); GaugeSeries g = new GaugeSeries(); g.Name = "Percentage"; if (protectionTotal > 0) { answerValue = Math.Round((protection / protectionTotal), 3) * 100; } else { answerValue = 0; } g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Protection")); if (surveillanceTotal > 0) { answerValue = Math.Round((surveillance / surveillanceTotal), 3) * 100; } else { answerValue = 0; } g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Surveillance")); if (manualresponseTotal > 0) { answerValue = Math.Round((manualresponse / manualresponseTotal), 3) * 100; } else { answerValue = 0; } g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Manual Response")); if (humanelementTotal > 0) { answerValue = Math.Round((humanelement / humanelementTotal), 3) * 100; } else { answerValue = 0; } g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Human Element")); if (hazardsTotal > 0) { answerValue = Math.Round((hazards / hazardsTotal), 3) * 100; } else { answerValue = 0; } g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Hazards")); if (maintenenceTotal > 0) { answerValue = Math.Round((maintenence / maintenenceTotal), 3) * 100; } else { answerValue = 0; } g.ItemList.Add(new GaugeSeriesItem(0, 0, 0, answerValue, "Maintenence")); gaugeSeries.Add(g); GaugeDefinition gauge = new GaugeDefinition(); gauge.ColorPallete = "chartSeriesColor"; //gauge.ContainerHeight = 550; //gauge.ContainerWidth = 550; gauge.ControlType = 70; gauge.DisplayLabel = true; gauge.DisplayLegend = true; gauge.DisplayTitle = true; gauge.DisplayTooltip = true; gauge.Grouping = 0; gauge.Height = 550; gauge.Width = 650; gauge.ItemVisual = "CENTER"; gauge.MinorTics = false; gauge.Multiplier = 0; gauge.ScaleMax = 100; gauge.ScaleMin = 0; gauge.Title = "Audit Summary"; gauge.DisplayTitle = false; CalcsResult rslt = new CalcsResult(); rslt.metricSeries = gaugeSeries; rslt.Status = 0; rslt.ValidResult = true; uclChart.CreateControl(SQMChartType.SpiderChart, gauge, rslt, divChart); pnlChartSection.Style.Add("display", "inline"); lnkChartClose.Visible = lnkPrint.Visible = true; divChart.Visible = true; divDataResults.Visible = false; break; case "report": lnkChartClose.Visible = lnkPrint.Visible = true; divChart.Visible = false; divDataResults.Visible = true; break; } } }