예제 #1
0
 ///############################################################
 /// <summary>
 /// Raises a CnException-based error.
 /// </summary>
 /// <param name="sFunction">String representing the calling function's name.</param>
 /// <param name="eErrorMessage">Enumeration representing the required error message value.</param>
 /// <param name="sExtraInfo1">String representing the value to replace any occurances of '$sExtraInfo1' with.</param>
 /// <param name="sExtraInfo2">String representing the value to replace any occurances of '$sExtraInfo2' with.</param>
 /// <exception cref="Cn.CnException">Thrown when called.</exception>
 ///############################################################
 /// <LastUpdated>June 5, 2007</LastUpdated>
 public void RaiseError(string sFunction, enumInternationalizationValues eErrorMessage, string sExtraInfo1, string sExtraInfo2)
 {
     //#### Hand the passed data off to a thrown CnException (ValueDecoder-ing the passed eErrorMessage as we go)
     throw new CnException(sFunction,
                           sFunction + ": " + ValueDecoder(eErrorMessage, sExtraInfo1, sExtraInfo2, g_sLanguageCode, true),
                           (int)eErrorMessage
                           );
 }
예제 #2
0
        ///############################################################
        /// <summary>
        /// Retrieves the requested Internationalization value using the referenced language code.
        /// </summary>
        /// <param name="eValue">Enumeration representing the required Internationalization value.</param>
        /// <param name="sLanguageCode">String representing the ISO639 2-letter language code to use when collecting the value.</param>
        /// <returns>String representing the requested Internationalization value.</returns>
        ///############################################################
        /// <LastUpdated>May 15, 2007</LastUpdated>
        public string Value(enumInternationalizationValues eValue, string sLanguageCode)
        {
            string[] a_sPicklistInfo;
            string   sReturn;

            //#### Borrow the use of the sReturn value to determine the .ToString-ified version of the passed eValue
            sReturn = eValue.ToString();

            //#### If the borrowed sReturn value is longer then 2 characters, peal off the leading "cn"
            if (sReturn.Length > 2)
            {
                sReturn = sReturn.Substring(2);
            }

            //#### Determine the PicklistName and DecodeValue from the borrowed sReturn value
            a_sPicklistInfo = sReturn.Split("_".ToCharArray(), 2);

            //#### Determine the value of the passed eValue, setting our return value accordingly
            switch (eValue)
            {
            //#### Cn internationalization values: constants
            case enumInternationalizationValues.cnDeveloperMessages_General_MissingDefaultData: {
                sReturn = g_cMissingDefaultData;
                break;
            }

            //#### Cn internationalization values: non-sLanguageCode prefixed PicklistNames
            case enumInternationalizationValues.cnGeneralSettings_DefaultLanguageCode: {
                //#### Toss the PicklistName and DecodeValue into the .Decoder, resetting the sReturn value accordingly
                sReturn = g_oPicklists.Decoder(a_sPicklistInfo[0], a_sPicklistInfo[1]);
                break;
            }

            //#### Cn internationalization values: sLanguageCode prefixed PicklistNames
            default: {
                //#### Toss the PicklistName (prefixed with the sLanguageCode) and DecodeValue into the .Decoder, resetting the sReturn value accordingly
                sReturn = g_oPicklists.Decoder(sLanguageCode + a_sPicklistInfo[0], a_sPicklistInfo[1]);
                break;
            }
            }

            //#### Return the above determined sReturn value to the caller
            return(sReturn);
        }
예제 #3
0
        //##########################################################################################
        //# Public RaiseError-related Functions
        //##########################################################################################
        ///############################################################
        /// <summary>
        /// Raises a CnException-based error utilizing the default internationalization data.
        /// </summary>
        /// <param name="sFunction">String representing the calling function's name.</param>
        /// <param name="eErrorMessage">Enumeration representing the required error message value.</param>
        /// <param name="sExtraInfo1">String representing the value to replace any occurances of '$sExtraInfo1' with.</param>
        /// <param name="sExtraInfo2">String representing the value to replace any occurances of '$sExtraInfo2' with.</param>
        /// <exception cref="Cn.CnException">Thrown when called.</exception>
        ///############################################################
        /// <LastUpdated>June 5, 2007</LastUpdated>
        public static void RaiseDefaultError(string sFunction, enumInternationalizationValues eErrorMessage, string sExtraInfo1, string sExtraInfo2)
        {
            Internationalization oIntl;

            //#### If the .DefaultData has been defined
            if (DefaultData != null && DefaultData.RowCount > 0)
            {
                //#### Create an instance based on the .DefaultData and .Raise(the)Error
                oIntl = new Internationalization(DefaultData);
                oIntl.RaiseError(sFunction, eErrorMessage, sExtraInfo1, sExtraInfo2);
            }
            //#### Else the .DefaultData isn't properly set, so throw our own CnException based on the g_cMissingDefaultData (aka -.cnDeveloperMessages_General_MissingDefaultData) error
            else
            {
                throw new CnException(sFunction,
                                      sFunction + ": " +
                                      DoValueDecoder(g_cMissingDefaultData, eErrorMessage.ToString(), "[" + sExtraInfo1 + "], [" + sExtraInfo2 + "]", true, (int)enumInternationalizationValues.cnDeveloperMessages_General_MissingDefaultData),
                                      (int)eErrorMessage
                                      );
            }
        }
예제 #4
0
 ///############################################################
 /// <summary>
 /// Decodes the referenced Internationalization value utilizing the provided extra information.
 /// </summary>
 /// <param name="eValue">Enumeration representing the required Internationalization value.</param>
 /// <param name="sExtraInfo1">String representing the value to replace any occurances of '$sExtraInfo1' with.</param>
 /// <param name="sExtraInfo2">String representing the value to replace any occurances of '$sExtraInfo2' with.</param>
 /// <param name="sLanguageCode">String representing the ISO639 2-letter language code.</param>
 /// <param name="bShowValueNumber">Boolean value indicating if the value number is to be shown at the end of the message.</param>
 /// <returns>String value containing the decoded <paramref>eValue</paramref> as defined within this instance.</returns>
 ///############################################################
 /// <LastUpdated>December 24, 2009</LastUpdated>
 public string ValueDecoder(enumInternationalizationValues eValue, string sExtraInfo1, string sExtraInfo2, string sLanguageCode, bool bShowValueNumber)
 {
     //#### Pass the call off to .DoValueDecoder (getting the .Value for the passed eValue as we go)
     return(DoValueDecoder(Value(eValue, sLanguageCode), sExtraInfo1, sExtraInfo2, bShowValueNumber, (int)eValue));
 }
예제 #5
0
 ///############################################################
 /// <summary>
 /// Retrieves the requested Internationalization value.
 /// </summary>
 /// <param name="eValue">Enumeration representing the required Internationalization value.</param>
 /// <returns>String representing the requested Internationalization value.</returns>
 ///############################################################
 /// <LastUpdated>May 10, 2007</LastUpdated>
 public string Value(enumInternationalizationValues eValue)
 {
     //#### Pass the call off to our sibling implementation (while passing in the g_sLanguageCode for the required sLanguageCode)
     return(Value(eValue, g_sLanguageCode));
 }