///############################################################ /// <summary> /// Resets the class to its initilized state based on the provided data. /// </summary> /// <param name="sColumnName">String representing the column name.</param> /// <param name="sValue">String representing the column value.</param> /// <param name="bQuoteValue">Boolean value signaling if the column value needs to be surrounded by quotes.</param> /// <param name="eValueOperator">Enumeration representing the comparison operator, which also signals if the column is insertable/updateable.</param> ///############################################################ /// <LastUpdated>January 11, 2010</LastUpdated> public void Reset(string sColumnName, string sValue, bool bQuoteValue, enumValueOperators eValueOperator) { //#### Set the global variables to the passed data g_sColumnName = Data.Tools.MakeString(sColumnName, ""); g_sValue = Data.Tools.MakeString(sValue, ""); g_eOperator = eValueOperator; g_bQuote = bQuoteValue; }
///############################################################ /// <summary> /// Initializes the class based on the provided data. /// </summary> /// <param name="oInputData">InputData representing the column's metadata.</param> ///############################################################ /// <LastUpdated>January 11, 2010</LastUpdated> public void Reset(Web.Inputs.InputData oInputData) { //#### Set the local variables to the passed data g_sColumnName = oInputData.ColumnName; g_sValue = oInputData.Value; //#### Determine the oInputData's .SaveType, translating it into the proper enumValueOperators switch (oInputData.SaveType) { case Web.Inputs.enumSaveTypes.cnID: { g_eOperator = enumValueOperators.cnWhereEqualTo; break; } case Web.Inputs.enumSaveTypes.cnIgnore: { g_eOperator = enumValueOperators.cnIgnore; break; } case Web.Inputs.enumSaveTypes.cnInsertNull: { g_eOperator = enumValueOperators.cnInsertNull; break; } case Web.Inputs.enumSaveTypes.cnInsertNullString: { g_eOperator = enumValueOperators.cnInsertNullString; break; } default: { g_eOperator = enumValueOperators.cnInsertIfPresent; break; } } //#### If the .ValueType is of a .cnVerbatum, set g_bQuote to false if (oInputData.ValueType == MetaData.enumValueTypes.cnVerbatum) { g_bQuote = false; } //#### Else if the .DataType is numeric, .Make(the g_sValue a)Number and set g_bQuote to false else if (oInputData.DataType == MetaData.enumDataTypes.cnInteger || oInputData.DataType == MetaData.enumDataTypes.cnFloat || oInputData.DataType == MetaData.enumDataTypes.cnCurrency ) { //! what about (1.0) negetive numbers? g_sValue = Data.Tools.MakeNumeric(g_sValue, "0"); g_bQuote = false; } //#### Else the .DataType is non-numeric and non-verbatum, so set g_bQuote to true else { g_bQuote = true; } }
///############################################################ /// <summary> /// Initializes the class based on the provided data. /// </summary> /// <param name="sColumnName">String representing the column name.</param> /// <param name="sValue">String representing the column value.</param> /// <param name="bQuoteValue">Boolean value signaling if the column value needs to be surrounded by quotes.</param> /// <param name="eValueOperator">Enumeration representing the comparison operator, which also signals if the column is insertable/updateable.</param> ///############################################################ /// <LastUpdated>January 11, 2010</LastUpdated> public ColumnDescription(string sColumnName, string sValue, bool bQuoteValue, enumValueOperators eValueOperator) { //#### Call .Reset to init the class vars Reset(sColumnName, sValue, bQuoteValue, eValueOperator); }
//####################################################################################################### //# Private Functions //####################################################################################################### ///############################################################ /// <summary> /// Translates the provided comparison operator into the actual operator. /// </summary> /// <param name="sFunction">String representing the calling function's name.</param> /// <param name="eValueOperator">Enumeration representing the comparison operator.</param> /// <returns></returns> /// <exception cref="Cn.CnException">Thrown when the passed <paramref>eValueOperator</paramref> is unreconized or defines a insertable/updateable column.</exception> ///############################################################ /// <LastUpdated>September 13, 2005</LastUpdated> private static string TranslateOperator(string sFunction, enumValueOperators eValueOperator) { string sReturn = ""; //#### Determine the passed eValueOperator then set the sReturn value accordingly switch (eValueOperator) { case enumValueOperators.cnWhereEqualTo: { sReturn = "="; break; } case enumValueOperators.cnWhereGreaterThen: { sReturn = ">"; break; } case enumValueOperators.cnWhereGreaterThenOrEqualTo: { sReturn = ">="; break; } case enumValueOperators.cnWhereIsNotNull: { sReturn = "IS NOT NULL"; break; } case enumValueOperators.cnWhereIsNull: { sReturn = "IS NULL"; break; } case enumValueOperators.cnWhereLessThen: { sReturn = "<"; break; } case enumValueOperators.cnWhereLessThenOrEqualTo: { sReturn = "<="; break; } case enumValueOperators.cnWhereLike: { sReturn = "LIKE"; break; } case enumValueOperators.cnWhereNotEqualTo: { sReturn = "!="; break; } case enumValueOperators.cnWhereNotLike: { sReturn = "NOT LIKE"; break; } // case enumValueOperators.cnIgnore: // case enumValueOperators.cnInsertIfPresent: // case enumValueOperators.cnInsertNull: // case enumValueOperators.cnInsertNullString: default: { Internationalization.RaiseDefaultError(g_cClassName + sFunction, Internationalization.enumInternationalizationValues.cnDeveloperMessages_General_UnknownValue, "eValueOperator", eValueOperator.ToString()); break; } } //#### Return the above determiend sReturn value to the caller return(sReturn); }