private void InitializeTable(CATable caTable, object initialValue) { if (caTable == null) { const string message = "caTable is null"; Logger.Error(message); throw new ArgumentNullException(nameof(caTable)); } dynamic safeArray = caTable.GetSafeArray(); Array array = (Array)safeArray; int rank = array.Rank; switch (rank) { case 2: InitializeTableOfRank2(caTable, array, initialValue); break; case 3: InitializeTableOfRank3(caTable, array, initialValue); break; case 4: InitializeTableOfRank4(caTable, array, initialValue); break; case 5: InitializeTableOfRank5(caTable, array, initialValue); break; case 6: InitializeTableOfRank6(caTable, array, initialValue); break; default: const string message = "Only tables of rank 2, 3, 4, 5, and 6 can be initialized"; Logger.Error(message); throw new Exception(message); } if (!caTable.Update()) { const string message = "CATable.Update() failed"; Logger.Error(message); throw new Exception(message); } }
protected Array GetTableArray(string tableName, string[] indexArray) { CATable caTable = GetResultTable(tableName); if (!caTable.SetIndexOrder(indexArray)) { const string message = "SetIndexOrder() failed"; Logger.Error(message + " " + tableName); throw new Exception(message); } dynamic safeArray = caTable.GetSafeArray(); Array array = (Array)safeArray; return(array); }
public Array LogTableValues(CATable caTable, string[] indexArray) { if (caTable == null) { const string message = "caTable is null"; Logger.Error(message); throw new ArgumentNullException(nameof(caTable)); } if (!caTable.SetIndexOrder(indexArray)) { string message = $"SetIndexOrder() failed: indexArray = {ConvertIndexArrayToString(indexArray)}"; Logger.Error(message); throw new Exception(message); } dynamic safeArray = caTable.GetSafeArray(); Array array = (Array)safeArray; return(array); }