예제 #1
0
        protected void btnGo_Click(object sender, EventArgs e)
        {
            var country = _Countries[ddlCountry.SelectedValue];
            var role    = _Roles[ddlRole.SelectedValue];

            var prospect = new Prospect
            {
                CompanyName  = txtCompanyName.Text,
                EmailAddress = txtEmail.Text,
                FirstName    = txtFirstName.Text,
                LastName     = txtLastName.Text,
                Country      = country,
                Role         = role
            };

            var eventMessage = new ProspectSignedUpEvent
            {
                Prospect   = prospect,
                SignedUpAt = DateTime.UtcNow
            };

            MessageQueue.Publish(eventMessage);

            Server.Transfer("ThankYou.aspx");
        }
예제 #2
0
        public void SaveProspect(Prospect prospect)
        {
            var eventMessage = new ProspectSignedUpEvent
            {
                Prospect   = prospect,
                SignedUpAt = DateTime.UtcNow
            };

            MessageQueue.Publish(eventMessage);
        }
예제 #3
0
        public void SaveProspect(Prospect prospect)
        {
            var eventMessage = new ProspectSignedUpEvent
            {
                Prospect   = prospect,
                SignedUpAt = DateTime.UtcNow
            };

            MessageQueue.Publish(eventMessage);

            _logger.LogInformation("Published ProspectSignedUpEvent - CorrelationId: {CorrelationId}", eventMessage.CorrelationId);
        }
예제 #4
0
        private void PublishProspectSignedUpEvent(Prospect prospect)
        {
            var eventMessage = new ProspectSignedUpEvent
            {
                Prospect   = prospect,
                SignedUpAt = DateTime.UtcNow
            };

            Log.Info("Publishing prospect signed-up event, email address: {0}", prospect.EmailAddress);
            var stopwatch = Stopwatch.StartNew();

            MessageQueue.Publish(eventMessage);

            Log.Info("Event published, email address: {0}, CorrelationId: {1}, took: {2}ms", prospect.EmailAddress, eventMessage.CorrelationId, stopwatch.ElapsedMilliseconds);
        }
예제 #5
0
        protected void btnGo_Click(object sender, EventArgs e)
        {
            var country = _Countries[ddlCountry.SelectedValue];
            var role    = _Roles[ddlRole.SelectedValue];

            var prospect = new Prospect
            {
                CompanyName  = txtCompanyName.Text,
                EmailAddress = txtEmail.Text,
                FirstName    = txtFirstName.Text,
                LastName     = txtLastName.Text,
                Country      = country,
                Role         = role
            };

            //v1:
            //using (var context = new ProductLaunchContext())
            //{
            //    //reload child objects:
            //    prospect.Country = context.Countries.Single(x => x.CountryCode == prospect.Country.CountryCode);
            //    prospect.Role = context.Roles.Single(x => x.RoleCode == prospect.Role.RoleCode);

            //    context.Prospects.Add(prospect);
            //    context.SaveChanges();
            //}

            //v2:
            var eventMessage = new ProspectSignedUpEvent
            {
                Prospect   = prospect,
                SignedUpAt = DateTime.UtcNow
            };

            MessageQueue.Publish(eventMessage);

            Server.Transfer("ThankYou.aspx");
        }