Friday, April 11, 2008

An Idal Data Access layer to start a project

first of all set a connection in webconfig file and set connection string into appsetig tabl




reffrence of aaplication class is just below of the DAL


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Net.Mail;


/// [summary]
/// Summary description for userProfileDAL
/// [/summary]
public class userProfileDAL
{

#region Constructor of the UserProfileDAL class
public userProfileDAL()
{
//
// TODO: Add constructor logic here
//
}

#endregion

#region Database Operators for the userProfileDAL class

//Declaration of The Class Objects And Variables.

// Creation of connection object to connect to SQL Server.
SqlConnection connectionToSQLServer = new SqlConnection(ConfigurationManager.ConnectionStrings["connStr"].ConnectionString);
// Creation of sql command which will handle the query and other queries to SQL Server.
SqlCommand commandForSQLServer = new SqlCommand();

#endregion

#region ---------- Edit My Profile ------

#region Public Data Access Layer Methods of the userProfileDAL class
// To add all the tags into eventTagList table and calculate total tag rating
public void bindTotalRating(userProfile profile)
{
commandForSQLServer.CommandText = "usp_AddEventsToEventTagList";
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();

}
commandForSQLServer.CommandTimeout = 6000;
commandForSQLServer.Parameters.Add("@ClientId", SqlDbType.VarChar, 200).Value = profile.clientId;

try { commandForSQLServer.ExecuteNonQuery(); }
catch (Exception ex) { string Msg = ex.Message; }
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
}
// To add all the tags into PlaceTagList table and calculate total tag rating
public void bindTotalPlaceRating(userProfile profile)
{
commandForSQLServer.CommandText = "usp_AddPlacesToPlaceTagList";
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();

}
commandForSQLServer.CommandTimeout = 6000;
commandForSQLServer.Parameters.Add("@ClientId", SqlDbType.VarChar, 200).Value = profile.clientId;

try { commandForSQLServer.ExecuteNonQuery(); }
catch (Exception ex) { string Msg = ex.Message; }
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
}
public DataSet getSexualOrientationInfo()
{
DataSet dsReturn = new DataSet();
commandForSQLServer.CommandText = "getSexualOrientationList";
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

SqlDataAdapter adap = new SqlDataAdapter(commandForSQLServer);
try
{
adap.Fill(dsReturn);
}
catch (Exception ex)
{
string str = ex.Message;

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return dsReturn;
}
public DataSet getMaritalStatusInfo()
{
DataSet dsReturn = new DataSet();
commandForSQLServer.CommandText = "getMaritalStatusList";
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

SqlDataAdapter adap = new SqlDataAdapter(commandForSQLServer);
try
{
adap.Fill(dsReturn);
}
catch (Exception ex)
{
string str = ex.Message;

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return dsReturn;
}
public DataSet getUserProfileDetails(userProfile profile)
{
DataSet dsReturn = new DataSet();
commandForSQLServer.CommandText = "getUserProfileInfo";
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
commandForSQLServer.Parameters.Add("@clientId", SqlDbType.VarChar, 200).Value = profile.clientId;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

SqlDataAdapter adap = new SqlDataAdapter(commandForSQLServer);
try
{
adap.Fill(dsReturn);
}
catch (Exception ex)
{
string str = ex.Message;

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return dsReturn;
}
public DataSet getUserPicDetails(userProfile profile)
{
DataSet dsReturn = new DataSet();
commandForSQLServer.CommandText = "getUserPicDetails";
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
commandForSQLServer.Parameters.Add("@clientId", SqlDbType.VarChar, 200).Value = profile.clientId;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

SqlDataAdapter adap = new SqlDataAdapter(commandForSQLServer);
try
{
adap.Fill(dsReturn);
}
catch (Exception ex)
{
string str = ex.Message;

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return dsReturn;
}

public DataSet getUserPurposeList(userProfile profile)
{
DataSet dsReturn = new DataSet();
commandForSQLServer.CommandText = "getPurposeList";
commandForSQLServer.Parameters.Add("@purposeId", SqlDbType.VarChar, 200).Value = profile.purposeId;
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;

if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

SqlDataAdapter adap = new SqlDataAdapter(commandForSQLServer);
try
{
adap.Fill(dsReturn);
}
catch (Exception ex)
{
string str = ex.Message;

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return dsReturn;
}

public DataSet getProfilePurposeList()
{
DataSet dsReturn = new DataSet();
commandForSQLServer.CommandText = "getPurposeList";
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;

if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

SqlDataAdapter adap = new SqlDataAdapter(commandForSQLServer);
try
{
adap.Fill(dsReturn);
}
catch (Exception ex)
{
string str = ex.Message;

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return dsReturn;
}

public string updateUserProfile(userProfile profile)
{
string status = string.Empty;
commandForSQLServer.CommandText = "updateUserProfile";
commandForSQLServer.Parameters.Add("@clientId", SqlDbType.VarChar, 200).Value = profile.clientId;
commandForSQLServer.Parameters.Add("@profileViewStatus", SqlDbType.VarChar, 10).Value = profile.profileViewStatus;
commandForSQLServer.Parameters.Add("@screenName", SqlDbType.VarChar, 50).Value = profile.screenName;
commandForSQLServer.Parameters.Add("@firstName", SqlDbType.VarChar, 50).Value = profile.firstName;
commandForSQLServer.Parameters.Add("@lastName", SqlDbType.VarChar, 50).Value = profile.lastName;

commandForSQLServer.Parameters.Add("@gender", SqlDbType.VarChar, 10).Value = profile.gender;
commandForSQLServer.Parameters.Add("@dateOfBirth", SqlDbType.VarChar, 50).Value = profile.dateOfBirth;
commandForSQLServer.Parameters.Add("@neighborhood", SqlDbType.VarChar, 50).Value = profile.neighborhood;
commandForSQLServer.Parameters.Add("@city", SqlDbType.VarChar, 50).Value = profile.city;
commandForSQLServer.Parameters.Add("@state", SqlDbType.VarChar, 50).Value = profile.state;
commandForSQLServer.Parameters.Add("@yourWebsite", SqlDbType.VarChar, 50).Value = profile.yourWebsite;
commandForSQLServer.Parameters.Add("@ylDomailURL", SqlDbType.VarChar, 50).Value = profile.ylDomailURL;
commandForSQLServer.Parameters.Add("@picPickId", SqlDbType.Int).Value = profile.picPickId;
commandForSQLServer.Parameters.Add("@occupation ", SqlDbType.VarChar, 100).Value = profile.occupation;
commandForSQLServer.Parameters.Add("@purpose", SqlDbType.VarChar, 50).Value = profile.purpose;
commandForSQLServer.Parameters.Add("@maritialStatusId", SqlDbType.Int).Value = profile.maritialStatusId;
commandForSQLServer.Parameters.Add("@sexualOrientationId", SqlDbType.Int).Value = profile.sexualOrientationId;
commandForSQLServer.Parameters.Add("@homeTown", SqlDbType.VarChar,50).Value = profile.hometown;
commandForSQLServer.Parameters.Add("@smoke", SqlDbType.VarChar, 10).Value = profile.smoke;
commandForSQLServer.Parameters.Add("@drink", SqlDbType.VarChar, 10).Value = profile.drink;
commandForSQLServer.Parameters.Add("@kids", SqlDbType.VarChar, 10).Value = profile.kids;
commandForSQLServer.Parameters.Add("@school", SqlDbType.VarChar, 50).Value = profile.school;
commandForSQLServer.Parameters.Add("@aboutMe", SqlDbType.VarChar,8000).Value = profile.aboutMe;
commandForSQLServer.Parameters.Add("@whoILikeToMeet", SqlDbType.VarChar, 8000).Value = profile.whoILikeToMeet;
commandForSQLServer.Parameters.Add("@whatILike", SqlDbType.VarChar, 8000).Value = profile.whatILike;
commandForSQLServer.Parameters.Add("@moviesILove", SqlDbType.VarChar, 8000).Value = profile.moviesILove;
commandForSQLServer.Parameters.Add("@booksILove", SqlDbType.VarChar, 8000).Value = profile.booksILove;
commandForSQLServer.Parameters.Add("@myFavBands", SqlDbType.VarChar, 8000).Value = profile.myFavBands;
commandForSQLServer.Parameters.Add("@myFavPeople", SqlDbType.VarChar, 8000).Value = profile.myFavPeople;
commandForSQLServer.Parameters.Add("@myTags", SqlDbType.VarChar, 8000).Value = profile.MyTags;

commandForSQLServer.Parameters.Add("@return", SqlDbType.VarChar, 10).Direction = ParameterDirection.Output;

commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

try
{
commandForSQLServer.ExecuteNonQuery();
status = commandForSQLServer.Parameters["@return"].Value.ToString();
/* This funcion add/edit the tag in personal tag list at the time user edit his/her profile. */
UpdatePersonalTags(profile.clientId, profile.MyTags);
}
catch (Exception ex)
{
string str = ex.Message;
status = "-1";

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return status;
}

private void UpdatePersonalTags(string ClientId, string MyTags)
{
commandForSQLServer = new SqlCommand();
commandForSQLServer.Connection = connectionToSQLServer;
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.CommandText = "usp_UpdatePersonalTags";


commandForSQLServer.Parameters.Add("@clientId", SqlDbType.VarChar, 200).Value = ClientId;
commandForSQLServer.Parameters.Add("@myFavTags", SqlDbType.VarChar, 8000).Value = MyTags;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

try { commandForSQLServer.ExecuteNonQuery(); }
catch (Exception ex) { string Msg = ex.Message; }
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
}

public bool addUserImagePhoto(userProfile profile)
{
bool status = true;

commandForSQLServer.CommandText = "addUserProfileImage";
commandForSQLServer.Parameters.Add("@clientId", SqlDbType.VarChar, 200).Value = profile.clientId;
commandForSQLServer.Parameters.Add("@picName", SqlDbType.VarChar, 50).Value = profile.picName;
commandForSQLServer.Parameters.Add("@picType", SqlDbType.VarChar, 50).Value = profile.picType;
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

try
{
commandForSQLServer.ExecuteNonQuery();
}
catch (Exception ex)
{
string str = ex.Message;
status = false;

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return status;
}
public bool DeleteUserImage(userProfile profile)
{
bool status=true ;
commandForSQLServer.CommandText = "deleteUserImage";
commandForSQLServer.Parameters.Add("@picId",SqlDbType.Int).Value=profile.picPickId;
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}
try
{
commandForSQLServer.ExecuteNonQuery();
}
catch (Exception ex)
{
string str = ex.Message;
status = false;
}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return status;
}
#endregion


#endregion

#region ------User Profile ------

//Function to add as friend
public string AddToPendingFriendList_YL(userProfile profile)
{
string status = string.Empty;
commandForSQLServer.CommandText = "AddToPendingFriendListYL";
commandForSQLServer.Parameters.Add("@clientId", SqlDbType.VarChar, 200).Value = profile.clientId;
commandForSQLServer.Parameters.Add("@friendId", SqlDbType.VarChar, 200).Value = profile.friendId;
commandForSQLServer.Parameters.Add("@friendStatus", SqlDbType.Int).Value = profile.friendStatus;
commandForSQLServer.Parameters.Add("@datetime", SqlDbType.VarChar, 100).Value = DateTime.Now.ToShortDateString();
commandForSQLServer.Parameters.Add("@return", SqlDbType.VarChar, 10).Direction = ParameterDirection.Output;

commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

try
{
commandForSQLServer.ExecuteNonQuery();
status = commandForSQLServer.Parameters["@return"].Value.ToString();
}
catch (Exception ex)
{
string str = ex.Message;
status = "-1";

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return status;
}
//to check recently reviewed
public int CheckUserLatestReview(userProfile profile)
{
int returnValue;
commandForSQLServer.CommandText = "checkUserLatestReview";
commandForSQLServer.Parameters.Add("@clientId", SqlDbType.VarChar, 200).Value = profile.clientId;
commandForSQLServer.Parameters.Add("@return", SqlDbType.Int).Direction = ParameterDirection.Output;

commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

try
{
commandForSQLServer.ExecuteNonQuery();
returnValue = Convert.ToInt32(commandForSQLServer.Parameters["@return"].Value);
}
catch (Exception ex)
{
string str = ex.Message;
returnValue = -1;

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return returnValue;
}

// update profile hit counter

public bool UpdateProfileHitCounter(userProfile profile)
{
bool status=true;
commandForSQLServer.CommandText = "updateUserProfileCounter";
commandForSQLServer.Parameters.Add("@clientId", SqlDbType.VarChar, 200).Value = profile.clientId;
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

try
{
commandForSQLServer.ExecuteNonQuery();

}
catch (Exception ex)
{
string str = ex.Message;
status = false;

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return status;
}

#endregion

#region -----------HomeMail-----------

//function to accept the the user add as friend request
public string AcceptFriendRequest(userProfile profile)
{
string status = string.Empty;
commandForSQLServer.CommandText = "AddToFriendList";
commandForSQLServer.Parameters.Add("@pendingId", SqlDbType.Int).Value = profile.pendingId;
commandForSQLServer.Parameters.Add("@clientId", SqlDbType.VarChar, 200).Value = profile.clientId;
commandForSQLServer.Parameters.Add("@friendId", SqlDbType.VarChar, 200).Value = profile.friendId;
commandForSQLServer.Parameters.Add("@friendStatus", SqlDbType.Int).Value = profile.friendStatus;
commandForSQLServer.Parameters.Add("@datetime", SqlDbType.VarChar, 100).Value = DateTime.Now;
commandForSQLServer.Parameters.Add("@return", SqlDbType.VarChar, 10).Direction = ParameterDirection.Output;

commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

try
{
commandForSQLServer.ExecuteNonQuery();
status = commandForSQLServer.Parameters["@return"].Value.ToString();
}
catch (Exception ex)
{
string str = ex.Message;
status = "-1";

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return status;
}
//function to reject the the user add as friend request
public bool RejectFriendRequest(userProfile profile)
{
bool status = true;
commandForSQLServer.CommandText = "RejectFriendRequest";
commandForSQLServer.Parameters.Add("@pendingId", SqlDbType.Int).Value = profile.pendingId;
commandForSQLServer.Parameters.Add("@datetime", SqlDbType.VarChar, 100).Value = DateTime.Now.ToString();

commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

try
{
commandForSQLServer.ExecuteNonQuery();

}
catch (Exception ex)
{
string str = ex.Message;
status = false;

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return status;
}

public bool SendMailMessage(userProfile profile)
{
bool status = true;
string path = ApplicationPath.getApplicationPath();
try
{
string strMailStyle = "[link rel='stylesheet' type='text/css' href=" + path + "/css/style.css]";
String strMessage;

strMessage = "[table width='517' border='0' align='center' cellpadding='0' cellspacing='0']";
strMessage += "[tr][td] [/td][/tr]";
strMessage += "[tr][td][table width='517' border='0' cellspacing='0' cellpadding='0']";
//strMessage += " [tr][td width='8'][img src=" + path + "images/mail_box_topl.gif width='8' height='8'][/td]";
//strMessage += "[td style=background-image:url(" + path + "images/mail_box_topm.gif); background-repeat:repeat-x;][/td]";
//strMessage += "[td width='8'][img src=" + path + "images/mail_box_topr.gif width='8' height='8'][/td][/tr]";
strMessage += " [tr][td width='8'][/td]";
strMessage += "[td][/td]";
strMessage += "[td width='8'][/td][/tr]";

strMessage += " [tr][td][/td]";
strMessage += "[td ][table width='100%' border='0' cellspacing='0' cellpadding='0']";
strMessage += "[tr] [td ] [/td][/tr]";
strMessage += " [tr][td ]";
strMessage += " " + profile.firstName + " has rejected the request to add as a friend on ylDomail.";
strMessage += "[tr] [td class='grey_itailic'] [/td][/tr]";
//strMessage += "[tr][td class='black_normal2'] [/td][/tr]";
//strMessage += "[tr][td class='black_normal2']Thanks,[/td][/tr]";
//strMessage += "[tr][td class='black_normal2'] [/td][/tr]";
//strMessage += "[tr][td class='black_normal2']The ylDomail Team[/td][/tr]";
//strMessage += "[tr][td class='black_normal2'] [/td][/tr]";
strMessage += "[tr] [td height='3px'] [/td][/tr]";
//-the ylDomail Team
strMessage += "[tr] [td ]  -the ylDomail Team [/td][/tr]";
strMessage += "[tr] [td height='1px' ]  [/td][/tr]";
strMessage += " [tr][td ] YPut address,[br/]   USA – www.ylDomail.com[/td][/tr]";
//Questions? Concerns? Acclaim? Contact us at feedback@ylDomail.com
strMessage += " [tr][td ]  Questions? Concerns? Acclaim? Contact us at [a href='mailto:feedback@ylDomail.com'] feedback@comain.om [/a] [/td][/tr]";
strMessage += " [tr][td ][/td][/tr]";
strMessage += "[tr][td align='right' ][/td][/tr]";
strMessage += " [tr][td align='right' ] [/td][/tr]";
strMessage += "[/table][/td]";
strMessage += "[td ][/td]";
strMessage += "[/tr][tr][td][/td]";
strMessage += " [td ][/td]";
strMessage += "[td][/td]";
strMessage += "[/tr][/table][/td][/tr][/table]";

string message = strMessage + strMailStyle;
MailMessage Mail_Message = new MailMessage();
Mail_Message.From = new MailAddress("service@domaill.com");
Mail_Message.To.Add(new MailAddress(profile.To));
Mail_Message.Subject = profile.Subject; // "This is my subject";
Mail_Message.Body = message; // "This is the content";
Mail_Message.IsBodyHtml = true;
SmtpClient Smtp_Client = new SmtpClient();
Smtp_Client.Send(Mail_Message);

}
catch (Exception e)
{

// throw new Exception("Could not send email message: " + e.Message);
status = false;
}

return status;
}
public bool SendConfirmMailMessage(userProfile profile)
{
bool status = true;
string path = ApplicationPath.getApplicationPath();
try
{
string strMailStyle = "[link rel='stylesheet' type='text/css' href=" + path + "/css/style.css]";
String strMessage;

strMessage = "[table width='517' border='0' align='center' cellpadding='0' cellspacing='0']";
strMessage += "[tr][td] [/td][/tr]";
strMessage += "[tr][td][table width='517' border='0' cellspacing='0' cellpadding='0']";
// strMessage += " [tr][td width='8'][img src=" + path + "images/mail_box_topl.gif width='8' height='8'][/td]";
//strMessage += "[td style=background-image:url(" + path + "images/mail_box_topm.gif); background-repeat:repeat-x;][/td]";
//strMessage += "[td width='8'][img src=" + path + "images/mail_box_topr.gif width='8' height='8'][/td][/tr]";
//strMessage += " [tr][td style=background-image:url(" + path + "images/mail_box_middlell.gif); background-repeat:repeat-y;][/td]";
strMessage += " [tr][td width='8'][/td]";
strMessage += "[td][/td]";
strMessage += "[td width='8'][/td][/tr]";
strMessage += " [tr][td ][/td]";

strMessage += "[td ][table width='100%' border='0' cellspacing='0' cellpadding='0']";
strMessage += "[tr] [td ] [/td][/tr]";
strMessage += " [tr][td class='black_normal2']";
strMessage += profile.firstName + " has accepted you as a friend on ylDomail.";
strMessage += "[tr] [td] [/td][/tr]";
strMessage += "[tr][td ]To view " + profile.firstName + "'s profile, follow the link below:[/td][/tr]";
strMessage += "[tr] [td '] [/td][/tr]";
strMessage += "[tr] [td ]" + path + "/HomeMyProfile.aspx?clientId=" + profile.friendId + "[/td][/tr]";
strMessage += "[tr] [td ] [/td][/tr]";
//strMessage += "[tr] [td class='grey_itailic'] [/td][/tr]";
//strMessage += "[tr][td class='black_normal2']Thanks,[/td][/tr]";
//strMessage += "[tr][td class='black_normal2'] [/td][/tr]";
//strMessage += "[tr][td class='black_normal2']The ylDomail Team[/td][/tr]";
//strMessage += "[tr][td class='black_normal2'] [/td][/tr]";
strMessage += "[tr] [td height='3px'] [/td][/tr]";
//-the ylDomail Team
strMessage += "[tr] [td ]  -the ylDomail Team [/td][/tr]";
strMessage += "[tr] [td height='1px' ]  [/td][/tr]";
strMessage += " [tr][td ] ylDomail.com, LLC – 20 Jay St., Ste. 207, Brooklyn, NY 11201,[br/]   USA – www.ylDomail.com[/td][/tr]";
//Questions? Concerns? Acclaim? Contact us at feedback@ylDomail.com
strMessage += " [tr][td ]  Questions? Concerns? Acclaim? Contact us at [a href='mailto:feedback@ylDomail.com'] feedback@ylDomail.com [/a] [/td][/tr]";
strMessage += " [tr][td '][/td][/tr]";

strMessage += "[tr][td align='right' ][/td][/tr]";
strMessage += " [tr][td align='right' ] [/td][/tr]";
strMessage += "[/table][/td]";
//strMessage += "[td style=background-image:url(" + path + "images/mail_box_middlelr.gif); background-repeat:repeat-y; ][/td]";
//strMessage += "[/tr][tr][td][img src=" + path + "images/mail_box_bottoml.gif width='8' height='8'][/td]";
//strMessage += " [td style=background-image:url(" + path + "images/mail_box_bottomm.gif); background-repeat:repeat-x; ][/td]";
//strMessage += "[td][img src=" + path + "images/mail_box_bottomr.gif width=8 height=8][/td]";
strMessage += "[td ][/td]";
strMessage += "[/tr][tr][td][/td]";
strMessage += " [td ][/td]";
strMessage += "[td][/td]";

strMessage += "[/tr][/table][/td][/tr][/table]";

string message = strMessage + strMailStyle;
MailMessage Mail_Message = new MailMessage();
Mail_Message.From = new MailAddress("service@ylDomail.com");
Mail_Message.To.Add(new MailAddress(profile.To));
Mail_Message.Subject = profile.Subject; // "This is my subject";
Mail_Message.Body = message; // "This is the content";
Mail_Message.IsBodyHtml = true;
SmtpClient Smtp_Client = new SmtpClient();
Smtp_Client.Send(Mail_Message);

}
catch (Exception e)
{

// throw new Exception("Could not send email message: " + e.Message);
status = false;
}
return status;
}
//Friend Request Add E-mail
public bool SendAddRequestMailMessage(userProfile profile)
{
bool status = true;
string path = ApplicationPath.getApplicationPath();
try
{
string strMailStyle = "[link rel='stylesheet' type='text/css' href=" + path + "/css/style.css]";
String strMessage;

strMessage = "[table width='517' border='0' align='center' cellpadding='0' cellspacing='0']";
strMessage += "[tr][td] [/td][/tr]";
strMessage += "[tr][td][table width='517' border='0' cellspacing='0' cellpadding='0']";
strMessage += " [tr][td width='8'][/td]";
strMessage += "[td ][/td]";
strMessage += "[td width='8'][/td][/tr]";
strMessage += " [tr][td ][/td]";
strMessage += "[td ][table width='100%' border='0' cellspacing='0' cellpadding='0']";
strMessage += "[tr] [td ] Hi  " + profile.username + ":[/td][/tr]";
strMessage += " [tr][td ]";
strMessage += " " + profile.firstName + " has requested to be your friend on ylDomail.";
strMessage += "[tr] [td height='2px' ] [/td][/tr]";
strMessage += "[tr][td ]  To see this request, follow the link below, or copy and paste it into your browser:[/td][/tr]";
strMessage += "[tr] [td height='2px' ] [/td][/tr]";
strMessage += "[tr] [td ] [a href= " + path + "]" + path + "[a]   [/td][/tr]";
strMessage += "[tr] [td ] [/td][/tr]";
//strMessage += "[tr] [td class='grey_itailic'] [/td][/tr]";
//strMessage += "[tr][td class='black_normal2']Thanks,[/td][/tr]";//1212
//strMessage += "[tr][td class='black_normal2'] [/td][/tr]";
//strMessage += "[tr][td class='black_normal2']The ylDomail Team[/td][/tr]";
strMessage += "[tr] [td height='3px'] [/td][/tr]";
//-the ylDomail Team
strMessage += "[tr] [td ]  -the ylDomail Team [/td][/tr]";
strMessage += "[tr] [td height='1px' ]  [/td][/tr]";
strMessage += " [tr][td ] ylDomail.com, LLC – 20 Jay St., Ste. 207, Brooklyn, NY 11201,[br/]   USA – www.ylDomail.com[/td][/tr]";
//Questions? Concerns? Acclaim? Contact us at feedback@ylDomail.com
strMessage += " [tr][td ]  Questions? Concerns? Acclaim? Contact us at [a href='mailto:feedback@ylDomail.com'] feedback@ylDomail.com [/a] [/td][/tr]";
strMessage += " [tr][td ][/td][/tr]";
strMessage += "[tr][td align='right' ][/td][/tr]";
strMessage += " [tr][td align='right' ] [/td][/tr]";
strMessage += "[/table][/td]";
strMessage += "[td][/td]";
strMessage += "[/tr][tr][td][/td]";
strMessage += " [td ][/td]";
strMessage += "[td][/td]";
strMessage += "[/tr][/table][/td][/tr][/table]";

string message = strMessage + strMailStyle;
MailMessage Mail_Message = new MailMessage();
Mail_Message.From = new MailAddress("service@ylDomail.com");
Mail_Message.To.Add(new MailAddress(profile.To));
Mail_Message.Subject = profile.Subject; // "This is my subject";
Mail_Message.Body = message; // "This is the content";
Mail_Message.IsBodyHtml = true;
SmtpClient Smtp_Client = new SmtpClient();
Smtp_Client.Send(Mail_Message);

}
catch (Exception e)
{

// throw new Exception("Could not send email message: " + e.Message);
status = false;
}
return status;
}

public string AddAdminAsFriend(userProfile profile)
{
string status = string.Empty;
commandForSQLServer.CommandText = "AddAdminToFriendList";

commandForSQLServer.Parameters.Add("@clientId", SqlDbType.VarChar, 200).Value = profile.clientId;
commandForSQLServer.Parameters.Add("@friendId", SqlDbType.VarChar, 200).Value = profile.friendId;
commandForSQLServer.Parameters.Add("@friendStatus", SqlDbType.Int).Value = profile.friendStatus;
commandForSQLServer.Parameters.Add("@datetime", SqlDbType.VarChar, 100).Value = DateTime.Now.ToShortDateString();
commandForSQLServer.Parameters.Add("@return", SqlDbType.VarChar, 10).Direction = ParameterDirection.Output;

commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

try
{
commandForSQLServer.ExecuteNonQuery();
status = commandForSQLServer.Parameters["@return"].Value.ToString();
}
catch (Exception ex)
{
string str = ex.Message;
status = "-1";

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return status;
}
#endregion

#region---------UserTrackList
public string AddUserTrackList(userProfile objUser)
{
string status = "0";
commandForSQLServer.CommandText = "addUserActivity";
commandForSQLServer.Parameters.Add("@trackClientId", SqlDbType.VarChar, 200).Value = objUser.trackClientId;
commandForSQLServer.Parameters.Add("@trackActivity", SqlDbType.VarChar, 50).Value = objUser.trackActivity;
commandForSQLServer.Parameters.Add("@trackActivityId", SqlDbType.VarChar, 200).Value = objUser.trackActivityId;
commandForSQLServer.Parameters.Add("@trackDateTime", SqlDbType.DateTime).Value = DateTime.Now.ToString();
commandForSQLServer.CommandType = CommandType.StoredProcedure;
commandForSQLServer.Connection = connectionToSQLServer;
if (connectionToSQLServer.State == ConnectionState.Closed)
{
connectionToSQLServer.Open();
}

try
{
commandForSQLServer.ExecuteNonQuery();

}
catch (Exception ex)
{
string str = ex.Message;
status = "1";

}
finally { connectionToSQLServer.Close(); connectionToSQLServer.Dispose(); }
return status;

}
#endregion

#region [------- Comment Mail -------]
public bool SendCommentMailMessage(userProfile profile)
{
bool status = true;
string path = ApplicationPath.getApplicationPath();
try
{
string strMailStyle = "[link rel='stylesheet' type='text/css' href=" + path + "/css/style.css]";
String strMessage;

strMessage = "[table width='517' border='0' align='center' cellpadding='0' cellspacing='0']";
strMessage += "[tr][td] [/td][/tr]";
strMessage += "[tr][td][table width='517' border='0' cellspacing='0' cellpadding='0']";
//strMessage += " [tr][td width='8'][img src=" + path + "images/mail_box_topl.gif width='8' height='8'][/td]";
//strMessage += "[td style=background-image:url(" + path + "images/mail_box_topm.gif); background-repeat:repeat-x;][/td]";
//strMessage += "[td width='8'][img src=" + path + "images/mail_box_topr.gif width='8' height='8'][/td][/tr]";
//strMessage += " [tr][td style=background-image:url(" + path + "images/mail_box_middlell.gif); background-repeat:repeat-y;][/td]";
strMessage += " [tr][td width='8'][/td]";
strMessage += "[td][/td]";
strMessage += "[td width='8'][/td][/tr]";
strMessage += " [tr][td][/td]";

strMessage += "[td ][table width='100%' border='0' cellspacing='0' cellpadding='0']";
strMessage += "[tr] [td ] Hi  " + profile.username + ":[/td][/tr]";
strMessage += "[tr] [td ] [/td][/tr]";
strMessage += " [tr][td ]";
strMessage += " " + profile.firstName + " has posted a comment about you on ylDomail.";
strMessage += "[tr] [td height='2px'] [/td][/tr]";
strMessage += "[tr][td ] Check it out by following the link below, or copy and paste it into your browser:[/td][/tr]";
strMessage += "[tr] [td height='2px'] [/td][/tr]";
//OLD:-strMessage += "[tr] [td ] [a href=" + path + "HomeNotLoggedIn.aspx]" + path + "HomeNotLoggedIn.aspx[/a]   [/td][/tr]";
strMessage += "[tr] [td ] [a href=" + path + "UserProfile.aspx?UserId=" + profile.UserID + "]" + path + "UserProfile.aspx?UserId=" + profile.UserID + "[/a]   [/td][/tr]";
strMessage += "[tr] [td height='3px'] [/td][/tr]";
//-the ylDomail Team
strMessage += "[tr] [td ]  -the ylDomail Team [/td][/tr]";
strMessage += "[tr] [td height='1px' ]  [/td][/tr]";
strMessage += " [tr][td ] ylDomail.com, LLC – 20 Jay St., Ste. 207, Brooklyn, NY 11201,[br/]   USA – www.ylDomail.com[/td][/tr]";
//Questions? Concerns? Acclaim? Contact us at feedback@ylDomail.com
strMessage += " [tr][td ]  Questions? Concerns? Acclaim? Contact us at [a href='mailto:feedback@ylDomail.com'] feedback@ylDomail.com [/a] [/td][/tr]";
strMessage += " [tr][td ][/td][/tr]";
strMessage += "[tr][td ] [/td][/tr]";
strMessage += "[tr][td align='right' ][/td][/tr]";
strMessage += " [tr][td align='right' ] [/td][/tr]";
strMessage += "[/table][/td]";
strMessage += "[td ][/td]";
strMessage += "[/tr][tr][td][/td]";
strMessage += " [td ][/td]";
strMessage += "[td][/td]";
strMessage += "[/tr][/table][/td][/tr][/table]";

string message = strMessage + strMailStyle;
MailMessage Mail_Message = new MailMessage();
Mail_Message.From = new MailAddress("service@ylDomail.com");
Mail_Message.To.Add(new MailAddress(profile.To));
Mail_Message.Subject = profile.Subject; // "This is my subject";
Mail_Message.Body = message; // "This is the content";
Mail_Message.IsBodyHtml = true;
SmtpClient Smtp_Client = new SmtpClient();
Smtp_Client.Send(Mail_Message);

}
catch (Exception e)
{

// throw new Exception("Could not send email message: " + e.Message);
status = false;
}
return status;
}
#endregion

#region [------- Message Mail -------]
public bool sendMessageMail(userProfile profile)
{
bool status = true;
string path = ApplicationPath.getApplicationPath();
try
{
string strMailStyle = "[link rel='stylesheet' type='text/css' href=" + path + "/css/style.css]";
String strMessage;

strMessage = "[table width='517' border='0' align='center' cellpadding='0' cellspacing='0']";
strMessage += "[tr][td] [/td][/tr]";
strMessage += "[tr][td][table width='517' border='0' cellspacing='0' cellpadding='0']";
//strMessage += " [tr][td width='8'][img src=" + path + "images/mail_box_topl.gif width='8' height='8'][/td]";
//strMessage += "[td style=background-image:url(" + path + "images/mail_box_topm.gif); background-repeat:repeat-x;][/td]";
//strMessage += "[td width='8'][img src=" + path + "images/mail_box_topr.gif width='8' height='8'][/td][/tr]";
//strMessage += " [tr][td style=background-image:url(" + path + "images/mail_box_middlell.gif); background-repeat:repeat-y;][/td]";
strMessage += " [tr][td width='8'][/td]";
strMessage += "[td][/td]";
strMessage += "[td width='8'][/td][/tr]";
strMessage += " [tr][td][/td]";

strMessage += "[td ][table width='100%' border='0' cellspacing='0' cellpadding='0']";
strMessage += "[tr] [td ]  Hi  " + profile.username + ":[/td][/tr]";
strMessage += "[tr] [td ]  [/td][/tr]";
strMessage += " [tr][td ]";
strMessage += " " + profile.firstName + " has sent you a message on ylDomail.";
strMessage += "[tr] [td height='2px'] [/td][/tr]";
strMessage += "[tr][td ] Check it out by following the link below, or copy and paste it into your browser:[/td][/tr]";
strMessage += "[tr] [td height='2px'] [/td][/tr]";
strMessage += "[tr] [td ] [a href=" + path + "]" + path + "[/a]   [/td][/tr]";
strMessage += "[tr] [td ] [/td][/tr]";
//strMessage += "[tr] [td class='grey_itailic'] [/td][/tr]";
//strMessage += "[tr][td class='black_normal2']Thanks,[/td][/tr]";
//strMessage += "[tr][td class='black_normal2'] [/td][/tr]";
//strMessage += "[tr][td class='black_normal2']The ylDomail Team[/td][/tr]";
//strMessage += "[tr][td class='black_normal2'] [/td][/tr]";
strMessage += "[tr] [td height='3px'] [/td][/tr]";
//-the ylDomail Team
strMessage += "[tr] [td ]  -the ylDomail Team [/td][/tr]";
strMessage += "[tr] [td height='1px' ]  [/td][/tr]";
strMessage += " [tr][td ] ylDomail.com, LLC – 20 Jay St., Ste. 207, Brooklyn, NY 11201,[br/]   USA – www.ylDomail.com[/td][/tr]";
//Questions? Concerns? Acclaim? Contact us at feedback@ylDomail.com
strMessage += " [tr][td ]  Questions? Concerns? Acclaim? Contact us at [a href='mailto:feedback@ylDomail.com'] feedback@ylDomail.com [/a] [/td][/tr]";
strMessage += " [tr][td ][/td][/tr]";

strMessage += "[tr][td ] [/td][/tr]";

// strMessage += "[tr][td align='right' class='black_normal2'][img src=" + path + "images/logo.gif width='211' height='46'][/td][/tr]";
strMessage += "[tr][td][/td][/tr]";

strMessage += " [tr][td align='right' ] [/td][/tr]";
strMessage += "[/table][/td]";
//strMessage += "[td style=background-image:url(" + path + "images/mail_box_middlelr.gif); background-repeat:repeat-y; ][/td]";
//strMessage += "[/tr][tr][td][img src=" + path + "images/mail_box_bottoml.gif width='8' height='8'][/td]";
//strMessage += " [td style=background-image:url(" + path + "images/mail_box_bottomm.gif); background-repeat:repeat-x; ][/td]";
//strMessage += "[td][img src=" + path + "images/mail_box_bottomr.gif width=8 height=8][/td]";
//strMessage += "[/tr][/table][/td][/tr][/table]";
strMessage += "[td][/td]";
strMessage += "[/tr][tr][td][/td]";
strMessage += " [td][/td]";
strMessage += "[td][/td]";
strMessage += "[/tr][/table][/td][/tr][/table]";


string message = strMessage + strMailStyle;
MailMessage Mail_Message = new MailMessage();
Mail_Message.From = new MailAddress("service@ylDomail.com");
Mail_Message.To.Add(new MailAddress(profile.To));
Mail_Message.Subject = profile.Subject; // "This is my subject";
Mail_Message.Body = message; // "This is the content";
Mail_Message.IsBodyHtml = true;
SmtpClient Smtp_Client = new SmtpClient();
Smtp_Client.Send(Mail_Message);

}
catch (Exception e)
{

// throw new Exception("Could not send email message: " + e.Message);
status = false;
}
return status;
}
#endregion

#region [------- Smile Mail -------]
public bool sendSmileMail(userProfile profile)
{
bool status = true;
string path = ApplicationPath.getApplicationPath();
try
{

string strMailStyle = "[link rel='stylesheet' type='text/css' href=" + path + "/css/style.css]";
String strMessage;

strMessage = "[table width='517' border='0' align='center' cellpadding='0' cellspacing='0']";
strMessage += "[tr][td] [/td][/tr]";
strMessage += "[tr][td][table width='517' border='0' cellspacing='0' cellpadding='0']";
//strMessage += " [tr][td width='8'][img src=" + path + "images/mail_box_topl.gif width='8' height='8'][/td]";
//strMessage += "[td style=background-image:url(" + path + "images/mail_box_topm.gif); background-repeat:repeat-x;][/td]";
//strMessage += "[td width='8'][img src=" + path + "images/mail_box_topr.gif width='8' height='8'][/td][/tr]";
//strMessage += " [tr][td style=background-image:url(" + path + "images/mail_box_middlell.gif); background-repeat:repeat-y;][/td]";
//strMessage += "[td bgcolor='#F2F2F2'][table width='100%' border='0' cellspacing='0' cellpadding='0']";
strMessage += " [tr][td width='8'][/td]";
strMessage += "[td][/td]";
strMessage += "[td][/td][/tr]";
strMessage += " [tr][td][/td]";

strMessage += "[tr] [td ] Hi " + profile.username + ":[br/][/td][/tr]";
strMessage += " [tr][td ]";
strMessage += " ";
strMessage += "[tr] [td ] " + profile.firstName + "  sent you a smile on ylDomail.  [/td][/tr]";
strMessage += "[tr][td height='2px'] [/td][/tr]";

strMessage += "[tr][td ]To see it, follow the link below, or copy and paste it into your browser:[/td][/tr]";
strMessage += "[tr] [td height='2px' ] [/td][/tr]";
strMessage += "[tr] [td ][a href=" + path + "]" + path + "[/a][/td][/tr]";
strMessage += "[tr] [td ] [/td][/tr]";
strMessage += "[tr] [td height='3px'] [/td][/tr]";
//-the ylDomail Team
strMessage += "[tr] [td ]  -the ylDomail Team [/td][/tr]";
strMessage += "[tr] [td height='1px' ]  [/td][/tr]";
strMessage += " [tr][td ] ylDomail.com, LLC – 20 Jay St., Ste. 207, Brooklyn, NY 11201,[br/]   USA – www.ylDomail.com[/td][/tr]";
//Questions? Concerns? Acclaim? Contact us at feedback@ylDomail.com
strMessage += " [tr][td ]  Questions? Concerns? Acclaim? Contact us at [a href='mailto:feedback@ylDomail.com'] feedback@ylDomail.com [/a] [/td][/tr]";
strMessage += " [tr][td ][/td][/tr]";

strMessage += "[tr][td '] [/td][/tr]";
//strMessage += "[tr][td align='right' class='black_normal2'][img src=" + path + "images/logo.gif width='211' height='46'][/td][/tr]";
strMessage += "[tr][td][/td][/tr]";
strMessage += " [tr][td] [/td][/tr]";
strMessage += "[/table][/td]";
//strMessage += "[td style=background-image:url(" + path + "images/mail_box_middlelr.gif); background-repeat:repeat-y; ][/td]";
//strMessage += "[/tr][tr][td][img src=" + path + "images/mail_box_bottoml.gif width='8' height='8'][/td]";
//strMessage += " [td style=background-image:url(" + path + "images/mail_box_bottomm.gif); background-repeat:repeat-x; ][/td]";
//strMessage += "[td][img src=" + path + "images/mail_box_bottomr.gif width=8 height=8][/td]";
//strMessage += "[/tr][/table][/td][/tr][/table]";
strMessage += "[td][/td]";
strMessage += "[/tr][tr][td][/td]";
strMessage += " [td][/td]";
strMessage += "[td][/td]";
strMessage += "[/tr][/table][/td][/tr][/table]";


string message = strMessage + strMailStyle;
MailMessage Mail_Message = new MailMessage();
Mail_Message.From = new MailAddress("service@ylDomail.com");
Mail_Message.To.Add(new MailAddress(profile.To));
Mail_Message.Subject = profile.Subject; // "This is my subject";
Mail_Message.Body = message; // "This is the content";
Mail_Message.IsBodyHtml = true;
SmtpClient Smtp_Client = new SmtpClient();
Smtp_Client.Send(Mail_Message);


}
catch (Exception e)
{

// throw new Exception("Could not send email message: " + e.Message);
status = false;
}
return status;
}
#endregion

#region [------- Favorite Mail --------]
public void SendAddFavRequestMailMessage(userProfile profile)
{
#region [--------CommentedFavoriteMailDueToAsRequirementOf10April2008-----------]

/*
*void orignaly it is return bool
bool status = true;
string path = ApplicationPath.getApplicationPath();
try
{
string strMailStyle = "[link rel='stylesheet' type='text/css' href=" + path + "/css/style.css]";
String strMessage;

strMessage = "[table width='517' border='0' align='center' cellpadding='0' cellspacing='0']";
strMessage += "[tr][td] [/td][/tr]";
strMessage += "[tr][td][table width='517' border='0' cellspacing='0' cellpadding='0']";
//strMessage += " [tr][td width='8'][img src=" + path + "images/mail_box_topl.gif width='8' height='8'][/td]";
//strMessage += "[td style=background-image:url(" + path + "images/mail_box_topm.gif); background-repeat:repeat-x;][/td]";
//strMessage += "[td width='8'][img src=" + path + "images/mail_box_topr.gif width='8' height='8'][/td][/tr]";
//strMessage += " [tr][td style=background-image:url(" + path + "images/mail_box_middlell.gif); background-repeat:repeat-y;][/td]";
strMessage += " [tr][td width='8'][/td]";
strMessage += "[td ][/td]";
strMessage += "[td width='8'][/td][/tr]";
strMessage += " [tr][td ][/td]";

strMessage += "[td ][table width='100%' border='0' cellspacing='0' cellpadding='0']";
strMessage += "[tr] [td ] Hi " + profile.username + ",[br/][br/][/td][/tr]";
strMessage += " [tr][td ]";
strMessage += profile.firstName + " added you as a favorite friend on ylDomail.We need you to confirm that you are, in fact, friends with " + profile.firstName + ".";
strMessage += "[tr] [td height='2px'] [/td][/tr]";
strMessage += "[tr][td ]To confirm this friend request, follow the link below:[/td][/tr]";
strMessage += "[tr] [td height='2px' ] [/td][/tr]";
strMessage += "[tr] [td ][a href= " + path + " ]" + path + "[a][/td][/tr]";
strMessage += "[tr] [td ] [/td][/tr]";
strMessage += "[tr] [td height='3px'] [/td][/tr]";
//-the ylDomail Team
strMessage += "[tr] [td ]  -the ylDomail Team [/td][/tr]";
strMessage += "[tr] [td height='1px' ]  [/td][/tr]";
strMessage += " [tr][td ] ylDomail.com, LLC – 20 Jay St., Ste. 207, Brooklyn, NY 11201,[br/]   USA – www.ylDomail.com[/td][/tr]";
//Questions? Concerns? Acclaim? Contact us at feedback@ylDomail.com
strMessage += " [tr][td ]  Questions? Concerns? Acclaim? Contact us at [a href='mailto:feedback@ylDomail.com'] feedback@ylDomail.com [/a] [/td][/tr]";
strMessage += " [tr][td ][/td][/tr]";
//strMessage += "[tr][td align='right'][img src=" + path + "images/logo.gif width='211' height='46'][/td][/tr]";
strMessage += "[tr][td align='right'][/td][/tr]";
strMessage += " [tr][td align='right' ] [/td][/tr]";
strMessage += "[/table][/td]";
strMessage += "[td ][/td]";
//strMessage += "[/tr][tr][td][img src=" + path + "images/mail_box_bottoml.gif width='8' height='8'][/td]";
//strMessage += " [td style=background-image:url(" + path + "images/mail_box_bottomm.gif); background-repeat:repeat-x; ][/td]";
//strMessage += "[td][img src=" + path + "images/mail_box_bottomr.gif width=8 height=8][/td]";
strMessage += "[/tr][tr][td][/td]";
strMessage += " [td ][/td]";
strMessage += "[td][/td]";

strMessage += "[/tr][/table][/td][/tr][/table]";

string message = strMessage + strMailStyle;
MailMessage Mail_Message = new MailMessage();
Mail_Message.From = new MailAddress("service@ylDomail.com");
Mail_Message.To.Add(new MailAddress(profile.To));
Mail_Message.Subject = profile.Subject; // "This is my subject";
Mail_Message.Body = message; // "This is the content";
Mail_Message.IsBodyHtml = true;
SmtpClient Smtp_Client = new SmtpClient();
Smtp_Client.Send(Mail_Message);

}
catch (Exception e)
{

// throw new Exception("Could not send email message: " + e.Message);
status = false;
}
return status;
* */
#endregion [--------CommentedFavoriteMailDueToAsRequirementOf10April2008-----------]
}
#endregion
}
//////////////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.IO;

///
/// Summary description for ApplicationPath
///

public class ApplicationPath
{
#region Constructor Of the Class
public ApplicationPath()
{
//
// TODO: Add constructor logic here
//
}
#endregion

public static string getApplicationPath()
{
string Port = System.Web.HttpContext.Current.Request.ServerVariables["SERVER_PORT"];
if (Port == null || Port == "80" || Port == "443")
Port = "";
else
Port = ":" + Port;
string Protocol = System.Web.HttpContext.Current.Request.ServerVariables["SERVER_PORT_SECURE"];
if (Protocol == null || Protocol == "0")
Protocol = "http://";
else
Protocol = "https://";
string p = Protocol + System.Web.HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + Port + System.Web.HttpContext.Current.Request.ApplicationPath;
p = p.Trim();
if (!p.EndsWith("/"))
p += "/";
return p;
}

}
//////////////////////////////////////////////////////////////////////////////////////////////////////

No comments: