DAL Example
DAL resides in appcode folder.It is a simple C# class.
Create a new folder name it appcode & now add a new C# class in it & write code for database connectivity.
//Import Required Namespace Here
public class CALLConnection
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString);
public WisemiserSMS()
{
}
#region properties
string _phoneNumber;
public string PhoneNumber { get { return _phoneNumber; } set { _phoneNumber = value; } }
int _msgId;
public int MessageId { get { return _msgId; } set { _msgId = value; } }
int _userId;
public int UserId { get { return _userId; } set { _userId = value; } }
string _messageText;
public string MessageText { get { return _messageText; } set { _messageText = value; } }
DateTime _sentTime;
public DateTime SentTime { get { return _sentTime; } set { _sentTime = value; } }
string _userName;
public string UserName { get { return _userName; } set { _userName = value; } }
string _password;
#endregion
public void sentSMSFlag()
{
openConnection();
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand("sp_smsSentFlag", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@id", this.id);
//cmd.Parameters.AddWithValue("@raiseflag", this.addedtime);
cmd.ExecuteNonQuery();
con.Close();
cmd.Dispose();
}
DAL resides in appcode folder.It is a simple C# class.
Create a new folder name it appcode & now add a new C# class in it & write code for database connectivity.
//Import Required Namespace Here
public class CALLConnection
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString);
public WisemiserSMS()
{
}
#region properties
string _phoneNumber;
public string PhoneNumber { get { return _phoneNumber; } set { _phoneNumber = value; } }
int _msgId;
public int MessageId { get { return _msgId; } set { _msgId = value; } }
int _userId;
public int UserId { get { return _userId; } set { _userId = value; } }
string _messageText;
public string MessageText { get { return _messageText; } set { _messageText = value; } }
DateTime _sentTime;
public DateTime SentTime { get { return _sentTime; } set { _sentTime = value; } }
string _userName;
public string UserName { get { return _userName; } set { _userName = value; } }
string _password;
#endregion
public void sentSMSFlag()
{
openConnection();
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand("sp_smsSentFlag", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@id", this.id);
//cmd.Parameters.AddWithValue("@raiseflag", this.addedtime);
cmd.ExecuteNonQuery();
con.Close();
cmd.Dispose();
}
}
Now we can call it in our code like this CALLConnection.sentSMSFlag()
Now we can call it in our code like this CALLConnection.sentSMSFlag()
No comments:
Post a Comment