private void Handle_All_Languages(CodeType Code, CodelistTypes codelistType, FilterFieldType filterField, string filterText, string nameColumn) { DataTable DtTable; string Query, Language; Query = string.Empty; if (this.MultiLanguageHandlingRequired) { foreach (DataRow LanguageRow in this.DIConnection.DILanguages(this.DIQueries.DataPrefix).Rows) { Language = LanguageRow[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Language.LanguageCode].ToString(); if (Language != this.DIQueries.LanguageCode.Substring(1)) { Query = this.Get_Language_Specific_Query(codelistType, filterField, filterText, Language); DtTable = this.DIConnection.ExecuteDataTable(Query); Add_Language_Specific_Details(Code, codelistType, DtTable, nameColumn, Language); } } } }
private void Add_Language_Specific_Details(CodeType Code, CodelistTypes codelistType, DataTable DtTable, string nameColumn, string language) { string[] IUSSplits; if (DtTable.Rows.Count > 0) { if (codelistType != CodelistTypes.IUS) { Code.Name.Add(new TextType(language, DtTable.Rows[0][nameColumn].ToString())); } else { IUSSplits = this.SplitString(nameColumn, Constants.AtTheRate); Code.Name.Add(new TextType(language, DtTable.Rows[0][IUSSplits[0]].ToString() + Constants.Dash + DtTable.Rows[0][IUSSplits[1]].ToString() + Constants.Dash + DtTable.Rows[0][IUSSplits[2]].ToString())); } } }
private CodeType Create_Code(string id, string name, string description, string language, string parentId, AnnotationType annotation) { CodeType RetVal; RetVal = new CodeType(id, name, description, language, parentId, annotation); return RetVal; }
private void Add_Code(CodelistType Codelist, CodeType Code) { if (Codelist != null && Code != null) { Codelist.Items.Add(Code); } }
private void Add_Annotation(CodeType Code, string title, string text) { if (title != string.Empty || text != string.Empty) { if (Code.Annotations == null) { Code.Annotations = new List<AnnotationType>(); } AnnotationType Annotation = new AnnotationType(); Annotation.AnnotationTitle = title; Annotation.AnnotationText = new List<TextType>(); Annotation.AnnotationText.Add(new TextType(null, text)); Code.Annotations.Add(Annotation); } }
private DIExcel GenerateCodelistsComparison(string hlngcodedb, CodelistType Codelist1, CodelistType Codelist2, DIExcel ReportExcel,int SheetIndex) { List<CodeType> ListOfMatchedCodes; List<CodeType> ListOfMissingCodes; List<CodeType> ListOfAdditionalCodelist1Codes; List<String> ListOfDSD1Codes; List<String> ListOfDSD2Codes; string CodeName = string.Empty; int i, SNo, rowindex; ListOfDSD1Codes = new List<string>(); ListOfDSD2Codes = new List<string>(); ListOfMatchedCodes = new List<CodeType>(); ListOfMissingCodes = new List<CodeType>(); ListOfAdditionalCodelist1Codes = new List<CodeType>(); i = 0; SNo = 0; rowindex = 0; CodeType Code = new CodeType(); string CodeId = string.Empty; string UnmatchedCodeName = string.Empty; IWorksheet WorkbookSheet = null; try { for (i = 0; i < Codelist2.Items.Count; i++) { Code = ((CodeType)(Codelist2.Items[i])); CodeId = Code.id; ListOfDSD2Codes.Add(CodeId); } for (i = 0; i < Codelist1.Items.Count; i++) { Code = ((CodeType)(Codelist1.Items[i])); CodeId = Code.id; ListOfDSD1Codes.Add(CodeId); if (!(ListOfDSD2Codes.Contains(CodeId))) { ListOfAdditionalCodelist1Codes.Add(Code); } else { ListOfMatchedCodes.Add(Code); } } for (i = 0; i < Codelist2.Items.Count; i++) { Code = ((CodeType)(Codelist2.Items[i])); CodeId = Code.id; if (!(ListOfDSD1Codes.Contains(CodeId))) { ListOfMissingCodes.Add(Code); } } // Writing Matched Codes that exist in both Codelist1 and Codelist2 rowindex = rowindex + 1; WorkbookSheet = ReportExcel.GetWorksheet(SheetIndex); this.WriteValueInCell(ReportExcel, "Matched Codes", rowindex, 1, 14, true, 10, 0, SheetIndex); WorkbookSheet.Cells[rowindex, 1, rowindex,2].Merge(); rowindex = rowindex + 2; this.WriteValueInCell(ReportExcel, "S.No.", rowindex, 1, 12, true, 10, 0, SheetIndex); this.WriteValueInCell(ReportExcel, "ID", rowindex, 2, 12, true, 60, 0, SheetIndex); this.WriteValueInCell(ReportExcel, "Name", rowindex, 3, 12, true, 70, 0, SheetIndex); rowindex = rowindex + 1; SNo = 0; foreach (CodeType MatchedCode in ListOfMatchedCodes) { SNo = SNo + 1; this.WriteValueInCell(ReportExcel, SNo.ToString(), rowindex, 1, 10, false, 10, 0, SheetIndex); CodeName = string.Empty; CodeName = GetLangSpecificValue(ListOfMatchedCodes[SNo - 1].Name, hlngcodedb); this.WriteValueInCell(ReportExcel, MatchedCode.id, rowindex, 2, 10, false,60, 0, SheetIndex); if (CodeName != string.Empty) { this.WriteValueInCell(ReportExcel, CodeName, rowindex, 3, 10, false, 70, 0, SheetIndex); } rowindex = rowindex + 1; } // Writing Missing Codes that exist in Codelist2 but not in Codelist1 rowindex = rowindex + 2; this.WriteValueInCell(ReportExcel, "Missing Codes", rowindex, 1, 14, true,10, 0, SheetIndex); WorkbookSheet.Cells[rowindex, 1, rowindex, 2].Merge(); rowindex = rowindex + 2; this.WriteValueInCell(ReportExcel, "S.No.", rowindex, 1, 12, true, 10, 0, SheetIndex); this.WriteValueInCell(ReportExcel, "ID", rowindex, 2, 12, true, 60, 0, SheetIndex); this.WriteValueInCell(ReportExcel, "Name", rowindex, 3, 12, true, 70, 0, SheetIndex); rowindex = rowindex + 1; SNo = 0; foreach (CodeType MissingCode in ListOfMissingCodes) { SNo = SNo + 1; this.WriteValueInCell(ReportExcel, SNo.ToString(), rowindex, 1, 10, false, 10, 0, SheetIndex); CodeName = string.Empty; CodeName = GetLangSpecificValue(ListOfMissingCodes[SNo - 1].Name, hlngcodedb); this.WriteValueInCell(ReportExcel, MissingCode.id, rowindex, 2, 10, false,60, 0, SheetIndex); if (CodeName != string.Empty) { this.WriteValueInCell(ReportExcel, CodeName, rowindex, 3, 10, false, 70, 0, SheetIndex); } rowindex = rowindex + 1; } // Writing Additional Codes that exist in Codelist1 but not in Codelist2 rowindex = rowindex + 2; this.WriteValueInCell(ReportExcel, "Additional Codes", rowindex, 1, 14, true, 10, 0, SheetIndex); WorkbookSheet.Cells[rowindex, 1, rowindex, 2].Merge(); rowindex = rowindex + 2; this.WriteValueInCell(ReportExcel, "S.No.", rowindex, 1, 12, true, 10, 0, SheetIndex); this.WriteValueInCell(ReportExcel, "ID", rowindex, 2, 12, true, 60, 0, SheetIndex); this.WriteValueInCell(ReportExcel, "Name", rowindex, 3, 12, true, 70, 0, SheetIndex); rowindex = rowindex + 1; SNo = 0; foreach (CodeType AdditionalCode in ListOfAdditionalCodelist1Codes) { SNo = SNo + 1; this.WriteValueInCell(ReportExcel, SNo.ToString(), rowindex, 1, 10, false, 10, 0, SheetIndex); CodeName = string.Empty; CodeName = GetLangSpecificValue(ListOfAdditionalCodelist1Codes[SNo - 1].Name, hlngcodedb); this.WriteValueInCell(ReportExcel, AdditionalCode.id, rowindex, 2, 10, false, 60, 0, SheetIndex); if (CodeName != string.Empty) { this.WriteValueInCell(ReportExcel, CodeName, rowindex, 3, 10, false, 70, 0, SheetIndex); } rowindex = rowindex + 1; } } catch (Exception ex) { Global.CreateExceptionString(ex, null); throw ex; } finally { } return ReportExcel; }
private string BindCodesComparison(CodelistType Codelist1, CodelistType Codelist2, string hlngcodedb, string ComparisonType) { StringBuilder RetVal; List<CodeType> ListOfMissingCodes; List<String> ListOfDSD2Codes; int i; RetVal = new StringBuilder(); ListOfMissingCodes = new List<CodeType>(); ListOfDSD2Codes = new List<string>(); CodeType Code = new CodeType(); string CodeId = string.Empty; string UnmatchedCodeName = string.Empty; try { for (i = 0; i < Codelist2.Items.Count; i++) { Code = ((CodeType)(Codelist2.Items[i])); CodeId = Code.id; ListOfDSD2Codes.Add(CodeId); } for (i = 0; i < Codelist1.Items.Count; i++) { Code = ((CodeType)(Codelist1.Items[i])); CodeId = Code.id; if (!(ListOfDSD2Codes.Contains(CodeId))) { ListOfMissingCodes.Add(Code); } } if (Codelist1.Items.Count > 0) { RetVal.Append("<div id=\"div_" + Codelist1.id + "\" style=\"display:none; \">"); } else { RetVal.Append("<div id=\"div_" + Codelist2.id + "\" style=\"display:none; \">"); } RetVal.Append("<br/>"); if (Codelist1.Items.Count > 0) { if (ListOfMissingCodes.Count > 0) { if (ComparisonType == "1") { RetVal.Append("<h4>Unmatched Codes that exist in Uploaded DSD1 and not in DSD2 </h4>"); } else { RetVal.Append("<h4>Unmatched Codes that exist in Uploaded DSD and not in Master DSD </h4>"); } RetVal.Append("<br/>"); RetVal.Append("<ul>"); for (i = 0; i < ListOfMissingCodes.Count; i++) { RetVal.Append("<li>"); UnmatchedCodeName = GetLangSpecificValue(ListOfMissingCodes[i].Name, hlngcodedb); RetVal.Append(ListOfMissingCodes[i].id); if (UnmatchedCodeName != string.Empty) { RetVal.Append("<span class=\"reg_li_brac_txt\" style=\"padding-left:40px;\">("); RetVal.Append(UnmatchedCodeName); RetVal.Append(")</span> "); } RetVal.Append("</li>"); } RetVal.Append("</ul>"); } else { RetVal.Append("<span class=\"reg_li_brac_txt\" style=\"padding-left:40px;\">"); RetVal.Append("No Unmatched Codes"); RetVal.Append("</span> "); } } else { RetVal.Append("<span class=\"reg_li_brac_txt\" style=\"padding-left:40px;\">"); RetVal.Append("Codelist does not exists in the Uploaded DSD."); RetVal.Append("</span> "); } RetVal.Append("</div>"); } catch (Exception ex) { Global.CreateExceptionString(ex, null); throw ex; } finally { } return RetVal.ToString(); }
private DIExcel GenerateCodelistWorksheets(DIExcel ReportExcel, int SheetIndex, SDMXObjectModel.Message.StructureType CompleteStructure) { int i, j; IWorksheet CodelistWorkSheet = null; SDMXObjectModel.Structure.CodelistType Codelist; SDMXObjectModel.Structure.CodeType Code; string AttributeImportance = string.Empty; string CodelistName = string.Empty; string CodeId = string.Empty; string CodeName = string.Empty; SDMXObjectModel.Structure.StructuresType ConceptsObj; int rowindex = 0; try { ConceptsObj = CompleteStructure.Structures; for (i = 1; i <= CompleteStructure.Structures.Codelists.Count; i++) { Codelist = new CodelistType(); Codelist = CompleteStructure.Structures.Codelists[i - 1]; CodelistName = GetLangSpecificValue(Codelist.Name, this.Language); ReportExcel.InsertWorkSheet(CodelistName); CodelistWorkSheet = ReportExcel.GetWorksheet(i); rowindex = 1; this.WriteValueInCell(ReportExcel, GetLangSpecificValue(Codelist.Description, this.Language), rowindex, 1, 12, true, 30, 0, i); rowindex = rowindex + 2; this.WriteValueInCell(ReportExcel, "Code", rowindex, 1, 10, true, 60, 0, i); this.WriteValueInCell(ReportExcel, "Name", rowindex, 2, 10, true, 250, 0, i); rowindex = rowindex + 2; //Binding Codelist for (j = 0; j < Codelist.Items.Count; j++) { Code = new CodeType(); Code = ((SDMXObjectModel.Structure.CodeType)(Codelist.Items[j])); CodeId = Code.id; CodeName = GetLangSpecificValue(Code.Name, this.Language); if ((CodeId.Length + 1) <= 30) { this.WriteValueInCell(ReportExcel, CodeId, rowindex, 1, 10, false, 30, 0, i); } else { this.WriteValueInCell(ReportExcel, CodeId, rowindex, 1, 10, false, CodeId.Length + 1, 0, i); } this.WriteValueInCell(ReportExcel, CodeName, rowindex, 2, 10, false, 250, 0, i); rowindex = rowindex + 1; } } } catch (Exception ex) { throw ex; } finally { } return ReportExcel; }