Free Programming Website

Free Programming Website www.sourcecodehub.com

Tuesday, August 12, 2014

Appointments Scheduler free asp.net project with source codes

Appointments Scheduler  free asp.net project with source codes

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
  • SQL Server 2005
  • Visual Studio.NET 2008
  • Layered Architecture with Presentation Layer and Data Access Layer
  • All database manipulations are done with stored procedures.
  • Stored procedures are accessed using classes in DAL.
  • ObjectDataSource is used in presentation layer to talk to DAL.
  • GridView, FormView, TreeView, Calendar and other core controls are used for interface.
  • Membership and login controls are used to implement security.
  • Master page and themes are used
  • Site navigation is done using Site Map.
  • ADO.NET is used to access database
The following are the major operations in this application.
  • User Registration
  • Login
  • Password Recovery
  • Change password
  • List of upcoming appointments
  • Adding a new appointment
  • Searching for appointments
  • List of all appointments
  • List of appointments by date
  • List of users of the system
  • Deleting an existing appointment
  • Editing details of an existing appointment
  • Logout

Steps to download, deploy and run this project

The following are the steps to be taken to run the existing part of the application. This project makes use of membership feature of ASP.NET. The download contains all tables and stored procedures created by us as well as Asp.net. So all that you have to do is download, unzip, open project in Visual Studio.Net and run login.aspx file. Here are the steps given below:
  1. Download appointments.rar and unzip it into any directory in your system. For example, if you extract to c:\ then it will create a directory c:\appointments.
  2. Open Visual Studio.NET 2008 or Visual Web Developer 2008.
  3. Open the project from the directory into which you extracted project. For example, c:\appointments
  4. Go to Solution Explorer and make login.aspx the startup page.
  5. Run project from Visual Studio.NET 2008 or Visual Web Developer 2008.
  6. You should see login.aspx page.
  7. Create new user using registration page and then login with that user name
  8. Test the rest of the options.

Appointments Administrator Application

The other application that is related to this requirement is notification application, which is run for every one hour. It finds out whether there are any appointments that need notification and sends mails to concerned users. Here are the steps related to this project.
  • 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
  • Rename Program.cs to AppointmentsAdmin.cs and Program class to AppointmentsAdmin
  • Write the following code in Main() method of AppointmentsAdmin class
    // program assumes database ASPNETDB.MDF at  c:\appointments\app_data folder. If that is not the case, change the path in the code.
    // It expects database to have GetAppointmentsToNotify stored
    procedure, which retrieves appointments that are to be notified.
    
    using System;
    using System.Data.SqlClient;
    using System.Data;
    using System.Net.Mail;
    using 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.MDF;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
                            m.Subject = "Appointment Reminder";
                            m.IsBodyHtml = true;
                            m.Body = "Hi" + dr["username"] + "<p/> This is to remind you about the following appointment.<p/>"
                                   + "Title : " + dr["title"] + "<p/>" + "Appointment Date : " + dr["appdate"] + "<p/>Admin,<br/> Appointments.Com";
                            SmtpClient server = new SmtpClient("classroom");  // change server name accordingly
                            try
                            {
                                server.Send(m);
                            }
                            catch(Exception ex)
                            {
                                Console.WriteLine("Could not send mail to " + dr["email"]);
                            }
    
                        }
                        dr.Close();
                        con.Close();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        break;
                    }
                    Console.WriteLine("Sent reminders at : " + DateTime.Now);
                    Thread.Sleep(1000 * 60 * 60);  // 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.