private List <CorrectableAdditionalInfo_Type> GetCorrectableAdditionalInfo(ExcelPackage package) { var list = new List <CorrectableAdditionalInfo_Type>(); //for (int ai = 0; ai < 10; ai++) //{ var info = new CorrectableAdditionalInfo_Type(); info.DocSpec = gloabalDocSpec; var otherInformationList = new List <StringMin1Max4000WithLang_Type>(); int rowNumber = 1; while (true) { var cellValue = GetExcelStringValue(package, "Additional Information", "A" + rowNumber); if (string.IsNullOrEmpty(cellValue)) { break; } if (cellValue.Length >= 4000) { throw new ArgumentException("Other Information not allowed more than 4000 characters in one cell"); } otherInformationList.Add(new StringMin1Max4000WithLang_Type() // (S: Additional Information; Cells:A) { language = LanguageCode_Type.EN, languageSpecified = true, Value = cellValue }); rowNumber++; } info.OtherInfo = otherInformationList.ToArray(); ////// TODO Add all note from spreadsheet ////var countryCodes = new List<CountryCode_Type>(); ////for (int cc = 0; cc < 10; cc++) ////{ //// countryCodes.Add(CountryCode_Type.AO); //// //countryCodes.Add(CountryCode_Type.BW); ////} ////info.ResCountryCode = countryCodes.ToArray(); //// info.SummaryRef = new CbcSummaryListElementsType_EnumType[] { CbcSummaryListElementsType_EnumType.CBC601 }; list.Add(info); //} return(list); }
private static StringBuilder CreatAdditionalInfoRowAndData(CorrectableAdditionalInfo_Type additionalInfo) { var reportingEntityBuilder = new StringBuilder(); var trimCahrs = new[] { '|', ' ' }; var IN = string.Empty; var resCountyCode = string.Empty; if (additionalInfo.ResCountryCode != null && additionalInfo.ResCountryCode.Any()) { foreach (var code in additionalInfo.ResCountryCode) { resCountyCode = resCountyCode + code + "|"; } } var summaryRef = string.Empty; if (additionalInfo.SummaryRef != null && additionalInfo.SummaryRef.Any()) { foreach (var summary in additionalInfo.SummaryRef) { summaryRef = summaryRef + summary + "| "; } } reportingEntityBuilder.AppendFormat("<td nowrap {1}>{0}</td>", additionalInfo.DocSpec.DocRefId, GetColumnAttributes()); reportingEntityBuilder.AppendFormat("<td nowrap {1}>{0}</td>", additionalInfo.DocSpec.DocTypeIndic, GetColumnAttributes()); reportingEntityBuilder.AppendFormat("<td nowrap {1}>{0}</td>", additionalInfo.DocSpec.CorrDocRefId, GetColumnAttributes()); reportingEntityBuilder.AppendFormat("<td nowrap {1}>{0}</td>", additionalInfo.OtherInfo, GetColumnAttributes()); reportingEntityBuilder.AppendFormat("<td nowrap {1}>{0}</td>", resCountyCode.Trim(trimCahrs), GetColumnAttributes()); reportingEntityBuilder.AppendFormat("<td nowrap {1}>{0}</td>", summaryRef.Trim(trimCahrs), GetColumnAttributes()); reportingEntityBuilder.Append("</tr>"); return(reportingEntityBuilder); }
private List <CorrectableAdditionalInfo_Type> GetCorrectableAdditionalInfo(ExcelPackage package) { var list = new List <CorrectableAdditionalInfo_Type>(); int rowNumber = 2; while (true) { var cellValue = GetExcelStringValue(package, "Additional Information", "A" + rowNumber); if (string.IsNullOrEmpty(cellValue)) { break; } var info = new CorrectableAdditionalInfo_Type(); var docTypeIndic = GetExcelStringValue(package, "Additional Information", "D" + rowNumber); var docRefId = GetExcelStringValue(package, "Additional Information", "E" + rowNumber); var corrDocRefId = GetExcelStringValue(package, "Additional Information", "F" + rowNumber); var corrMessageRefId = GetExcelStringValue(package, "CoverPage", "B3"); info.DocSpec = GetDocSpec(package, docTypeIndic, docRefId, corrDocRefId, corrMessageRefId); if (cellValue.Length >= 4000) { throw new ArgumentException("Other Information not allowed more than 4000 characters in one cell"); } var otherInfoList = new List <StringMin1Max4000WithLang_Type>(); otherInfoList.Add(new StringMin1Max4000WithLang_Type() { language = LanguageCode_Type.EN, languageSpecified = true, Value = cellValue }); info.OtherInfo = otherInfoList.ToArray(); var resCountryCodeExcelValue = GetExcelStringValue(package, "Additional Information", "B" + rowNumber); info.ResCountryCode = GetAdditionalInfoResCountryCodes(resCountryCodeExcelValue); var resSummaryRegExcelValue = GetExcelStringValue(package, "Additional Information", "C" + rowNumber); info.SummaryRef = GetAdditionalInfoSummaryRefs(resSummaryRegExcelValue); list.Add(info); rowNumber++; } return(list); }
private List <CorrectableAdditionalInfo_Type> GetCorrectableAdditionalInfo(ExcelPackage package) { var list = new List <CorrectableAdditionalInfo_Type>(); int rowNumber = 2; while (true) { var cellValue = GetExcelStringValue(package, "Additional Information", "A" + rowNumber); if (string.IsNullOrEmpty(cellValue)) { break; } var info = new CorrectableAdditionalInfo_Type(); var docTypeIndic = GetExcelStringValue(package, "Additional Information", "B" + rowNumber); var docRefId = GetExcelStringValue(package, "Additional Information", "C" + rowNumber); var corrDocRefId = GetExcelStringValue(package, "Additional Information", "D" + rowNumber); var corrMessageRefId = GetExcelStringValue(package, "CoverPage", "B3"); info.DocSpec = GetDocSpec(package, docTypeIndic, docRefId, corrDocRefId, corrMessageRefId); if (cellValue.Length >= 4000) { throw new ArgumentException("Other Information not allowed more than 4000 characters in one cell"); } info.OtherInfo = cellValue; // info.ResCountryCode = null; - Optional // info.SummaryRef = null; - Optional list.Add(info); rowNumber++; } return(list); }