示例#1
0
        public Addressee Add(Addressee addressee)
        {
            var mewAddressee = _context.Addressees.Add(addressee);

            _context.SaveChanges();
            return(mewAddressee);
        }
示例#2
0
        /// <remarks>
        /// This function retrieves the message ID from the row that is updated. It does this so as not to put the burden
        /// on the consuming client application to pass the message ID value. This should make it less confusing which identifier
        /// is which and therefore the service easier to consume
        /// </remarks>
        /// <summary>
        /// Mark a message as read in the Addressee table. Set the ReadDate property to current timestamp toggle the date on. Or,
        /// set the ReadDate property to a new DateTime() - year of 1 - to toggle the read date off
        /// </summary>
        /// <param name="addressee"></param>
        /// <returns></returns>
        public Addressee readMessage(Addressee addressee)
        {
            _cxn.beginTransaction();

            try
            {
                OracleQuery query       = buildReadMessageRequest(addressee);
                nonQuery    insertQuery = delegate() { return(query.Command.ExecuteNonQuery()); };
                if ((Int32)_cxn.query(query, insertQuery) != 1)
                {
                    throw new mdo.exceptions.MdoException("Unable to mark message as read");
                }

                Int32 msgId = ((Oracle.DataAccess.Types.OracleDecimal)query.Command.Parameters["outId"].Value).ToInt32();
                addressee.Oplock++;

                SecureMessageDao msgDao = new SecureMessageDao(_cxn);
                addressee.Message = msgDao.getSecureMessageBody(msgId);

                _cxn.commitTransaction();

                // TBD - any business rules around SECURE_MESSAGE.READ_RECEIPT and marking a message as read?
                return(addressee);
            }
            catch (Exception)
            {
                _cxn.rollbackTransaction();
                throw;
            }
        }
        public ActionResult Index(FormCollection collection)
        {
            string email = collection["email"];

            if (email != null)
            {
                AddresseeClient adc          = new AddresseeClient();
                string          partitionkey = AddresseeClient.GetPartitionKeyForEmail(email);

                //Addressee ad = adc.GetByRowKey(email.ToLower());
                Addressee ad = adc.GetByPartitionAndRowKey(partitionkey, email.ToLower());
                if (ad != null)
                {
                    ad.Unsubscribed        = true;
                    ad.UnsubscribedUTCDate = EasternTimeConverter.Convert(DateTime.UtcNow);
                    adc.Update(ad);
                }

                UserProfileClient upc = new UserProfileClient();
                UserProfile       p   = upc.GetByPartitionAndRowKey(partitionkey, email.ToLower());
                if (p != null)
                {
                    p.Unsubscribed = true;
                    upc.Update(p);
                }
            }
            else
            {
                email = "";
            }


            return(RedirectToAction("Unsubscribed", new { email = email }));
        }
示例#4
0
        private IEnumerable <(int id, Email email)> CustomerDataToEmail(IEnumerable <Customer> customerDataBatch)
        {
            var counter = _sentMessageIds
                          .Count;

            foreach (var item in customerDataBatch)
            {
                var discount = item
                               .Discount
                               .ToString()
                               .ToPercent();

                var addressee = new Addressee
                {
                    Email   = item.Email,
                    Name    = item.Name,
                    Surname = item.Surname,
                    Title   = item.Title
                };

                var mail = new Email
                {
                    Content = discount,
                    Subject = _subjectTemplate
                              .Replace(_subjectTemplateDiscountPlaceholder, discount),
                    From = _companyData,
                    To   = addressee
                };

                yield return(++counter, mail);
            }
        }
示例#5
0
        internal OracleQuery buildMoveMessageQuery(Addressee addressee)
        {
            string sql = "UPDATE SMS.ADDRESSEE SET FOLDER_ID=:folderId, OPLOCK=:oplockPlusOne WHERE ADDRESSEE_ID=:addresseeId and OPLOCK=:oplock";

            OracleQuery query = new OracleQuery();

            query.Command = new OracleCommand(sql);

            OracleParameter folderIdParam = new OracleParameter("folderId", OracleDbType.Decimal);

            folderIdParam.Value = addressee.FolderId;
            query.Command.Parameters.Add(folderIdParam);

            OracleParameter oplockPlusOneParam = new OracleParameter("oplockPlusOne", OracleDbType.Decimal);

            oplockPlusOneParam.Value = addressee.Oplock + 1;
            query.Command.Parameters.Add(oplockPlusOneParam);

            OracleParameter addresseeParam = new OracleParameter("addresseeId", OracleDbType.Decimal);

            addresseeParam.Value = addressee.Id;
            query.Command.Parameters.Add(addresseeParam);

            OracleParameter oplockParam = new OracleParameter("oplock", OracleDbType.Decimal);

            oplockParam.Value = addressee.Oplock;
            query.Command.Parameters.Add(oplockParam);

            return(query);
        }
示例#6
0
        internal OracleQuery buildUpdateAddresseeQuery(Addressee addressee)
        {
            string sql = "UPDATE SMS.ADDRESSEE SET OPLOCK=:oplockPlusOne, MODIFIED_DATE=:modifiedDate, FOLDER_ID=:folderId, READ_DATE=:readDate, " +
                         "REMINDER_DATE=:reminderDate WHERE ADDRESSEE_ID=:addresseeId AND OPLOCK=:oplock";

            OracleQuery query = new OracleQuery();

            query.Command = new OracleCommand(sql);

            OracleParameter oplockPlusOneParam = new OracleParameter("oplockPlusOne", OracleDbType.Decimal);

            oplockPlusOneParam.Value = Convert.ToDecimal(addressee.Oplock + 1);
            query.Command.Parameters.Add(oplockPlusOneParam);

            OracleParameter modifiedDateParam = new OracleParameter("modifiedDate", OracleDbType.Date);

            modifiedDateParam.Value = new OracleDate(DateTime.Now);
            query.Command.Parameters.Add(modifiedDateParam);

            OracleParameter folderIdParam = new OracleParameter("folderId", OracleDbType.Decimal);

            folderIdParam.Value = Convert.ToDecimal(addressee.FolderId);
            query.Command.Parameters.Add(folderIdParam);

            OracleParameter readDateParam = new OracleParameter("readDate", OracleDbType.Date);

            if (addressee.ReadDate.Year > 1900)
            {
                readDateParam.Value = new OracleDate(addressee.ReadDate);
            }
            else
            {
                readDateParam.Value = DBNull.Value;
            }
            query.Command.Parameters.Add(readDateParam);

            OracleParameter reminderDateParam = new OracleParameter("reminderDate", OracleDbType.Date);

            if (addressee.ReminderDate.Year > 1900)
            {
                reminderDateParam.Value = new OracleDate(addressee.ReminderDate);
            }
            else
            {
                reminderDateParam.Value = DBNull.Value;
            }
            query.Command.Parameters.Add(reminderDateParam);

            OracleParameter addresseeIdParam = new OracleParameter("addresseeId", OracleDbType.Decimal);

            addresseeIdParam.Value = Convert.ToDecimal(addressee.Id);
            query.Command.Parameters.Add(addresseeIdParam);

            OracleParameter oplockParam = new OracleParameter("oplock", OracleDbType.Decimal);

            oplockParam.Value = Convert.ToDecimal(addressee.Oplock);
            query.Command.Parameters.Add(oplockParam);

            return(query);
        }
        protected override DeferredProcessExitCode Execute(MessageBroker messageBroker)
        {
            try
            {
                AddresseeClient ac = new AddresseeClient();
                Addressee       a  = ac.GetByPartitionAndRowKey(AddresseeClient.GetPartitionKeyForEmail(To), To);
                if (a.Unsubscribed)
                {
                    return(DeferredProcessExitCode.NothingToDo);
                }

                SendGrid myMessage = SendGrid.GetInstance();

                myMessage.From    = new MailAddress(FromEmail, FromDisplay);
                myMessage.Subject = Subject;

                myMessage.AddTo(To);
                myMessage.Html = Body;

                SendByWeb(myMessage);

                return(DeferredProcessExitCode.Success);
            }
            catch
            {
                return(DeferredProcessExitCode.Error);
            }
        }
        public ActionResult SchoolNewsletter(string name, string email, string organization, string phone)
        {
            AddresseeClient        adc = new AddresseeClient();
            SchoolNewsletterClient snc = new SchoolNewsletterClient();
            string    emailpartition   = AddresseeClient.GetPartitionKeyForEmail(email);
            Addressee a = adc.GetByPartitionAndRowKey(emailpartition, email);

            if (a == null)
            {
                adc.AddNewItem(new Addressee(email.ToLower())
                {
                    Name = name, Email = email.ToLower()
                });
                EmailManager emailManager = new EmailManager();
                string       str          = "<p>Name: " + name + "</p><p>Email: " + email.ToLower() + "</p><p>Organization/School: " + organization + "</p><p>Phone:" + phone + "</p>";
                emailManager.SendMail("*****@*****.**", "Admin", "*****@*****.**", "School Newsletter subscribed", str);
            }
            SchoolNewsletter user = snc.GetByPartitionAndRowKey(emailpartition, email);

            if (user == null)
            {
                snc.AddNewItem(new SchoolNewsletter
                {
                    PartitionKey = emailpartition,
                    RowKey       = email.ToLower(),
                    Name         = name,
                    Email        = email.ToLower(),
                    Organization = organization,
                    Phone        = phone
                });
            }
            sendSignupEmail(name, email);
            return(RedirectToAction("Thankyou", "About"));
        }
示例#9
0
        public void AddAddressee(Addressee addressee)
        {
            var aSection = m_Config.AddChildNode(CONFIG_A_SECT);

            aSection.AddAttributeNode(ATTR_NAME, addressee.Name);
            aSection.AddAttributeNode(ATTR_CHANNEL_NAME, addressee.ChannelName);
            aSection.AddAttributeNode(ATTR_CHANNEL_ADDRESS, addressee.ChannelAddress);
        }
示例#10
0
        }         // SetTemplateAndVariables

        protected override void ActionAtEnd()
        {
            if (CustomerData.IsAlibaba)
            {
                var address = new Addressee(CurrentValues.Instance.AlibabaMailTo, CurrentValues.Instance.AlibabaMailCc, addSalesforceActivity: false);
                Log.Info("Sending Alibaba internal rejection mail");
                SendCostumeMail("Mandrill - Alibaba - Internal rejection email", Variables, new[] { address });
            }
        }
示例#11
0
        internal Addressee createAddressee(Addressee addressee, Int32 messageId)
        {
            OracleQuery query       = buildCreateAddresseeQuery(addressee, messageId);
            nonQuery    insertQuery = delegate() { return(query.Command.ExecuteNonQuery()); };

            _cxn.query(query, insertQuery);
            addressee.Id = ((Oracle.DataAccess.Types.OracleDecimal)query.Command.Parameters["outId"].Value).ToInt32();
            return(addressee);
        }
示例#12
0
    void SetupNextAdressee(Addressee addressee)
    {
        CurrentAddressee = addressee;

        addresseeText.text = addressee.Name;
        addressText.text   = addressee.Address;

        animPivot.localRotation = Quaternion.Euler(animFromRotation);
        timer = 0f;
    }
示例#13
0
        internal Addressee toAddressee(IDataReader rdr)
        {
            Addressee addressee = new Addressee();

            if (rdr.Read())
            {
                addressee = Addressee.getAddresseeFromReader(rdr);
            }
            return(addressee);
        }
        public JsonResult EmailMeMyResults(string name, string email, string attitude, string action, string information, string processing, string endurance, string patterns, string presence, string compensation, string concentration)
        {
            AddresseeClient      adc = new AddresseeClient();
            LockedModeUserClient lmu = new LockedModeUserClient();
            string    emailpartition = AddresseeClient.GetPartitionKeyForEmail(email);
            Addressee a = adc.GetByPartitionAndRowKey(emailpartition, email);

            if (a == null)
            {
                adc.AddNewItem(new Addressee(email.ToLower())
                {
                    Name = name, Email = email.ToLower()
                });
            }
            LockedModeUser user = lmu.GetByPartitionAndRowKey(emailpartition, email);

            if (user == null)
            {
                lmu.AddNewItem(new LockedModeUser
                {
                    PartitionKey = emailpartition,
                    RowKey       = email.ToLower(),
                    Name         = name,
                    Email        = email.ToLower(),
                    Referer      = "general",

                    Attitude      = attitude == null ? "" : attitude,
                    Action        = action == null ? "" : action,
                    Information   = information == null ? "" : information,
                    Processing    = processing == null ? "" : processing,
                    Endurance     = endurance == null ? "" : endurance,
                    Patterns      = patterns == null ? "" : patterns,
                    Presence      = presence == null ? "" : presence,
                    Compensation  = compensation == null ? "" : compensation,
                    Concentration = concentration == null ? "" : concentration
                });
            }
            else
            {
                user.Attitude      = attitude == null ? "" : attitude;
                user.Action        = action == null ? "" : action;
                user.Information   = information == null ? "" : information;
                user.Processing    = processing == null ? "" : processing;
                user.Endurance     = endurance == null ? "" : endurance;
                user.Patterns      = patterns == null ? "" : patterns;
                user.Presence      = presence == null ? "" : presence;
                user.Compensation  = compensation == null ? "" : compensation;
                user.Concentration = concentration == null ? "" : concentration;
                lmu.Update(user);
            }
            sendResultEmail(name, email);
            return(new JsonResult {
                Data = new { result = "ok" }
            });
        }
示例#15
0
        public static Addressee AddresseeValidWithoutIdWithAddress()
        {
            Addressee addressee = new Addressee();

            addressee.BusinessName = "Bruno Barba";
            addressee.Address      = AddressValid();
            addressee.Cpf          = "12345678901";
            addressee.PersonType   = EnumPersonType.PessoaFisica;

            return(addressee);
        }
示例#16
0
 public void ComposeEmailAndSaveDraft(string addressee, string subject, string body)
 {
     Addressee.SendKeys(addressee);
     Subject.SendKeys(subject);
     GetDriver().SwitchTo().Frame(EmailBodyFrame);
     EmailBody.Clear();
     EmailBody.Click();
     EmailBody.SendKeys(body);
     GetDriver().SwitchTo().DefaultContent();
     SaveButton.Click();
 }
示例#17
0
        }         // SetTemplateAndVariables

        protected override void ActionAtEnd()
        {
            if (CustomerData.IsAlibaba)
            {
                var address = new Addressee(CurrentValues.Instance.AlibabaMailTo, CurrentValues.Instance.AlibabaMailCc, addSalesforceActivity: false);
                Log.Info("Sending Alibaba internal took loan mail");
                SendCostumeMail("Mandrill - Alibaba - Internal Took Loan", Variables, new[] { address });
            }             // if

            new EnlistLottery(CustomerId).Execute();
        }         // ActionAtEnd
示例#18
0
        public IList <Addressee> toAddressees(IDataReader rdr)
        {
            IList <Addressee>         addressees       = new List <Addressee>();
            Dictionary <string, bool> addresseesSchema = QueryUtils.getColumnExistsTable(TableSchemas.ADDRESSEE_COLUMNS, rdr);

            while (rdr.Read())
            {
                addressees.Add(Addressee.getAddresseeFromReader(rdr, addresseesSchema));
            }

            return(addressees);
        }
        /// <summary>
        /// Validates this recomendation
        /// </summary>
        /// <param name="path">The path to this object as a string</param>
        /// <param name="messages">the validation messages to date, these may be added to within this method</param>
        public void Validate(string path, List <ValidationMessage> messages)
        {
            var vb = new ValidationBuilder(path, messages);

            vb.ArgumentRequiredCheck("TimeFrame", TimeFrame);
            vb.ArgumentRequiredCheck("Narrative", Narrative);

            if (vb.ArgumentRequiredCheck("Addressee", Addressee))
            {
                Addressee.Validate(vb.Path + "Addressee", messages);
            }
        }
        public void Setup()
        {
            var conexao = DbConnectionFactory.CreatePersistent(Guid.NewGuid().ToString());

            _ctx        = new FakeDbContext(conexao);
            _repository = new AddresseReposiotory(_ctx);
            _addressee  = ObjectMother.AddresseeValidWithIdWithAddress();
            //Seed
            _addresseeBase = ObjectMother.AddresseeValidWithIdWithAddress();
            _ctx.Addressees.Add(_addresseeBase);
            _ctx.SaveChanges();
        }
示例#21
0
 public InvitationInfo GetEncryptedInfo()
 {
     return(new InvitationInfo()
     {
         Id = Id,
         Sender = Sender.GetEncryptedInfo(),
         Addressee = Addressee.GetEncryptedInfo(),
         Date = Date,
         IsTransferable = IsTransferable,
         TestId = Test.Id
     });
 }
示例#22
0
        internal Addressee moveMessage(Addressee addressee)
        {
            OracleQuery request      = buildMoveMessageQuery(addressee);
            nonQuery    qry          = delegate() { return(request.Command.ExecuteNonQuery()); };
            Int32       rowsAffected = (Int32)_cxn.query(request, qry);

            if (rowsAffected != 1)
            {
                throw new MdoException("Failed to move message");
            }
            addressee.Oplock++;
            return(addressee);
        }
示例#23
0
        public void AddAddressee(Addressee addressee)
        {
            var aSection = m_Config.AddChildNode(CONFIG_A_SECT);

            aSection.AddAttributeNode(ATTR_NAME, addressee.Name);
            aSection.AddAttributeNode(ATTR_CHANNEL_NAME, addressee.ChannelName);
            aSection.AddAttributeNode(ATTR_CHANNEL_ADDRESS, addressee.ChannelAddress);

            if (MessageBuilderChange != null)
            {
                MessageBuilderChange(this);
            }
        }
示例#24
0
    void OnLaunched()
    {
        scalePivot.gameObject.SetActive(true);

        Addressee selected = CurrentAddressee;

        while (selected == CurrentAddressee)
        {
            selected = gameDatabase.addressees [Random.Range(0, gameDatabase.addressees.Length)];
        }

        SetupNextAdressee(selected);
    }
示例#25
0
        public Addressee updateAddressee(Addressee addressee)
        {
            OracleQuery request      = buildUpdateAddresseeQuery(addressee);
            nonQuery    qry          = delegate() { return(request.Command.ExecuteNonQuery()); };
            Int32       rowsAffected = (Int32)_cxn.query(request, qry);

            if (rowsAffected != 1)
            {
                throw new MdoException("Unable to update addressee");
            }

            addressee.Oplock++;
            return(addressee);
        }
示例#26
0
        public void Addressee_Domain_Validate_PessoaJuridica_Sucessfully()
        {
            //cenário
            _addressee = ObjectMother.AddresseePessoaJuridicaValida(_mockAddress.Object);

            //ação
            Action act = () => _addressee.Validate();

            //verificação
            act.Should().NotThrow();
            _addressee.Address.Should().NotBeNull();
            _addressee.PersonType.Should().Be(EnumPersonType.PessoaJuridica);
            _addressee.Cpf.Should().BeNullOrEmpty();
        }
示例#27
0
        public static Addressee AddresseeValidComCnpjWithIdWithAddress()
        {
            Addressee addressee = new Addressee();

            addressee.Id                = 1;
            addressee.BusinessName      = "Bruno Barba";
            addressee.CorporateName     = "Bruno Barba";
            addressee.Address           = AddressValid();
            addressee.Cnpj              = "12345678901234";
            addressee.StateRegistration = "89032487087";
            addressee.PersonType        = EnumPersonType.PessoaJuridica;

            return(addressee);
        }
示例#28
0
        public Addressee moveMessage(Message message, domain.sm.User user, Folder folder)
        {
            Addressee addressee = getAddressee(message.Id, user.Id);

            checkValidMove(addressee.Folder, folder);

            addressee.Folder   = folder;
            addressee.FolderId = folder.Id;
            if (!addressee.Folder.SystemFolder)
            {
                FolderDao folderDao = new FolderDao(_cxn);
                addressee.Folder = folderDao.getUserFolder(user.Id, folder.Id);
            }
            return(moveMessage(addressee));
        }
示例#29
0
 internal AiConversationLineBlockBase(BinaryReader binaryReader)
 {
     this.flags                = (Flags)binaryReader.ReadInt16();
     this.participant          = binaryReader.ReadShortBlockIndex1();
     this.addressee            = (Addressee)binaryReader.ReadInt16();
     this.addresseeParticipant = binaryReader.ReadShortBlockIndex1();
     this.invalidName_         = binaryReader.ReadBytes(4);
     this.lineDelayTime        = binaryReader.ReadSingle();
     this.invalidName_0        = binaryReader.ReadBytes(12);
     this.variant1             = binaryReader.ReadTagReference();
     this.variant2             = binaryReader.ReadTagReference();
     this.variant3             = binaryReader.ReadTagReference();
     this.variant4             = binaryReader.ReadTagReference();
     this.variant5             = binaryReader.ReadTagReference();
     this.variant6             = binaryReader.ReadTagReference();
 }
示例#30
0
        public MailerJob(string name, string cronInterval, CancellationToken token, MailerJobSettings settings)
        {
            _sentMessageIds = new List <int>();

            CronInterval      = cronInterval;
            CancellationToken = token;

            _customerDataFilePath = settings.CustomerDataFilePath;
            _batchSize            = settings.BatchSize;
            _mailer      = settings.Mailer;
            _logger      = settings.Logger;
            _csvHelper   = settings.CsvHelper;
            _companyData = settings.CompanyData;
            _subjectTemplateDiscountPlaceholder = settings.SubjectTemplateDiscountPlaceholder;
            _subjectTemplate = settings.SubjectTemplate;
        }
示例#31
0
 public AiConversationLineBlock(BinaryReader binaryReader)
 {
     this.flags = (Flags)binaryReader.ReadInt16();
     this.participant = binaryReader.ReadShortBlockIndex1();
     this.addressee = (Addressee)binaryReader.ReadInt16();
     this.addresseeParticipantThisFieldIsOnlyUsedIfTheAddresseeTypeIsParticipant = binaryReader.ReadShortBlockIndex1();
     this.padding = binaryReader.ReadBytes(4);
     this.lineDelayTime = binaryReader.ReadSingle();
     this.padding0 = binaryReader.ReadBytes(12);
     this.variant1 = binaryReader.ReadTagReference();
     this.variant2 = binaryReader.ReadTagReference();
     this.variant3 = binaryReader.ReadTagReference();
     this.variant4 = binaryReader.ReadTagReference();
     this.variant5 = binaryReader.ReadTagReference();
     this.variant6 = binaryReader.ReadTagReference();
 }
        private bool SendNotification(NotificationType notificationType, Addressee addressee, dynamic data)
        {
            var success = true;
            try
            {
                foreach (var recipient in addressee.Recipients)
                {
                    success &= notificationService.SendMail(new NotificationData()
                    {
                        CopyTo = addressee.CopyToEmail,
                        Recipients = List.Of(recipient),
                        Type = notificationType,
                        Placeholders = data
                    });
                }
            }
            catch (Exception ex)
            {
                CommonLogger.Error("Notification failed.", ex);
                success = false;
            }

            return success;
        }