// Token: 0x0600313A RID: 12602 RVA: 0x00122920 File Offset: 0x00120B20
        private static void ProcessTimeOfDay(PersonalAutoAttendant pAA, ref bool isFirst, StringBuilder builder, UserContext userContext)
        {
            if (!isFirst)
            {
                builder.Append("\r\n");
                builder.Append(LocalizedStrings.GetHtmlEncoded(-56156833));
            }
            else
            {
                isFirst = false;
            }
            string s = string.Empty;

            switch (pAA.TimeOfDay)
            {
            case TimeOfDayEnum.WorkingHours:
                s = LocalizedStrings.GetNonEncoded(1604545240);
                break;

            case TimeOfDayEnum.NonWorkingHours:
                s = LocalizedStrings.GetNonEncoded(955250317);
                break;

            case TimeOfDayEnum.Custom:
                s = UnifiedMessagingUtilities.GetCustomWorkingHours(pAA, userContext);
                break;
            }
            builder.Append(Utilities.HtmlEncode(s));
        }
        // Token: 0x06003144 RID: 12612 RVA: 0x00122F5C File Offset: 0x0012115C
        private static void TransferToContact(KeyMappingBase keyMappingBase, UserContext userContext, StringBuilder builder, KeyMappingTypeEnum keyMappingType, bool addNewLine)
        {
            string text = UnifiedMessagingUtilities.AddContext(keyMappingBase);
            string contactNameFromLegacyDN = UnifiedMessagingUtilities.GetContactNameFromLegacyDN(((TransferToADContact)keyMappingBase).LegacyExchangeDN, userContext);

            Strings.IDs?ds = null;
            if (keyMappingType == KeyMappingTypeEnum.TransferToADContactMailbox)
            {
                ds = new Strings.IDs?(1644624696);
            }
            else
            {
                ds = new Strings.IDs?(-348119052);
            }
            if (addNewLine)
            {
                builder.Append("\r\n");
            }
            builder.Append(Utilities.HtmlEncode(string.Format(CultureInfo.CurrentCulture, LocalizedStrings.GetNonEncoded(ds.Value), new object[]
            {
                text,
                keyMappingBase.Key,
                contactNameFromLegacyDN
            })));
        }
 // Token: 0x06002AE3 RID: 10979 RVA: 0x000F1AF0 File Offset: 0x000EFCF0
 protected void RenderSender(TextWriter writer)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     if (!this.isFaxMessage)
     {
         RenderingUtilities.RenderSender(base.UserContext, writer, this.Message, new RenderSubHeaderDelegate(this.RenderSentTime));
         return;
     }
     writer.Write(UnifiedMessagingUtilities.GetUMSender(base.UserContext, this.Message, "spnSender"));
 }
        // Token: 0x06003145 RID: 12613 RVA: 0x00122FF8 File Offset: 0x001211F8
        private static void TransferToPhoneNumber(KeyMappingBase keyMappingBase, StringBuilder builder, bool addNewLine)
        {
            string text = UnifiedMessagingUtilities.AddContext(keyMappingBase);

            if (addNewLine)
            {
                builder.Append("\r\n");
            }
            builder.Append(Utilities.HtmlEncode(string.Format(CultureInfo.CurrentCulture, LocalizedStrings.GetNonEncoded(-348119052), new object[]
            {
                text,
                keyMappingBase.Key,
                ((TransferToNumber)keyMappingBase).PhoneNumberString
            })));
        }
        // Token: 0x0600313F RID: 12607 RVA: 0x00122BFC File Offset: 0x00120DFC
        private static string GetCustomWorkingHours(PersonalAutoAttendant pAA, UserContext userContext)
        {
            if (DateTimeUtilities.GetHoursFormat(userContext.UserOptions.TimeFormat) == null)
            {
            }
            string timeDisplayValue  = UnifiedMessagingUtilities.GetTimeDisplayValue(pAA.WorkingPeriod.StartTimeInMinutes, userContext);
            string timeDisplayValue2 = UnifiedMessagingUtilities.GetTimeDisplayValue(pAA.WorkingPeriod.EndTimeInMinutes, userContext);
            string days = UnifiedMessagingUtilities.GetDays(pAA.WorkingPeriod.DayOfWeek);

            return(string.Format(CultureInfo.CurrentCulture, LocalizedStrings.GetNonEncoded(-250514213), new object[]
            {
                timeDisplayValue,
                timeDisplayValue2,
                days
            }));
        }
 // Token: 0x06003132 RID: 12594 RVA: 0x00122250 File Offset: 0x00120450
 public static void RenderSender(UserContext userContext, TextWriter writer, MessageItem message)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     if (message == null)
     {
         throw new ArgumentNullException("message");
     }
     if (Utilities.IsOnBehalfOf(message.Sender, message.From))
     {
         writer.Write(LocalizedStrings.GetHtmlEncoded(-165544498), RenderingUtilities.GetSender(userContext, message.Sender, "spnSender", null), UnifiedMessagingUtilities.GetUMSender(userContext, message, "spnFrom", SenderDisplayMode.NoPhoto));
         return;
     }
     writer.Write(UnifiedMessagingUtilities.GetUMSender(userContext, message, "spnFrom"));
 }
        // Token: 0x06003135 RID: 12597 RVA: 0x0012238C File Offset: 0x0012058C
        internal static string ValidatePhoneNumbers(UnifiedMessagingUtilities.ValidatePhoneNumber validatePhoneNumber, params string[] phoneNumbers)
        {
            IDataValidationResult dataValidationResult = new DataValidationResult();
            string data   = string.Empty;
            string result = null;

            foreach (string text in phoneNumbers)
            {
                if (!validatePhoneNumber(text, out dataValidationResult))
                {
                    data = text;
                    break;
                }
            }
            if (dataValidationResult.PAAValidationResult != PAAValidationResult.Valid)
            {
                result = UnifiedMessagingUtilities.GetErrorResourceId(dataValidationResult.PAAValidationResult, data);
            }
            return(result);
        }
        public void ValidateFindMe()
        {
            PAAFindMeInfo paafindMeInfo = (PAAFindMeInfo)base.GetParameter("FndMe");
            string        text          = null;

            using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
            {
                List <string> list = new List <string>();
                if (!string.IsNullOrEmpty(paafindMeInfo.Ph1))
                {
                    list.Add(paafindMeInfo.Ph1);
                }
                if (!string.IsNullOrEmpty(paafindMeInfo.Ph2))
                {
                    list.Add(paafindMeInfo.Ph2);
                }
                text = UnifiedMessagingUtilities.ValidatePhoneNumbers(new UnifiedMessagingUtilities.ValidatePhoneNumber(ipaastore.ValidatePhoneNumberForOutdialing), list.ToArray());
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.RenderErrorInfobar(text);
            }
        }
        public void ValidateTransferTo()
        {
            PAATransferToInfo paatransferToInfo = (PAATransferToInfo)base.GetParameter("XfrTo");
            string            text = null;

            using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
            {
                if (!string.IsNullOrEmpty(paatransferToInfo.Ph))
                {
                    text = UnifiedMessagingUtilities.ValidatePhoneNumbers(new UnifiedMessagingUtilities.ValidatePhoneNumber(ipaastore.ValidatePhoneNumberForOutdialing), new string[]
                    {
                        paatransferToInfo.Ph
                    });
                }
                else
                {
                    IDataValidationResult dataValidationResult = null;
                    if (paatransferToInfo.VM)
                    {
                        ipaastore.ValidateADContactForTransferToMailbox(paatransferToInfo.Contact, out dataValidationResult);
                    }
                    else
                    {
                        ipaastore.ValidateADContactForOutdialing(paatransferToInfo.Contact, out dataValidationResult);
                    }
                    if (dataValidationResult.PAAValidationResult != PAAValidationResult.Valid)
                    {
                        text = UnifiedMessagingUtilities.GetErrorResourceId(dataValidationResult.PAAValidationResult, paatransferToInfo.Contact);
                    }
                }
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.RenderErrorInfobar(text);
            }
        }
        // Token: 0x06003137 RID: 12599 RVA: 0x00122510 File Offset: 0x00120710
        internal static string CreatePAAPreviewString(PersonalAutoAttendant pAA, UserContext userContext)
        {
            StringBuilder stringBuilder = new StringBuilder();
            bool          flag          = true;

            stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(-1942641301));
            if (pAA.ExtensionList != null && pAA.ExtensionList.Count > 0)
            {
                stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(-1452720339));
                flag = false;
            }
            if (pAA.CallerIdList != null && pAA.CallerIdList.Count > 0)
            {
                UnifiedMessagingUtilities.ProcessCallerIdList(pAA, ref flag, stringBuilder, userContext);
            }
            if (pAA.TimeOfDay != TimeOfDayEnum.None)
            {
                UnifiedMessagingUtilities.ProcessTimeOfDay(pAA, ref flag, stringBuilder, userContext);
            }
            if (pAA.FreeBusy != FreeBusyStatusEnum.None)
            {
                UnifiedMessagingUtilities.ProcessFreeBusyStatus(pAA, ref flag, stringBuilder);
            }
            if (pAA.OutOfOffice != OutOfOfficeStatusEnum.None)
            {
                UnifiedMessagingUtilities.ProcessOutofOfficeStatus(pAA, ref flag, stringBuilder);
            }
            if (string.CompareOrdinal(stringBuilder.ToString(), LocalizedStrings.GetHtmlEncoded(-1942641301)) == 0)
            {
                stringBuilder.Length = 0;
                stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(-194809129));
            }
            stringBuilder.Append("\r\n");
            stringBuilder.Append(UnifiedMessagingUtilities.CreatePAAPreviewActionString(pAA, userContext));
            return(stringBuilder.ToString());
        }
        internal void Render(TextWriter writer)
        {
            writer.Write("<table class=\"dlIL\" id=\"tblIL\">");
            int num = 1;

            foreach (PersonalAutoAttendant personalAutoAttendant in this.personalAutoAttendants)
            {
                bool isCompatible = personalAutoAttendant.IsCompatible;
                writer.Write("<tr id=\"us\" _id=\"");
                Utilities.HtmlEncode(Convert.ToBase64String(personalAutoAttendant.Identity.ToByteArray()), writer);
                writer.Write("\" isUSpt=");
                writer.Write(isCompatible ? 0 : 1);
                string value = null;
                if (personalAutoAttendant.Valid && isCompatible)
                {
                    value = UnifiedMessagingUtilities.CreatePAAPreviewString(personalAutoAttendant, this.userContext);
                }
                else if (!personalAutoAttendant.Valid)
                {
                    value = LocalizedStrings.GetHtmlEncoded(2099558169);
                }
                else if (!isCompatible)
                {
                    value = LocalizedStrings.GetHtmlEncoded(1688035379);
                }
                writer.Write(" _ps=\"");
                writer.Write(value);
                writer.Write("\"><td class=\"c paaOrd\"><div class=\"paaOrd\">");
                writer.Write(num++);
                writer.Write("</div></td><td class=\"c paaChk\"><div class=\"paaChk\">");
                if (personalAutoAttendant.Valid)
                {
                    writer.Write("<input tabindex=-1 id=chkEnb type=checkbox class=rulChk ");
                    Utilities.RenderScriptHandler(writer, "onclick", "onEnbl(_this);");
                    if (personalAutoAttendant.Enabled)
                    {
                        writer.Write(" checked");
                    }
                    writer.Write(">");
                }
                else
                {
                    this.userContext.RenderThemeImage(writer, ThemeFileId.Error2);
                }
                writer.Write("</div></td><td title=\"");
                Utilities.HtmlEncode(personalAutoAttendant.Name, writer);
                writer.Write("\" class=\"d w100");
                if (!isCompatible)
                {
                    writer.Write(" rulNS");
                }
                else if (!personalAutoAttendant.Valid)
                {
                    writer.Write(" rulErr");
                }
                writer.Write("\" nowrap>");
                Utilities.HtmlEncode(personalAutoAttendant.Name, writer);
                writer.Write("</td>");
                writer.Write("</tr>");
            }
            writer.Write("</table>");
        }
        public void ValidateCallerId()
        {
            PAACallerIdInfo paacallerIdInfo = (PAACallerIdInfo)base.GetParameter("CllrId");
            string          text            = null;

            using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
            {
                if (paacallerIdInfo.HasPhoneNumbers)
                {
                    string[] array = (string[])base.GetParameter("CPh");
                    if (array.Length > 50)
                    {
                        text = Utilities.HtmlEncode(string.Format(CultureInfo.CurrentCulture, LocalizedStrings.GetNonEncoded(1755659442), new object[]
                        {
                            50
                        }));
                    }
                    if (text == null)
                    {
                        text = UnifiedMessagingUtilities.ValidatePhoneNumbers(new UnifiedMessagingUtilities.ValidatePhoneNumber(ipaastore.ValidatePhoneNumberCallerId), array);
                    }
                }
                IDataValidationResult dataValidationResult = null;
                if (text == null && paacallerIdInfo.HasContacts)
                {
                    RecipientInfo[] array2 = (RecipientInfo[])base.GetParameter("CRcps");
                    if (array2.Length > 50)
                    {
                        text = Utilities.HtmlEncode(string.Format(CultureInfo.CurrentCulture, LocalizedStrings.GetNonEncoded(2034140420), new object[]
                        {
                            50
                        }));
                    }
                    if (text == null)
                    {
                        foreach (RecipientInfo recipientInfo in array2)
                        {
                            if (recipientInfo.AddressOrigin == AddressOrigin.Store)
                            {
                                ipaastore.ValidateContactItemCallerId(recipientInfo.StoreObjectId, out dataValidationResult);
                            }
                            else if (recipientInfo.AddressOrigin == AddressOrigin.Directory)
                            {
                                ipaastore.ValidateADContactCallerId(recipientInfo.RoutingAddress, out dataValidationResult);
                            }
                            if (dataValidationResult.PAAValidationResult != PAAValidationResult.Valid)
                            {
                                text = UnifiedMessagingUtilities.GetErrorResourceId(dataValidationResult.PAAValidationResult, recipientInfo.DisplayName);
                                break;
                            }
                        }
                    }
                }
                if (text == null && paacallerIdInfo.IsInContactFolder)
                {
                    ipaastore.ValidateContactFolderCallerId(out dataValidationResult);
                    if (dataValidationResult.PAAValidationResult != PAAValidationResult.Valid)
                    {
                        text = UnifiedMessagingUtilities.GetErrorResourceId(dataValidationResult.PAAValidationResult, null);
                    }
                }
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.RenderErrorInfobar(text);
            }
        }
        // Token: 0x06003142 RID: 12610 RVA: 0x00122D80 File Offset: 0x00120F80
        private static string CreatePAAPreviewActionString(PersonalAutoAttendant pAA, UserContext userContext)
        {
            StringBuilder stringBuilder = new StringBuilder();
            bool          flag          = false;

            stringBuilder.Append("\r\n");
            stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(1230987283));
            if (pAA.KeyMappingList.Count == 0)
            {
                return(LocalizedStrings.GetHtmlEncoded(-1306184482));
            }
            foreach (KeyMappingBase keyMappingBase in pAA.KeyMappingList.SortedMenu)
            {
                switch (keyMappingBase.KeyMappingType)
                {
                case KeyMappingTypeEnum.TransferToNumber:
                    UnifiedMessagingUtilities.TransferToPhoneNumber(keyMappingBase, stringBuilder, flag);
                    if (!flag)
                    {
                        flag = true;
                    }
                    break;

                case KeyMappingTypeEnum.TransferToADContactMailbox:
                    UnifiedMessagingUtilities.TransferToContact(keyMappingBase, userContext, stringBuilder, KeyMappingTypeEnum.TransferToADContactMailbox, flag);
                    if (!flag)
                    {
                        flag = true;
                    }
                    break;

                case KeyMappingTypeEnum.TransferToADContactPhone:
                    UnifiedMessagingUtilities.TransferToContact(keyMappingBase, userContext, stringBuilder, KeyMappingTypeEnum.TransferToADContactPhone, flag);
                    if (!flag)
                    {
                        flag = true;
                    }
                    break;

                case KeyMappingTypeEnum.TransferToVoicemail:
                    if (flag)
                    {
                        stringBuilder.Append("\r\n");
                    }
                    stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(-246907567));
                    if (!flag)
                    {
                        flag = true;
                    }
                    break;

                case KeyMappingTypeEnum.FindMe:
                {
                    if (flag)
                    {
                        stringBuilder.Append("\r\n");
                    }
                    string text = UnifiedMessagingUtilities.AddContext(keyMappingBase);
                    stringBuilder.Append(Utilities.HtmlEncode(string.Format(CultureInfo.CurrentCulture, LocalizedStrings.GetNonEncoded(-578565389), new object[]
                        {
                            text,
                            keyMappingBase.Key
                        })));
                    if (!flag)
                    {
                        flag = true;
                    }
                    break;
                }
                }
            }
            return(stringBuilder.ToString());
        }
 // Token: 0x06003133 RID: 12595 RVA: 0x001222CE File Offset: 0x001204CE
 public static SanitizedHtmlString GetUMSender(UserContext userContext, MessageItem message, string id)
 {
     return(UnifiedMessagingUtilities.GetUMSender(userContext, message, id, SenderDisplayMode.DefaultDisplay));
 }
Exemple #15
0
 // Token: 0x06002B73 RID: 11123 RVA: 0x000F3EE8 File Offset: 0x000F20E8
 protected void RenderSender()
 {
     UnifiedMessagingUtilities.RenderSender(base.UserContext, base.Response.Output, this.Message);
 }
        // Token: 0x06003139 RID: 12601 RVA: 0x00122678 File Offset: 0x00120878
        private static void ProcessCallerIdList(PersonalAutoAttendant pAA, ref bool isFirst, StringBuilder builder, UserContext userContext)
        {
            if (!isFirst)
            {
                builder.Append("\r\n");
                builder.Append(LocalizedStrings.GetHtmlEncoded(-56156833));
            }
            else
            {
                isFirst = false;
            }
            bool          flag  = false;
            List <string> list  = new List <string>();
            List <string> list2 = new List <string>();
            List <string> list3 = new List <string>();
            List <string> list4 = new List <string>();

            foreach (CallerIdBase callerIdBase in pAA.CallerIdList)
            {
                switch (callerIdBase.CallerIdType)
                {
                case CallerIdTypeEnum.Number:
                {
                    string phoneNumberString = ((PhoneNumberCallerId)callerIdBase).PhoneNumberString;
                    if (!string.IsNullOrEmpty(phoneNumberString))
                    {
                        list.Add(phoneNumberString);
                        continue;
                    }
                    continue;
                }

                case CallerIdTypeEnum.ContactItem:
                    using (Contact contact = UnifiedMessagingUtilities.GetContact(((ContactItemCallerId)callerIdBase).StoreObjectId, userContext))
                    {
                        string item = (contact != null && !string.IsNullOrEmpty(contact.DisplayName)) ? contact.DisplayName : LocalizedStrings.GetNonEncoded(-1626952556);
                        list2.Add(item);
                        continue;
                    }
                    break;

                case CallerIdTypeEnum.DefaultContactFolder:
                    flag = true;
                    continue;

                case CallerIdTypeEnum.ADContact:
                    break;

                default:
                    continue;
                }
                list3.Add(((ADContactCallerId)callerIdBase).LegacyExchangeDN);
            }
            builder.Append(LocalizedStrings.GetHtmlEncoded(235538885));
            bool flag2 = false;
            bool flag3 = false;

            if (list.Count > 0)
            {
                builder.Append(Utilities.HtmlEncode(string.Format(CultureInfo.CurrentCulture, LocalizedStrings.GetNonEncoded(1695555698), new object[]
                {
                    string.Join(", ", list.ToArray())
                })));
                flag2 = true;
            }
            if (list3.Count > 0)
            {
                list4 = UnifiedMessagingUtilities.GetContactNamesFromLegacyDN(list3, userContext);
                flag3 = true;
            }
            if (list2.Count > 0 || flag3)
            {
                string[] array = new string[list2.Count + list3.Count];
                if (flag3)
                {
                    Array.Copy(list4.ToArray(), array, list4.Count);
                }
                if (list2.Count > 0)
                {
                    Array.Copy(list2.ToArray(), 0, array, list4.Count, list2.Count);
                }
                if (flag2)
                {
                    builder.Append(LocalizedStrings.GetHtmlEncoded(53305273));
                }
                builder.Append(Utilities.HtmlEncode(string.Format(CultureInfo.CurrentCulture, LocalizedStrings.GetNonEncoded(435094942), new object[]
                {
                    string.Join(", ", array)
                })));
                flag3 = true;
            }
            if (flag)
            {
                if (flag2 || flag3)
                {
                    builder.Append(LocalizedStrings.GetHtmlEncoded(53305273));
                }
                builder.Append(LocalizedStrings.GetHtmlEncoded(623331318));
            }
        }
 protected void RenderPersonalAutoAttendantPreviewString(TextWriter writer, PersonalAutoAttendant personalAutoAttendant)
 {
     writer.Write(UnifiedMessagingUtilities.CreatePAAPreviewString(personalAutoAttendant, this.userContext));
 }