///############################################################ /// <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); }
//########################################################################################## //# 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 ); } }