Beispiel #1
0
 private void ReadCellData()
 {
     try
     {
         DataTable excelDataTable = excelOperator.ReadCellData(CalculatedFileName, CalculatedSheetName, CalculatedFilter, SelectAllRows);
         if (!string.IsNullOrEmpty(SelectRowsWhere) && !SelectAllRows)
         {
             string CellValue = excelDataTable.Rows[0][0].ToString();
             AddOrUpdateReturnParamActual(excelDataTable.Columns[0].ColumnName, CellValue);
         }
         else
         {
             for (int j = 0; j < excelDataTable.Rows.Count; j++)
             {
                 DataRow r = excelDataTable.Rows[j];
                 //Read data to return values
                 // in case the user didn't select cols then get all excel output columns
                 for (int i = 0; i < excelDataTable.Columns.Count; i++)
                 {
                     AddOrUpdateReturnParamActualWithPath(excelDataTable.Columns[i].ColumnName, ((object)r[i]).ToString(), (j + 1).ToString() + (i + 1).ToString());
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Error += eUserMsgKey.ExcelInvalidFieldData + ", " + ex.Message;
     }
 }
Beispiel #2
0
 DataTable GetExcelSheetData(bool isViewAllData)
 {
     if (!mAct.CheckMandatoryFieldsExists(new List <string>()
     {
         nameof(mAct.CalculatedFileName), nameof(mAct.CalculatedSheetName)
     }))
     {
         return(null);
     }
     if (!isViewAllData && mAct.ExcelActionType == ActExcel.eExcelActionType.ReadCellData && !string.IsNullOrWhiteSpace(mAct.CalculatedFilter))
     {
         return(mExcelOperations.ReadCellData(mAct.CalculatedFileName, mAct.CalculatedSheetName, mAct.CalculatedFilter, true));
     }
     return(mExcelOperations.ReadData(mAct.CalculatedFileName, mAct.CalculatedSheetName, isViewAllData ? null : mAct.CalculatedFilter, true));
 }