예제 #1
0
 protected void LinkButtonSend_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         var contactRequest = new ContactRequest {
             Name = TextBoxName.Text,
             Email = TextBoxEmail.Text,
             Phone = TextBoxPhone.Text,
             Message = TextBoxMessage.Text,
             Interests = String.Join(", ", CheckBoxListInterests.Items.Cast<ListItem>().Where(item => item.Selected).Select(item => item.Value).ToArray()) };
         contactRequest.Save();
         var emailService = new EmailService(EmailService.form.contact);
         var notificationMessage = emailService.mailMessage;
         notificationMessage.Subject = "New contact request";
         notificationMessage.Body = String.Format("Name: {0}\n\nEmail: {1}\n\nPhone: {2}\n\nMessage:\n{3}\n\nInterests: {4}\n\n",
             TextBoxName.Text,
             TextBoxEmail.Text,
             TextBoxPhone.Text,
             TextBoxMessage.Text,
             String.Join(", ", CheckBoxListInterests.Items.Cast<ListItem>().Where(item => item.Selected).Select(item => item.Value).ToArray()));
         emailService.sendMessage(notificationMessage);
         MultiViewContactRequest.SetActiveView(ViewResponse);
     }
 }
예제 #2
0
 protected void LinkButtonSend_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         var quoteRequest = new QuoteRequest
         {
             Interests = String.Join(", ", CheckBoxListInterests.Items.Cast<ListItem>().Where(item => item.Selected).Select(item => item.Value).ToArray()),
             Name = TextBoxName.Text,
             Email = TextBoxEmail.Text,
             Phone = TextBoxPhone.Text,
             Company = TextBoxCompany.Text,
             Title = TextBoxTitle.Text,
             StreetAddress = TextBoxStreetAddress.Text,
             City = TextBoxCity.Text,
             Zip = TextBoxZip.Text,
             State = DropDownListState.SelectedValue,
             Country = DropDownListCountry.SelectedValue,
             EventDate = Text2DateTime(TextBoxEventDate.Text),
             EventLocation = TextBoxEventLocation.Text,
             NumberOfDays = Text2Int32(TextBoxNumberOfDays.Text),
             SetupRehearsalDate = Text2DateTime(TextBoxSetupRehearsalDate.Text),
             SetupRehearsalTime = TextBoxSetupRehearsalTime.Text,
             NumberOfVotingSystems = Text2Int32(TextBoxNumberOfVotingSystems.Text),
             NumberOfVotingDevicesPerSystem = TextBoxNumberOfVotingDevicesPerSystem.Text,
             AdditionalInformation = TextBoxAdditionalInformation.Text
         };
         quoteRequest.Save();
         var emailService = new EmailService(EmailService.form.quote);
         var notificationMessage = emailService.mailMessage;
         notificationMessage.Subject = "New quote request";
         notificationMessage.Body = String.Format(
     @"Interests: {0}
     Name: {1}
     Email: {2}
     Phone: {3}
     Company: {4}
     Title: {5}
     Street Address: {6}
     City: {7}
     Zip: {18}
     State: {8}
     Country: {9}
     Setup / Rehearsal Date: {13}
     Setup / Rehearsal Time: {14}
     Meeting/Event Dates: {10}
     Number of Days: {12}
     Event Location: {11}
     Number of Voting Systems: {15}
     Number of Voting Devices per System: {16}
     Additional Information:
     {17}
     ",
             String.Join(", ", CheckBoxListInterests.Items.Cast<ListItem>().Where(item => item.Selected).Select(item => item.Value).ToArray()),
             TextBoxName.Text,
             TextBoxEmail.Text,
             TextBoxPhone.Text,
             TextBoxCompany.Text,
             TextBoxTitle.Text,
             TextBoxStreetAddress.Text,
             TextBoxCity.Text,
             DropDownListState.SelectedValue,
             DropDownListCountry.SelectedValue,
             TextBoxEventDate.Text,
             TextBoxEventLocation.Text,
             Text2Int32(TextBoxNumberOfDays.Text),
             TextBoxSetupRehearsalDate.Text,
             TextBoxSetupRehearsalTime.Text,
             Text2Int32(TextBoxNumberOfVotingSystems.Text),
             TextBoxNumberOfVotingDevicesPerSystem.Text,
             TextBoxAdditionalInformation.Text,
             TextBoxZip.Text);
         emailService.sendMessage(notificationMessage);
         MultiViewQuoteRequest.SetActiveView(ViewResponse);
     }
 }