Пример #1
0
        // Token: 0x06002DAC RID: 11692 RVA: 0x001028F0 File Offset: 0x00100AF0
        private int CheckDuplicateItems(RecipientInfo[] items)
        {
            int result = 0;
            IComparer <RecipientInfo> comparer = new EditDistributionListEventHandler.RecipientInfoComparer();

            for (int i = 0; i < items.Length; i++)
            {
                if (items[i].AddressOrigin != AddressOrigin.Directory && items[i].AddressOrigin != AddressOrigin.Store && string.IsNullOrEmpty(items[i].RoutingType))
                {
                    items[i].AddressOrigin = AddressOrigin.OneOff;
                    RecipientAddress recipientAddress = AnrManager.ResolveAnrStringToOneOffEmail(items[i].RoutingAddress);
                    if (recipientAddress != null)
                    {
                        items[i].RoutingType    = recipientAddress.RoutingType;
                        items[i].RoutingAddress = recipientAddress.RoutingAddress;
                    }
                    else
                    {
                        items[i].RoutingType = "SMTP";
                    }
                }
            }
            Array.Sort <RecipientInfo>(items, comparer);
            for (int j = 0; j < items.Length; j++)
            {
                if ((items[j].AddressOrigin != AddressOrigin.Store || !items[j].StoreObjectId.Equals(base.IsParameterSet("Id") ? ((OwaStoreObjectId)base.GetParameter("Id")).StoreObjectId : null)) && (j <= 0 || comparer.Compare(items[j - 1], items[j]) != 0))
                {
                    items[result++] = items[j];
                }
            }
            return(result);
        }
Пример #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            RecipientAddress recipientAddress = (RecipientAddress)db.RecipientAddresses.Find(id);

            db.RecipientAddresses.Remove(recipientAddress);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #3
0
        private void SendMailInternal(NativeActivityContext context, string mailBody)
        {
            var mail = $"{Environment.NewLine}From: {FromAddress.Get(context)}" +
                       $"{Environment.NewLine}To: {RecipientAddress.Get(context)}" +
                       $"{Environment.NewLine}Subject: {Subject.Get(context)}" +
                       $"{Environment.NewLine}Body: {mailBody}";

            Console.WriteLine(mail);
        }
Пример #4
0
        protected override void Execute(CodeActivityContext context)
        {
            var msg = new MailMessage(FromAddress.Get(context),
                                      RecipientAddress.Get(context),
                                      Subject.Get(context),
                                      MailBody.Get(context));

            using (var client = new SmtpClient())
            {
                client.Send(msg);
            }
        }
Пример #5
0
 private byte[] GetPayload()
 {
     return(BitConverter.GetBytes(ProtocolVersion)
            .Concat(BitConverter.GetBytes(Services))
            .Concat(BitConverter.GetBytes(Timestamp))
            .Concat(RecipientAddress.ToBytes())
            .Concat(SenderAddress.ToBytes())
            .Concat(BitConverter.GetBytes(Nonce))
            .Concat(UserAgentLength.ToBytes())
            .Concat(Encoding.ASCII.GetBytes(UserAgent))
            .Concat(BitConverter.GetBytes(StartHeight))
            .Concat(Relay ? new byte[] { 0x01 } : new byte[] { 0x00 })
            .ToArray());
 }
Пример #6
0
        // GET: RecipientAddresses/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RecipientAddress recipientAddress = (RecipientAddress)db.RecipientAddresses.Find(id);

            if (recipientAddress == null)
            {
                return(HttpNotFound());
            }
            return(View(recipientAddress));
        }
Пример #7
0
        public ActionResult Edit([Bind(Include = "RecipientAddressID,NickName,RecipientName,RecipientShippingAccountId,CompanyName,DepartmentName,Building,Street,City,ProvinceCode,PostalCode,RecipientPhoneNumber,RecipientEmail")]  RecipientAddressViewModel recipientAddressViewModel)
        {
            if (ModelState.IsValid)
            {
                RecipientAddress recipientAddress = new RecipientAddress(recipientAddressViewModel.RecipientAddressID,
                                                                         recipientAddressViewModel.NickName, recipientAddressViewModel.RecipientName, recipientAddressViewModel.RecipientShippingAccountId,
                                                                         recipientAddressViewModel.CompanyName, recipientAddressViewModel.DepartmentName,
                                                                         recipientAddressViewModel.Building, recipientAddressViewModel.Street, recipientAddressViewModel.City, recipientAddressViewModel.ProvinceCode,
                                                                         recipientAddressViewModel.PostalCode, recipientAddressViewModel.RecipientPhoneNumber, recipientAddressViewModel.RecipientEmail
                                                                         );

                recipientAddress.ProvinceCode    = GetProvince(recipientAddress.City);
                db.Entry(recipientAddress).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(recipientAddressViewModel));
        }
Пример #8
0
        public PushMessage PreparePushMessage(NotificationQueueRequest queueRequest, RecipientAddress pushId)
        {
            int timeToLive = ConfigurationHelper.GetConfiguration <int>(Constants.PushFireBaseTimeToLive, Constants.PushFireBaseTimeToLiveDefault);

            PushMessage pushRequest = new PushMessage
            {
                to = pushId?.Adress //"eRArK-0TwkM:APA91bH7APab_SVh2NeOqvlC0IQu9jcutjEIzCHwu8HATlLI_5mSdLIC6eDkH3WUlcklG-g9nlwtiIn2DGr5XJt1j4cx-Yl7fVXeNsh__LH6iJ8FcsQRcxveMwp7HOYejH5RJq6nq73rM-w_v3dwqmZpgvCBGaiDEg"; //for a topic to": "/topics/foo-bar"
            };
            PushMessageData notification = new PushMessageData();

            string subject = queueRequest.Subject;
            string content = queueRequest.Content;

            try {
                content = CommonOperation.EncodeJavaUnicodes(queueRequest.Content);
                subject = CommonOperation.EncodeJavaUnicodes(queueRequest.Subject);
            }
            catch (Exception ex) {
                log.WarnFormat("PreparePushMessage-EncodeJavaUnicodes Error :{0} ; Content:{1}, Subject:{2}, TransactionId:{3}, Customer : {4}", ex, queueRequest.Content, queueRequest.Subject, queueRequest.TransactionId, queueRequest.CustomerNumber);
            }
            notification.title = subject;
            notification.body  = content;

            notification.sound          = "default";
            notification.badge          = queueRequest.PushBadge;
            pushRequest.notification    = notification;
            pushRequest.mutable_content = true;
            PushExtraData data = new PushExtraData
            {
                tranCode       = queueRequest.TransactionCode,
                pushResponseId = queueRequest.ResponseID
            };

            var credentials = PushSenderHelper.GetRsaCredentials();

            data.pushRegisterId = PushSenderHelper.EncryptPushRegisterId(queueRequest.PushRegisterId.ToString(), credentials.Password);

            data.tranData            = JsonConvert.DeserializeObject(queueRequest.TranData);
            pushRequest.time_to_live = timeToLive;
            pushRequest.data         = data;

            return(pushRequest);
        }
Пример #9
0
        // GET: RecipientAddresses/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RecipientAddress recipientAddress = (RecipientAddress)db.RecipientAddresses.Find(id);

            if (recipientAddress == null)
            {
                return(HttpNotFound());
            }
            RecipientAddressViewModel recipientAddressViewModel = new RecipientAddressViewModel(recipientAddress.RecipientAddressID,
                                                                                                recipientAddress.NickName, recipientAddress.RecipientName, recipientAddress.RecipientShippingAccountId,
                                                                                                recipientAddress.CompanyName, recipientAddress.DepartmentName,
                                                                                                recipientAddress.Building, recipientAddress.Street, recipientAddress.City, recipientAddress.ProvinceCode,
                                                                                                recipientAddress.PostalCode, recipientAddress.RecipientPhoneNumber, recipientAddress.RecipientEmail);

            recipientAddressViewModel.Cities = PopulateDestinationsDropDownList().ToList();
            return(View(recipientAddressViewModel));
        }
Пример #10
0
        async Task ExecuteSendCommand()
        {
            if (string.IsNullOrWhiteSpace(RecipientAddress) || SendingAmount <= 0)
            {
                return;
            }
            var toAddress = RecipientAddress.Trim();

            if (toAddress.Length != DefaultAccountAddress.Length)
            {
                return;
            }

            //userDialogs.ShowLoading("Sending");
            var result = await accountsManager.TransferAsync(DefaultAccountAddress, toAddress, SendingAmount);

            await navService.DisplayAlert("Send Result", $"tx:{result}", "ok", "cancel");

            //userDialogs.HideLoading();
            await UpdateBalance();
        }
Пример #11
0
 // Token: 0x06001E91 RID: 7825 RVA: 0x000B01D0 File Offset: 0x000AE3D0
 internal static void ResolveAndRenderChunk(TextWriter writer, string chunk, ArrayList wellNodes, RecipientCache recipientCache, UserContext userContext, AnrManager.Options options)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     if (chunk == null)
     {
         throw new ArgumentNullException("chunk");
     }
     if (userContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     writer.Write("<div id=\"chk\">");
     string[] array = Utilities.ParseRecipientChunk(chunk);
     if (array != null)
     {
         for (int i = 0; i < array.Length; i++)
         {
             string text = array[i].Trim();
             if (text.IndexOf(Globals.HtmlDirectionCharacterString, StringComparison.Ordinal) != -1)
             {
                 text = Utilities.RemoveHTMLDirectionCharacters(text);
             }
             if (text.Length > 0)
             {
                 RecipientAddress  recipientAddress  = AnrManager.ResolveAnrString(text, options, userContext);
                 RecipientWellNode recipientWellNode = new RecipientWellNode(text, null);
                 if (recipientAddress != null)
                 {
                     recipientWellNode.DisplayName       = recipientAddress.DisplayName;
                     recipientWellNode.SmtpAddress       = recipientAddress.SmtpAddress;
                     recipientWellNode.AddressOrigin     = recipientAddress.AddressOrigin;
                     recipientWellNode.RoutingAddress    = recipientAddress.RoutingAddress;
                     recipientWellNode.RoutingType       = recipientAddress.RoutingType;
                     recipientWellNode.RecipientFlags    = recipientAddress.RecipientFlags;
                     recipientWellNode.StoreObjectId     = recipientAddress.StoreObjectId;
                     recipientWellNode.EmailAddressIndex = recipientAddress.EmailAddressIndex;
                     recipientWellNode.ADObjectId        = recipientAddress.ADObjectId;
                     recipientWellNode.SipUri            = recipientAddress.SipUri;
                     recipientWellNode.MobilePhoneNumber = recipientAddress.MobilePhoneNumber;
                 }
                 if ((recipientWellNode.RoutingAddress != null || Utilities.IsMapiPDL(recipientWellNode.RoutingType)) && recipientCache != null)
                 {
                     string itemId = string.Empty;
                     if (recipientWellNode.StoreObjectId != null)
                     {
                         itemId = recipientWellNode.StoreObjectId.ToBase64String();
                     }
                     else if (recipientWellNode.ADObjectId != null)
                     {
                         itemId = Convert.ToBase64String(recipientWellNode.ADObjectId.ObjectGuid.ToByteArray());
                     }
                     recipientCache.AddEntry(recipientWellNode.DisplayName, recipientWellNode.SmtpAddress, recipientWellNode.RoutingAddress, string.Empty, recipientWellNode.RoutingType, recipientWellNode.AddressOrigin, recipientWellNode.RecipientFlags, itemId, recipientWellNode.EmailAddressIndex, recipientWellNode.SipUri, recipientWellNode.MobilePhoneNumber);
                 }
                 recipientWellNode.Render(writer, userContext, RecipientWellNode.RenderFlags.RenderSkinnyHtml);
                 if (wellNodes != null)
                 {
                     wellNodes.Add(recipientWellNode);
                 }
             }
         }
     }
     writer.Write("</div>");
 }
        public void ExpandDistributionList()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "RecipientWellEventHandler.ExpandDistributionList");
            RecipientInfo[]    array = (RecipientInfo[])base.GetParameter("Recips");
            List <Participant> list  = new List <Participant>();

            foreach (RecipientInfo recipientInfo in array)
            {
                if (recipientInfo.StoreObjectId == null || !Utilities.IsMapiPDL(recipientInfo.RoutingType))
                {
                    throw new OwaEventHandlerException("The requested recipient is not personal distribution list");
                }
                list.AddRange(DistributionList.ExpandDeep(base.UserContext.MailboxSession, recipientInfo.StoreObjectId));
            }
            using (List <Participant> .Enumerator enumerator = list.GetEnumerator())
            {
                AdRecipientBatchQuery adRecipientBatchQuery = new AdRecipientBatchQuery(enumerator, base.UserContext);
                bool flag = false;
                foreach (Participant participant in list)
                {
                    string            smtpAddress       = null;
                    string            sipUri            = null;
                    ADObjectId        adObjectId        = null;
                    StoreObjectId     storeObjectId     = null;
                    EmailAddressIndex emailAddressIndex = EmailAddressIndex.None;
                    string            mobilePhoneNumber = null;
                    if (participant.RoutingType == "EX")
                    {
                        ADRecipient adRecipient = adRecipientBatchQuery.GetAdRecipient(participant.EmailAddress);
                        if (adRecipient != null)
                        {
                            smtpAddress       = adRecipient.PrimarySmtpAddress.ToString();
                            adObjectId        = adRecipient.Id;
                            sipUri            = InstantMessageUtilities.GetSipUri((ProxyAddressCollection)adRecipient[ADRecipientSchema.EmailAddresses]);
                            mobilePhoneNumber = Utilities.NormalizePhoneNumber((string)adRecipient[ADOrgPersonSchema.MobilePhone]);
                        }
                    }
                    else
                    {
                        smtpAddress = participant.EmailAddress;
                        sipUri      = participant.EmailAddress;
                    }
                    RecipientAddress.RecipientAddressFlags recipientAddressFlags = RecipientAddress.RecipientAddressFlags.None;
                    if (participant.GetValueOrDefault <bool>(ParticipantSchema.IsDistributionList))
                    {
                        recipientAddressFlags |= RecipientAddress.RecipientAddressFlags.DistributionList;
                    }
                    else if (participant.GetValueOrDefault <bool>(ParticipantSchema.IsRoom))
                    {
                        recipientAddressFlags |= RecipientAddress.RecipientAddressFlags.Room;
                    }
                    StoreParticipantOrigin storeParticipantOrigin = participant.Origin as StoreParticipantOrigin;
                    if (storeParticipantOrigin != null)
                    {
                        storeObjectId     = storeParticipantOrigin.OriginItemId;
                        emailAddressIndex = storeParticipantOrigin.EmailAddressIndex;
                    }
                    RecipientWellNode.Render(this.Writer, base.UserContext, participant.DisplayName, smtpAddress, participant.EmailAddress, participant.RoutingType, participant.GetValueOrDefault <string>(ParticipantSchema.Alias), RecipientAddress.ToAddressOrigin(participant), (int)recipientAddressFlags, storeObjectId, emailAddressIndex, adObjectId, flag ? RecipientWellNode.RenderFlags.RenderCommas : RecipientWellNode.RenderFlags.None, sipUri, mobilePhoneNumber);
                    flag = true;
                }
            }
        }
        // Token: 0x06002F13 RID: 12051 RVA: 0x0010F384 File Offset: 0x0010D584
        private void ResolveOneRecipientAndRenderResults(TextWriter output)
        {
            string text = (string)base.GetParameter("n");

            if (text.IndexOf(Globals.HtmlDirectionCharacterString, StringComparison.Ordinal) != -1)
            {
                text = Utilities.RemoveHTMLDirectionCharacters(text);
            }
            List <RecipientAddress> list = new List <RecipientAddress>();

            AnrManager.Options options = this.ReadAnrOptions();
            AnrManager.ResolveOneRecipient(text, base.UserContext, list, options);
            if (list.Count == 0)
            {
                RecipientAddress recipientAddress = AnrManager.ResolveAnrStringToOneOffEmail(text, options);
                if (recipientAddress != null)
                {
                    list.Add(recipientAddress);
                }
            }
            bool flag = false;

            output.Write("new Array(");
            foreach (RecipientAddress recipientAddress2 in list)
            {
                if (flag)
                {
                    output.Write(",");
                }
                else
                {
                    flag = true;
                }
                output.Write("new Recip(\"");
                if (recipientAddress2.DisplayName != null)
                {
                    Utilities.JavascriptEncode(recipientAddress2.DisplayName, output);
                }
                output.Write("\",\"");
                if (recipientAddress2.RoutingAddress != null)
                {
                    Utilities.JavascriptEncode(recipientAddress2.RoutingAddress, output);
                }
                output.Write("\",\"");
                if (recipientAddress2.SmtpAddress != null)
                {
                    Utilities.JavascriptEncode(recipientAddress2.SmtpAddress, output);
                }
                output.Write("\",\"");
                if (recipientAddress2.Alias != null)
                {
                    Utilities.JavascriptEncode(recipientAddress2.Alias, output);
                }
                output.Write("\",\"");
                if (recipientAddress2.RoutingType != null)
                {
                    Utilities.JavascriptEncode(recipientAddress2.RoutingType, output);
                }
                output.Write("\",{0},\"", (int)recipientAddress2.AddressOrigin);
                if (recipientAddress2.ADObjectId != null)
                {
                    Utilities.JavascriptEncode(Convert.ToBase64String(recipientAddress2.ADObjectId.ObjectGuid.ToByteArray()), output);
                }
                else if (recipientAddress2.StoreObjectId != null)
                {
                    Utilities.JavascriptEncode(recipientAddress2.StoreObjectId.ToBase64String(), output);
                }
                output.Write("\",");
                output.Write(recipientAddress2.RecipientFlags);
                output.Write(",");
                output.Write((int)recipientAddress2.EmailAddressIndex);
                output.Write(",\"");
                if (base.UserContext.IsInstantMessageEnabled() && base.UserContext.InstantMessagingType == InstantMessagingTypeOptions.Ocs && recipientAddress2.SipUri != null)
                {
                    Utilities.JavascriptEncode(recipientAddress2.SipUri, output);
                }
                output.Write("\",\"");
                if (base.UserContext.IsSmsEnabled && recipientAddress2.MobilePhoneNumber != null)
                {
                    Utilities.JavascriptEncode(recipientAddress2.MobilePhoneNumber, output);
                }
                output.Write("\")");
            }
            output.Write(")");
        }
Пример #14
0
        internal override void RenderContents(TextWriter writer, UserContext userContext, RecipientWellType type, RecipientWellNode.RenderFlags flags, RenderRecipientWellNode wellNode)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (!this.HasRecipients(type))
            {
                return;
            }
            IEnumerator <Participant> recipientsCollection = this.GetRecipientsCollection(type);

            RecipientWellNode.RenderFlags renderFlags = flags & ~RecipientWellNode.RenderFlags.RenderCommas;
            bool flag  = true;
            bool flag2 = userContext.IsInstantMessageEnabled();

            Result <ADRawEntry>[] array = null;
            int num = 0;

            while (recipientsCollection.MoveNext())
            {
                Participant participant       = recipientsCollection.Current;
                string      smtpAddress       = null;
                string      alias             = null;
                string      text              = null;
                int         num2              = 0;
                ADObjectId  adObjectId        = null;
                string      mobilePhoneNumber = null;
                if (participant.RoutingType == "EX" && !string.IsNullOrEmpty(participant.EmailAddress))
                {
                    bool flag3 = (flags & RecipientWellNode.RenderFlags.ReadOnly) != RecipientWellNode.RenderFlags.None;
                    if (flag3)
                    {
                        alias = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.Alias, null);
                    }
                    bool participantProperty = Utilities.GetParticipantProperty <bool>(participant, ParticipantSchema.IsDistributionList, false);
                    if (participantProperty)
                    {
                        num2 |= 1;
                    }
                    bool participantProperty2 = Utilities.GetParticipantProperty <bool>(participant, ParticipantSchema.IsRoom, false);
                    if (participantProperty2)
                    {
                        num2 |= 2;
                    }
                    smtpAddress = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.SmtpAddress, null);
                    if (flag2 && !participantProperty && !participantProperty2)
                    {
                        text = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.SipUri, null);
                        if (text == null || text.Trim().Length == 0)
                        {
                            if (array == null)
                            {
                                array = AdRecipientBatchQuery.FindAdResultsByLegacyExchangeDNs(this.GetRecipientsCollection(type), userContext);
                            }
                            ADRawEntry data = array[num].Data;
                            if (data != null)
                            {
                                adObjectId = (ADObjectId)data[ADObjectSchema.Id];
                                text       = InstantMessageUtilities.GetSipUri((ProxyAddressCollection)data[ADRecipientSchema.EmailAddresses]);
                                if (text != null && text.Trim().Length == 0)
                                {
                                    text = null;
                                }
                            }
                        }
                    }
                    if (userContext.IsSmsEnabled)
                    {
                        if (array == null)
                        {
                            array = AdRecipientBatchQuery.FindAdResultsByLegacyExchangeDNs(this.GetRecipientsCollection(type), userContext);
                        }
                        ADRawEntry data2 = array[num].Data;
                        if (data2 != null)
                        {
                            mobilePhoneNumber = (string)data2[ADOrgPersonSchema.MobilePhone];
                        }
                    }
                    num++;
                }
                else if (participant.RoutingType == "SMTP")
                {
                    smtpAddress = participant.EmailAddress;
                    if (flag2)
                    {
                        text = participant.EmailAddress;
                    }
                }
                else if (string.CompareOrdinal(participant.RoutingType, "MAPIPDL") == 0)
                {
                    num2 |= 1;
                }
                StoreObjectId          storeObjectId          = null;
                EmailAddressIndex      emailAddressIndex      = EmailAddressIndex.None;
                StoreParticipantOrigin storeParticipantOrigin = participant.Origin as StoreParticipantOrigin;
                if (storeParticipantOrigin != null && storeParticipantOrigin.OriginItemId != null)
                {
                    storeObjectId     = storeParticipantOrigin.OriginItemId;
                    emailAddressIndex = storeParticipantOrigin.EmailAddressIndex;
                }
                if (wellNode(writer, userContext, participant.DisplayName, smtpAddress, participant.EmailAddress, participant.RoutingType, alias, RecipientAddress.ToAddressOrigin(participant), num2, storeObjectId, emailAddressIndex, adObjectId, renderFlags, text, mobilePhoneNumber) && flag)
                {
                    flag = false;
                    if ((flags & RecipientWellNode.RenderFlags.RenderCommas) != RecipientWellNode.RenderFlags.None)
                    {
                        renderFlags |= RecipientWellNode.RenderFlags.RenderCommas;
                    }
                }
            }
        }
 public RecipientAddressCreatedEvent(RecipientAddress recipientAddress)
 {
     RecipientAddress = recipientAddress;
 }
Пример #16
0
 public ResolvedRecipientDetail(RecipientAddress recipientAddress) : this(recipientAddress.SmtpAddress, recipientAddress.RoutingAddress, recipientAddress.DisplayName, recipientAddress.RoutingType, recipientAddress.AddressOrigin, recipientAddress.RecipientFlags, recipientAddress.StoreObjectId, recipientAddress.EmailAddressIndex, recipientAddress.ADObjectId)
 {
 }
        // POST: Shipments/ArrangeShipment
        public ActionResult ArrangeShipment(ArrangeShipmentViewModel shipment,
                                            bool next = false)
        {
            shipment.Destinations       = PopulateDestinationsDropDownList().ToList();
            shipment.Destinations       = PopulateDestinationsDropDownList().ToList();
            shipment.ServiceTypes       = PopulateServiceTypesDropDownList().ToList();
            shipment.CurrencyCodes      = PopulateCurrenciesDropDownList().ToList();
            shipment.RecipientAddresses = PopulateRecipientAddressesDropDownList().ToList();
            if (shipment.RecipientAddresses.Count > 0)
            {
                ViewBag.ShowRecipientAddresses = 1;
            }
            else
            {
                ViewBag.ShowRecipientAddresses = 0;
            }
            for (int i = 0; i < 10; i++)
            {
                shipment.Packages[i].PackageTypeSizes = PopulatePackageTypeSizesDropDownList().ToList();
            }

            shipment.ShipmentCost = 0;

            ViewBag.NumberOfPackages = shipment.NumberOfPackages;
            ViewBag.CityID           = 1;

            if (!next)                                // Submit RecipientAddress or Change in NumberOfPackages in View
            {
                if (shipment.RecipientAddressID == 0) // If Change in NumberOfPackages in View
                {
                    return(View(shipment));
                }

                RecipientAddress recipientAddress = db.RecipientAddresses.Find(shipment.RecipientAddressID);
                ViewBag.RecipientName = recipientAddress.RecipientName;
                ViewBag.RecipientShippingAccountId = recipientAddress.RecipientShippingAccountId;
                ViewBag.RecipientCompanyName       = recipientAddress.CompanyName;
                ViewBag.RecipientDepartmentName    = recipientAddress.DepartmentName;
                ViewBag.RecipientBuilding          = recipientAddress.Building;
                ViewBag.RecipientStreet            = recipientAddress.Street;
                ViewBag.CityID = db.Destinations.First(s => s.City == recipientAddress.City).DestinationID;
                ViewBag.City   = recipientAddress.City;
                ViewBag.RecipientPostalCode  = recipientAddress.PostalCode;
                ViewBag.RecipientPhoneNumber = recipientAddress.RecipientPhoneNumber;
                ViewBag.RecipientEmail       = shipment.RecipientEmail;
                return(View(shipment));
            }

            for (int i = 0; i < shipment.NumberOfPackages; i++)
            {
                if (shipment.Packages[i].CustomerWeight == 0)
                {
                    ViewBag.PackageStatusMessage = "Package weight should not be 0.";
                    return(View(shipment));
                }
            }

            if (shipment.NotifyRecipient)
            {
                if (shipment.RecipientEmail == null)
                {
                    ViewBag.RecipientEmailStatusMessage = "Recipient email has to be provided for notification.";
                    return(View(shipment));
                }
            }

            if (shipment.ShipmentPayer == "Recipient" || shipment.DTPayer == "Recipient")
            {
                if (shipment.RecipientShippingAccountId == null)
                {
                    ViewBag.RecipientShippingAccountIdStatusMessage = "Recipient Account ID is required to be the payer.";
                    return(View(shipment));
                }
            }


            if (Session["newShipment"] != null)
            {
                Session.Remove("newShipment");
            }
            SaveToSessionState("newShipment", shipment);
            return(RedirectToAction("ConfirmShipment"));
        }
        // Token: 0x060000C0 RID: 192 RVA: 0x00006DF0 File Offset: 0x00004FF0
        protected override bool RenderAnrContents(TextWriter writer, UserContext userContext, RecipientWellType type, bool isTableStartRendered)
        {
            bool flag  = isTableStartRendered;
            bool flag2 = false;

            if (this.HasRecipients(type))
            {
                AdRecipientBatchQuery     adRecipientBatchQuery = new AdRecipientBatchQuery(this.GetRecipientCollection(type), this.UserContext);
                IEnumerator <Participant> recipientCollection   = this.GetRecipientCollection(type);
                string empty = string.Empty;
                int    num   = 0;
                List <RecipientAddress> list = new List <RecipientAddress>();
                RecipientItemType       recipientItemType = ItemRecipientWell.GetRecipientItemType(type);
                int num2 = 0;
                while (recipientCollection.MoveNext())
                {
                    Participant participant = recipientCollection.Current;
                    string      text        = ItemRecipientWell.BuildRecipientIdString(recipientItemType, num2++);
                    if (string.CompareOrdinal(participant.RoutingType, "MAPIPDL") != 0 && (string.IsNullOrEmpty(participant.EmailAddress) || string.IsNullOrEmpty(participant.RoutingType)) && !string.IsNullOrEmpty(participant.DisplayName))
                    {
                        num = 0;
                        ADObjectId adobjectId = null;
                        int        num3;
                        ItemRecipientWell.GetSmtpAddressAndADObjectInfo(participant, adRecipientBatchQuery, out adobjectId, out num, out num3);
                        StoreParticipantOrigin storeParticipantOrigin = participant.Origin as StoreParticipantOrigin;
                        if (storeParticipantOrigin != null)
                        {
                            StoreObjectId originItemId = storeParticipantOrigin.OriginItemId;
                        }
                        if (!flag)
                        {
                            writer.Write("<table cellspacing=0 cellpadding=0 class=\"anrot\" id=\"tblANR\"><tr><td class=\"msg\"><h1 tabindex=0>");
                            writer.Write(LocalizedStrings.GetHtmlEncoded(147143837));
                            writer.Write("</h1></td></tr><tr><td class=\"h100\"><table cellspacing=0 cellpadding=0 class=\"anrit\">");
                            flag = true;
                        }
                        if (!flag2)
                        {
                            string value = null;
                            if (this is CalendarItemRecipientWell)
                            {
                                switch (type)
                                {
                                case RecipientWellType.To:
                                    value = LocalizedStrings.GetHtmlEncoded(609567352);
                                    break;

                                case RecipientWellType.Cc:
                                    value = LocalizedStrings.GetHtmlEncoded(633037671);
                                    break;

                                case RecipientWellType.Bcc:
                                    value = LocalizedStrings.GetHtmlEncoded(-1107183092);
                                    break;
                                }
                            }
                            else
                            {
                                switch (type)
                                {
                                case RecipientWellType.To:
                                    value = LocalizedStrings.GetHtmlEncoded(-1105875540);
                                    break;

                                case RecipientWellType.Cc:
                                    value = LocalizedStrings.GetHtmlEncoded(701860997);
                                    break;

                                case RecipientWellType.Bcc:
                                    value = LocalizedStrings.GetHtmlEncoded(1482538735);
                                    break;
                                }
                            }
                            writer.Write("<tr><td class=\"hdr\" tabindex=0>");
                            writer.Write(value);
                            writer.Write("</td></tr>");
                            flag2 = true;
                        }
                        writer.Write("<tr><td class=\"rcpt\" nowrap><span tabindex=0>");
                        Utilities.CropAndRenderText(writer, participant.DisplayName, 24);
                        writer.Write("</span> [<a href=\"#\" title=\"");
                        writer.Write(Utilities.HtmlEncode(participant.DisplayName));
                        writer.Write("\" onClick=\"return onClkRmRcp('{0}')\">{1}</a>]", text, LocalizedStrings.GetHtmlEncoded(341226654));
                        writer.Write("</td></tr>");
                        list.Clear();
                        AnrManager.ResolveOneRecipient(participant.DisplayName, userContext, list);
                        if (list.Count == 0)
                        {
                            RecipientAddress recipientAddress = AnrManager.ResolveAnrStringToOneOffEmail(participant.DisplayName);
                            if (recipientAddress != null)
                            {
                                list.Add(recipientAddress);
                            }
                        }
                        int num4 = 0;
                        while (num4 < list.Count && num4 < 100)
                        {
                            RecipientAddress recipientAddress2 = list[num4];
                            if (recipientAddress2.DisplayName != null)
                            {
                                writer.Write("<tr><td><a href=\"#\" title=\"");
                                Utilities.HtmlEncode(recipientAddress2.DisplayName, writer);
                                if (recipientAddress2.SmtpAddress != null)
                                {
                                    writer.Write(" [");
                                    Utilities.HtmlEncode(recipientAddress2.SmtpAddress, writer);
                                    writer.Write("]");
                                }
                                writer.Write("\" onClick=\"return onClkAddAnr(this,'");
                                ResolvedRecipientDetail resolvedRecipientDetail = new ResolvedRecipientDetail(recipientAddress2);
                                resolvedRecipientDetail.RenderConcatenatedDetails(true, writer);
                                writer.Write("',");
                                writer.Write((int)recipientItemType);
                                writer.Write(",'");
                                writer.Write(text);
                                writer.Write("')\">");
                                Utilities.CropAndRenderText(writer, recipientAddress2.DisplayName, 24);
                                if (string.IsNullOrEmpty(recipientAddress2.DisplayName) && !string.IsNullOrEmpty(recipientAddress2.SmtpAddress))
                                {
                                    writer.Write("(");
                                    Utilities.CropAndRenderText(writer, recipientAddress2.SmtpAddress, 24);
                                    writer.Write(")");
                                }
                                writer.Write("</a></td></tr>");
                            }
                            num4++;
                        }
                    }
                }
            }
            return(flag);
        }
Пример #19
0
 // Token: 0x060000B0 RID: 176 RVA: 0x000068A0 File Offset: 0x00004AA0
 public static void ResolveRecipients(string chunk, ArrayList wellNodes, UserContext userContext, bool resolveAgainstContactsFirst)
 {
     if (chunk == null)
     {
         throw new ArgumentNullException("chunk");
     }
     if (userContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     string[] array = Utilities.ParseRecipientChunk(chunk);
     if (array != null)
     {
         RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext);
         for (int i = 0; i < array.Length; i++)
         {
             string text = array[i].Trim();
             if (text.Length > 0)
             {
                 RecipientAddress  recipientAddress  = AnrManager.ResolveAnrString(text, resolveAgainstContactsFirst, userContext);
                 RecipientWellNode recipientWellNode = new RecipientWellNode(text, null);
                 if (recipientAddress != null)
                 {
                     recipientWellNode.DisplayName       = recipientAddress.DisplayName;
                     recipientWellNode.SmtpAddress       = recipientAddress.SmtpAddress;
                     recipientWellNode.AddressOrigin     = recipientAddress.AddressOrigin;
                     recipientWellNode.RoutingAddress    = recipientAddress.RoutingAddress;
                     recipientWellNode.RoutingType       = recipientAddress.RoutingType;
                     recipientWellNode.RecipientFlags    = recipientAddress.RecipientFlags;
                     recipientWellNode.StoreObjectId     = recipientAddress.StoreObjectId;
                     recipientWellNode.ADObjectId        = recipientAddress.ADObjectId;
                     recipientWellNode.EmailAddressIndex = recipientAddress.EmailAddressIndex;
                 }
                 if ((recipientWellNode.RoutingAddress != null || Utilities.IsMapiPDL(recipientWellNode.RoutingType)) && recipientCache != null)
                 {
                     string itemId = string.Empty;
                     if (recipientWellNode.AddressOrigin == AddressOrigin.Store && recipientWellNode.StoreObjectId != null)
                     {
                         itemId = recipientWellNode.StoreObjectId.ToBase64String();
                     }
                     else if (recipientWellNode.AddressOrigin == AddressOrigin.Directory && recipientWellNode.ADObjectId != null)
                     {
                         itemId = Convert.ToBase64String(recipientWellNode.ADObjectId.ObjectGuid.ToByteArray());
                     }
                     if (string.IsNullOrEmpty(recipientWellNode.DisplayName))
                     {
                         recipientWellNode.DisplayName = recipientWellNode.SmtpAddress;
                     }
                     if (userContext.UserOptions.AddRecipientsToAutoCompleteCache)
                     {
                         recipientCache.AddEntry(recipientWellNode.DisplayName, recipientWellNode.SmtpAddress, recipientWellNode.RoutingAddress, string.Empty, recipientWellNode.RoutingType, recipientWellNode.AddressOrigin, recipientWellNode.RecipientFlags, itemId, recipientWellNode.EmailAddressIndex);
                     }
                 }
                 if (wellNodes != null)
                 {
                     wellNodes.Add(recipientWellNode);
                 }
             }
         }
         if (recipientCache != null && recipientCache.IsDirty)
         {
             recipientCache.Commit(true);
         }
     }
 }
        // Token: 0x060000BF RID: 191 RVA: 0x00006CF0 File Offset: 0x00004EF0
        protected override void RenderContents(TextWriter writer, RecipientWellType type, RecipientWellNode.RenderFlags flags)
        {
            if (!this.HasRecipients(type))
            {
                return;
            }
            AdRecipientBatchQuery     adRecipientBatchQuery = new AdRecipientBatchQuery(this.GetRecipientCollection(type), this.UserContext);
            IEnumerator <Participant> recipientCollection   = this.GetRecipientCollection(type);

            RecipientWellNode.RenderFlags renderFlags = flags & ~RecipientWellNode.RenderFlags.RenderCommas;
            bool flag = true;
            RecipientItemType recipientItemType = ItemRecipientWell.GetRecipientItemType(type);
            bool isWebPartRequest = OwaContext.Current.UserContext.IsWebPartRequest;
            int  num = 0;

            while (recipientCollection.MoveNext())
            {
                Participant            participant                = recipientCollection.Current;
                int                    recipientFlags             = 0;
                ADObjectId             adObjectId                 = null;
                int                    readItemType               = 1;
                string                 smtpAddressAndADObjectInfo = ItemRecipientWell.GetSmtpAddressAndADObjectInfo(participant, adRecipientBatchQuery, out adObjectId, out recipientFlags, out readItemType);
                StoreObjectId          storeObjectId              = null;
                StoreParticipantOrigin storeParticipantOrigin     = participant.Origin as StoreParticipantOrigin;
                if (storeParticipantOrigin != null)
                {
                    storeObjectId = storeParticipantOrigin.OriginItemId;
                }
                string idString = ItemRecipientWell.BuildRecipientIdString(recipientItemType, num++);
                if (RecipientWellNode.Render(this.UserContext, writer, participant.DisplayName, smtpAddressAndADObjectInfo, participant.EmailAddress, participant.RoutingType, RecipientAddress.ToAddressOrigin(participant), recipientFlags, readItemType, recipientItemType, adObjectId, storeObjectId, renderFlags, idString, isWebPartRequest) && flag)
                {
                    flag = false;
                    if ((flags & RecipientWellNode.RenderFlags.RenderCommas) != RecipientWellNode.RenderFlags.None)
                    {
                        renderFlags |= RecipientWellNode.RenderFlags.RenderCommas;
                    }
                }
            }
        }