Exemple #1
0
        private static LocalizedString GenerateOldFashionedReportBody(MessageItem message, out CultureInfo culture)
        {
            message.Load(ReportMessageSchema.Instance.AutoloadProperties);
            ExDateTime?  valueAsNullable = message.GetValueAsNullable <ExDateTime>(InternalSchema.ReportTime);
            ExTimeZone   exTimeZone      = ExTimeZone.CurrentTimeZone;
            StoreSession session         = message.Session;

            if (session != null)
            {
                exTimeZone = session.ExTimeZone;
            }
            byte[]     valueOrDefault = message.GetValueOrDefault <byte[]>(InternalSchema.TimeZoneDefinitionStart);
            ExTimeZone exTimeZone2;

            if (valueOrDefault != null && O12TimeZoneFormatter.TryParseTruncatedTimeZoneBlob(valueOrDefault, out exTimeZone2))
            {
                exTimeZone = (TimeZoneHelper.PromoteCustomizedTimeZone(exTimeZone2) ?? exTimeZone2);
            }
            culture = ReportMessage.GetMdnCulture(message.CoreItem);
            LocalizedString originalMessageInfo = ReportMessage.GetOriginalMessageInfo(message, exTimeZone, culture);
            LocalizedString result;

            if (ObjectClass.IsReport(message.ClassName, "IPNRN"))
            {
                if (valueAsNullable != null)
                {
                    result = ClientStrings.MdnRead(originalMessageInfo, exTimeZone.ConvertDateTime(valueAsNullable.Value), new LocalizedString(exTimeZone.LocalizableDisplayName.ToString(culture)));
                }
                else
                {
                    result = ClientStrings.MdnReadNoTime(originalMessageInfo);
                }
            }
            else
            {
                if (!ObjectClass.IsReport(message.ClassName, "IPNNRN"))
                {
                    ExTraceGlobals.StorageTracer.TraceDebug((long)message.GetHashCode(), ServerStrings.UnsupportedReportType(message.ClassName));
                    return(new LocalizedString(ServerStrings.UnsupportedReportType(message.ClassName)));
                }
                if (valueAsNullable != null)
                {
                    result = ClientStrings.MdnNotRead(originalMessageInfo, exTimeZone.ConvertDateTime(valueAsNullable.Value), new LocalizedString(exTimeZone.LocalizableDisplayName.ToString(culture)));
                }
                else
                {
                    result = ClientStrings.MdnNotReadNoTime(originalMessageInfo);
                }
            }
            return(result);
        }
Exemple #2
0
 internal static void CoreObjectUpdateSubjectPrefix(CoreItem coreItem)
 {
     if (coreItem.Session != null)
     {
         string          valueOrDefault = coreItem.PropertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass);
         LocalizedString localizedString;
         if (DsnMdnUtil.TryGetSubjectPrefix(valueOrDefault, out localizedString))
         {
             CultureInfo formatProvider = coreItem.Session.InternalPreferedCulture;
             if (ObjectClass.IsMdn(valueOrDefault))
             {
                 formatProvider = ReportMessage.GetMdnCulture(coreItem);
             }
             coreItem.PropertyBag[InternalSchema.SubjectPrefix] = localizedString.ToString(formatProvider);
         }
     }
 }