Professional Documents
Culture Documents
net project
This is a web based application that allows registered users to store appointments in web. The
first advantage with this is they can access their appointments irrespective of the physical
location, once they have access to Internet. The other major advantage of this application is; it
notifies users about the appointments, if users want notification. The entire application is built
with .Net and used the following technologies of .Net.
Asp.Net 3.5
C# Language
GridView, FormView, TreeView, Calendar and other core controls are used for interface.
Password Recovery
Change password
Logout
Create a new project using File->New -> Project. Select Visual C# as the language and
Console Application as the type of the project.
Enter name as appointmentsadmin
using
using
using
using
using
System;
System.Data.SqlClient;
System.Data;
System.Net.Mail;
System.Threading;
namespace appointmentsadmin
{
class AppointmentsAdmin
{
static void Main(string[] args)
{
Console.WriteLine("Sending Appointment Reminders...");
Thread t = new Thread(SendMails);
t.Start();
}
public static void SendMails()
{
while (true)
{
// connect to database
SqlConnection con = new SqlConnection(@"Data
Source=.\SQLEXPRESS;AttachDbFilename=c:\appointments\app_data\ASPNETDB.M
DF;Integrated Security=True;User Instance=True");
try
{
con.Open();
SqlCommand cmd = new
SqlCommand("GetAppointmentsToNotify", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
// send mail
MailMessage m = new MailMessage();
m.To.Add(new
MailAddress(dr["email"].ToString()));
m.From = new MailAddress("admin@classroom.com");
// change from address accordingly
// 60 min
}
}
}
}
Build the project and run appointmentsadmin.exe file from bin\Debug directory. It
starts but never ends. It sends mails for every 1 hour. It uses an exclusive thread that
wakes up for every one hour and sends messages.