CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > starter_kits_and_source_projects.commerce_starter_kit Tags:
Item Type: Date Entered: 3/16/2004 1:16:54 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 2 Views: 32 Favorited: 0 Favorite
3 Items, 1 Pages 1 |< << Go >> >|
"OneIdesigned"
NewsGroup User
How do I GetCustomerDetails to show up in Email?3/16/2004 1:16:54 AM

0

Hello,

Sorry for reposting this but I see that there is a lock on it preventing anyone from replying to it..


I need some help trying to solve why I can't get the fullname output value of from the CustomerDB to show up in the email portion of the checkout.aspx.. please I need a bit of direction. This one error that I get. All I want is to see how I can get the data using the existing code or some of it to display the fullname in the email.

Error:

E:\Program Files\ASP.NET Starter Kits\ASP.NET Commerce (VBSDK)\CommerceVBSDK\Checkout.aspx(69) : error BC30455: Argument not specified for parameter 'customerID' of 'Public Function GetCustomerDetails(customerID As String) As ASPNET.StarterKit.Commerce.CustomerDetails'.

Dim FullName = CustomersDB.GetCustomerDetails.myCustomerDetails.FullName.Value
"blueshader" <>
NewsGroup User
Re: How do I GetCustomerDetails to show up in Email?3/19/2004 5:33:21 AM

0

You have to create a CustomerDetails object first to get the name.
Here is how you can do it.

' First you have to create a customer object
Dim mCustomer As Commerce.CustomersDB = New Commerce.CustomersDB()

' Second: Create a CustomerDetail object, its in CustomersDB as well and this class holds
' all the information returned by GetCustomerDetails() Function
' Pass the CustomerID all the information
Dim mCustomerDetails As Commerce.CustomerDetails = mCustomer.GetCustomerDetails(customerID)

Dim FullName as String
FullName = mCustomerDetails.FullName

Hope this helps.
TechyGuy
"OneIdesigned"
NewsGroup User
Re: How do I GetCustomerDetails to show up in Email?3/19/2004 11:48:06 PM

0

Thanks for the reply. I finally did something like that. What I did was create a new page and copied the orderdetails into the new page along with pulling the data from a newly created view that included the information I want to to display for the customer. Then I used a html writer to write the page into the body of the confirming email, I thought this would be a good way of being consistent with how the email and the confirmation page looks.

Here is the code that I used.



Sub Page_Load(Sender As Object, E As EventArgs)



'create a string writer

Dim stringWrite As New System.IO.StringWriter

'create an htmltextwriter which uses the stringwriter

Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)

'Dim OrderIDSent As String = Request.QueryString("OrderId")
Dim OrderIDSent As String = 113


' TODO: Update the ConnectionString and CommandText values for your application
Dim myConnection1 As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))

Dim myConnection2 As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))

Dim CommandText1 As String = "SELECT CustomerId, OrderId, FullName, EmailAddress, FirstName, MiddleName, Lastname, CompanyName, Address1, Address2, Town, State, Zip, Phone, OrderDate, Shipdate from V_Orders Where OrderID = '" & OrderIDSent & "' order by [OrderId]"

Dim CommandText2 As String = "SELECT ProductId, Quantity, UnitCost, ModelName, CategoryName from V_OrderDetails Where OrderID = '" & OrderIDSent & "' order by [OrderId]"

Dim myCommand1 As New SqlCommand(CommandText1, myConnection1)
Dim myCommand2 As New SqlCommand(CommandText2, myConnection2)

myConnection1.Open()

Dim dr1
dr1 = myCommand1.ExecuteReader(CommandBehavior.CloseConnection)


myConnection2.Open()
Dim dr2
dr2 = myCommand2.ExecuteReader(CommandBehavior.CloseConnection)


''''''''''''''''''''''

dr1.Read()
'While dr1.Read()

Dim strCustomerId As String = dr1("CustomerId").ToString
Dim strEmail As String = dr1("EmailAddress").ToString
Dim strFullName As String = dr1("FullName").ToString
Dim strFirstName As String = dr1("FirstName").ToString
Dim strOrderId As String = dr1("OrderId").ToString
Dim strMiddleName As String = dr1("MiddleName").ToString
Dim strLastName As String = dr1("LastName").ToString
Dim strCompanyName As String = dr1("CompanyName").ToString
Dim strAddress1 As String = dr1("address1").ToString
Dim strAddress2 As String = dr1("address2").ToString
Dim strTown As String = dr1("Town").ToString
Dim strState As String = dr1("State").ToString
Dim strZip As String = dr1("Zip").ToString
Dim strPhone As String = dr1("Phone").ToString
Dim strOrderDate As String = dr1("OrderDate").ToString
Dim strShipDate As String = dr1("ShipDate").ToString

lblFullName.text = dr1("FullName").ToString
lblFirstName.text = strFirstName.ToString
lblMiddleName.text = strMiddleName.ToString
lblLastName.text = strLastName.ToString
lblCompanyName.text = strCompanyName.ToString
lblAddress1.text = strAddress1.ToString
lblAddress2.text = strAddress2.ToString
lblTown.text = strTown.ToString
lblState.text = strState.ToString
lblZip.text = strZip.ToString
lblPhone.text = strPhone.ToString


Dim mail As New MailMessage()
mail.To = Email.text '<--------make a textbox called Email
mail.bcc = Email.text '<-------Email to you letting you know of the order
mail.From = "From email goes here" '<-----can be whatever you want it to look like it's coming from
mail.Subject = "Receipt for your order " & strOrderId '<-----So it sends the Order ID to them
mail.BodyFormat = MailFormat.Html


While dr2.Read()

Dim strProductId As String = dr2("ProductId").ToString
Dim strQuantity As String = dr2("Quantity").ToString
Dim strUnitCost As String = dr2("UnitCost").ToString
Dim strModelName As String = dr2("ModelName").ToString
Dim strCategoryName As String = dr2("CategoryName").ToString


mail.Body = "Customer's Full Name: " & strFullName & "<br>" _
& "First Name: " & strFirstName & "<br>" _
& "Middle Name: " & strMiddleName & "<br>" _
& "Last Name: " & strLastName & "<br>" _
& "Company Name: " & strCompanyName & "<br>" _
& "Address 1: " & strAddress1 & "<br>" _
& "Address 2: " & strAddress2 & "<br>" _
& "Town: " & strTown & "<br>" _
& "State: " & strState & "<br>" _
& "Zip: " & strZip & "<br>" _
& "Phone: " & strPhone & "<br>" _
& "Email: " & strEmail & "<br>" _
& "Order: " & strOrderId & "<br>" _
& "Order Date: " & strOrderDate & "<br>" _
& "Ship Date: " & strShipDate & "<br>" _
& "<TR><TD>" & strProductId & "</TD><TD>" & strQuantity & "</TD></TR>"




End While

' Obtain Order ID from QueryString
'Dim OrderID As Integer = CInt(Request.Params("OrderID"))
Dim OrderID As Integer = OrderIDSent

' Get the customer ID too
'Dim CustomerId As String = User.Identity.Name
Dim CustomerId As String = strCustomerId

' Obtain Order Details from Database
Dim orderHistory As ASPNET.StarterKit.Commerce.OrdersDB = New ASPNET.StarterKit.Commerce.OrdersDB()
Dim myOrderDetails As ASPNET.StarterKit.Commerce.OrderDetails = orderHistory.GetOrderDetails(OrderID, CustomerId)

' if order was found, display it
If Not (myOrderDetails Is Nothing) Then

' Bind Items to GridControl
GridControl1.DataSource = myOrderDetails.OrderItems
GridControl1.DataBind()

' Update labels with summary details

lblTotal.Text = String.Format("{0:c}", myOrderDetails.OrderTotal)
lblOrderNumber.Text = OrderID.ToString()
lblOrderDate.Text = myOrderDetails.OrderDate.ToShortDateString()
lblShipDate.Text = myOrderDetails.ShipDate.ToShortDateString()


detailsTable.RenderControl(htmlWrite)
Dim strHtml = stringWrite.ToString()
mail.Body = strHtml
SmtpMail.SmtpServer = "Put your mail server here" ' <------localhost works if it's on the same as your mail server
SmtpMail.Send(mail)


Else
' otherwise display an error message
MyError.Text = "Order not found!"
detailsTable.Visible = False

End If


End Sub


3 Items, 1 Pages 1 |< << Go >> >|


Free Download:













how to import and define class components

migrate commerce starter kit database to different web app

new problem! (w/printscreen)

problems running on hosting site

component folder in commerce starter kit and how do i get to see the databases

i'm can't find where to download ibuyspy

windows server 2003 installation error

updatecartitem ..plz help

how to secure ibs store management pages.

how to recompile dll using web matrix ?

mdse problem with commerce starter kit install

ozmcart

compiling security.vb with mk.bat

just got it all working... but need a bit of help

question about adding an item weight column to products table

ambiguous in namespace

showing ad of products on the main page.

how do i deploy?

how to display different categories depending on login?

shipping & handling calculation ?

looking for help on custom commerce application

commerce starter kit installation problem

turning the commerce starter kit into a functional webshop

help installing starter kits

no real cookie in getshoppingcartid-function

configuration error?

how do i get the fullname to appear in the email?

new update to commerce starter kit

commerce starterkit - submit button on register page not working. please help!

server error in '/commercevbsdk' application.

fedex, ups, usps, etc

strange error ! can anyone help

sql server

cart migration bug

a newbie needds help on asp.net commerce

language problem

commerce starter kit on brinkster

no db connection when installing starter kit

why am i getting a nullreferenceexception?

submenu

custom error handling

image fonts

install error - unable to lookup local instances of sql server or msde

installation on iis6.0??

database access layer

gift registry

website

localhost in the webconfig file

maybe bug in commerce starter kit?

ups online tools

   
  Privacy | Contact Us
All Times Are GMT