public void CalculateAndSaveQuote()
        {
            int quoteId = 0;
            var quote   = quoteRequest.Get(quoteId);

            quote.SalesRepresentativeId = 0;

            foreach (var line in quote.Lines)
            {
                line.Quantity = line.Quantity + 1;
            }
            var calculatedQuote = quoteRequest.Calculate(quote);
            var updatedQuote    = quoteRequest.Save(calculatedQuote);
        }
예제 #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);
     }
 }