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); }
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 { } }
public int BindGHGReport(EHSModel.GHGResultList GHGTable) { pnlCO2Report.Visible = true; SetLocalGHGResultList(GHGTable); rptCO2Report.DataSource = GHGTable.ResultList.Select(l => l.Plant).Distinct().ToList(); rptCO2Report.DataBind(); return(0); }
EHSModel.GHGResultList SetLocalGHGResultList(EHSModel.GHGResultList GHGResultList) { SessionManager.CurrentObject = GHGResultList; return(LocalGHGResultList()); }