private static void GetLookups(Worksheet ws2007) { for (uint r = ws2007.CellMap.FirstRow + 1; r <= ws2007.CellMap.LastRow; r++) { Row row = ws2007.GetRow(r); string moduleName = null, lookupName = null; bool hasValue = false; for (uint c = ws2007.CellMap.FirstCol; c <= ws2007.CellMap.LastCol; c++) { if (row.GetCell(c).Value == null || string.IsNullOrWhiteSpace(row.GetCell(c).Value.ToString())) continue; switch (c) { case 0: moduleName = (string) row.GetCell(c).Value; hasValue = true; continue; case 1: lookupName = (string) row.GetCell(c).Value; hasValue = true; continue; } } if (!hasValue) { continue; } if (string.IsNullOrWhiteSpace(moduleName) || string.IsNullOrWhiteSpace(lookupName)) { throw new ApplicationException("Incomplete data in Sheet : " + LookupsSheetName + " Row: " + r); } string fullyQualifiedClassName = DomainNamespaceNamePrefix + moduleName + "." + lookupName; if (!Lookups.Contains(fullyQualifiedClassName)) { Lookups.Add(fullyQualifiedClassName); } } }
private static void GetDataElements(Worksheet ws2007) { for (uint r = ws2007.CellMap.FirstRow + 1; r <= ws2007.CellMap.LastRow; r++) { Row row = ws2007.GetRow(r); string moduleName = null; string className = null; string propertyName = null; string propertyType = null; string questionNumber = null; bool hasValue = false; for (uint c = ws2007.CellMap.FirstCol; c <= ws2007.CellMap.LastCol; c++) { if (row.GetCell(c).Value == null || string.IsNullOrWhiteSpace(row.GetCell(c).Value.ToString())) continue; switch (c) { case 0: moduleName = (string) row.GetCell(c).Value; hasValue = true; continue; case 1: className = (string) row.GetCell(c).Value; hasValue = true; continue; case 2: propertyName = (string) row.GetCell(c).Value; hasValue = true; continue; case 3: propertyType = (string) row.GetCell(c).Value; hasValue = true; continue; case 4: questionNumber = (string) row.GetCell(c).Value; hasValue = true; continue; } } if (!hasValue) { continue; } if (string.IsNullOrWhiteSpace(moduleName) || string.IsNullOrWhiteSpace(className) || string.IsNullOrWhiteSpace(propertyName) || string.IsNullOrWhiteSpace(propertyType)) { throw new ApplicationException("Incomplete data in Sheet : " + DataElementsSheetName + " Row: " + r); } string fullyQualifiedClassName = DomainNamespaceNamePrefix + moduleName + "." + className; AddTypeDescriptionAndQuestionIdentifiers(propertyName, propertyType, fullyQualifiedClassName, questionNumber, TypeDescriptions, QuestionIdentifiers); AddTypeDescriptionAndQuestionIdentifiers(propertyName, propertyType, fullyQualifiedClassName, questionNumber, TypeDescriptionsForAgatha, QuestionIdentifiersForAgatha); } }