Ejemplo n.º 1
0
        public void actualEnPI(Excel.ListObject LO)
        {
            groupSheetCollection           = new GroupSheetCollection();
            groupSheetCollection.PlantName = ((Excel.Worksheet)LO.Parent).Name;
            groupSheetCollection.WB        = (Excel.Workbook)((Excel.Worksheet)LO.Parent).Parent;
            groupSheetCollection.WBName    = groupSheetCollection.WB.Name;
            masterGroupCollection.Add(groupSheetCollection);
            groupSheetCollection.regressionIteration = masterGroupCollection.WorkbookNextIteration(groupSheetCollection.WB);

            object[,] sourcerows = ExcelHelpers.getYearArray(LO, Years);
            DataTable dtSourceData = DataHelper.ConvertToDataTable(LO.HeaderRowRange.Value2 as object[, ], sourcerows);

            EnPIData = new EnPIDataSet();

            EnPIData.WorksheetName  = ((Excel.Worksheet)LO.Parent).Name;
            EnPIData.SourceData     = dtSourceData;
            EnPIData.ListObjectName = LO.Name;
            EnPIData.BaselineYear   = BaselineYear;

            EnPIData.ProductionVariables = SelectedProduction;
            EnPIData.BuildingVariables   = SelectedBuildings;

            SelectedSources.Add(rsc.GetString("unadjustedTotalColName"));
            EnPIData.EnergySourceVariables = SelectedSources;

            EnPIData.Init();

            fromRegression = false;

            AdjustedDataSheet adjData = new AdjustedDataSheet(EnPIData);

            adjData.Populate(false);

            ActualSheet results = new ActualSheet(EnPIData);

            results.DetailDataSheet = adjData.thisSheet;
            results.AdjustedData    = adjData.AdjustedData;
            results.Populate();

            if (Globals.ThisAddIn.wizardPane.Visible)
            {
                Globals.ThisAddIn.hideWizard();
            }

            // cleanup
            ExcelHelpers.Cleanup(Globals.ThisAddIn.Application.ActiveWorkbook);
        }
Ejemplo n.º 2
0
        public void plotEnPI(Excel.ListObject LO)
        {
            groupSheetCollection           = new GroupSheetCollection();
            groupSheetCollection.PlantName = ((Excel.Worksheet)LO.Parent).Name;
            groupSheetCollection.WB        = (Excel.Workbook)((Excel.Worksheet)LO.Parent).Parent;
            groupSheetCollection.WBName    = groupSheetCollection.WB.Name;
            masterGroupCollection.Add(groupSheetCollection);
            groupSheetCollection.regressionIteration = masterGroupCollection.WorkbookNextIteration(groupSheetCollection.WB);


            // create a data table with the data to be adjusted
            object[,] sourcerows = ExcelHelpers.getYearArray(LO, Years);
            DataTable dtSourceData = DataHelper.ConvertToDataTable(LO.HeaderRowRange.Value2 as object[, ], sourcerows);

            EnPIData = new EnPIDataSet();
            EnPIData.WorksheetName  = ((Excel.Worksheet)LO.Parent).Name;
            EnPIData.SourceData     = dtSourceData;
            EnPIData.ListObjectName = LO.Name;
            EnPIData.BaselineYear   = BaselineYear;
            EnPIData.ModelYear      = SelectedYear;
            EnPIData.ReportYear     = ReportYear; //Added By Suman for SEP Changes
            EnPIData.Years          = Years.Cast <string>().ToList();

            if (Utilities.Constants.MODEL_TOTAL)
            {
                SelectedSources.Add(rsc.GetString("unadjustedTotalColName"));
            }
            EnPIData.EnergySourceVariables = SelectedSources;
            EnPIData.IndependentVariables  = SelectedVariables;
            EnPIData.ProductionVariables   = SelectedProduction;
            EnPIData.BuildingVariables     = SelectedBuildings;

            EnPIData.Init();

            ModelSheets = new ModelSheetCollection();
            foreach (Utilities.EnergySource src in EnPIData.EnergySources)
            {
                ModelSheet aSrc = ModelSheets.Add(src);
                aSrc.Populate();
                aSrc.WS.Visible = Excel.XlSheetVisibility.xlSheetVisible;
            }

            AdjustedDataSheet adjData = new AdjustedDataSheet(EnPIData);

            adjData.Populate(true);

            EnPISheet results = new EnPISheet(EnPIData, false);

            results.AdjustedDataSheet = adjData.thisSheet;
            results.AdjustedData      = adjData.AdjustedData;
            results.Populate();

            //EnPISheet senpiresults = new EnPISheet(EnPIData, true);
            //senpiresults.AdjustedDataSheet = adjData.thisSheet;
            //senpiresults.AdjustedData = adjData.AdjustedData;
            //senpiresults.Populate();


            SEPSheet sepResults = new SEPSheet(EnPIData);

            sepResults.AdjustedDataSheet = adjData.thisSheet;
            sepResults.AdjustedData      = adjData.AdjustedData;
            sepResults.Populate();

            if (Globals.ThisAddIn.wizardPane.Visible)
            {
                Globals.ThisAddIn.hideWizard();
            }

            // cleanup
            ExcelHelpers.Cleanup(Globals.ThisAddIn.Application.ActiveWorkbook);
        }