示例#1
0
        private static void AssessExtensionInfo(CountryConfigFacade ccf, DataConfigFacade dcf,
                                                string extensionId, string offOn, ref Dictionary <string, List <string> > switchInfo)
        {
            Dictionary <string, List <string> > dataSwitches = new Dictionary <string, List <string> >();

            foreach (DataConfig.PolicySwitchRow polSwitch in from e in dcf.GetDataConfig().PolicySwitch where e.SwitchablePolicyID == extensionId select e)
            {
                if (polSwitch.Value != offOn)
                {
                    continue;
                }
                if (!dataSwitches.ContainsKey(polSwitch.DataBaseID))
                {
                    dataSwitches.Add(polSwitch.DataBaseID, new List <string>());
                }
                dataSwitches[polSwitch.DataBaseID].Add(polSwitch.SystemID);
            }
            foreach (var dataSwitch in dataSwitches)
            {
                DataConfig.DataBaseRow dataRow = dcf.GetDataBaseRow(dataSwitch.Key); if (dataRow == null)
                {
                    continue;
                }
                string sumDataSwitches = dataRow.Name + ":";
                foreach (string sysId in dataSwitch.Value)
                {
                    CountryConfig.SystemRow sysRow = ccf.GetSystemRowByID(sysId); if (sysRow == null)
                    {
                        continue;
                    }
                    sumDataSwitches += sysRow.Name + ",";
                }
                if (!switchInfo.ContainsKey(extensionId))
                {
                    switchInfo.Add(extensionId, new List <string>());
                }
                switchInfo[extensionId].Add(RVItem_Base.TrimEnd(sumDataSwitches));
            }
        }
示例#2
0
        void FillExcelFile()
        {
            int row = 2;

            foreach (RVCountryInfo ccInfo in rvCountryInfo)
            {
                // fill country name in all sheets
                for (int i = 0; i < workbook.Worksheets.Count; ++i)
                {
                    workbook.Worksheets[i].Cells[row, 0].Value = ccInfo.country;
                }

                // fill year info in release-, years, and best-matches-sheets
                int col = colFirstYear;
                foreach (int y in systemYears)
                {
                    sheetYears.Cells[row, col].Value       = ccInfo.systemYearInfo.ContainsKey(y) ? AVAILABLE : NOT_AVAILABLE;
                    sheetBestMatches.Cells[row, col].Value = ccInfo.bestMatchInfo.ContainsKey(y) ? ccInfo.bestMatchInfo[y] : string.Empty;
                    ++col;
                }
                col = colFirstYear;
                foreach (int y in systemYearsPublic)
                {
                    sheetRelease.Cells[row, col].Value = ccInfo.systemYearInfo.ContainsKey(y) && !ccInfo.systemYearInfo[y] ? AVAILABLE : NOT_AVAILABLE;
                    ++col;
                }

                // fill data info in release- and datasets-sheets
                string allData = string.Empty, pubData = string.Empty, privData = string.Empty, allDataNA = string.Empty;
                foreach (string dataName in ccInfo.dataInfo.Keys)
                {
                    if (!dataName.ToLower().StartsWith("training") && !dataName.ToLower().StartsWith("hypo"))
                    {
                        allData += dataName + ", ";
                    }
                    if (ccInfo.dataInfo[dataName])
                    {
                        privData += dataName + ", ";
                    }
                    else if (!dataName.ToLower().StartsWith("training"))
                    {
                        pubData += dataName + ", ";
                    }
                }
                sheetDatasets.Cells[row, colData].Value      = RVItem_Base.TrimEnd(allData);
                sheetRelease.Cells[row, colDataPublic].Value = RVItem_Base.TrimEnd(pubData);

                sheetDatasets.Cells[row, colTraining].Value      = ccInfo.hasTrainingData ? AVAILABLE : NOT_AVAILABLE;
                sheetDatasets.Cells[row, colHypo].Value          = ccInfo.hasHypoData ? AVAILABLE : NOT_AVAILABLE;
                sheetRelease.Cells[row, colTrainingPublic].Value = ccInfo.isTrainingPublic ? AVAILABLE : NOT_AVAILABLE;

                foreach (var dataNA in ccInfo.dataNA)
                {
                    if (dataNA.Value.Count == 0)
                    {
                        continue;
                    }
                    allDataNA += dataNA.Key + ": ";
                    foreach (string sys in dataNA.Value)
                    {
                        allDataNA += sys + ",";
                    }
                    allDataNA = RVItem_Base.TrimEnd(allDataNA) + Environment.NewLine;
                }
                sheetDatasets.Cells[row, colDataNA].Value = RVItem_Base.TrimEnd(allDataNA);

                // fill private info in private-sheet
                string privSys = string.Empty;
                foreach (int y in ccInfo.systemYearInfo.Keys)
                {
                    if (ccInfo.systemYearInfo[y])
                    {
                        privSys += y + ", ";
                    }
                }
                string privPol = string.Empty, privFun = string.Empty, privPar = string.Empty;
                foreach (string p in ccInfo.privatePolicies)
                {
                    privPol += p + Environment.NewLine;
                }
                foreach (string f in ccInfo.privateFunctions)
                {
                    privFun += f + Environment.NewLine;
                }
                foreach (string p in ccInfo.privateParameters)
                {
                    privPar += p + Environment.NewLine;
                }
                sheetPrivate.Cells[row, colPrivData].Value = privData == string.Empty ? "-" : RVItem_Base.TrimEnd(privData);
                sheetPrivate.Cells[row, colPrivSys].Value  = privSys == string.Empty ? "-" : RVItem_Base.TrimEnd(privSys);
                sheetPrivate.Cells[row, colPrivPol].Value  = privPol == string.Empty ? "-" : RVItem_Base.TrimEnd(privPol);
                sheetPrivate.Cells[row, colPrivFun].Value  = privFun == string.Empty ? "-" : RVItem_Base.TrimEnd(privFun);
                sheetPrivate.Cells[row, colPrivPar].Value  = privPar == string.Empty ? "-" : RVItem_Base.TrimEnd(privPar);

                // fill add-on info in addons-sheet
                sheetAddOns.Cells[row, colMTR].Value = ccInfo.mtrImplemented ? AVAILABLE : NOT_AVAILABLE;
                sheetAddOns.Cells[row, colLMA].Value = ccInfo.lmaImplemented ? AVAILABLE : NOT_AVAILABLE;
                sheetAddOns.Cells[row, colNRR].Value = ccInfo.nrrImplemented ? AVAILABLE : NOT_AVAILABLE;

                // fill extension info in extension-sheets
                for (bool global = true; ; global = false)
                {
                    for (bool on = true; ; on = false)
                    {
                        Dictionary <string, int> extensions = global ? globalExtensions : countriesExtensions;
                        Worksheet sheetExtensions           = global ? sheetGlobalExtensions : sheetCountriesExtensions;
                        foreach (var switchInfo in on ? ccInfo.switchInfoOn : ccInfo.switchInfoOff)
                        {
                            if (!extensions.ContainsKey(switchInfo.Key))
                            {
                                continue;
                            }
                            int    iCol          = extensions[switchInfo.Key];
                            string dbSysSwitches = (on ? "default-switch = on:" : Environment.NewLine + "default-switch = off:") + Environment.NewLine;
                            foreach (var dbSysSwitch in switchInfo.Value)
                            {
                                dbSysSwitches += dbSysSwitch + Environment.NewLine;
                            }
                            sheetExtensions.Cells[row, iCol].Value += RVItem_Base.TrimEnd(dbSysSwitches);
                        }
                        if (on == false)
                        {
                            break;
                        }
                    }
                    if (global == false)
                    {
                        break;
                    }
                }

                // fill extensions-content info in extensions-content-sheet
                foreach (var extension in allExtensions)
                {
                    if (ccInfo.extensionContent.ContainsKey(extension.Key))
                    {
                        sheetExtensionsContent.Cells[row, extension.Value].Value = string.Join(Environment.NewLine, ccInfo.extensionContent[extension.Key]);
                    }
                }

                ++row;
            }
        }