/// <summary> /// Import the IUS mapping data /// </summary> /// <param name="excel">Excel Object</param> /// <param name="paramValue">Parameter value</param> private string ImportIUSMappingData(DIExcel excel, string paramValue) { string RetVal = "false"; //Read the IndicatorSheet StringBuilder ParamString = new StringBuilder(); string ResultString = string.Empty; string OutResult = string.Empty; bool Mapped = false; bool IsRowMapped = false; try { ParamString.Append(paramValue); this.objCallBack = new Callback(); int StartRowIndex = 4; int StartColIndex = 0; int SheetIndex = 0; int RowCount = excel.GetUsedRange(0).RowCount; if (RowCount > StartRowIndex) { //Loop through each row and import the records for (int RowIndex = StartRowIndex; RowIndex <= RowCount; RowIndex++) { //Import only those records whose mapping has been done. if (excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 3, RowIndex, StartColIndex + 3) == "YES") { //Make sure that all the values of dropdown are selected if (!string.IsNullOrEmpty(excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 17, RowIndex, StartColIndex + 17)) && !string.IsNullOrEmpty(excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 18, RowIndex, StartColIndex + 18)) && !string.IsNullOrEmpty(excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 19, RowIndex, StartColIndex + 19)) && !string.IsNullOrEmpty(excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 20, RowIndex, StartColIndex + 20)) && !string.IsNullOrEmpty(excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 21, RowIndex, StartColIndex + 21)) && !string.IsNullOrEmpty(excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 22, RowIndex, StartColIndex + 22)) && !string.IsNullOrEmpty(excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 23, RowIndex, StartColIndex + 23)) && !string.IsNullOrEmpty(excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 24, RowIndex, StartColIndex + 24)) && !string.IsNullOrEmpty(excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 25, RowIndex, StartColIndex + 25))) { //Make the parameter string ParamString.Append(excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 13, RowIndex, StartColIndex + 13) + Constants.Delimiters.IndGUIDSeoarator + excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 14, RowIndex, StartColIndex + 14) + Constants.Delimiters.IndGUIDSeoarator + excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 15, RowIndex, StartColIndex + 15) + Constants.Delimiters.ColumnDelimiter + excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 17, RowIndex, StartColIndex + 17) + Constants.Delimiters.ColumnDelimiter + excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 18, RowIndex, StartColIndex + 18) + Constants.Delimiters.ColumnDelimiter + excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 19, RowIndex, StartColIndex + 19) + Constants.Delimiters.ColumnDelimiter + excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 20, RowIndex, StartColIndex + 20) + Constants.Delimiters.ColumnDelimiter + excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 21, RowIndex, StartColIndex + 21) + Constants.Delimiters.ColumnDelimiter + excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 22, RowIndex, StartColIndex + 22) + Constants.Delimiters.ColumnDelimiter + excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 23, RowIndex, StartColIndex + 23) + Constants.Delimiters.ColumnDelimiter + excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 24, RowIndex, StartColIndex + 24) + Constants.Delimiters.ColumnDelimiter + excel.GetCellValue(SheetIndex, RowIndex, StartColIndex + 25, RowIndex, StartColIndex + 25) + Constants.Delimiters.RowDelimiter); Mapped = true; } IsRowMapped = true; } } //Make the XML Files ResultString = ParamString.ToString(); if (ResultString.Contains(Constants.Delimiters.RowDelimiter)) { ResultString = ResultString.Substring(0, ResultString.Length - 9); } OutResult = objCallBack.GenerateIUSMappingXml(ResultString); Global.GetLanguageKeyValue(""); string[] OutResultArray = OutResult.Split(new string[] { Constants.Delimiters.ParamDelimiter }, StringSplitOptions.None); if (OutResultArray[0].ToString() == "true") { RetVal = "true"; } else { RetVal = "false"; if (IsRowMapped == false) { RetVal += "false[**]No row mapped. Please map at least one row."; } else if (Mapped == false) { RetVal += "false[**]Invalid Mapping"; } } } } catch (Exception Ex) { Global.CreateExceptionString(Ex, null); RetVal = "false"; } return RetVal; }
private bool ImportMetadataMappingData(DIExcel excel, string paramValue) { bool RetVal = false; StringBuilder ParamString = new StringBuilder(); string ResultString = string.Empty; try { ParamString.Append(paramValue); this.objCallBack = new Callback(); int StartRowIndex = 4; int RowCount = excel.GetUsedRange(0).RowCount; string SourceGID = string.Empty; string TargetGId = string.Empty; Dictionary<string, string> DictSource = null; Dictionary<string, string> DictTarget = null; if (RowCount > StartRowIndex) { DictSource = GenerateDict_Source_Target("Metadata", true); DictTarget = GenerateDict_Source_Target("Metadata", false); for (int RowIndex = StartRowIndex; RowIndex <= RowCount; RowIndex++) { //Get the Source and Target GIDs SourceGID = excel.GetCellValue(0, RowIndex, 1, RowIndex, 1); TargetGId = excel.GetCellValue(0, RowIndex, 3, RowIndex, 3); if (!(string.IsNullOrEmpty(SourceGID) || string.IsNullOrEmpty(TargetGId))) { //Check if the mapped GID of Excelsheet lies in the Source Files if (this.IsValidGID(DictSource, DictTarget, SourceGID, TargetGId)) { //Make the parameter string ParamString.Append(SourceGID + Constants.Delimiters.ColumnDelimiter + TargetGId + Constants.Delimiters.RowDelimiter); } } } } //Make the XML Files ResultString = ParamString.ToString(); if (ResultString.Contains(Constants.Delimiters.RowDelimiter)) { ResultString = ResultString.Substring(0, ResultString.Length - 9); RetVal = true; } objCallBack.GenerateMetadataMappingXml(ResultString); } catch (Exception Ex) { Global.CreateExceptionString(Ex, null); RetVal = false; } return RetVal; }
/// <summary> /// Import the Data and Make XML mapping files /// </summary> /// <param name="sheetIndex">Sheet Index</param> /// <param name="excel">Excel Object</param> /// <param name="paramString">Param string</param> /// <param name="importCode">Import Code</param> private void ImportCodeListData(int sheetIndex, DIExcel excel, StringBuilder paramString, string importCode) { int StartRowIndex = 4; string SourceGID = string.Empty; string TargetGId = string.Empty; Dictionary<string, string> DictSource = null; Dictionary<string, string> DictTarget = null; int SheetCount = excel.GetWorksheetCount(); int RowCount = excel.GetUsedRange(sheetIndex).RowCount; if (RowCount > StartRowIndex) { excel.ActivateSheet(sheetIndex); DictSource = GenerateDict_Source_Target(importCode, true); DictTarget = GenerateDict_Source_Target(importCode, false); for (int RowIndex = StartRowIndex; RowIndex <= RowCount; RowIndex++) { //Get the Source and Target GIDs SourceGID = excel.GetCellValue(sheetIndex, RowIndex, 1, RowIndex, 1); TargetGId = excel.GetCellValue(sheetIndex, RowIndex, 3, RowIndex, 3); if (!(string.IsNullOrEmpty(SourceGID) || string.IsNullOrEmpty(TargetGId))) { //Check if the mapped GID of Excelsheet lies in the Source Files if (this.IsValidGID(DictSource, DictTarget, SourceGID, TargetGId)) { //Make the parameter string paramString.Append(importCode + Constants.Delimiters.ColumnDelimiter + SourceGID + Constants.Delimiters.ColumnDelimiter + TargetGId + Constants.Delimiters.RowDelimiter); } } } } }