Esempio n. 1
0
        public ModelSheet Add(Utilities.EnergySource aSource)
        {
            Excel.Worksheet thisSheet = (Excel.Worksheet)Globals.ThisAddIn.Application.ActiveWorkbook.Worksheets.Add
                                            (System.Type.Missing, Globals.ThisAddIn.Application.ActiveWorkbook.Sheets.get_Item(Globals.ThisAddIn.Application.ActiveWorkbook.Sheets.Count), 1, Excel.XlSheetType.xlWorksheet);
            thisSheet.CustomProperties.Add("SheetGUID", System.Guid.NewGuid().ToString());

            thisSheet.Name      = Utilities.ExcelHelpers.CreateValidWorksheetName(Globals.ThisAddIn.Application.ActiveWorkbook, aSource.Name, Globals.ThisAddIn.groupSheetCollection.regressionIteration);
            thisSheet.Tab.Color = 0x50CC11;
            thisSheet.Visible   = Excel.XlSheetVisibility.xlSheetHidden;

            string sheetString = thisSheet.ToString();

            GroupSheet GS = new GroupSheet(thisSheet, false, false, thisSheet.Name);

            Globals.ThisAddIn.groupSheetCollection.Add(GS);

            ModelSheet aSheet = new ModelSheet(thisSheet);

            aSheet.Source = aSource;

            return(aSheet);
        }
Esempio 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);
        }