int IComparer <object[]> .Compare(object[] x, object[] y)
            {
                int num = 0;

                if (this.sortedColumn == ColumnId.MemberIcon)
                {
                    num = string.Compare((string)x[this.dataSource.PropertyIndex(StoreObjectSchema.ItemClass)], (string)y[this.dataSource.PropertyIndex(StoreObjectSchema.ItemClass)]);
                }
                else
                {
                    string strA;
                    string strA2;
                    ContactUtilities.GetParticipantEmailAddress((Participant)x[this.dataSource.PropertyIndex(ContactSchema.Email1)], out strA, out strA2);
                    string strB;
                    string strB2;
                    ContactUtilities.GetParticipantEmailAddress((Participant)y[this.dataSource.PropertyIndex(ContactSchema.Email1)], out strB, out strB2);
                    switch (this.sortedColumn)
                    {
                    case ColumnId.MemberDisplayName:
                        num = string.Compare(strA2, strB2, false, this.cultureInfo);
                        break;

                    case ColumnId.MemberEmail:
                        num = string.Compare(strA, strB, false, this.cultureInfo);
                        break;
                    }
                }
                if (this.order == SortOrder.Ascending)
                {
                    return(num);
                }
                return(-num);
            }
Ejemplo n.º 2
0
        private string GetContactPropertyStringValue(ContactPropertyInfo property)
        {
            string result = string.Empty;

            if (this.Contact == null)
            {
                return(result);
            }
            string result2 = null;
            string result3 = null;

            if (property == ContactUtilities.Email1EmailAddress || property == ContactUtilities.Email2EmailAddress || property == ContactUtilities.Email3EmailAddress)
            {
                EmailAddressIndex emailPropertyIndex = ContactUtilities.GetEmailPropertyIndex(property);
                ContactUtilities.GetContactEmailAddress(this.Contact, emailPropertyIndex, out result2, out result3);
                return(result2);
            }
            if (property == ContactUtilities.Email1DisplayName || property == ContactUtilities.Email2DisplayName || property == ContactUtilities.Email3DisplayName)
            {
                EmailAddressIndex emailPropertyIndex2 = ContactUtilities.GetEmailPropertyIndex(property);
                ContactUtilities.GetContactEmailAddress(this.Contact, emailPropertyIndex2, out result2, out result3);
                return(result3);
            }
            string text = this.Contact.TryGetProperty(property.PropertyDefinition) as string;

            if (text != null)
            {
                result = text;
            }
            return(result);
        }
Ejemplo n.º 3
0
        protected void RenderAddresses()
        {
            List <ContactPropertyInfo> addressInfo  = ContactUtilities.GetAddressInfo(PhysicalAddressType.Business);
            List <ContactPropertyInfo> addressInfo2 = ContactUtilities.GetAddressInfo(PhysicalAddressType.Home);
            List <ContactPropertyInfo> addressInfo3 = ContactUtilities.GetAddressInfo(PhysicalAddressType.Other);

            for (int i = 0; i < addressInfo.Count; i++)
            {
                if (addressInfo[i].PropertyDefinition == ContactSchema.WorkAddressStreet)
                {
                    this.RenderMultilineTextProperty(new ContactPropertyInfo[]
                    {
                        addressInfo[i],
                        addressInfo2[i],
                        addressInfo3[i]
                    });
                }
                else
                {
                    this.RenderTextProperty(new ContactPropertyInfo[]
                    {
                        addressInfo[i],
                        addressInfo2[i],
                        addressInfo3[i]
                    });
                }
            }
            this.RenderMailingAddressCheckBox();
        }
Ejemplo n.º 4
0
 // Token: 0x06001FFB RID: 8187 RVA: 0x000B939D File Offset: 0x000B759D
 private static void GetEmailAddressData(Participant participant, out string emailAddress, out string emailAddressForDisplay, out string displayName, out string routingType)
 {
     emailAddressForDisplay = null;
     displayName            = null;
     ContactUtilities.GetParticipantEmailAddress(participant, out emailAddressForDisplay, out displayName);
     emailAddress = participant.EmailAddress;
     routingType  = participant.RoutingType;
 }
Ejemplo n.º 5
0
        // Token: 0x06002DA3 RID: 11683 RVA: 0x001023F4 File Offset: 0x001005F4
        private void SetEmailPropertyValue(Contact contact, ContactPropertyInfo propertyInfo)
        {
            ContactPropertyInfo emailDisplayAsProperty = ContactUtilities.GetEmailDisplayAsProperty(propertyInfo);
            EmailAddressIndex   emailPropertyIndex     = ContactUtilities.GetEmailPropertyIndex(propertyInfo);
            string email       = (string)base.GetParameter(propertyInfo.Id);
            string displayName = (string)base.GetParameter(emailDisplayAsProperty.Id);

            ContactUtilities.SetContactEmailAddress(contact, emailPropertyIndex, email, displayName);
        }
Ejemplo n.º 6
0
        // Token: 0x060027E9 RID: 10217 RVA: 0x000E1F70 File Offset: 0x000E0170
        private void GetEmailAddressValue(ContactPropertyInfo propertyInfo, out string displayName, out string email)
        {
            displayName = string.Empty;
            email       = string.Empty;
            if (base.Item == null)
            {
                return;
            }
            EmailAddressIndex emailPropertyIndex = ContactUtilities.GetEmailPropertyIndex(propertyInfo);

            ContactUtilities.GetContactEmailAddress(this.contact, emailPropertyIndex, out email, out displayName);
        }
Ejemplo n.º 7
0
        private bool RenderPhoneNumberColumn(TextWriter writer, int itemIndex)
        {
            PhoneNumberType    itemPropertyInt = (PhoneNumberType)this.dataSource.GetItemPropertyInt(itemIndex, ContactSchema.SelectedPreferredPhoneNumber, 1);
            PropertyDefinition propertyDefinitionFromPhoneNumberType = ContactUtilities.GetPropertyDefinitionFromPhoneNumberType(itemPropertyInt);
            string             text = this.dataSource.GetItemProperty(itemIndex, propertyDefinitionFromPhoneNumberType) as string;

            this.propertyIconMap = ContactsListViewContents.PropertyIconMap;
            if (text != null && text.Length > 0)
            {
                ThemeFileId themeFileId = this.propertyIconMap[propertyDefinitionFromPhoneNumberType];
                if (themeFileId == ThemeFileId.None)
                {
                    writer.Write("<span class=\"phpd\">&nbsp;</span>");
                }
                else
                {
                    writer.Write("<img class=\"cPh\" src=\"");
                    this.userContext.RenderThemeFileUrl(writer, themeFileId);
                    writer.Write("\"");
                    Strings.IDs localizedID;
                    if (ContactsListViewContents.PropertyAltMap.TryGetValue(propertyDefinitionFromPhoneNumberType, out localizedID))
                    {
                        writer.Write(" alt=\"");
                        writer.Write(LocalizedStrings.GetHtmlEncoded(localizedID));
                        writer.Write("\"");
                    }
                    writer.Write(">");
                }
                Utilities.CropAndRenderText(writer, text, 24);
                return(true);
            }
            foreach (KeyValuePair <PropertyDefinition, ThemeFileId> keyValuePair in this.propertyIconMap)
            {
                string text2 = this.dataSource.GetItemProperty(itemIndex, keyValuePair.Key) as string;
                if (text2 != null && text2.Length > 0)
                {
                    ThemeFileId value = keyValuePair.Value;
                    if (value == ThemeFileId.None)
                    {
                        writer.Write("<span class=\"phpd\">&nbsp;</span>");
                    }
                    else
                    {
                        writer.Write("<img class=\"cPh\" src=\"");
                        this.userContext.RenderThemeFileUrl(writer, value);
                        writer.Write("\">");
                    }
                    Utilities.CropAndRenderText(writer, text2, 24);
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 8
0
        // Token: 0x060027F6 RID: 10230 RVA: 0x000E2664 File Offset: 0x000E0864
        protected void RenderAddresses()
        {
            List <ContactPropertyInfo> addressInfo = ContactUtilities.GetAddressInfo(PhysicalAddressType.Business);

            this.RenderSeparator(LocalizedStrings.GetHtmlEncoded(-765825260));
            this.RenderAddress(addressInfo, ContactSchema.WorkAddressStreet);
            this.RenderSeparator(LocalizedStrings.GetHtmlEncoded(1414246315));
            addressInfo = ContactUtilities.GetAddressInfo(PhysicalAddressType.Home);
            this.RenderAddress(addressInfo, ContactSchema.HomeStreet);
            this.RenderSeparator(LocalizedStrings.GetHtmlEncoded(-582599340));
            addressInfo = ContactUtilities.GetAddressInfo(PhysicalAddressType.Other);
            this.RenderAddress(addressInfo, ContactSchema.OtherStreet);
        }
Ejemplo n.º 9
0
        // Token: 0x060027F2 RID: 10226 RVA: 0x000E2358 File Offset: 0x000E0558
        protected void RenderEmailProperties()
        {
            EmailDropDownList emailDropDownList = new EmailDropDownList("divEM", this.firstEmailProperty);

            base.Response.Write("<div class=\"cntLabelCombo\">");
            emailDropDownList.Render(base.Response.Output);
            base.Response.Write("</div><div class=\"cntField\">");
            string[] array = new string[ContactUtilities.EmailAddressProperties.Length];
            for (int i = 0; i < ContactUtilities.EmailAddressProperties.Length; i++)
            {
                string text = null;
                string s    = null;
                ContactPropertyInfo contactPropertyInfo = ContactUtilities.EmailAddressProperties[i];
                this.GetEmailAddressValue(contactPropertyInfo, out text, out s);
                array[i] = text;
                base.Response.Write("<input id=\"");
                base.Response.Write(contactPropertyInfo.Id);
                base.Response.Write("\"");
                if (contactPropertyInfo != this.firstEmailProperty)
                {
                    base.Response.Write(" style=\"display:none\"");
                }
                ContactPropertyInfo emailDisplayAsProperty = ContactUtilities.GetEmailDisplayAsProperty(contactPropertyInfo);
                base.Response.Write(" maxlength=\"256\" class=\"cntWell\" type=\"text\" value=\"");
                Utilities.HtmlEncode(s, base.Response.Output);
                base.Response.Write("\" _da=\"");
                base.Response.Write(emailDisplayAsProperty.Id);
                base.Response.Write("\">");
            }
            base.Response.Write("</div>");
            base.Response.Write("<div class=\"cntLabel\">");
            base.Response.Write(LocalizedStrings.GetHtmlEncoded(1019177604));
            base.Response.Write("</div><div class=\"cntField\">");
            for (int j = 0; j < ContactUtilities.EmailAddressProperties.Length; j++)
            {
                ContactPropertyInfo contactPropertyInfo2 = ContactUtilities.EmailAddressProperties[j];
                string s2 = array[j];
                base.Response.Write("<input id=\"");
                base.Response.Write(ContactUtilities.GetEmailDisplayAsProperty(contactPropertyInfo2).Id);
                base.Response.Write("\"");
                if (contactPropertyInfo2 != this.firstEmailProperty)
                {
                    base.Response.Write(" style=\"display:none\"");
                }
                base.Response.Write(" maxlength=\"256\" class=\"cntWell\" type=\"text\" value=\"");
                Utilities.HtmlEncode(s2, base.Response.Output);
                base.Response.Write("\">");
            }
            base.Response.Write("</div>");
        }
Ejemplo n.º 10
0
        private int?GetContactPropertyIntValue(ContactPropertyInfo propertyInfo)
        {
            if (propertyInfo == ContactUtilities.FileAsId)
            {
                return(new int?((int)ContactUtilities.GetFileAs(this.Contact)));
            }
            object obj = this.Contact.TryGetProperty(propertyInfo.PropertyDefinition);

            if (obj != null && obj is int)
            {
                return(new int?((int)obj));
            }
            return(null);
        }
Ejemplo n.º 11
0
 // Token: 0x06002804 RID: 10244 RVA: 0x000E2978 File Offset: 0x000E0B78
 protected void RenderProfileArea()
 {
     if (ContactUtilities.GetDefaultFileAs() != FileAsMapping.LastCommaFirst)
     {
         if (this.isPhoneticNamesEnabled)
         {
             this.RenderTextProperty(ContactUtilities.YomiLastName);
         }
         this.RenderTextProperty(ContactUtilities.SurName);
         if (this.isPhoneticNamesEnabled)
         {
             this.RenderTextProperty(ContactUtilities.YomiFirstName);
         }
         this.RenderTextProperty(ContactUtilities.GivenName);
         if (!this.isPhoneticNamesEnabled)
         {
             this.RenderTextProperty(ContactUtilities.MiddleName);
         }
     }
     else
     {
         if (this.isPhoneticNamesEnabled)
         {
             this.RenderTextProperty(ContactUtilities.YomiFirstName);
         }
         this.RenderTextProperty(ContactUtilities.GivenName);
         if (!this.isPhoneticNamesEnabled)
         {
             this.RenderTextProperty(ContactUtilities.MiddleName);
         }
         if (this.isPhoneticNamesEnabled)
         {
             this.RenderTextProperty(ContactUtilities.YomiLastName);
         }
         this.RenderTextProperty(ContactUtilities.SurName);
     }
     this.RenderFileAs();
     this.RenderSeparator();
     this.RenderTextProperty(ContactUtilities.Title);
     this.RenderTextProperty(ContactUtilities.OfficeLocation);
     this.RenderTextProperty(ContactUtilities.Department);
     if (this.isPhoneticNamesEnabled)
     {
         this.RenderTextProperty(ContactUtilities.CompanyYomi);
     }
     this.RenderTextProperty(ContactUtilities.CompanyName);
     this.RenderTextProperty(ContactUtilities.Manager);
     this.RenderTextProperty(ContactUtilities.AssistantName);
 }
Ejemplo n.º 12
0
        protected void RenderFileAs()
        {
            base.Response.Write("<tr><td class=\"cntPT\">");
            base.Response.Write(LocalizedStrings.GetHtmlEncoded(ContactUtilities.FileAsId.Label));
            base.Response.Write("</td><td class=\"cntPV\"><select name=\"");
            base.Response.Write(ContactUtilities.FileAsId.Id);
            base.Response.Write("\" class=\"cntDD cntCB\">");
            FileAsMapping fileAs = ContactUtilities.GetFileAs(base.Item);

            foreach (FileAsMapping fileAsMapping in ContactUtilities.GetSupportedFileAsMappings())
            {
                int num = (int)fileAsMapping;
                this.RenderListItem(num.ToString(), ContactUtilities.GetFileAsString(fileAsMapping), fileAsMapping == fileAs);
            }
            base.Response.Write("</select></td></tr>");
        }
Ejemplo n.º 13
0
        private void SetEmail(ContactPropertyInfo propertyInfo)
        {
            ContactPropertyInfo emailDisplayAsProperty = ContactUtilities.GetEmailDisplayAsProperty(propertyInfo);
            string            text  = this.GetFormParameterStringValue(propertyInfo.Id);
            string            text2 = this.GetFormParameterStringValue(emailDisplayAsProperty.Id);
            EmailAddressIndex emailPropertyIndex = ContactUtilities.GetEmailPropertyIndex(propertyInfo);

            if (Utilities.WhiteSpaceOnlyOrNullEmpty(text))
            {
                text = null;
            }
            if (Utilities.WhiteSpaceOnlyOrNullEmpty(text2))
            {
                text2 = null;
            }
            ContactUtilities.SetContactEmailAddress(this.Contact, emailPropertyIndex, text, text2);
        }
Ejemplo n.º 14
0
        public void AddOneOffToContacts()
        {
            ExTraceGlobals.ContactsCallTracer.TraceDebug((long)this.GetHashCode(), "DirectoryItemEventHandler.AddOneOffToContacts");
            string displayName = (string)base.GetParameter("dn");
            string email       = (string)base.GetParameter("em");
            string text        = (string)base.GetParameter("mp");

            using (Contact contact = Contact.Create(base.UserContext.MailboxSession, base.UserContext.ContactsFolderId))
            {
                ContactUtilities.SetContactEmailAddress(contact, ContactUtilities.GetEmailPropertyIndex(ContactUtilities.Email1EmailAddress), email, displayName);
                if (!string.IsNullOrEmpty(text))
                {
                    contact.SetOrDeleteProperty(ContactUtilities.MobilePhone.PropertyDefinition, text);
                }
                contact.Save(SaveMode.ResolveConflicts);
                contact.Load();
                this.RenderUrlToOpenContactAsDraft(contact.Id.ObjectId.ToBase64String(), "IPM.Contact");
            }
        }
Ejemplo n.º 15
0
        protected void RenderPhoneProperties()
        {
            base.Response.Write("<tr><td class=\"cntPT\"><select id=phl class=\"cntDD\">");
            this.RenderListBody(ContactUtilities.AssistantPhoneNumber.Id, ContactUtilities.PhoneNumberProperties);
            base.Response.Write("</select></td><td class=\"cntPV\">");
            this.RenderTextControl(true, ContactUtilities.PhoneNumberProperties);
            base.Response.Write("</td></tr>");
            base.Response.Write("<tr><td colspan=2 class=cntPV2><table cellspacing=0 cellpadding=0 class=w100><tr><td id=cntLt>");
            base.Response.Write(LocalizedStrings.GetHtmlEncoded(-746050732));
            base.Response.Write("</td><td id=cntRt><select name=\"");
            base.Response.Write(ContactUtilities.DefaultPhoneNumber.Id);
            base.Response.Write("\" class=\"cntDD cntCB\">");
            int intValue = this.helper.GetIntValue(ContactUtilities.DefaultPhoneNumber, 1);

            for (int i = 0; i <= 18; i++)
            {
                this.RenderListItem(i.ToString(), ContactUtilities.GetPropertyStringFromPhoneNumberType((PhoneNumberType)i), intValue == i);
            }
            base.Response.Write("</select></td></tr></table></td></tr>");
        }
Ejemplo n.º 16
0
        private void RenderEmailAddresses(TextWriter writer)
        {
            foreach (EmailAddressIndex emailAddressIndex in ContactUtilities.EmailAddressIndexesToRead)
            {
                string value = null;
                switch (emailAddressIndex)
                {
                case EmailAddressIndex.Email1:
                    value = LocalizedStrings.GetHtmlEncoded(1111077458);
                    break;

                case EmailAddressIndex.Email2:
                    value = LocalizedStrings.GetHtmlEncoded(1405549740);
                    break;

                case EmailAddressIndex.Email3:
                    value = LocalizedStrings.GetHtmlEncoded(-160534201);
                    break;
                }
                Participant participant = this.contact.EmailAddresses[emailAddressIndex];
                if (!(participant == null))
                {
                    string text  = null;
                    string text2 = null;
                    ContactUtilities.GetParticipantEmailAddress(participant, out text, out text2, false);
                    if (!string.IsNullOrEmpty(text))
                    {
                        writer.Write("<tr><td class=\"lbl lp\">");
                        writer.Write(value);
                        writer.Write("</td><td class=\"txvl\">");
                        base.RenderEmail(writer, text2, text, participant.RoutingType, base.IsEmbeddedItem ? null : base.Item.Id.ObjectId, emailAddressIndex);
                        writer.Write("</td></tr>");
                        this.isEmailRendered = true;
                    }
                }
            }
            if (this.isEmailRendered)
            {
                writer.Write("<tr><td class=\"spcHd\" colspan=2></td></tr>");
            }
        }
        // Token: 0x0600201D RID: 8221 RVA: 0x000BA278 File Offset: 0x000B8478
        protected override void RenderTableCellAttributes(TextWriter writer, ColumnId columnId)
        {
            string text = null;

            if (columnId == ColumnId.MemberDisplayName)
            {
                text = this.DataSource.GetItemProperty <string>(StoreObjectSchema.DisplayName, null);
            }
            else if (columnId == ColumnId.MemberEmail)
            {
                Participant itemProperty = this.DataSource.GetItemProperty <Participant>(ContactSchema.Email1, null);
                if (itemProperty != null)
                {
                    string text2;
                    ContactUtilities.GetParticipantEmailAddress(itemProperty, out text, out text2);
                }
            }
            if (text != null)
            {
                DistributionListContents.RenderAttributes(writer, "title", text);
            }
        }
 protected override DropDownListItem[] CreateListItems()
 {
     DropDownListItem[] array = new DropDownListItem[MailingAddressDropDownList.physicalAddressTypes.Length];
     for (int i = 0; i < array.Length; i++)
     {
         array[i] = new DropDownListItem((int)MailingAddressDropDownList.physicalAddressTypes[i], ContactUtilities.GetPhysicalAddressString(MailingAddressDropDownList.physicalAddressTypes[i]), false);
     }
     return(array);
 }
Ejemplo n.º 19
0
        // Token: 0x06001FF9 RID: 8185 RVA: 0x000B8AC0 File Offset: 0x000B6CC0
        protected virtual bool InternalRenderColumn(TextWriter writer, ColumnId columnId)
        {
            Column column = ListViewColumns.GetColumn(columnId);

            if (columnId <= ColumnId.ADIcon)
            {
                switch (columnId)
                {
                case ColumnId.MailIcon:
                case ColumnId.ContactIcon:
                    break;

                case ColumnId.From:
                case ColumnId.To:
                case ColumnId.Subject:
                case ColumnId.Department:
                    goto IL_66B;

                case ColumnId.HasAttachment:
                {
                    string itemClass = this.dataSource.GetItemClass();
                    this.dataSource.GetItemId();
                    bool itemProperty = this.dataSource.GetItemProperty <bool>(ItemSchema.HasAttachment, false);
                    this.dataSource.GetItemProperty <string>(MessageItemSchema.RequireProtectedPlayOnPhone, string.Empty);
                    return(ListViewContentsRenderingUtilities.RenderHasAttachments(writer, this.userContext, itemProperty, itemClass));
                }

                case ColumnId.Importance:
                    goto IL_17B;

                case ColumnId.DeliveryTime:
                {
                    ExDateTime itemProperty2 = this.dataSource.GetItemProperty <ExDateTime>(ItemSchema.ReceivedTime, ExDateTime.MinValue);
                    return(this.RenderSmartDate(writer, itemProperty2));
                }

                case ColumnId.SentTime:
                {
                    ExDateTime itemProperty3 = this.dataSource.GetItemProperty <ExDateTime>(ItemSchema.SentTime, ExDateTime.MinValue);
                    return(this.RenderSmartDate(writer, itemProperty3));
                }

                case ColumnId.Size:
                {
                    int itemProperty4 = this.dataSource.GetItemProperty <int>(ItemSchema.Size, 0);
                    Utilities.RenderSizeWithUnits(writer, (long)itemProperty4, true);
                    return(true);
                }

                default:
                    switch (columnId)
                    {
                    case ColumnId.EmailAddresses:
                        if (ObjectClass.IsDistributionList(this.dataSource.GetItemClass()))
                        {
                            this.RenderSingleEmailAddress(writer, this.dataSource.GetItemProperty <string>(ContactBaseSchema.FileAs, string.Empty), string.Empty, string.Empty, null, EmailAddressIndex.None, RecipientAddress.RecipientAddressFlags.DistributionList);
                            return(true);
                        }
                        return(this.RenderEmailAddresses(writer));

                    case ColumnId.Email1:
                    case ColumnId.Email2:
                    case ColumnId.Email3:
                        goto IL_408;

                    case ColumnId.GivenName:
                    case ColumnId.Surname:
                    case ColumnId.SharepointDocumentDisplayName:
                    case ColumnId.SharepointDocumentLastModified:
                    case ColumnId.SharepointDocumentModifiedBy:
                    case ColumnId.SharepointDocumentCheckedOutTo:
                    case ColumnId.UncDocumentDisplayName:
                    case ColumnId.UncDocumentLastModified:
                        goto IL_66B;

                    case ColumnId.Categories:
                    case ColumnId.ContactCategories:
                        goto IL_34E;

                    case ColumnId.SharepointDocumentIcon:
                        return(this.RenderSharepointDocumentIcon(writer));

                    case ColumnId.SharepointDocumentFileSize:
                    {
                        long itemProperty5 = this.dataSource.GetItemProperty <long>(SharepointDocumentSchema.FileSize, 0L);
                        Utilities.RenderSizeWithUnits(writer, itemProperty5, true);
                        return(true);
                    }

                    case ColumnId.UncDocumentIcon:
                        return(this.RenderUncDocumentIcon(writer));

                    case ColumnId.UncDocumentLibraryIcon:
                        return(ListViewContentsRenderingUtilities.RenderItemIcon(writer, this.userContext, "ipf.documentlibrary.sharepoint"));

                    case ColumnId.UncDocumentFileSize:
                    {
                        long itemProperty6 = this.dataSource.GetItemProperty <long>(UncDocumentSchema.FileSize, 0L);
                        Utilities.RenderSizeWithUnits(writer, itemProperty6, true);
                        return(true);
                    }

                    case ColumnId.SharepointDocumentLibraryIcon:
                        return(ListViewContentsRenderingUtilities.RenderItemIcon(writer, this.userContext, "ipf.documentlibrary.sharepoint"));

                    default:
                        if (columnId != ColumnId.ADIcon)
                        {
                            goto IL_66B;
                        }
                        break;
                    }
                    break;
                }
            }
            else
            {
                if (columnId == ColumnId.EmailAddressAD)
                {
                    return(this.RenderADEmailAddress(this.dataSource, writer));
                }
                switch (columnId)
                {
                case ColumnId.YomiFullName:
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    string        itemProperty7 = this.dataSource.GetItemProperty <string>(ContactSchema.YomiLastName, string.Empty);
                    if (!string.IsNullOrEmpty(itemProperty7))
                    {
                        Utilities.HtmlEncode(itemProperty7, stringBuilder);
                    }
                    string itemProperty8 = this.dataSource.GetItemProperty <string>(ContactSchema.YomiFirstName, string.Empty);
                    if (!string.IsNullOrEmpty(itemProperty8))
                    {
                        if (stringBuilder.Length > 0)
                        {
                            stringBuilder.Append(" ");
                        }
                        Utilities.HtmlEncode(itemProperty8, stringBuilder);
                    }
                    if (stringBuilder.Length == 0)
                    {
                        return(false);
                    }
                    writer.Write(stringBuilder.ToString());
                    return(true);
                }

                case ColumnId.YomiLastName:
                case ColumnId.YomiDisplayNameAD:
                case ColumnId.YomiDepartmentAD:
                case ColumnId.ResourceCapacityAD:
                case ColumnId.FlagStartDate:
                case ColumnId.ContactFlagStartDate:
                case ColumnId.MemberDisplayName:
                case ColumnId.ConversationLastDeliveryTime:
                case ColumnId.ConversationIcon:
                case ColumnId.ConversationSubject:
                case ColumnId.ConversationUnreadCount:
                case ColumnId.ConversationHasAttachment:
                case ColumnId.ConversationSenderList:
                    goto IL_66B;

                case ColumnId.FlagDueDate:
                case ColumnId.ContactFlagDueDate:
                case ColumnId.TaskFlag:
                {
                    FlagStatus  itemProperty9  = this.dataSource.GetItemProperty <FlagStatus>(ItemSchema.FlagStatus, FlagStatus.NotFlagged);
                    int         itemProperty10 = this.dataSource.GetItemProperty <int>(ItemSchema.ItemColor, int.MinValue);
                    ThemeFileId themeFileId    = ThemeFileId.FlagEmpty;
                    if (itemProperty9 == FlagStatus.NotFlagged)
                    {
                        string itemClass2 = this.dataSource.GetItemClass();
                        if (ObjectClass.IsTask(itemClass2))
                        {
                            bool itemProperty11 = this.dataSource.GetItemProperty <bool>(ItemSchema.IsComplete, false);
                            if (itemProperty11)
                            {
                                themeFileId = (this.IsAssignedTask ? ThemeFileId.FlagCompleteDisabled : ThemeFileId.FlagComplete);
                            }
                            else
                            {
                                themeFileId = (this.IsAssignedTask ? ThemeFileId.FlagDisabled : ThemeFileId.Flag);
                            }
                        }
                    }
                    else if (itemProperty10 == -2147483648 && itemProperty9 == FlagStatus.Flagged)
                    {
                        themeFileId = ThemeFileId.FlagSender;
                    }
                    else if (itemProperty9 == FlagStatus.Flagged)
                    {
                        themeFileId = ThemeFileId.Flag;
                    }
                    else
                    {
                        themeFileId = ThemeFileId.FlagComplete;
                    }
                    this.userContext.RenderThemeImage(writer, themeFileId, null, new object[]
                        {
                            "id=imgFlg"
                        });
                    return(true);
                }

                case ColumnId.TaskIcon:
                case ColumnId.MemberIcon:
                    break;

                case ColumnId.MarkCompleteCheckbox:
                {
                    bool itemProperty12 = this.dataSource.GetItemProperty <bool>(ItemSchema.IsComplete, false);
                    writer.Write("<input id=chkMkCmp type=checkbox class=mkCmp");
                    if (this.IsAssignedTask)
                    {
                        writer.Write(" disabled");
                    }
                    writer.Write(itemProperty12 ? " checked>" : ">");
                    return(true);
                }

                case ColumnId.DueDate:
                {
                    ExDateTime itemProperty13 = this.dataSource.GetItemProperty <ExDateTime>(TaskSchema.DueDate, ExDateTime.MinValue);
                    if (itemProperty13 != ExDateTime.MinValue)
                    {
                        writer.Write(itemProperty13.ToString(this.userContext.UserOptions.DateFormat));
                        return(true);
                    }
                    return(false);
                }

                case ColumnId.MemberEmail:
                    goto IL_408;

                case ColumnId.DeletedOnTime:
                {
                    ExDateTime itemProperty14 = this.dataSource.GetItemProperty <ExDateTime>(StoreObjectSchema.DeletedOnTime, ExDateTime.MinValue);
                    return(this.RenderWeekdayDateTime(writer, itemProperty14));
                }

                case ColumnId.DumpsterReceivedTime:
                {
                    ExDateTime itemProperty15 = this.dataSource.GetItemProperty <ExDateTime>(ItemSchema.ReceivedTime, ExDateTime.MinValue);
                    return(this.RenderWeekdayDateTime(writer, itemProperty15));
                }

                case ColumnId.ObjectDisplayName:
                {
                    string itemProperty16 = this.dataSource.GetItemProperty <string>(FolderSchema.DisplayName, string.Empty);
                    if (string.IsNullOrEmpty(itemProperty16))
                    {
                        itemProperty16 = this.dataSource.GetItemProperty <string>(ItemSchema.Subject, string.Empty);
                    }
                    if (itemProperty16.Length == 0)
                    {
                        return(false);
                    }
                    Utilities.HtmlEncode(itemProperty16, writer);
                    return(true);
                }

                case ColumnId.ObjectIcon:
                {
                    VersionedId itemProperty17 = this.dataSource.GetItemProperty <VersionedId>(FolderSchema.Id);
                    if (itemProperty17 != null)
                    {
                        return(ListViewContentsRenderingUtilities.RenderItemIcon(writer, this.userContext, ThemeFileId.Folder));
                    }
                    return(this.RenderIcon(writer));
                }

                case ColumnId.ConversationImportance:
                    goto IL_17B;

                case ColumnId.ConversationCategories:
                    goto IL_34E;

                default:
                {
                    if (columnId != ColumnId.IMAddress)
                    {
                        goto IL_66B;
                    }
                    string itemProperty18 = this.dataSource.GetItemProperty <string>(ContactSchema.IMAddress, string.Empty);
                    this.RenderSingleEmailAddress(writer, itemProperty18, itemProperty18, itemProperty18, null, EmailAddressIndex.None, RecipientAddress.RecipientAddressFlags.None);
                    return(true);
                }
                }
            }
            return(this.RenderIcon(writer));

IL_17B:
            Importance importance = Importance.Normal;
            object itemProperty19 = this.dataSource.GetItemProperty <object>(ListViewColumns.GetColumn(columnId)[0]);

            if (itemProperty19 is Importance || itemProperty19 is int)
            {
                importance = (Importance)itemProperty19;
            }
            return(ListViewContentsRenderingUtilities.RenderImportance(writer, this.UserContext, importance));

IL_34E:
            this.RenderCategories(writer, columnId == ColumnId.ConversationCategories);
            return(true);

IL_408:
            PropertyDefinition propertyDefinition = ContactSchema.Email1;

            switch (columnId)
            {
            case ColumnId.Email1:
                break;

            case ColumnId.Email2:
                propertyDefinition = ContactSchema.Email2;
                goto IL_447;

            case ColumnId.Email3:
                propertyDefinition = ContactSchema.Email3;
                goto IL_447;

            default:
                if (columnId != ColumnId.MemberEmail)
                {
                    goto IL_447;
                }
                break;
            }
            propertyDefinition = ContactSchema.Email1;
IL_447:
            Participant itemProperty20 = this.dataSource.GetItemProperty <Participant>(propertyDefinition, null);

            if (itemProperty20 == null)
            {
                return(false);
            }
            string text  = null;
            string text2 = null;

            ContactUtilities.GetParticipantEmailAddress(itemProperty20, out text2, out text);
            if (string.IsNullOrEmpty(text2))
            {
                return(false);
            }
            Utilities.HtmlEncode(text2, writer);
            return(true);

IL_66B:
            object itemProperty21 = this.dataSource.GetItemProperty <object>(column[0]);

            if (itemProperty21 is ExDateTime)
            {
                writer.Write(((ExDateTime)itemProperty21).ToString());
            }
            else if (itemProperty21 is DateTime)
            {
                ExDateTime exDateTime = new ExDateTime(this.userContext.TimeZone, (DateTime)itemProperty21);
                writer.Write(exDateTime.ToString());
            }
            else if (itemProperty21 is string)
            {
                string text3 = (string)itemProperty21;
                if (text3.Length == 0)
                {
                    return(false);
                }
                Utilities.HtmlEncode(text3, writer);
            }
            else if (itemProperty21 is int)
            {
                Utilities.HtmlEncode(((int)itemProperty21).ToString(CultureInfo.CurrentCulture.NumberFormat), writer);
            }
            else if (itemProperty21 is long)
            {
                Utilities.HtmlEncode(((long)itemProperty21).ToString(CultureInfo.CurrentCulture.NumberFormat), writer);
            }
            else if (itemProperty21 is Unlimited <int> )
            {
                if (((Unlimited <int>)itemProperty21).IsUnlimited)
                {
                    return(false);
                }
                Utilities.HtmlEncode(((Unlimited <int>)itemProperty21).Value.ToString(CultureInfo.CurrentCulture.NumberFormat), writer);
            }
            else
            {
                if (itemProperty21 is PropertyError)
                {
                    return(false);
                }
                if (itemProperty21 is PropertyError)
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 20
0
        // Token: 0x06002A86 RID: 10886 RVA: 0x000EE4C8 File Offset: 0x000EC6C8
        private void RenderAddressList()
        {
            if (string.IsNullOrEmpty(this.orgPerson.StreetAddress) && string.IsNullOrEmpty(this.orgPerson.City) && string.IsNullOrEmpty(this.orgPerson.StateOrProvince) && string.IsNullOrEmpty(this.orgPerson.PostalCode) && string.IsNullOrEmpty(this.orgPerson.CountryOrRegionDisplayName))
            {
                return;
            }
            base.Response.Write(string.Concat(new string[]
            {
                "<div class=\"row2sp\"><div class=\"secCol\"><span class=spS>",
                LocalizedStrings.GetHtmlEncoded(-1159205642),
                "</span></div><div class=bLn>(",
                LocalizedStrings.GetHtmlEncoded(1912536019),
                ")</div></div>"
            }));
            IDictionary <AddressFormatTable.AddressPart, AddressComponent> addressInfo = ContactUtilities.GetAddressInfo(this.orgPerson);

            foreach (KeyValuePair <AddressFormatTable.AddressPart, AddressComponent> keyValuePair in addressInfo)
            {
                this.RenderLabelValueRow(keyValuePair.Value.Label, keyValuePair.Value.Value, false);
            }
        }
Ejemplo n.º 21
0
        // Token: 0x060027EE RID: 10222 RVA: 0x000E213C File Offset: 0x000E033C
        protected void RenderFileAs()
        {
            FileAsDropDownList dropDown = new FileAsDropDownList("divFA", ContactUtilities.GetFileAs(base.Item));

            this.RenderLabelAndDropDown(LocalizedStrings.GetHtmlEncoded(ContactUtilities.FileAsId.Label), dropDown);
        }
Ejemplo n.º 22
0
        // Token: 0x06002AAC RID: 10924 RVA: 0x000EFD68 File Offset: 0x000EDF68
        private void RenderAddress(PhysicalAddressType type, bool isSelected)
        {
            IDictionary <AddressFormatTable.AddressPart, AddressComponent> addressInfo = ContactUtilities.GetAddressInfo(base.Item, type);

            if (addressInfo.Count == 0)
            {
                return;
            }
            this.isSubsectionStarted = false;
            this.RenderSectionStart(true);
            string s    = string.Empty;
            string text = string.Empty;

            base.Response.Write("<div ");
            switch (type)
            {
            case PhysicalAddressType.Home:
                s    = LocalizedStrings.GetHtmlEncoded(1414246315);
                text = "AH";
                break;

            case PhysicalAddressType.Business:
                s    = LocalizedStrings.GetHtmlEncoded(-765825260);
                text = "AB";
                break;

            case PhysicalAddressType.Other:
                s    = LocalizedStrings.GetHtmlEncoded(-582599340);
                text = "AO";
                break;
            }
            base.Response.Write(" id=td");
            base.Response.Write(text);
            base.Response.Write(" class=\"bLn");
            if (!this.isFirstLine)
            {
                base.Response.Write(" indent");
            }
            base.Response.Write("\">");
            base.Response.Write(s);
            base.Response.Write("</div><div");
            base.Response.Write(" id=td");
            base.Response.Write(text);
            base.Response.Write("S class=\"fld bLn\">");
            if (isSelected)
            {
                base.Response.Write("<span id=spnSel class=gryTxt>");
                base.Response.Write(base.UserContext.IsRtl ? string.Empty : " ");
                base.Response.Write(base.UserContext.DirectionMark);
                base.Response.Write("(");
                base.Response.Write(LocalizedStrings.GetHtmlEncoded(1912536019));
                base.Response.Write(")");
                base.Response.Write(base.UserContext.DirectionMark);
                base.Response.Write("</span>");
            }
            base.Response.Write("</div></div>");
            this.isFirstLine = true;
            foreach (KeyValuePair <AddressFormatTable.AddressPart, AddressComponent> keyValuePair in addressInfo)
            {
                string id = text + ((int)keyValuePair.Key).ToString();
                if (this.isFirstLine)
                {
                    this.isFirstLine = false;
                    base.Response.Write("<div class=\"clear row noindent\">");
                }
                else
                {
                    base.Response.Write("<div class=\"clear row\">");
                }
                this.RenderLabelValueAndUrl(keyValuePair.Value.Label, id, keyValuePair.Value.Value, null, false, null);
            }
        }
Ejemplo n.º 23
0
        protected void RenderAddressBucket(TextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            bool flag = true;

            if (string.IsNullOrEmpty(this.adOrgPerson.StreetAddress) && string.IsNullOrEmpty(this.adOrgPerson.City) && string.IsNullOrEmpty(this.adOrgPerson.StateOrProvince) && string.IsNullOrEmpty(this.adOrgPerson.PostalCode) && string.IsNullOrEmpty(this.adOrgPerson.CountryOrRegionDisplayName))
            {
                flag = false;
            }
            writer.Write("<table cellpadding=0 cellspacing=0 class=\"pAddr\">");
            if (flag)
            {
                ReadADRecipient.RenderAddressHeader(writer, -1159205642);
                IDictionary <AddressFormatTable.AddressPart, AddressComponent> addressInfo = ContactUtilities.GetAddressInfo(this.adOrgPerson);
                foreach (KeyValuePair <AddressFormatTable.AddressPart, AddressComponent> keyValuePair in addressInfo)
                {
                    ReadADOrgPerson.RenderAddressPart(writer, keyValuePair.Value.Label, keyValuePair.Value.Value);
                }
            }
            if (this.renderCustomProperties)
            {
                this.RenderCustomProperties(writer);
            }
            ReadADRecipient.RenderAddressHeader(writer, 1601836855);
            writer.Write("<tr><td colspan=2 class=\"rp\"><textarea name=\"notes\" rows=10 cols=32 readonly>");
            Utilities.HtmlEncode(this.adOrgPerson.Notes, writer);
            writer.Write("</textarea></td></tr></table>");
        }
Ejemplo n.º 24
0
        // Token: 0x06002AA6 RID: 10918 RVA: 0x000EF620 File Offset: 0x000ED820
        private void RenderEmailSubsectionData()
        {
            foreach (EmailAddressIndex emailAddressIndex in ContactUtilities.EmailAddressIndexesToRead)
            {
                string label = null;
                string id    = null;
                switch (emailAddressIndex)
                {
                case EmailAddressIndex.Email1:
                    label = LocalizedStrings.GetHtmlEncoded(1111077458);
                    id    = "E1";
                    break;

                case EmailAddressIndex.Email2:
                    label = LocalizedStrings.GetHtmlEncoded(1405549740);
                    id    = "E2";
                    break;

                case EmailAddressIndex.Email3:
                    label = LocalizedStrings.GetHtmlEncoded(-160534201);
                    id    = "E3";
                    break;
                }
                Participant participant = this.contact.EmailAddresses[emailAddressIndex];
                if (!(participant == null))
                {
                    string text  = null;
                    string text2 = null;
                    ContactUtilities.GetParticipantEmailAddress(participant, out text, out text2, false);
                    if (!string.IsNullOrEmpty(text))
                    {
                        if (participant.RoutingType != null)
                        {
                            StringBuilder stringBuilder = new StringBuilder();
                            stringBuilder.Append("?ae=Item&t=IPM.Note&a=New&to=");
                            stringBuilder.Append(Utilities.UrlEncode(participant.EmailAddress));
                            if (!string.IsNullOrEmpty(text2))
                            {
                                stringBuilder.Append("&nm=");
                                stringBuilder.Append(Utilities.UrlEncode(text2));
                            }
                            if (!string.IsNullOrEmpty(participant.RoutingType))
                            {
                                stringBuilder.Append("&rt=");
                                stringBuilder.Append(Utilities.UrlEncode(participant.RoutingType));
                            }
                            if (!base.IsEmbeddedItem)
                            {
                                stringBuilder.Append("&ao=");
                                stringBuilder.Append(Utilities.UrlEncode(1.ToString()));
                                stringBuilder.Append("&stId=");
                                stringBuilder.Append(Utilities.UrlEncode(base.Item.Id.ObjectId.ToBase64String()));
                                stringBuilder.Append("&ei=");
                                StringBuilder stringBuilder2 = stringBuilder;
                                int           num            = (int)emailAddressIndex;
                                stringBuilder2.Append(num.ToString());
                            }
                            this.RenderSectionLabelValueAndUrl(label, id, string.IsNullOrEmpty(text2) ? text : text2, stringBuilder.ToString(), false);
                        }
                        else
                        {
                            this.RenderSectionLabelValueAndUrl(label, id, string.IsNullOrEmpty(text2) ? text : text2, null, false);
                        }
                    }
                }
            }
        }
Ejemplo n.º 25
0
        public void AddADRecipientsToContacts()
        {
            ExTraceGlobals.ContactsCallTracer.TraceDebug((long)this.GetHashCode(), "DirectoryItemEventHandler.AddToContacts");
            string text        = null;
            string contactType = "IPM.Contact";
            int    num         = 0;
            bool   flag        = false;
            string text2       = null;

            if (base.IsParameterSet("email"))
            {
                text2 = (base.GetParameter("email") as string);
            }
            if (!string.IsNullOrEmpty(text2))
            {
                if (base.IsParameterSet("id"))
                {
                    this.itemIds = (ADObjectId[])base.GetParameter("id");
                }
                IRecipientSession    session = Utilities.CreateADRecipientSession(Culture.GetUserCulture().LCID, true, ConsistencyMode.IgnoreInvalid, true, base.UserContext);
                ADRecipient          data    = Utilities.CreateADRecipientFromProxyAddress((this.itemIds == null) ? null : ((ADObjectId)this.itemIds[0]), text2, session);
                Result <ADRecipient> result  = new Result <ADRecipient>(data, null);
                this.results    = new Result <ADRecipient> [1];
                this.results[0] = result;
            }
            else
            {
                this.BindToData();
            }
            for (int i = 0; i < this.results.Length; i++)
            {
                ADRecipient data2 = this.results[i].Data;
                if (data2 == null)
                {
                    flag = true;
                }
                else
                {
                    using (ContactBase contactBase = ContactUtilities.AddADRecipientToContacts(base.UserContext, data2))
                    {
                        if (contactBase != null)
                        {
                            num++;
                            if (num == 1)
                            {
                                contactBase.Load();
                                text = contactBase.Id.ObjectId.ToBase64String();
                                if (contactBase is DistributionList)
                                {
                                    contactType = "IPM.DistList";
                                }
                            }
                        }
                    }
                }
            }
            if (num == 1 && text != null)
            {
                this.RenderUrlToOpenContactAsDraft(text, contactType);
                return;
            }
            if (flag)
            {
                this.Writer.Write("<div id=\"sCntErr\">");
                this.Writer.Write(LocalizedStrings.GetHtmlEncoded(-552412224));
                this.Writer.Write("</div>");
            }
        }
 protected override void RenderSelectedValue(TextWriter writer)
 {
     Utilities.HtmlEncode(ContactUtilities.GetPhysicalAddressString(this.addressType), writer);
 }
Ejemplo n.º 27
0
        private void RenderAddress(TextWriter writer, PhysicalAddressType type, bool isMailingAddress)
        {
            IDictionary <AddressFormatTable.AddressPart, AddressComponent> addressInfo = ContactUtilities.GetAddressInfo(base.Item, type);

            if (addressInfo.Count == 0)
            {
                return;
            }
            this.isAddressRendered = true;
            string value = string.Empty;

            switch (type)
            {
            case PhysicalAddressType.Home:
                value = LocalizedStrings.GetHtmlEncoded(1414246315);
                break;

            case PhysicalAddressType.Business:
                value = LocalizedStrings.GetHtmlEncoded(-765825260);
                break;

            case PhysicalAddressType.Other:
                value = LocalizedStrings.GetHtmlEncoded(-582599340);
                break;
            }
            if (isMailingAddress)
            {
                writer.Write("<tr><td colspan=2 class=\"hd lp\">");
                writer.Write(value);
                writer.Write(" <span class=\"brkt\">(");
                writer.Write(LocalizedStrings.GetHtmlEncoded(1912536019));
                writer.Write(")</span></td></tr>");
            }
            else
            {
                writer.Write("<tr><td colspan=2 class=\"hd lp\">");
                writer.Write(value);
                writer.Write("</td></tr>");
            }
            foreach (KeyValuePair <AddressFormatTable.AddressPart, AddressComponent> keyValuePair in addressInfo)
            {
                writer.Write("<tr><td class=\"lbl lp\">");
                writer.Write(keyValuePair.Value.Label);
                writer.Write("</td><td class=\"txvl\">");
                Utilities.HtmlEncode(keyValuePair.Value.Value, writer);
                writer.Write("</td></tr>");
            }
            writer.Write("<tr><td colspan=2 class=\"lbl lp\"><a href=\"");
            writer.Write("<tr><td class=\"spcOP\" colspan=2></td></tr>");
        }
Ejemplo n.º 28
0
        public DataResult GetCSVFile(ContactParams searchParam)
        {
            string            currentPath = Directory.GetCurrentDirectory();
            List <SampleData> dataList    = new List <SampleData>();
            bool isFirtLine = true;

            using (var reader = new StreamReader(currentPath + "/SampleData.csv"))
            {
                while (!reader.EndOfStream)
                {
                    var line = reader.ReadLine();
                    if (isFirtLine)
                    {
                        isFirtLine = false;
                        continue;
                    }

                    var values = line.Split(',');
                    if (values.Length > 10)
                    {
                        if (!string.IsNullOrEmpty(searchParam.SearchKey))
                        {
                            if ((!string.IsNullOrEmpty(values[0]) && values[0].ToLower().Trim().Contains(searchParam.SearchKey.ToLower().Trim())) ||
                                (!string.IsNullOrEmpty(values[1]) && values[1].ToLower().Trim().Contains(searchParam.SearchKey.ToLower().Trim())) ||
                                (!string.IsNullOrEmpty(values[9]) && values[9].ToLower().Trim().Contains(searchParam.SearchKey.ToLower().Trim())) ||
                                (!string.IsNullOrEmpty(values[7]) && values[7].ToLower().Trim().Contains(searchParam.SearchKey.ToLower().Trim())))
                            {
                                /// <summary>
                                /// We can clean inpudate data here to make sure that we get correct data, such as: email, phone
                                /// For this case, I just clean email value
                                /// </summary>

                                if (ContactUtilities.IsValidEmail(values[9]))
                                {
                                    dataList.Add(new SampleData
                                    {
                                        FirstName   = values[0],
                                        LastName    = values[1],
                                        CompanyName = values[2],
                                        Address     = values[3],
                                        City        = values[4],
                                        State       = values[5],
                                        Post        = values[6],
                                        Phone1      = values[7],
                                        Phone2      = values[8],
                                        Email       = values[9],
                                        Web         = values[10],
                                    });
                                }
                            }
                        }
                        else
                        {
                            if (ContactUtilities.IsValidEmail(values[9]))
                            {
                                dataList.Add(new SampleData
                                {
                                    FirstName   = values[0],
                                    LastName    = values[1],
                                    CompanyName = values[2],
                                    Address     = values[3],
                                    City        = values[4],
                                    State       = values[5],
                                    Post        = values[6],
                                    Phone1      = values[7],
                                    Phone2      = values[8],
                                    Email       = values[9],
                                    Web         = values[10],
                                });
                            }
                        }
                    }
                }
            }

            int itemTotal = dataList.Count;
            int pageTotal = itemTotal / searchParam.PageSize;
            List <SampleData> dataResult = new List <SampleData>();

            if (!string.IsNullOrEmpty(searchParam.SearchKey))
            {
                dataResult = dataList.Skip(0).Take(searchParam.PageSize).ToList();
            }
            else
            {
                int realPageIndex = searchParam.PageIndex - 1;
                dataResult = dataList.Skip(realPageIndex * searchParam.PageSize).Take(searchParam.PageSize).ToList();
            }

            return(new DataResult
            {
                Contacts = dataResult,
                PageTotal = pageTotal,
                ItemTotal = itemTotal
            });
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            UserContext userContext = owaContext.UserContext;
            HttpRequest request     = owaContext.HttpContext.Request;

            string[] array = null;
            applicationElement = ApplicationElement.Item;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            string        formParameter = Utilities.GetFormParameter(request, "hidAB");
            int           num           = 0;
            StoreObjectId storeObjectId = null;
            string        changeKey     = null;

            string[] array2 = formParameter.Split(new char[]
            {
                ';'
            });
            if (array2 != null && array2.Length > 0)
            {
                if (string.CompareOrdinal(array2[0], "Ad") == 0)
                {
                    num = 1;
                }
                else
                {
                    if (string.CompareOrdinal(array2[0], "Con") != 0)
                    {
                        throw new OwaInvalidRequestException("Invalid search location for addressbook");
                    }
                    num = 2;
                }
            }
            string action2 = owaContext.FormsRegistryContext.Action;

            if (action2 == null)
            {
                throw new OwaInvalidRequestException("Action query string parameter is missing");
            }
            object obj = AddressBookPreFormAction.actionParser.Parse(action2);

            AddressBookPreFormAction.Action action3 = (AddressBookPreFormAction.Action)obj;
            string text = request.Form["chkRcpt"];

            if (!string.IsNullOrEmpty(text))
            {
                array = text.Split(new char[]
                {
                    ','
                });
            }
            AddressBook.Mode mode = AddressBookHelper.TryReadAddressBookMode(request, AddressBook.Mode.None);
            if (AddressBook.IsEditingMode(mode))
            {
                string formParameter2 = Utilities.GetFormParameter(request, "hidid", false);
                changeKey = Utilities.GetFormParameter(request, "hidchk", false);
                if (!string.IsNullOrEmpty(formParameter2))
                {
                    storeObjectId = Utilities.CreateStoreObjectId(userContext.MailboxSession, formParameter2);
                    if (storeObjectId == null)
                    {
                        throw new OwaInvalidRequestException("ItemId cannot be null");
                    }
                }
            }
            switch (action3)
            {
            case AddressBookPreFormAction.Action.Done:
                if (AddressBook.IsEditingMode(mode))
                {
                    using (Item item = AddressBookHelper.GetItem(userContext, mode, storeObjectId, changeKey))
                    {
                        if (array != null && array.Length > 0)
                        {
                            RecipientItemType type2          = RecipientItemType.To;
                            string            formParameter3 = Utilities.GetFormParameter(request, "hidrw");
                            if (!string.IsNullOrEmpty(formParameter3))
                            {
                                int num2;
                                if (!int.TryParse(formParameter3, out num2) || num2 < 1 || num2 > 3)
                                {
                                    type2 = RecipientItemType.To;
                                }
                                else
                                {
                                    type2 = (RecipientItemType)num2;
                                }
                            }
                            if (num == 1)
                            {
                                AddressBookHelper.AddRecipientsToDraft(array, item, type2, userContext);
                            }
                            else if (num == 2)
                            {
                                AddressBookHelper.AddContactsToDraft(item, type2, userContext, array);
                            }
                        }
                        preFormActionResponse = AddressBookHelper.RedirectToEdit(userContext, item, mode);
                        break;
                    }
                }
                throw new OwaInvalidRequestException("This action must be in editing mode");

            case AddressBookPreFormAction.Action.Mail:
                if (array != null && array.Length > 0)
                {
                    using (Item item2 = MessageItem.Create(userContext.MailboxSession, userContext.DraftsFolderId))
                    {
                        item2[ItemSchema.ConversationIndexTracking] = true;
                        if (num == 1)
                        {
                            AddressBookHelper.AddRecipientsToDraft(array, item2, RecipientItemType.To, userContext);
                        }
                        else if (num == 2)
                        {
                            AddressBookHelper.AddContactsToDraft(item2, RecipientItemType.To, userContext, array);
                        }
                        preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                        preFormActionResponse.Type   = "IPM.Note";
                        preFormActionResponse.Action = "Open";
                        preFormActionResponse.State  = "Draft";
                        preFormActionResponse.AddParameter("id", item2.Id.ObjectId.ToBase64String());
                        break;
                    }
                }
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = "IPM.Note";
                preFormActionResponse.Action = "New";
                break;

            case AddressBookPreFormAction.Action.MeetingRequest:
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = "IPM.Appointment";
                if (array != null && array.Length > 0)
                {
                    using (CalendarItemBase calendarItemBase = EditCalendarItemHelper.CreateDraft(userContext, userContext.CalendarFolderId))
                    {
                        calendarItemBase.IsMeeting = true;
                        if (num == 1)
                        {
                            AddressBookHelper.AddRecipientsToDraft(array, calendarItemBase, RecipientItemType.To, userContext);
                        }
                        else if (num == 2)
                        {
                            AddressBookHelper.AddContactsToDraft(calendarItemBase, RecipientItemType.To, userContext, array);
                        }
                        preFormActionResponse.Action = "Open";
                        EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase);
                        break;
                    }
                }
                preFormActionResponse.AddParameter("mr", "1");
                preFormActionResponse.Action = "New";
                break;

            case AddressBookPreFormAction.Action.Close:
                if (AddressBook.IsEditingMode(mode))
                {
                    using (Item item3 = AddressBookHelper.GetItem(userContext, mode, storeObjectId, changeKey))
                    {
                        preFormActionResponse = AddressBookHelper.RedirectToEdit(userContext, item3, mode);
                        break;
                    }
                }
                throw new OwaInvalidRequestException("This action must be in editing mode");

            case AddressBookPreFormAction.Action.AddToContacts:
            {
                string type3 = "IPM.Contact";
                string text2 = null;
                if (array == null || array.Length != 1)
                {
                    throw new OwaInvalidRequestException("User must select some recipient to add and can only add one recipient to contacts at one time");
                }
                ADObjectId adobjectId = DirectoryAssistance.ParseADObjectId(array[0]);
                if (adobjectId == null)
                {
                    throw new OwaADObjectNotFoundException();
                }
                IRecipientSession recipientSession = Utilities.CreateADRecipientSession(Culture.GetUserCulture().LCID, true, ConsistencyMode.FullyConsistent, true, userContext);
                ADRecipient       adrecipient      = recipientSession.Read(adobjectId);
                if (adrecipient == null)
                {
                    throw new OwaADObjectNotFoundException();
                }
                using (ContactBase contactBase = ContactUtilities.AddADRecipientToContacts(userContext, adrecipient))
                {
                    if (contactBase != null)
                    {
                        contactBase.Load();
                        text2 = contactBase.Id.ObjectId.ToBase64String();
                        type3 = contactBase.ClassName;
                    }
                }
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = type3;
                if (text2 != null)
                {
                    preFormActionResponse.Action = "Open";
                    preFormActionResponse.State  = "Draft";
                    preFormActionResponse.AddParameter("id", text2);
                }
                else
                {
                    preFormActionResponse.Action = "New";
                }
                break;
            }

            default:
                throw new OwaInvalidRequestException("Invalid request for addressbook preformaction");
            }
            return(preFormActionResponse);
        }
Ejemplo n.º 30
0
        protected void RenderColumn(TextWriter writer, ColumnId columnId, int itemIndex, bool isBold, bool openForCompose)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (itemIndex < 0 || itemIndex >= this.dataSource.RangeCount)
            {
                throw new ArgumentOutOfRangeException("itemIndex", itemIndex.ToString());
            }
            Column column = ListViewColumns.GetColumn(columnId);

            switch (columnId)
            {
            case ColumnId.MailIcon:
                if (!this.RenderIcon(writer, itemIndex))
                {
                    goto IL_857;
                }
                goto IL_857;

            case ColumnId.From:
            case ColumnId.To:
            {
                string itemPropertyString = this.dataSource.GetItemPropertyString(itemIndex, column[0]);
                if (itemPropertyString.Length != 0)
                {
                    Utilities.CropAndRenderText(writer, itemPropertyString, 16);
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.Subject:
            {
                writer.Write("<h1");
                if (isBold)
                {
                    writer.Write(" class=\"bld\"");
                }
                writer.Write(">");
                writer.Write("<a href=\"#\"");
                this.RenderFolderNameTooltip(writer, itemIndex);
                writer.Write(" onClick=\"onClkRdMsg(this, '");
                string s = this.dataSource.GetItemProperty(itemIndex, StoreObjectSchema.ItemClass) as string;
                Utilities.HtmlEncode(Utilities.JavascriptEncode(s), writer);
                writer.Write("', {0}, {1});\">", itemIndex, openForCompose ? 1 : 0);
                string itemPropertyString2 = this.dataSource.GetItemPropertyString(itemIndex, column[0]);
                if (string.IsNullOrEmpty(itemPropertyString2.Trim()))
                {
                    writer.Write(LocalizedStrings.GetHtmlEncoded(730745110));
                }
                else
                {
                    Utilities.CropAndRenderText(writer, itemPropertyString2, 32);
                }
                writer.Write("</a></h1>");
                goto IL_857;
            }

            case ColumnId.Department:
            case ColumnId.ContactIcon:
            case ColumnId.BusinessPhone:
            case ColumnId.BusinessFax:
            case ColumnId.MobilePhone:
            case ColumnId.HomePhone:
                goto IL_74A;

            case ColumnId.HasAttachment:
            {
                bool   hasAttachments = false;
                object itemProperty   = this.dataSource.GetItemProperty(itemIndex, ItemSchema.HasAttachment);
                if (itemProperty is bool)
                {
                    hasAttachments = (bool)itemProperty;
                }
                if (!ListViewContentsRenderingUtilities.RenderHasAttachments(writer, this.userContext, hasAttachments))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.Importance:
            {
                Importance importance    = Importance.Normal;
                object     itemProperty2 = this.dataSource.GetItemProperty(itemIndex, ItemSchema.Importance);
                if (itemProperty2 is Importance || itemProperty2 is int)
                {
                    importance = (Importance)itemProperty2;
                }
                if (!ListViewContentsRenderingUtilities.RenderImportance(writer, this.UserContext, importance))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.DeliveryTime:
            {
                ExDateTime itemPropertyExDateTime = this.dataSource.GetItemPropertyExDateTime(itemIndex, ItemSchema.ReceivedTime);
                if (!this.RenderDate(writer, itemPropertyExDateTime))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.SentTime:
            {
                ExDateTime itemPropertyExDateTime2 = this.dataSource.GetItemPropertyExDateTime(itemIndex, ItemSchema.SentTime);
                if (!this.RenderDate(writer, itemPropertyExDateTime2))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.Size:
            {
                int    num           = 0;
                object itemProperty3 = this.dataSource.GetItemProperty(itemIndex, ItemSchema.Size);
                if (itemProperty3 is int)
                {
                    num = (int)itemProperty3;
                }
                Utilities.RenderSizeWithUnits(writer, (long)num, true);
                goto IL_857;
            }

            case ColumnId.FileAs:
                break;

            case ColumnId.Title:
            case ColumnId.CompanyName:
                goto IL_5B5;

            case ColumnId.PhoneNumbers:
                if (!this.RenderPhoneNumberColumn(writer, itemIndex))
                {
                    goto IL_857;
                }
                goto IL_857;

            case ColumnId.EmailAddresses:
            {
                Participant[] array = new Participant[3];
                bool          flag  = false;
                array[0] = (this.dataSource.GetItemProperty(itemIndex, ContactSchema.Email1) as Participant);
                array[1] = (this.dataSource.GetItemProperty(itemIndex, ContactSchema.Email2) as Participant);
                array[2] = (this.dataSource.GetItemProperty(itemIndex, ContactSchema.Email3) as Participant);
                foreach (Participant participant in array)
                {
                    if (participant != null && !string.IsNullOrEmpty(participant.EmailAddress))
                    {
                        string text  = null;
                        string text2 = null;
                        ContactUtilities.GetParticipantEmailAddress(participant, out text, out text2);
                        Utilities.CropAndRenderText(writer, text, 24);
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            default:
            {
                switch (columnId)
                {
                case ColumnId.CheckBox:
                {
                    VersionedId itemPropertyVersionedId = this.dataSource.GetItemPropertyVersionedId(itemIndex, ItemSchema.Id);
                    ListViewContentsRenderingUtilities.RenderCheckBox(writer, itemPropertyVersionedId.ObjectId.ToBase64String());
                    string itemClass = this.dataSource.GetItemProperty(itemIndex, StoreObjectSchema.ItemClass) as string;
                    if (ObjectClass.IsMeetingRequest(itemClass) || ObjectClass.IsMeetingCancellation(itemClass))
                    {
                        if (this.meetingMessageIdStringBuilder.Length > 0)
                        {
                            this.meetingMessageIdStringBuilder.Append(",");
                        }
                        this.meetingMessageIdStringBuilder.Append(itemPropertyVersionedId.ObjectId.ToBase64String());
                        goto IL_857;
                    }
                    goto IL_857;
                }

                case ColumnId.CheckBoxContact:
                case ColumnId.CheckBoxAD:
                {
                    string arg;
                    if (columnId == ColumnId.CheckBoxAD)
                    {
                        arg = Utilities.GetBase64StringFromGuid((Guid)this.dataSource.GetItemProperty(itemIndex, ADObjectSchema.Guid));
                    }
                    else
                    {
                        VersionedId itemPropertyVersionedId2 = this.dataSource.GetItemPropertyVersionedId(itemIndex, ItemSchema.Id);
                        arg = itemPropertyVersionedId2.ObjectId.ToBase64String();
                    }
                    writer.Write("<input type=\"checkbox\" name=\"chkRcpt\" value=\"{0}\"", arg);
                    writer.Write(" onClick=\"onClkRChkBx(this);\">");
                    goto IL_857;
                }

                case ColumnId.ADIcon:
                case ColumnId.BusinessFaxAD:
                case ColumnId.BusinessPhoneAD:
                case ColumnId.DepartmentAD:
                    goto IL_74A;

                case ColumnId.AliasAD:
                    break;

                case ColumnId.CompanyAD:
                    goto IL_5B5;

                case ColumnId.DisplayNameAD:
                    goto IL_383;

                default:
                    switch (columnId)
                    {
                    case ColumnId.PhoneAD:
                        break;

                    case ColumnId.TitleAD:
                        goto IL_5B5;

                    default:
                        goto IL_74A;
                    }
                    break;
                }
                string text3 = this.dataSource.GetItemProperty(itemIndex, column[0]) as string;
                if (!string.IsNullOrEmpty(text3))
                {
                    Utilities.CropAndRenderText(writer, text3, 24);
                    goto IL_857;
                }
                goto IL_857;
            }
            }
IL_383:
            StringBuilder stringBuilder = new StringBuilder();
            object obj;
            int    num2;

            if (columnId == ColumnId.DisplayNameAD)
            {
                string value = this.dataSource.GetItemProperty(itemIndex, ADRecipientSchema.DisplayName) as string;
                if (!string.IsNullOrEmpty(value))
                {
                    stringBuilder.Append(value);
                }
                obj  = Utilities.GetBase64StringFromGuid((Guid)this.dataSource.GetItemProperty(itemIndex, ADObjectSchema.Guid));
                num2 = (isBold ? 2 : 1);
            }
            else
            {
                string value = this.dataSource.GetItemProperty(itemIndex, ContactBaseSchema.FileAs) as string;
                if (!string.IsNullOrEmpty(value))
                {
                    stringBuilder.Append(value);
                }
                bool flag2 = (columnId == ColumnId.DisplayNameAD) ? this.userContext.IsPhoneticNamesEnabled : Utilities.IsJapanese;
                if (flag2)
                {
                    string value2 = this.dataSource.GetItemProperty(itemIndex, ContactSchema.YomiFirstName) as string;
                    string value3 = this.dataSource.GetItemProperty(itemIndex, ContactSchema.YomiLastName) as string;
                    bool   flag3  = false;
                    if (stringBuilder.Length > 0 && (!string.IsNullOrEmpty(value3) || !string.IsNullOrEmpty(value2)))
                    {
                        stringBuilder.Append(" (");
                        flag3 = true;
                    }
                    if (!string.IsNullOrEmpty(value3))
                    {
                        stringBuilder.Append(value3);
                        if (!string.IsNullOrEmpty(value2))
                        {
                            stringBuilder.Append(" ");
                        }
                    }
                    if (!string.IsNullOrEmpty(value2))
                    {
                        stringBuilder.Append(value2);
                    }
                    if (flag3)
                    {
                        stringBuilder.Append(")");
                    }
                }
                VersionedId itemPropertyVersionedId3 = this.dataSource.GetItemPropertyVersionedId(itemIndex, ItemSchema.Id);
                obj  = itemPropertyVersionedId3.ObjectId.ToBase64String();
                num2 = (isBold ? 4 : 3);
            }
            if (Utilities.WhiteSpaceOnlyOrNullEmpty(stringBuilder.ToString()))
            {
                stringBuilder.Append(LocalizedStrings.GetNonEncoded(-808148510));
            }
            writer.Write("<h1");
            if (isBold)
            {
                writer.Write(" class=\"bld\"");
            }
            writer.Write("><a href=\"#\" id=\"{0}\"", obj.ToString());
            if (isBold)
            {
                writer.Write(" class=\"lvwdl\"");
            }
            this.RenderFolderNameTooltip(writer, itemIndex);
            writer.Write(" onClick=\"return onClkRcpt(this, {0});\">", num2);
            if (isBold)
            {
                ListViewContentsRenderingUtilities.RenderItemIcon(writer, this.userContext, "IPM.DistList");
            }
            Utilities.CropAndRenderText(writer, stringBuilder.ToString(), 32);
            writer.Write("</a></h1>");
            goto IL_857;
IL_5B5:
            string text4 = this.dataSource.GetItemProperty(itemIndex, column[0]) as string;

            if (!string.IsNullOrEmpty(text4))
            {
                Utilities.CropAndRenderText(writer, text4, 16);
                goto IL_857;
            }
            goto IL_857;
IL_74A:
            object itemProperty4 = this.dataSource.GetItemProperty(itemIndex, column[0]);
            string text5 = itemProperty4 as string;

            if (itemProperty4 is ExDateTime)
            {
                writer.Write(((ExDateTime)itemProperty4).ToString());
            }
            else if (itemProperty4 is DateTime)
            {
                ExDateTime exDateTime = new ExDateTime(this.userContext.TimeZone, (DateTime)itemProperty4);
                writer.Write(exDateTime.ToString());
            }
            else if (text5 != null)
            {
                if (text5.Length != 0)
                {
                    Utilities.HtmlEncode(text5, writer);
                }
            }
            else if (itemProperty4 is int)
            {
                Utilities.HtmlEncode(((int)itemProperty4).ToString(CultureInfo.CurrentCulture.NumberFormat), writer);
            }
            else if (itemProperty4 is Unlimited <int> )
            {
                Unlimited <int> unlimited = (Unlimited <int>)itemProperty4;
                if (!unlimited.IsUnlimited)
                {
                    Utilities.HtmlEncode(unlimited.Value.ToString(CultureInfo.CurrentCulture.NumberFormat), writer);
                }
            }
            else if (!(itemProperty4 is PropertyError))
            {
            }
IL_857:
            writer.Write("&nbsp;");
        }