Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 1st, 2008, 01:32 AM
Registered User
 
Join Date: May 2008
Location: chandigarh, chandigarh, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tiawebchd
Default problem in e-mail structure sending data from data

i have a problem when send email i want the data to be grouped but the email is sent individually for each data

here is the result email

Print Order

Ordered From: MostlyArt.com
Order Id: 203
Ordered Date: 4/28/2008
Customer Notes:

Bill To:
A & F Gallery
32 N. Huron St.
Ypsilanti, MI 48197
United States

Ship To:
Shaw Cheektowaga
3806 Union Rd #252
Cheektowaga, NY 14225-4248
United States

Nicholas De Stael, Noon Landscape
Pub: EUR
Number: EUR/1400-13241
Qty: 1
Price: $32.00

Subtotal: $32.00
Shipping: $10
Sales Tax: $0
Discount: $0
Total: $42.00

i want the result email grouped by Ship To:

Print Order

Ordered From: MostlyArt.com
Order Id: 203
Ordered Date: 4/28/2008
Customer Notes:

Bill To:
A & F Gallery
32 N. Huron St.
Ypsilanti, MI 48197
United States

Ship To:
Shaw Cheektowaga
3806 Union Rd #252
Cheektowaga, NY 14225-4248
United States

Nicholas De Stael, Noon Landscape
Pub: EUR
Number: EUR/1400-13241
Qty: 1
Price: $32.00

F Senatore, Setimo Impacto (Abstract)
Pub: EUR
Number: EUR/1505-15073
Qty: 1
Price: $38.00

Tc Chiu, Chef III
Pub: APG
Number: APG/136-22231
Qty: 1
Price: $14.50


Subtotal: $84.50
Shipping: $10
Sales Tax: $0
Discount: $0
Total: $94.50

all above in bold are the data i want in this format here is the code



Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim cmdString As String = "usp_order_OrderPrints"
Dim theError As String
theError =
""

conn = New SqlConnection(ConfigurationManager.ConnectionStrin gs("customerdbConnectionString").ConnectionString) cmd = New SqlCommand(cmdString, conn)

cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@steptype", SqlDbType.VarChar)
cmd.Parameters(
"@steptype").Value = "1"

conn.Open()
Dim myReader As SqlDataReader

myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)

Dim EmailTo, EmailSubject, EmailBody, EmailFrom, MAOrderNum, printCode, PosterName, dropshipaddresstype, specialInstructions, ArtistName, Publisher, Price, CustomerName, PrintCodeInStock As String
Dim Bill_ContactName, Bill_Address, Bill_City, Bill_Province, Bill_PostalCode, Bill_Country, Ship_ContactName, Ship_Address, Ship_City, Ship_Province, Ship_PostalCode, Ship_Country As StringDim orderId, qty, RowsReturned, t1Bill_Amt, temp_Amnt As Int32


Dim t1Ship_ContactName, t1Bill_ContactName, t1Bill_Address, t1Ship_Address As String

RowsReturned = 0

While myReader.Read()

Trace.Write("send to:" & myReader.GetString(0))
' send email to supplier

EmailTo = myReader.GetString(0)
orderId = myReader.GetInt32(1)
MAOrderNum = myReader.GetString(2)
printCode = myReader.GetString(3)
PosterName = myReader.GetString(4)
qty = myReader.GetInt32(5)
dropshipaddresstype = myReader.GetString(6)
specialInstructions = myReader.GetString(7)

Bill_ContactName = myReader.GetString(8)
Bill_Address = myReader.GetString(9)
Bill_City = myReader.GetString(10)
Bill_Province = myReader.GetString(11)
Bill_PostalCode = myReader.GetString(12)
Bill_Country = myReader.GetString(13)

Ship_ContactName = myReader.GetString(14)
Ship_Address = myReader.GetString(15)
Ship_City = myReader.GetString(16)
Ship_Province = myReader.GetString(17)
Ship_PostalCode = myReader.GetString(18)
Ship_Country = myReader.GetString(19)


ArtistName = myReader.GetString(20)
Publisher = myReader.GetString(21)

Price = myReader.GetDecimal(22)
CustomerName = myReader.GetString(23)
PrintCodeInStock = myReader.GetString(24)

'' SEND ALL TO JASON FOR NOW
'If EmailTo = "" Then
'EmailTo = "andrew@platypi.ca, jason@cottagetime.com,tiawebchd@gmail.com"
EmailTo =
"jason@cottagetime.com"

'End If

EmailFrom =
"jason@mostlyart.com"
'EmailSubject = "Print Order - Id # " & orderId
EmailSubject =
"Order"EmailBody = "Print Order" & vbCrLf & vbCrLf

If Trim(PrintCodeInStock) <> "" ThenEmailBody += "This is an item that is in stock" & vbCrLf
End If

EmailBody += "Ordered From: MostlyArt.com" & vbCrLf
EmailBody +=
"Order Id: " & orderId & vbCrLf
'EmailBody += "MostlyArt Order #: " & MAOrderNum & vbCrLf & vbCrLf

EmailBody += "Ordered Date: " & FormatDateTime(Now(), DateFormat.ShortDate) & vbCrLf & vbCrLf

'EmailBody += "Special Instruction: " & specialInstructions & vbCrLf & vbCrLf

EmailBody += "Customer Notes: " & vbCrLf & vbCrLf

EmailBody += "Bill To: " & vbCrLf
EmailBody += CustomerName & vbCrLf
'EmailBody += Bill_ContactName & vbCrLf
EmailBody += Bill_Address & vbCrLf
EmailBody += Bill_City & ", " & Bill_Province & " " & Bill_PostalCode & vbCrLf
EmailBody += Bill_Country & vbCrLf & vbCrLf

EmailBody += "Ship To: " & vbCrLf
EmailBody += Ship_ContactName & vbCrLf
EmailBody += Ship_Address & vbCrLf
EmailBody += Ship_City & ", " & Ship_Province & " " & Ship_PostalCode & vbCrLf
EmailBody += Ship_Country & vbCrLf & vbCrLf



EmailBody += ArtistName & ", " & PosterName & vbCrLf
EmailBody +=
"Pub: " & Publisher & vbCrLfEmailBody += "Number: " & printCode & vbCrLf
EmailBody +=
"Qty: " & qty & vbCrLfEmailBody += "Price: " & FormatCurrency(Price, 2) & vbCrLf & vbCrLf


EmailBody += "Subtotal: $" & Price * qty & vbCrLf
EmailBody +=
"Shipping: $" & ShippingCharge & vbCrLfEmailBody += "Sales Tax: $0" & vbCrLf
EmailBody +=
"Discount: $0" & vbCrLfEmailBody += "Total: $" & Price * qty + ShippingCharge & vbCrLf


Dim Msg As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()Msg.From = New System.Net.Mail.MailAddress(EmailFrom)
Msg.To.Add(EmailTo)
Msg.Subject = EmailSubject
Msg.Body = EmailBody
Msg.IsBodyHtml =
False

'Dim basicAuthenticationInfo As New System.Net.NetworkCredential("request@ruralphilant hropy.ca", "foundation")Dim MailObj As New System.Net.Mail.SmtpClient("localhost")
'MailObj.Credentials = basicAuthenticationInfo
MailObj.Send(Msg)


RowsReturned += 1
End While

If RowsReturned = 0 Then
theError =
"There are no orders to send"
End If
myReader.Close()

Reply With Quote
  #2 (permalink)  
Old May 2nd, 2008, 08:19 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What do you mean by "grouped"? Do you mean you want a table of the items? You can change the format type of the mail message to HTML and then generate the necessary HTML to achieve the desired formatting.

When you post code, please wrap it inside the forum markup tag . This way it will retain its original formatting and will be considerably easier for us to read.

-Peter
peterlanoie.blog
Reply With Quote
  #3 (permalink)  
Old May 4th, 2008, 11:09 PM
Registered User
 
Join Date: May 2008
Location: chandigarh, chandigarh, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tiawebchd
Default

I want my email result as total order of the same shipping address must come in same email not different email for different order having same shipping address.

Reply With Quote
  #4 (permalink)  
Old May 5th, 2008, 08:07 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I imagine then you'll need to handle several issues:

1) Track when an order's email has been sent so that you can determine what orders to include in the aggregated message.

2) Build a query that groups unsent orders by the ship to information, then divide up the actual order detail into separate sections so you maintain the structure of each order.

-Peter
compiledthoughts.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Structure and Algorithms darkestangel1980 Pro Java 1 September 6th, 2007 11:56 AM
converting and sending data problem csharpa ADO.NET 2 March 24th, 2007 06:38 AM
pick data from xml structure crmpicco XML 2 December 1st, 2006 11:01 AM
Need help with tree data structure vidhya_venkat C++ Programming 0 June 14th, 2006 01:13 PM
tree data structure pandjie Java Basics 1 January 16th, 2006 05:15 AM



All times are GMT -4. The time now is 07:36 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.