Ejemplo n.º 1
0
        public void GenerateEmissionsReport()
        {
            string plantList = "";

            foreach (RadComboBoxItem item in SQMBasePage.GetComboBoxCheckedItems(ddlExportPlantSelect))
            {
                if (radExportDateSelect1.SelectedDate != null)
                {
                    if (plantList.Length > 0)
                    {
                        plantList += ", ";
                    }
                    plantList += item.Value;
                }
            }
            try
            {
                decimal[]    plantArray = Array.ConvertAll(plantList.Split(','), new Converter <string, decimal>(decimal.Parse));
                SQMMetricMgr metricMgr  = new SQMMetricMgr().CreateNew(SessionManager.PrimaryCompany(), "E", radExportDateSelect1.SelectedDate.Value, radExportDateSelect2.SelectedDate.Value, plantArray);
                metricMgr.Load(DateIntervalType.month, DateSpanOption.SelectRange);
                CalcsResult            rslt     = metricMgr.CalcsMethods(plantArray, "E", "ghg|co2,ch4,n2o", "gwp100|sum", 22, (int)EHSCalcsCtl.SeriesOrder.YearMeasurePlant);
                EHSModel.GHGResultList ghgTable = (EHSModel.GHGResultList)rslt.ResultObj;
                uclGHGReport.BindGHGReport(ghgTable);
            }
            catch { }
        }
Ejemplo n.º 2
0
        protected int GenerateEmissionsReport()
        {
            int status = 0;

            try
            {
                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, PlantIDS);
                //metricMgr.Load(DateIntervalType.month, DateSpanOption.SelectRange);
                //CalcsResult rslt = metricMgr.CalcsMethods(PlantIDS, "E", "ghg|co2,ch4,n2o", "gwp100|sum", 22, (int)EHSCalcsCtl.SeriesOrder.YearMeasurePlant);
                metricMgr.Load(DateIntervalType.span, DateSpanOption.SelectRange);
                CalcsResult            rslt     = metricMgr.CalcsMethods(PlantIDS, "E", "ghg|co2,ch4,n2o", "gwp100|sum", 22, (int)EHSCalcsCtl.SeriesOrder.MeasurePlant, "", "");
                EHSModel.GHGResultList ghgTable = (EHSModel.GHGResultList)rslt.ResultObj;
                uclGHG.BindGHGReport(ghgTable);
                divGHG.Visible = true;

                SetLocalDataset(metricMgr);
            }
            catch { status = -1; }

            return(status);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public CalcsResult DaysElapsedLTC(COMPANY company, decimal[] plantArray)
        {
            CalcsResult results = new CalcsResult().Initialize();

            SQMMetricMgr metricMgr = new SQMMetricMgr().CreateNew(company, "HS", DateTime.Now, DateTime.Now, plantArray).Load(DateIntervalType.fuzzy, DateSpanOption.SelectRange);

            metricMgr.CalcsMethods(plantArray, "HS", "63", SStat.deltaDy.ToString(), 5, 1);
            results = metricMgr.ehsCtl.Results;
            if (!results.ValidResult)
            {
                PLANT plant = SQMModelMgr.LookupPlant(plantArray[0]);
                if (plant != null && plant.PLANT_START_DT.HasValue)
                {
                    results.Result      = (decimal)Math.Truncate(DateTime.Now.Subtract((DateTime)plant.PLANT_START_DT).TotalDays);
                    results.ValidResult = true;
                }
            }
            return(results);
        }