|
|
 |
| C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the C# section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

March 5th, 2007, 06:08 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
help, converting vb.net few lines to C#
Could anybody please, help in converting the following few lines to C#???
Public Sub Send_Email2(ByVal claimID As Integer, ByVal ApartmentID As Integer, ByVal strComplaintTitle As String, ByVal strFullName As String, ByVal strPriority As String, ByVal strProblemDetails As String)
Dim UNMtxt As String = "nesrine72@hotmail.com"
Try
Dim varMailbody As String
varMailbody = "<b>Dear Admin,</b><br><br>"
varMailbody = varMailbody & "You got a new ticket."
varMailbody = varMailbody & "<b>Ticket Number: </b>" & claimID & "<b> Customer Name: </b>" & strFullName & "<br>"
varMailbody = varMailbody & "<br><b>Problem Title: </b>" & strComplaintTitle & "<b> Priority: " & strPriority & "</b><br>"
varMailbody = varMailbody & "<br><b>Problem Details: </b>" & strProblemDetails & "<br><br>Please check and reply.<br><br>Thank you<br>albab.com<br>"
Dim ToAddress As String = UNMtxt
Dim fromAddress As String = "nesrine1972@yahoo.com"
'(1) Create the MailMessage instance
Dim mm As New MailMessage(fromAddress, ToAddress)
'(1.2) set the e-mail Priority
mm.Priority = CInt(DropDownList1.SelectedValue)
'(2) Assign the MailMessage's properties
mm.Subject = "New Ticket - albab.com"
mm.Body = varMailbody
mm.IsBodyHtml = True
'(3) Create the SmtpClient object
Dim smtp As New SmtpClient
'smtp.Host = "mail.albab.com"
smtp.Host = "LOCALHOST"
smtp.Port = 25
smtp.Credentials = New NetworkCredential("nesrine1972@yahoo.com", "Sys!234")
'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
Response.redirect("~/OrderCompleted.aspx");
findlastTicketno()
Catch ex As Exception
Errlbl.Text = "Sorry! Your ticket can not be submitted at the moment!"
Errlbl.Text = Errlbl.Text & " " & ex.Message
End Try
End Sub
|

March 5th, 2007, 07:28 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The following was obtained with Instant C#:
public void Send_Email2(int claimID, int ApartmentID, string strComplaintTitle, string strFullName, string strPriority, string strProblemDetails)
{
string UNMtxt = "nesrine72@hotmail.com";
try
{
string varMailbody = null;
varMailbody = "<b>Dear Admin,</b><br><br>";
varMailbody = varMailbody + "You got a new ticket.";
varMailbody = varMailbody + "<b>Ticket Number: </b>" + claimID + "<b> Customer Name: </b>" + strFullName + "<br>";
varMailbody = varMailbody + "<br><b>Problem Title: </b>" + strComplaintTitle + "<b> Priority: " + strPriority + "</b><br>";
varMailbody = varMailbody + "<br><b>Problem Details: </b>" + strProblemDetails + "<br><br>Please check and reply.<br><br>Thank you<br>albab.com<br>";
string ToAddress = UNMtxt;
string fromAddress = "nesrine1972@yahoo.com";
//(1) Create the MailMessage instance
MailMessage mm = new MailMessage(fromAddress, ToAddress);
//(1.2) set the e-mail Priority
mm.Priority = System.Convert.ToInt32(DropDownList1.SelectedValue );
//(2) Assign the MailMessage's properties
mm.Subject = "New Ticket - albab.com";
mm.Body = varMailbody;
mm.IsBodyHtml = true;
//(3) Create the SmtpClient object
SmtpClient smtp = new SmtpClient();
//smtp.Host = "mail.albab.com"
smtp.Host = "LOCALHOST";
smtp.Port = 25;
smtp.Credentials = new NetworkCredential("nesrine1972@yahoo.com", "Sys!234");
//(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm);
Response.redirect("~/OrderCompleted.aspx");
findlastTicketno();
}
catch (Exception ex)
{
Errlbl.Text = "Sorry! Your ticket can not be submitted at the moment!";
Errlbl.Text = Errlbl.Text + " " + ex.Message;
}
}
|

March 6th, 2007, 02:52 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you very much, that was a great help, you saved me.
Please note that void is underlined because of
"Invalid token void in calss, struct, order interface member declaration "
so what am i supposed to do??
|

March 6th, 2007, 10:43 AM
|
|
Authorized User
|
|
Join Date: Feb 2004
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The method must be within a class or struct.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |