Wednesday, April 23, 2008

Redirect page on clicking on OK button of (JavaScript) alert msg

Response . Write("[script language='javascript']a l e r t('You got a free membership');window . location = 'default2.aspx';[/script]");

Sunday, April 13, 2008

Blogs from pradeep sir,

http://csharpspider.blogspot.com/

Complete set of show hide div with javaScript and html

[script language="javascript" type="text/javascript"]
function ChkInvalidSmileRequest()

{

var chkStrSmile = '[%=chkStrSmile %]' ;

if(chkStrSmile == "invalidRequest")
{

document.getElementById("[%=divInvalidSmileRequest.ClientID%]").style.visibility= 'visible';


document.getElementById("[%=divInvalidSmileRequest.ClientID%]").style.display='block';

document.getElementById("[%=divInvalidSmileRequest.ClientID%]").style.position="absolute";

document.getElementById("ctl00_ContentPlaceHolder1_imgSendSmile").disabled = true;


return false;
}


}
function divInvalidSmileRequestClose()
{

document.getElementById("[%=divInvalidSmileRequest.ClientID%]").style.display='none';
document.getElementById("[%=divInvalidSmileRequest.ClientID%]").style.visibility='hidden';
document.getElementById("ctl00_ContentPlaceHolder1_imgSendSmile").disabled = false;

return false;
}

[/script]


[div id="divInvalidSmileRequest" style="visibility: hidden; z-index: 3; display: none; background-color: #ffffff;
border: 1px solid #cccccc; left:450px; top:200px;" runat="server" ]
[table width="250px" border="0" cellpadding="0" cellspacing="0"]
[tr]
[td valign="top" class="heading_white2" style="background-image: url(images/grey_box_small_middle.gif);
background-repeat: repeat-x; width: 250px;height: 30px;"]
 YourLocal Message
[/td]
[td valign="top" style="background-image: url(images/grey_box_small_middle.gif);
background-repeat: repeat-x; width: 22px" align="right"]

[/td]
[/tr]
[tr]
[td colspan="2"]
[table cellpadding="0" style="padding-top: 20px;" cellspacing="0" border="0" width="100%"]
[tr]
[td colspan="3"]
[/td]
[/tr]
[tr]
[td rowspan="3"]
[/td]
[td style="width: 5px;height: 15px;"]
[/td]
[td align="center" class="blue_light1"]
Invalid smile request !
[/td]
[/tr]
[tr]
[td colspan="3" style="height: 15px;"]
[/td]
[/tr]
[/table]
[/td]
[/tr]
[tr]
[td colspan="2" style="height: 20px;" align="center"]
[asp:ImageButton ID="OkButton" runat="server" ImageUrl="~/images/ok_btn.gif" AlternateText="Okay" OnClientClick="return divInvalidSmileRequestClose()" /]

[/td]
[/tr]
[tr]
[td align="center" colspan="2" style="height: 15px;"]

[/td]
[/tr]

[/table]
[/div]

Friday, April 11, 2008

Ab Identical BAL using above DAL

#region mahesh kumar sharma
//
// All rights are reserved. Reproduction or transmission in whole or in part, in
// any form or by any means, electronic, mechanical or otherwise, is prohibited
// without the prior written permission of the copyright owner.
//
// Class Name : userProfile.cs
//
// Functionality : This class contains all those properties and methods which are required for Editing user profile,
// saving user profile info, showing user profile info

//

#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;

///
/// Summary description for userProfile
///

public class userProfile
{
#region Constructor of userProfile Class
public userProfile()
{
//
// TODO: Add constructor logic here
//
}
#endregion

#region Private Properties of class userProfile

private string _clientId;
private string _screenName;
private string _firstName;
private string _lastName;
private string _school;
private string _neighborhood;
private string _city;
private string _state;
private string _yourWebsite;
private string _YLURL;
private string _hometown;
private string _MyTags;

private string _purposeId;

//for user profile1

private string _profileViewStatus;
private string _gender;
private string _dateOfBirth;

private int _picPickId;
//for user profile 2

private string _occupation;
private string _purpose;
private int _maritialStatusId;
private int _sexualOrientationId;

private string _aboutMe;
private string _whoILikeToMeet;
private string _whatILike;
private string _moviesILove;
private string _booksILove;
private string _myFavBands;
private string _myFavPeople;
private string _smoke;
private string _drink;
private string _kids;

private string _picName;

private string _picType;
//for user profile page
private string _friendId;
private int _friendStatus;

//for Home Mail Page

private int _pendingId;

//for sending Mail
//private string _FirstName;
private string _Sender;
private string _From;
private string _Subject;
private string _To;
//For User Track list
private string _trackClientId;
private string _trackActivity;
private string _trackActivityId;
private string _UserID;
private DateTime _trackDateTime;
public string username = string.Empty;



#endregion

#region Public Properties of class userProfile

//For User Track list
public String trackClientId
{
get { return _trackClientId; }
set { _trackClientId=value; }
}
public string trackActivity
{
get { return _trackActivity; }
set { _trackActivity = value; }
}
public string trackActivityId
{
get { return _trackActivityId; }
set { _trackActivityId = value; }
}
public DateTime trackDateTime
{
get { return _trackDateTime; }
set { _trackDateTime = value; }
}
//for sending mail
public string To
{
get
{
return _To;
}
set
{
_To = value;
}
}
public string Sender
{
get
{
return _Sender;
}
set
{
_Sender = value;
}
}
public string From
{
get
{
return _From;
}
set
{
_From = value;
}
}
public string Subject
{
get
{
return _Subject;
}
set
{
_Subject = value;
}
}

//for user profile page
public int friendStatus
{
get
{
return _friendStatus;
}
set
{
_friendStatus = value;
}
}
public string friendId
{
get
{
return _friendId;
}
set
{
_friendId = value;
}
}
//for user profile 2

public string picType
{
get
{
return _picType;
}
set
{
_picType = value;
}
}

public string picName
{
get
{
return _picName;
}
set
{
_picName = value;
}
}
public string firstName
{
get
{
return _firstName;
}
set
{
_firstName = value;
}
}
public string lastName
{
get
{
return _lastName;
}
set
{
_lastName = value;
}
}

public string drink
{
get
{
return _drink;
}
set
{
_drink = value;
}
}

public string kids
{
get
{
return _kids;
}
set
{
_kids = value;
}
}


public string smoke
{
get
{
return _smoke;
}
set
{
_smoke = value;
}
}

public string aboutMe
{
get
{
return _aboutMe;
}
set
{
_aboutMe = value;
}
}
public string whoILikeToMeet
{
get
{
return _whoILikeToMeet;
}
set
{
_whoILikeToMeet = value;
}
}

public string whatILike
{
get
{
return _whatILike;
}
set
{
_whatILike = value;
}
}

public string moviesILove
{
get
{
return _moviesILove;
}
set
{
_moviesILove = value;
}
}

public string booksILove
{
get
{
return _booksILove;
}
set
{
_booksILove = value;
}
}
public string myFavBands
{
get
{
return _myFavBands;
}
set
{
_myFavBands = value;
}
}
public string myFavPeople
{
get
{
return _myFavPeople;
}
set
{
_myFavPeople = value;
}
}
public int sexualOrientationId
{
get
{
return _sexualOrientationId;
}
set
{
_sexualOrientationId = value;
}
}
public int maritialStatusId
{
get
{
return _maritialStatusId;
}
set
{
_maritialStatusId = value;
}
}
public string purpose
{
get
{
return _purpose;
}
set
{
_purpose = value;
}
}
public string occupation
{
get
{
return _occupation;
}
set
{
_occupation = value;
}
}
//for userprofile 1
public string profileViewStatus
{
get
{
return _profileViewStatus;
}
set
{
_profileViewStatus = value;
}
}
public string gender
{
get
{
return _gender;
}
set
{
_gender = value;
}
}
public int picPickId
{
get
{
return _picPickId;
}
set
{
_picPickId = value;
}
}

public string dateOfBirth
{
get
{
return _dateOfBirth;
}
set
{
_dateOfBirth = value;
}
}

public string purposeId
{
get
{
return _purposeId;
}
set
{
_purposeId = value;
}
}

public string clientId
{
get
{
return _clientId;
}
set
{
_clientId = value;
}
}


public string screenName
{
get
{
return _screenName;
}
set
{
_screenName = value;
}
}

public string school
{
get
{
return _school;
}
set
{
_school = value;
}
}


public string neighborhood
{
get
{
return _neighborhood;
}
set
{
_neighborhood = value;
}
}


public string city
{
get
{
return _city;
}
set
{
_city = value;
}
}


public string state
{
get
{
return _state;
}
set
{
_state = value;
}
}


public string yourWebsite
{
get
{
return _yourWebsite;
}
set
{
_yourWebsite = value;
}
}


public string YLURL
{
get
{
return _YLURL;
}
set
{
_YLURL = value;
}
}

public string hometown
{
get
{
return _hometown;
}
set
{
_hometown = value;
}
}
//for my tags
public string MyTags
{
get
{
return _MyTags ;
}

set {
_MyTags =value ;
}
}
public string UserID
{
get
{
return _UserID;
}
set
{
_UserID = value;
}
}

//for Home Mail Page
public int pendingId
{
get
{
return _pendingId;
}
set
{
_pendingId = value;
}
}

#endregion

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


#region Public Methods of class userProfile
// To add all the tags into eventTagList table and calculate total tag rating
public void bindTotalRating()
{
userProfileDAL profile = new userProfileDAL();
profile.bindTotalRating(this);
}
// To add all the tags into placeTagList table and calculate total tag rating
public void bindTotalPlaceRating()
{
userProfileDAL profile = new userProfileDAL();
profile.bindTotalPlaceRating(this);
}

public DataSet getSexualOrientations()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.getSexualOrientationInfo();
}
public DataSet getUserProfileDetails()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.getUserProfileDetails(this);
}
public DataSet getMaritalStatus()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.getMaritalStatusInfo();
}

public DataSet getUserPurposeList()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.getUserPurposeList(this);
}
public DataSet getPurposeList()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.getProfilePurposeList();
}

public DataSet getUserPicDetails()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.getUserPicDetails(this);
}
public string updateUserProfile()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.updateUserProfile(this);
}
#endregion

#region for uploading User Image from Edit Profile Page ----->
public bool addUserImagePhoto()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.addUserImagePhoto(this);
}
public bool DeleteUserImage()
{
userProfileDAL profile = new userProfileDAL ();
return profile.DeleteUserImage(this);
}

#endregion
#endregion

#region -----------User Profile-----------
//Function to add as friend

public string AddToPendingFriendList_YL()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.AddToPendingFriendList_YL(this);
}

//THIS FUNCTION IS USED CHECK WETHER USER HAS RECENTLY REVIEW WHETHER PLACE OR EVENT
public int CheckUserLatestReview()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.CheckUserLatestReview(this);
}
//Update User profile Counter
public bool UpdateProfileHitCounter()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.UpdateProfileHitCounter(this);
}
#endregion

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

//function to accept the the user add as friend request
public string AcceptFriendRequest()
{
//create the object for Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.AcceptFriendRequest(this);
}
public string AddAdminAsFriend()
{
//create the object for Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.AddAdminAsFriend(this);
}
//function to reject the the user add as friend request
public bool RejectFriendRequest()
{
//create the object for Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.RejectFriendRequest(this);
}

//function to send mail for reject
public bool SendMailMessage()
{
//create the object for Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.SendMailMessage(this);
}
//function to send mail for accepting
public bool SendConfirmMailMessage()
{
//create the object for Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.SendConfirmMailMessage(this);
}
//function to send mail for adding as friend
public bool SendAddRequestMailMessage()
{
//create the object for Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.SendAddRequestMailMessage(this);

}
//function to send mail for adding as favorite friend
public void SendAddFavRequestMailMessage()
{
//create the object for Data Access Layer
userProfileDAL profile = new userProfileDAL();
//Commented due to changes in 10 April requiremetns Origanaly it retuens bool
//return profile.SendAddFavRequestMailMessage(this);

}

//function to send mail for comment a friend
public bool SendCommentMailMessage()
{
//create the object for Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.SendCommentMailMessage(this);
}

//function to send mail for Message a friend
public bool sendMessageMail()
{
//create the object for Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.sendMessageMail(this);
}

//function to send mail for Smile a friend
public bool sendSmileMail()
{
//create the object for Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.sendSmileMail(this);
}

#endregion

#region---------------UserTrackList---------
public string AddUserTrackList()
{
//create the object of Data Access Layer
userProfileDAL profile = new userProfileDAL();
return profile.AddUserTrackList(this);
}
#endregion
}

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;
}

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

Open a Live site in your page without showing its URL

[IFRAME SRC="http://www.htmlcodetutorial.com/frames/_IFRAME.html" style="width: 600px; height: 800px;"]
If you can see this, your browser doesn't
understand IFRAME. However, we'll still

you to the file.
[/IFRAME]

Thursday, April 10, 2008

Check user age on client end

function chkAge(){
//// Getin the DOB var DOBmdy = (document.getElementById("ctl00_ContentPlaceHolder1_txtDateOfBirth").value).split('/'); // Created date object for geting previous 13 year date var DOBmdyMonth = DOBmdy[0] -1; var myDate=new Date(); // Geting the previous datesvar Previousdate = myDate.getDate();
var PreviousMonth = myDate.getMonth();
var CurrentYear = myDate.getFullYear();
var PreviousYear = CurrentYear-13;
// End of // Geting the previous dates
// to find that DOB is in Leap year It it return 0 that mean it is leap yearvar leapyear = DOBmdy[2]%4;if (leapyear == 0) {// now check that month of leap year is Fabif(DOBmdyMonth == 1){// if month is Fab then check that date of month is 29 if(DOBmdy[1]== 29) { // now compare with 1 March Becz 29 is not in Fab month now if(DOBmdy[2] !LessThan disabled =" false;return" disabled =" false;return" dobmdymonth ="=""!GreaterThan 1))// here 1 is 1t march{document.getElementById("ctl00_ContentPlaceHolder1_imgBtnNext").disabled = false;return true;}else{
var divEmailPreviewMain = document.getElementById("ctl00_ContentPlaceHolder1_divUnderAge13"); divEmailPreviewMain.style.display='block'; divEmailPreviewMain.style.visibility='visible'; divEmailPreviewMain.style.position="absolute"; divEmailPreviewMain.style.top = '400px'; divEmailPreviewMain.style.left= '350px'; document.getElementById("ctl00_ContentPlaceHolder1_imgBtnNext").disabled = true;
return false; } // check that user is able to join site or not if(DOBmdy[2]!LessThanPreviousYear) {
} // condition DOBmdy[2]!LessThanPreviousYear end of If Scope else { var divEmailPreviewMain = document.getElementById("ctl00_ContentPlaceHolder1_divUnderAge13"); divEmailPreviewMain.style.display='block'; divEmailPreviewMain.style.visibility='visible'; divEmailPreviewMain.style.position="absolute"; divEmailPreviewMain.style.top = '400px'; divEmailPreviewMain.style.left= '350px'; document.getElementById("ctl00_ContentPlaceHolder1_imgBtnNext").disabled = true;
return false; }// condition DOBmdy[2]!LessThanPreviousYear end of Else Scope }// condition Previousdate == 29 end of If Scope else { if((DOBmdy[2] !LessThan PreviousYear) && (DOBmdy[1] !LessThan Previousdate) && (DOBmdyMonth !LessThan PreviousMonth)) { }// if conditon for okay user ((DOBmdy[2] !LessThan PreviousYear) && (DOBmdy[1] !LessThan Previousdate) && (DOBmdyMonth !LessThan PreviousMonth)) else { var divEmailPreviewMain = document.getElementById("ctl00_ContentPlaceHolder1_divUnderAge13"); divEmailPreviewMain.style.display='block'; divEmailPreviewMain.style.visibility='visible'; divEmailPreviewMain.style.position="absolute"; divEmailPreviewMain.style.top = '400px'; divEmailPreviewMain.style.left= '350px'; document.getElementById("ctl00_ContentPlaceHolder1_imgBtnNext").disabled = true;
return false; } // end of Else scope of condition ((DOBmdy[2] !LessThan PreviousYear) && (DOBmdy[1] !LessThan Previousdate) && (DOBmdyMonth !LessThan PreviousMonth)) }//condition Previousdate == 29 end of Else Scope }// condition CurrentMonth end of If Scope
} // condition leapyear == 0 end of If Scope

// end of check that month of leap year is Fab

// if DOB is in normal year
// second attempt for DOB normal text
// if year is lessif(DOBmdy[2] !LessThan PreviousYear){document.getElementById("ctl00_ContentPlaceHolder1_imgBtnNext").disabled = false;return true;}// condition DOBmdy[2] !LessThan PreviousYear end of if scope of if year is lesselse if((DOBmdy[2] == PreviousYear) && (DOBmdyMonth !LessThan PreviousMonth)){document.getElementById("ctl00_ContentPlaceHolder1_imgBtnNext").disabled = false;return true;}else if( (DOBmdy[2] == PreviousYear) && (DOBmdyMonth == PreviousMonth) && (DOBmdy[1] !LessThan Previousdate)){document.getElementById("ctl00_ContentPlaceHolder1_imgBtnNext").disabled = false;return true;}else if( (DOBmdy[2] == PreviousYear) && (DOBmdyMonth == PreviousMonth) && (DOBmdy[1] == Previousdate)){document.getElementById("ctl00_ContentPlaceHolder1_imgBtnNext").disabled = false;
return true;}else{ var divEmailPreviewMain = document.getElementById("ctl00_ContentPlaceHolder1_divUnderAge13"); divEmailPreviewMain.style.display='block'; divEmailPreviewMain.style.visibility='visible'; divEmailPreviewMain.style.position="absolute"; divEmailPreviewMain.style.top = '400px'; divEmailPreviewMain.style.left= '350px'; document.getElementById("ctl00_ContentPlaceHolder1_imgBtnNext").disabled = true;
return false;}
return false;}
function setFocus(){if(document.getElementById("ctl00_ContentPlaceHolder1_divUnderAge13").style.display =='block') { document.getElementById("ctl00_ContentPlaceHolder1_divUnderAge13").style.display='none'; document.getElementById("ctl00_ContentPlaceHolder1_divUnderAge13").style.visibility='hidden'; }
document.getElementById("ctl00_ContentPlaceHolder1_txtDateOfBirth").focus();document.getElementById("ctl00_ContentPlaceHolder1_imgBtnNext").disabled = true;
return false;
}

Code for upload an image

Code in cs side.
First copy paste in note pad and then change [ to <>

private string SaveLocation = string.Empty; private string imgPath; public string ImagePath { get { return imgPath; } set { imgPath = value; } } protected void Page_Load(object sender, EventArgs e) { UpLoadImage();
} public void UpLoadImage() { if ((File1.PostedFile != null) && (File1.PostedFile.ContentLength > 0)) { string fn = System.IO.Path.GetFileName(File1.PostedFile.FileName); SaveLocation = Server.MapPath("UserImages") + @"\" + DateTime.Now.ToFileTimeUtc().ToString()+fn; string FileExtension = SaveLocation.Substring(SaveLocation.LastIndexOf('.')); if ((FileExtension.ToLower() == ".jpg") (FileExtension.ToLower() == ".bmp") (FileExtension.ToLower() == ".gif")) { try { File1.PostedFile.SaveAs(SaveLocation); imgPath = SaveLocation; // return SaveLocation;
lblmsg.Text = Utilitty.Messages(3); } catch { lblmsg.Text="Error:.... "; // return ""; } } else { lblmsg.Text = "Please choose bmp/jpg/gif images."; // return ""; } } else { lblmsg.Text="Please select a file to upload."; // return ""; }
}


In html side
[script language="javascript" type="text/javascript"]/*function setImage(string) {debugger ;
var index = string.lastIndexOf("."); var Extension=string.substring(index+1,(string.length)); Extension=Extension.toUpperCase(); if(Extension =="BMP" Extension=="JPEG" Extension == "GIF" Extension == "JPG") { } else { document.getElementById("FileUpload1_File1").value=' '; alert('Please select bmp/jpg/gif image'); return false; } }*/
[/script]
[table][tr][td style="width: 476px"] [input type="file" id="File1" name="File1" runat="server" style="width: 223px" /]
[/td]
[/tr][tr][td style="width: 476px"][asp:Label ID="lblmsg" runat="server"][/asp:Label][/td][/tr]
[/table]

validation on login page and div show hide

// JScript File validation for Login page
function msg() { var msgs='Please enter username / password'; return msgs; } function validation() {
var strMsg= msg(); // 1 Mail validation if (document.getElementById('txtLoginEmail').value=="") { alert(strMsg); document.getElementById('txtLoginEmail').value=""; document.getElementById('txtLoginPassword').value=""; document.getElementById('txtLoginEmail').focus(); return false; } var strEmail = document.getElementById('txtLoginEmail').value; strEmail = strEmail.toString(); var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/; if (!strEmail.match(re)) { alert("enter correct email address."); document.getElementById('txtLoginEmail').value=""; document.getElementById('txtLoginPassword').value=""; document.getElementById('txtLoginEmail').focus(); return false; } //2 LoginPassword var strValue=document.getElementById('txtLoginPassword').value; if (document.getElementById('txtLoginPassword').value=="") { alert(strMsg); document.getElementById('txtLoginPassword').value=""; document.getElementById('txtLoginPassword').focus(); return false; } } function setOpacity(e,opacity) { var o=e.style; o.opacity=(opacity/100); //Opera o.MozOpacity=(opacity/100); //Mozilla+Firefox o.KhtmlOpacity=(opacity/100); //Konqueror o.filter="alpha(opacity="+opacity+")"; //IE } function showHide() { var ContentDiv; var MainDiv; ContentDiv = document.getElementById("Div_Content"); MainDiv = document.getElementById("Main_Div"); ContentDiv.style.display='block'; ContentDiv.style.visibility='visible'; ContentDiv.style.position = "absolute"; ContentDiv.style.top =240+'px'; ContentDiv.style.left = 350+'px'; setOpacity(MainDiv, 100); document.getElementById("txtLoginPassword").disabled=true; document.getElementById("txtLoginEmail").disabled=true; document.getElementById("btnSignin").disabled=true; document.getElementById("hypLinkForgotPassword").disabled=true; return false; } function Cancel() { var ContentDiv; var MainDivo; ContentDiv = document.getElementById("Div_Content"); ContentDiv.style.display='none'; ContentDiv.style.visibility='hidden'; MainDivo = document.getElementById("Main_Div"); setOpacityFull(MainDivo, 100); document.getElementById("txtLoginPassword").disabled=false; document.getElementById("txtLoginEmail").disabled=false; document.getElementById("btnSignin").disabled=false; return false; } function setOpacityFull(E,opacity) { var o = E.style; o.opacity=(opacity/100); //Opera o.MozOpacity=(opacity/100); //Mozilla+Firefox o.KhtmlOpacity=(opacity/100); //Konqueror o.filter="alpha(opacity="+opacity+")"; //IE }

JavaScript functions As used in validation or client end

Copy paste in notepad and then read

// JScript File For Validations ( Called on page Registeration.aspx)
// Check url expression
function ChtUrl(){ var Url="^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$" var tempURL=document.getElementById("txtYourRefferedLink").value; if(tempURL.length >= 1) { var matchURL=tempURL.match(Url); if(matchURL==null) { alert("Web URL is not valid... For Example:- http://www.abcd.com"); document.getElementById("txtYourRefferedLink").value=""; document.getElementById("txtYourRefferedLink").focus(); return false; } }
}// end of function ChtUrl()
// ckh digit onlyfunction CheckNumber()
{
var key = event.keyCode;var keyStr = String.fromCharCode(key);
var keyNum = parseInt(keyStr);if(isNaN(keyNum))
{event.keyCode = '';
}
} // end chk
function msg() { var msgs='Mandatory fields cannot be left blank'; return msgs; } function validation() { debugger; var strMsg= msg(); //0 // 1 Mail validation //2 txtFirstName var strValue=document.getElementById('txtFirstName').value; if (document.getElementById('txtFirstName').value=="") { alert(strMsg); document.getElementById('txtFirstName').value=""; document.getElementById('txtFirstName').focus(); return false; } //3 txtLastName var strValue=document.getElementById('txtLastName').value; if (document.getElementById('txtLastName').value=="") { alert(strMsg); document.getElementById('txtLastName').value=""; document.getElementById('txtLastName').focus(); return false; } //4 txtScreenName var strValue=document.getElementById('txtScreenName').value; if (document.getElementById('txtScreenName').value=="") { alert(strMsg); document.getElementById('txtScreenName').value=""; document.getElementById('txtScreenName').focus(); return false; } //5 Location var strValue=document.getElementById('txtLocation').value; if (document.getElementById('txtLocation').value=="") { alert(strMsg); document.getElementById('txtLocation').value=""; document.getElementById('txtLocation').focus(); return false; } // 6 date of birth var strValue=document.getElementById('txtDateOfBirth').value; if (document.getElementById('txtDateOfBirth').value=="") { alert(strMsg); document.getElementById('txtDateOfBirth').value=""; document.getElementById('txtDateOfBirth').focus(); return false; } // 8 ddlSecQuestion var strValue=document.getElementById('ddlSecQuestion').value; if (document.getElementById('ddlSecQuestion').value=="-1") { alert(strMsg); document.getElementById('ddlSecQuestion').focus(); return false; } // 9 txtAnswer var strValue=document.getElementById('txtAnswer').value; if (document.getElementById('txtAnswer').value=="") { alert(strMsg); document.getElementById('txtAnswer').value=""; document.getElementById('txtAnswer').focus(); return false; } // 10 verificationofCode var strValue=document.getElementById('txtForVerficationOfCode').value; if (document.getElementById('txtForVerficationOfCode').value=="") { alert('Enter Verification Code'); document.getElementById('txtForVerficationOfCode').value=""; document.getElementById('txtForVerficationOfCode').focus(); return false; } }

//10
function ZipCode(){
var strZip = document.getElementById('txtZipCode').value; strZip = strZip.toString();
if ((strZip.length > 5 )) { alert('Can not exceed 5') document.getElementById('txtZipCode').value=""; document.getElementById('txtZipCode').focus(); return false;
} // fr digit only var digitonly = /^[-]?\d*\.?\d*$/; if(!strZip.match(digitonly)) { alert('Must Enter Digit') document.getElementById('txtZipCode').value=""; document.getElementById('txtZipCode').focus(); return false; } } // function for phone validations function Phone() { var strLength = document.getElementById('txtPhone1').value; if(strLength.search(/[^0-9]/) != -1) { document.getElementById('txtPhone1').value = ''; alert('Enter digit only');f return false; } strLength = strLength.toString();
if (strLength.length ==3) { // alert(strLength.length) document.getElementById('txtPhone2').focus(); return false; } } function Phone2() { var strLength = document.getElementById('txtPhone2').value; if(strLength.search(/[^0-9]/) != -1) { document.getElementById('txtPhone2').value = ''; alert('Enter digit only'); return false; } var strLength2 = document.getElementById('txtPhone2').value; strLength2 = strLength2.toString();
if (strLength2.length ==3) { // alert(strLength.length) document.getElementById('txtPhone3').focus(); return false; } } function Phone3() { var strLength = document.getElementById('txtPhone3').value; if(strLength.search(/[^0-9]/) != -1) { document.getElementById('txtPhone3').value = ''; alert('Enter digit only'); return false; } } // zip code
function ZipCode() { var strLength = document.getElementById('txtZipCode').value; if(strLength.search(/[^0-9]/) != -1) { document.getElementById('txtZipCode').value = ''; alert('Enter digit only'); return false; } } // /^[a-zA-Z]+$/ function Alphabatic() { var name=document.getElementById('txtFirstName').value; for(i=0;i=65 && name.charCodeAt(i)<=90)(name.charCodeAt(i)>=97 && name.charCodeAt(i)<=122)(name.charCodeAt(i)==32))) { alert('Alphabets only'); document.getElementById('txtFirstName').value=""; document.getElementById('txtFirstName').focus(); return false } } } function AlphabaticLasName() { var name=document.getElementById('txtLastName').value; for(i=0;i=65 && name.charCodeAt(i)<=90)(name.charCodeAt(i)>=97 && name.charCodeAt(i)<=122)(name.charCodeAt(i)==32))) { alert('Alphabates only'); document.getElementById('txtLastName').value=""; document.getElementById('txtLastName').focus(); return false } } }