Ejemplo n.º 1
0
        private static SystemMessage[] GetAllResourceSystemMessages(ADObjectId orgContainer)
        {
            CultureInfo[]     allSupportedDsnLanguages = ClientCultures.GetAllSupportedDsnLanguages();
            string[]          array;
            LocalizedString[] array2;
            DsnDefaultMessages.GetAllDsnCodesAndMessages(out array, out array2);
            QuotaMessageType[] array3 = (QuotaMessageType[])Enum.GetValues(typeof(QuotaMessageType));
            SystemMessage[]    array4 = new SystemMessage[(array.Length + array3.Length) * allSupportedDsnLanguages.Length];
            int num = 0;

            foreach (CultureInfo cultureInfo in allSupportedDsnLanguages)
            {
                ADObjectId dsnCustomizationContainer = SystemMessage.GetDsnCustomizationContainer(orgContainer);
                ADObjectId childId  = dsnCustomizationContainer.GetChildId(cultureInfo.LCID.ToString(NumberFormatInfo.InvariantInfo));
                ADObjectId childId2 = childId.GetChildId("internal");
                for (int j = 0; j < array.Length; j++)
                {
                    array4[num] = new SystemMessage();
                    array4[num].SetId(childId2.GetChildId(array[j]));
                    array4[num].Text = array2[j].ToString(cultureInfo);
                    num++;
                }
                foreach (QuotaMessageType quotaMessageType in array3)
                {
                    QuotaLocalizedTexts quotaLocalizedTexts = QuotaLocalizedTexts.GetQuotaLocalizedTexts(SetSystemMessage.ConvertToInternal(quotaMessageType), string.Empty, string.Empty, true);
                    array4[num] = new SystemMessage();
                    array4[num].SetId(childId.GetChildId(quotaMessageType.ToString()));
                    array4[num].Text = quotaLocalizedTexts.Details.ToString(cultureInfo);
                    num++;
                }
            }
            return(array4);
        }
Ejemplo n.º 2
0
 protected override void InternalProcessRecord()
 {
     if (this.Original)
     {
         SystemMessage dataObject = this.DataObject;
         if (dataObject.DsnCode != null)
         {
             LocalizedString localizedString;
             if (DsnDefaultMessages.TryGetResourceRecipientExplanation(dataObject.DsnCode.Value, out localizedString))
             {
                 if (!ClientCultures.IsCultureSupportedForDsn(dataObject.Language))
                 {
                     this.WriteWarning(Strings.CustomizedDsnLanguageNotAvailable(dataObject.Language.Name, base.DataSession.Source));
                 }
                 dataObject.Text = localizedString.ToString(dataObject.Language);
             }
             else
             {
                 base.WriteError(new CodeNotADefaultException(dataObject.DsnCode), ErrorCategory.InvalidOperation, this.DataObject);
             }
         }
         else if (dataObject.QuotaMessageType != null)
         {
             QuotaLocalizedTexts quotaLocalizedTexts = QuotaLocalizedTexts.GetQuotaLocalizedTexts(SetSystemMessage.ConvertToInternal(dataObject.QuotaMessageType.Value), string.Empty, string.Empty, true);
             dataObject.Text = quotaLocalizedTexts.Details.ToString(dataObject.Language);
         }
     }
     base.InternalProcessRecord();
 }