private void TestPrimaryKeyColumnsAction(BoxModuleI boxModule) { bool isPrimaryKey = false; DataMatrixFunctionsI functionsIObj = (DataMatrixFunctionsI)boxModule.FunctionsIObj; try { Ferda.Modules.Helpers.Data.DataMatrix.TestValuesInEnteredPrimaryKeyColumnsAreNotUniqueError( functionsIObj.GetDatabaseFunctionsPrx().getDatabaseInfo().odbcConnectionString, functionsIObj.DataMatrixName, functionsIObj.PrimaryKeyColumns, boxModule.StringIceIdentity ); isPrimaryKey = true; } catch (Ferda.Modules.BoxRuntimeError) { } if (isPrimaryKey) // test succeed boxModule.OutputMessage( Ferda.ModulesManager.MsgType.Info, "TestPrimaryKey", "ActionTestTestPrimaryKeySucceed"); else // test failed boxModule.OutputMessage( Ferda.ModulesManager.MsgType.Warning, "TestPrimaryKey", "ActionTestTestPrimaryKeyFailed"); }
private void TestConnectionStringAction(BoxModuleI boxModule) { bool isConnectionStringValid = false; try { Ferda.Modules.Helpers.Data.Database.TestConnectionString( boxModule.GetPropertyString(OdbcConnectionStringPropertyName), boxModule.StringIceIdentity); isConnectionStringValid = true; } catch (BadParamsError ex) { if (ex.restrictionType != restrictionTypeEnum.DbConnectionString) throw ex; } if (isConnectionStringValid) // test succeed boxModule.OutputMessage( Ferda.ModulesManager.MsgType.Info, "ActionTestConnectionString", "ActionTestConnectionStringSucceed"); else // test failed boxModule.OutputMessage( Ferda.ModulesManager.MsgType.Warning, "ActionTestConnectionString", "ActionTestConnectionStringFailed"); }
/// <summary> /// It is strongly recommended to call this functions before calling any other function in this class. /// </summary> public GeneratedAttribute Value(string boxIdentity, BoxModuleI boxModule, ColumnInfo columnInfo, AttributeDomainEnum domainType, double from, double to, long countOfCategories) { lock (this) { Dictionary<string, IComparable> cacheSetting = new Dictionary<string, IComparable>(); cacheSetting.Add(Database.DatabaseBoxInfo.typeIdentifier + Database.DatabaseBoxInfo.OdbcConnectionStringPropertyName, columnInfo.dataMatrix.database.odbcConnectionString); cacheSetting.Add(DataMatrix.DataMatrixBoxInfo.typeIdentifier + DataMatrix.DataMatrixBoxInfo.DataMatrixNamePropertyName, columnInfo.dataMatrix.dataMatrixName); cacheSetting.Add(DataMatrix.DataMatrixBoxInfo.typeIdentifier + DataMatrix.DataMatrixBoxInfo.RecordCountPropertyName, columnInfo.dataMatrix.recordsCount); cacheSetting.Add(Column.ColumnBoxInfo.typeIdentifier + Column.ColumnBoxInfo.ColumnSelectExpressionPropertyName, columnInfo.columnSelectExpression); cacheSetting.Add("DomainType", domainType); cacheSetting.Add("From", from); cacheSetting.Add("To", to); cacheSetting.Add("CountOfCategories", countOfCategories); if (IsObsolete(columnInfo.dataMatrix.database.lastReloadInfo, cacheSetting)) { try { value = EquidistantAlgorithm.Generate( domainType, from, to, countOfCategories, columnInfo, boxIdentity); } catch (Ferda.Modules.BadParamsError ex) { value = new GeneratedAttribute(); if (ex.restrictionType == restrictionTypeEnum.DbColumnDataType) { boxModule.OutputMessage( Ferda.ModulesManager.MsgType.Info, "UnsupportedColumnDatatype", "NumericDatatypesSupportedOnly"); } else throw Ferda.Modules.Exceptions.BoxRuntimeError(ex, boxModule.StringIceIdentity, null); } } if (value == null) value = new GeneratedAttribute(); return value; } }
private void TestColumnSelectExpressionAction(BoxModuleI boxModule) { ColumnFunctionsI functionsIObj = (ColumnFunctionsI)boxModule.FunctionsIObj; bool isColumnSelectExpressionValid = false; try { DataMatrix.DataMatrixInfo dataMatrixInfo = functionsIObj.GetDataMatrixFunctionsPrx().getDataMatrixInfo(); Ferda.Modules.Helpers.Data.Column.TestColumnSelectExpression( dataMatrixInfo.database.odbcConnectionString, dataMatrixInfo.dataMatrixName, functionsIObj.ColumnSelectExpression, boxModule.StringIceIdentity); isColumnSelectExpressionValid = true; } catch (Ferda.Modules.BoxRuntimeError) { } if (isColumnSelectExpressionValid) // test succeed boxModule.OutputMessage( Ferda.ModulesManager.MsgType.Info, "TestColumnSelectExpression", "TestColumnSelectExpressionSucceed"); else // test failed boxModule.OutputMessage( Ferda.ModulesManager.MsgType.Warning, "TestColumnSelectExpression", "TestColumnSelectExpressionFailed"); }