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"); }
public void SaveProspect(Prospect prospect) { var eventMessage = new ProspectSignedUpEvent { Prospect = prospect, SignedUpAt = DateTime.UtcNow }; MessageQueue.Publish(eventMessage); }
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); }
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); }
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"); }