Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/CGAppointment.cs
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/CGAppointment.cs	(revision 1104)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/CGAppointment.cs	(revision 1106)
@@ -303,4 +303,6 @@
             }
         }
+
+        public Patient Patient { get; set; }
     }
 }
Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs	(revision 1104)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs	(revision 1106)
@@ -8,4 +8,5 @@
 using IndianHealthService.BMXNet;
 using System.Linq;
+using System.Collections.Generic;
 
 namespace IndianHealthService.ClinicalScheduling
@@ -321,5 +322,5 @@
         }
 
-        public void OnOpenDocument()
+        public void OnOpenDocument(DateTime dDate)
         {
             try
@@ -328,7 +329,5 @@
                 m_ScheduleType = (m_sResourcesArray.Count == 1) ? ScheduleType.Resource : ScheduleType.Clinic;
                 bool bRet = false;
-
-                //Set initial From and To dates based on current day
-                DateTime dDate = DateTime.Today;
+                
                 if (m_ScheduleType == ScheduleType.Resource)
                 {
@@ -396,24 +395,7 @@
         private bool RefreshSchedule()
         {
-            try
-            {
-                bool bRet = this.RefreshAvailabilitySchedule();
-                if (bRet == false)
-                {
-                    return bRet;
-                }
-                bRet = this.RefreshDaysSchedule();
-                return bRet;
-            }
-            catch (ApplicationException aex)
-            {
-                Debug.Write("CGDocument.RefreshSchedule Application Error:  " + aex.Message + "\n");
-                return false;
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show("CGDocument.RefreshSchedule error:  " + ex.Message + "\n");
-                return false;
-            }
+            this.RefreshAvailabilitySchedule();
+            this.RefreshDaysSchedule();
+            return true;
         }
 
@@ -637,12 +619,13 @@
         /// <param name="sAvailabilityMessage">Out: Access Note</param>
         /// <returns>Number of slots</returns>
-        public int SlotsAvailable(DateTime dSelStart, DateTime dSelEnd, string sResource, out string sAccessType, out string sAvailabilityMessage)
-        {
-
-
-            sAccessType = "";               //default out value
-            sAvailabilityMessage = "";      //default out value
+        public int SlotsAvailable(DateTime dSelStart, DateTime dSelEnd, string sResource, int viewTimeScale, out CGAvailability resultantAV)
+        {
+
+            resultantAV = null;
 
             double slotsAvailable = 0;      //defalut return value
+
+            double effectiveSlotsAvailable = 0;    //Slots available based on the time scale.
+
 
             //NOTE: What's this lock? This lock makes sure that nobody is editing the availability array
@@ -660,28 +643,83 @@
             {
                 //This foreach loop looks for an availability that overlaps where the user clicked.
-                //There can only be one, as availabilites cannot overlap each other (enforced at the DB level)
+                //Availabilites cannot overlap each other (enforced at the DB level)
                 //If selection hits multiple blocks, get the block with the most slots (reflected by the sorting here)
-                CGAvailability[] pAVs = (from pAV in this.m_pAvArray.Cast<CGAvailability>()
-                                         where (sResource == pAV.ResourceList && CalendarGrid.TimesOverlap(dSelStart, dSelEnd, pAV.StartTime, pAV.EndTime))
-                                         orderby pAV.Slots descending
-                                         select pAV)
-                                         .ToArray<CGAvailability>();
-
-                if ((pAVs.Length) == 0) return 0;
-
-                slotsAvailable = pAVs[0].Slots;
-                sAccessType = pAVs[0].AccessTypeName;
-                sAvailabilityMessage = pAVs[0].Note;
-
+                List<CGAvailability> lstAV = (from avail in this.m_pAvArray.Cast<CGAvailability>()
+                           where (sResource == avail.ResourceList && CalendarGrid.TimesOverlap(dSelStart, dSelEnd, avail.StartTime, avail.EndTime))
+                           select avail).ToList();
+
+                //if we don't have any availabilities, then return with zero slots.
+                if (lstAV.Count == 0) return 0;
+                
+                CGAvailability pAV;
+
+                //if there is just one, that's it.
+                if (lstAV.Count == 1) pAV = lstAV.First();
+                //otherwise...
+                else
+                {
+                    //if availabilities are contigous to each other, need to join them together.
+
+                    //First, are they the same?
+                    string firsttype = lstAV.First().AccessTypeName;
+                    bool bAllSameType = lstAV.All(av => av.AccessTypeName == firsttype);
+
+                    //Second are they ALL contigous?
+                    DateTime lastEndTime = DateTime.Today; //bogus value to please compiler who wants it assigned.
+                    int index = 0;
+
+                    bool bContigous = lstAV.OrderBy(av => av.StartTime)
+                       .All(av =>
+                       {
+                           index++;
+                           if (index == 1)
+                           {
+                               lastEndTime = av.EndTime;
+                               return true;
+                           }
+                           if (av.StartTime == lastEndTime)
+                           {
+                               lastEndTime = av.EndTime;
+                               return true;
+                           }
+
+                           return false;
+                       });
+
+
+
+                    if (bContigous && bAllSameType)
+                    {
+                        var enumAVOrdered = lstAV.OrderBy(av => av.StartTime);
+
+                        pAV = new CGAvailability
+                        {
+                            StartTime = enumAVOrdered.First().StartTime,
+                            EndTime = enumAVOrdered.Last().EndTime,
+                            Slots = enumAVOrdered.Sum(av => av.Slots),
+                            AccessTypeName = enumAVOrdered.First().AccessTypeName,
+                            Note = enumAVOrdered.First().Note
+                        };
+                    }
+                    else
+                    {
+                        pAV = lstAV.OrderByDescending(av => av.Slots).First();
+                    }
+                }
+
+                resultantAV = pAV; // out var
+                
+                slotsAvailable = pAV.Slots;
+                
                 //Subtract total slots current appointments take up.
                 slotsAvailable -= (from appt in this.Appointments.AppointmentTable.Values.Cast<CGAppointment>()
                                    //If the resource is the same and the user selection overlaps, then...
-                                   where (sResource == appt.Resource && CalendarGrid.TimesOverlap(pAVs[0].StartTime, pAVs[0].EndTime, appt.StartTime, appt.EndTime))
+                                   where (sResource == appt.Resource && CalendarGrid.TimesOverlap(pAV.StartTime, pAV.EndTime, appt.StartTime, appt.EndTime))
                                    // if appt starttime is before avail start time, only count against the avail starting from the availability start time
-                                   let startTimeToCountAgainstBlock = appt.StartTime < pAVs[0].StartTime ? pAVs[0].StartTime : appt.StartTime
+                                   let startTimeToCountAgainstBlock = appt.StartTime < pAV.StartTime ? pAV.StartTime : appt.StartTime
                                    // if appt endtime is after the avail ends, only count against the avail up to where the avail ends
-                                   let endTimeToCountAgainstBlock = appt.EndTime > pAVs[0].EndTime ? pAVs[0].EndTime : appt.EndTime
+                                   let endTimeToCountAgainstBlock = appt.EndTime > pAV.EndTime ? pAV.EndTime : appt.EndTime
                                    // theoretical minutes per slot for the availability
-                                   let minPerSlot = (pAVs[0].EndTime - pAVs[0].StartTime).TotalMinutes / pAVs[0].Slots
+                                   let minPerSlot = (pAV.EndTime - pAV.StartTime).TotalMinutes / pAV.Slots
                                    // how many minutes does this appointment take away from the slot
                                    let minPerAppt = (endTimeToCountAgainstBlock - startTimeToCountAgainstBlock).TotalMinutes
@@ -691,7 +729,15 @@
                                    // add up SlotsConsumed to substract from slotsAvailable
                                    .Sum();
-            }
-
-            return (int)slotsAvailable;
+
+                //theoretical minutes per slot for the availability
+                double minPerSlot2 = (pAV.EndTime - pAV.StartTime).TotalMinutes / pAV.Slots;
+                
+                //Convert it to the view's time scale.
+                effectiveSlotsAvailable = (minPerSlot2 / viewTimeScale) * slotsAvailable;
+
+            }
+            
+            //round it down.
+            return (int)effectiveSlotsAvailable;
 
             /* OLD ALGOTHRIM 2
Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs	(revision 1104)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs	(revision 1106)
@@ -410,5 +410,12 @@
                     {
                         bRetry = true;
-                        _current.m_ConnectInfo.ChangeServerInfo();
+                        //I hate this, but this is how the library is designed. It throws an error if the user cancels. XXX: Won't fix library until BMX 4.0 port.
+                        try { _current.m_ConnectInfo.ChangeServerInfo(); }
+                        catch (Exception) 
+                        {
+                            closeSplashDelegate();
+                            bRetry = false;
+                            return false; //tell main that it's a no go.
+                        }
                     }
                     else
Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs	(revision 1104)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs	(revision 1106)
@@ -617,10 +617,11 @@
             this.tvSchedules.Location = new System.Drawing.Point(0, 0);
             this.tvSchedules.Name = "tvSchedules";
-            this.tvSchedules.Size = new System.Drawing.Size(128, 358);
+            this.tvSchedules.Size = new System.Drawing.Size(128, 393);
             this.tvSchedules.Sorted = true;
             this.tvSchedules.TabIndex = 1;
             this.tvSchedules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSchedules_AfterSelect);
-            this.tvSchedules.Click += new System.EventHandler(this.tvSchedules_Click);
+            this.tvSchedules.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvSchedules_NodeMouseClick);
             this.tvSchedules.DoubleClick += new System.EventHandler(this.tvSchedules_DoubleClick);
+            this.tvSchedules.MouseEnter += new System.EventHandler(this.tvSchedules_MouseEnter);
             // 
             // contextMenu1
@@ -662,7 +663,7 @@
             this.panelRight.Controls.Add(this.panelClip);
             this.panelRight.Dock = System.Windows.Forms.DockStyle.Right;
-            this.panelRight.Location = new System.Drawing.Point(941, 0);
+            this.panelRight.Location = new System.Drawing.Point(996, 0);
             this.panelRight.Name = "panelRight";
-            this.panelRight.Size = new System.Drawing.Size(128, 358);
+            this.panelRight.Size = new System.Drawing.Size(128, 393);
             this.panelRight.TabIndex = 3;
             this.panelRight.Visible = false;
@@ -730,5 +731,5 @@
             this.panelTop.Location = new System.Drawing.Point(128, 0);
             this.panelTop.Name = "panelTop";
-            this.panelTop.Size = new System.Drawing.Size(813, 24);
+            this.panelTop.Size = new System.Drawing.Size(868, 24);
             this.panelTop.TabIndex = 6;
             // 
@@ -737,5 +738,5 @@
             this.dateTimePicker1.Dock = System.Windows.Forms.DockStyle.Right;
             this.dateTimePicker1.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right;
-            this.dateTimePicker1.Location = new System.Drawing.Point(607, 0);
+            this.dateTimePicker1.Location = new System.Drawing.Point(662, 0);
             this.dateTimePicker1.Name = "dateTimePicker1";
             this.dateTimePicker1.Size = new System.Drawing.Size(206, 20);
@@ -760,5 +761,5 @@
             this.panelCenter.Location = new System.Drawing.Point(136, 24);
             this.panelCenter.Name = "panelCenter";
-            this.panelCenter.Size = new System.Drawing.Size(802, 310);
+            this.panelCenter.Size = new System.Drawing.Size(857, 345);
             this.panelCenter.TabIndex = 7;
             // 
@@ -846,7 +847,7 @@
             this.panelBottom.Controls.Add(this.statusBar1);
             this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
-            this.panelBottom.Location = new System.Drawing.Point(136, 334);
+            this.panelBottom.Location = new System.Drawing.Point(136, 369);
             this.panelBottom.Name = "panelBottom";
-            this.panelBottom.Size = new System.Drawing.Size(802, 24);
+            this.panelBottom.Size = new System.Drawing.Size(857, 24);
             this.panelBottom.TabIndex = 8;
             // 
@@ -856,5 +857,5 @@
             this.statusBar1.Location = new System.Drawing.Point(0, 0);
             this.statusBar1.Name = "statusBar1";
-            this.statusBar1.Size = new System.Drawing.Size(802, 24);
+            this.statusBar1.Size = new System.Drawing.Size(857, 24);
             this.statusBar1.SizingGrip = false;
             this.statusBar1.TabIndex = 0;
@@ -864,5 +865,5 @@
             this.splitter1.Location = new System.Drawing.Point(128, 24);
             this.splitter1.Name = "splitter1";
-            this.splitter1.Size = new System.Drawing.Size(8, 334);
+            this.splitter1.Size = new System.Drawing.Size(8, 369);
             this.splitter1.TabIndex = 9;
             this.splitter1.TabStop = false;
@@ -871,7 +872,7 @@
             // 
             this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
-            this.splitter2.Location = new System.Drawing.Point(938, 24);
+            this.splitter2.Location = new System.Drawing.Point(993, 24);
             this.splitter2.Name = "splitter2";
-            this.splitter2.Size = new System.Drawing.Size(3, 334);
+            this.splitter2.Size = new System.Drawing.Size(3, 369);
             this.splitter2.TabIndex = 10;
             this.splitter2.TabStop = false;
@@ -901,5 +902,5 @@
             this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources")));
             this.calendarGrid1.SelectedAppointment = 0;
-            this.calendarGrid1.Size = new System.Drawing.Size(802, 310);
+            this.calendarGrid1.Size = new System.Drawing.Size(857, 345);
             this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
             this.calendarGrid1.TabIndex = 0;
@@ -914,5 +915,5 @@
             // 
             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
-            this.ClientSize = new System.Drawing.Size(1069, 358);
+            this.ClientSize = new System.Drawing.Size(1124, 393);
             this.Controls.Add(this.panelCenter);
             this.Controls.Add(this.panelBottom);
@@ -946,5 +947,4 @@
 		private CGDocumentManager	m_DocManager;
 		private int					m_nSlots;
-		bool						bSchedulesClicked = false;
 		private ArrayList			m_alSelectedTreeResourceArray = new ArrayList();
 		private string				m_sDocName;
@@ -1360,28 +1360,31 @@
 		}
 
-		void UpdateStatusBar(DateTime dStart, DateTime dEnd, string sAccessType, string sAvailabilityMessage)
-		{
-			string sMsg =  dStart.ToShortTimeString() + " to " + dEnd.ToShortTimeString();
-			if (m_nSlots > 0)
-			{
-				sMsg = sMsg + ": " + m_nSlots.ToString() + " slot";
-				sMsg = sMsg + ((m_nSlots > 1)?"s " : " ");
-				sMsg = sMsg + "available";
-				if (sAccessType != "")
-				{
-					sMsg = sMsg + " for " + sAccessType;
-				}
-				sMsg = sMsg + ".";
-				if (sAvailabilityMessage != "")
-				{
-					sMsg = sMsg + "  Note: " + sAvailabilityMessage;
-				}
-			}
+		void UpdateStatusBar(DateTime dStart, DateTime dEnd, CGAvailability av)
+		{
+            System.Text.StringBuilder sbMsg = new System.Text.StringBuilder(100);
+		    sbMsg.Append(dStart.ToShortTimeString() + " to " + dEnd.ToShortTimeString());
+			if (av != null && m_nSlots > 0)
+			{
+                sbMsg.Append(String.Format(" has {0} slot(s) available for {1}. ", m_nSlots.ToString(), av.AccessTypeName));
+            }
 			else
 			{
-				sMsg += ": No appointment slots available.";
-			}
-
-			this.statusBar1.Text = sMsg;
+				sbMsg.Append(": No appointment slots available. ");
+			}
+
+            if (av != null)
+            {
+                sbMsg.Append(String.Format("Source Block: {0} to {1} with {2} slot(s) of type {3}",
+                    av.StartTime.ToShortTimeString(),
+                    av.EndTime.ToShortTimeString(),
+                    av.Slots.ToString(),
+                    av.AccessTypeName));
+
+                sbMsg.Append(". ");
+
+                if (av.Note.Trim().Length > 0) sbMsg.Append("Note: " + av.Note + ".");
+            }
+
+            this.statusBar1.Text = sbMsg.ToString();
 		}
 
@@ -1475,4 +1478,5 @@
 				v.Activate();
 				v.dateTimePicker1.Value = dDate;
+                v.RequestRefreshGrid();
                 return;
 			}
@@ -1507,5 +1511,5 @@
             try
 			{
-				doc.OnOpenDocument();
+				doc.OnOpenDocument(dDate);
 			}
 				
@@ -1638,5 +1642,5 @@
 			try
 			{
-				doc.OnOpenDocument();
+				doc.OnOpenDocument(DateTime.Today);
 			}
 			catch (Exception ex)
@@ -2046,7 +2050,7 @@
                 //SMH: Takes too long to do.
 				//this.Document.RefreshDocument();
-				string sAccessType = "";
-				string sAvailabilityMessage = "";
-				m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);
+                CGAvailability resultantAvail;
+
+				m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, this.calendarGrid1.TimeScale, out resultantAvail);
 
 				if (m_nSlots < 1)
@@ -2155,14 +2159,8 @@
 				}
 				
-				TimeSpan tsDuration = dEnd - dStart;
-				int nDuration = (int) tsDuration.TotalMinutes;
-				Debug.Assert(nDuration > 0);
-
-
                 //Sam: takes too long. Remove this call; deal with the issue of concurrent appointments another way.
                 //this.Document.RefreshDocument();
-				string sAccessType = "";
-				string sAvailabilityMessage = "";
-				m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);
+                CGAvailability resultantAvail;
+                m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, this.calendarGrid1.TimeScale, out resultantAvail);
 
 				if (m_nSlots < 1)
@@ -2192,5 +2190,5 @@
 				dAppt.DocManager = this.m_DocManager;
 				string sNote = "";
-				dAppt.InitializePage(dPat.PatientIEN, dStart, nDuration, sResource, sNote);
+                dAppt.InitializePage(dPat.PatientIEN, dStart, dEnd, sResource, sNote, nAccessTypeID);
 
 				if (dAppt.ShowDialog(this) == DialogResult.Cancel)
@@ -2199,5 +2197,8 @@
 				}
 
-                CGAppointment appt = new CGAppointment();
+                CGAppointment appt = dAppt.Appointment;
+                    
+                // old way of making an appointment
+                    /*new CGAppointment();
 				appt.PatientID = Convert.ToInt32(dPat.PatientIEN);
 				appt.PatientName = dPat.PatientName;
@@ -2208,7 +2209,16 @@
 				appt.HealthRecordNumber = dPat.HealthRecordNumber;
 				appt.AccessTypeID = nAccessTypeID;
+                    */
 
 				//Call Document to add a new appointment. Document adds appointment to CGAppointments array.
 				this.Document.CreateAppointment(appt);
+
+                //Experimental now.
+                if (dAppt.PrintAppointmentSlip)
+                {
+                    System.Drawing.Printing.PrintDocument pd = new System.Drawing.Printing.PrintDocument();
+                    pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintAppointmentSlip(appt, e);
+                    pd.Print();
+                }
 
                 //Show the new set of appointments by calling UpdateArrays. Fetches Document's CGAppointments
@@ -2505,4 +2515,15 @@
                 calendarGrid1.Focus();
         }
+
+        /// <summary>
+        /// If mouse enters the Tree Section, check if the grid is on the active form first before stealing the focus
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void tvSchedules_MouseEnter(object sender, EventArgs e)
+        {
+            if (GetActiveWindow() == this.Handle)
+                tvSchedules.Focus();
+        }
         
         private void CGView_Load(object sender, System.EventArgs e)
@@ -2520,4 +2541,7 @@
             //Show the Form
             this.Activate();
+
+            //Set focus on the calendar grid
+            this.calendarGrid1.Focus();
 		}
 
@@ -2592,8 +2616,5 @@
 		}
 
-		private void tvSchedules_Click(object sender, System.EventArgs e)
-		{
-			bSchedulesClicked = true;
-		}
+
 
 		private void tvSchedules_DoubleClick(object sender, System.EventArgs e)
@@ -2636,10 +2657,7 @@
         }
 
+
 		private void tvSchedules_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
-		{
-			if (bSchedulesClicked == false)
-				return;
-			bSchedulesClicked = false;
-			
+		{	
 			m_alSelectedTreeResourceArray = new ArrayList();
 			string sResource = e.Node.FullPath;
@@ -2662,4 +2680,20 @@
 		}
 
+        /// <summary>
+        /// Makes sure that the node gets selected no matter where we click.
+        /// Incidentally, Invokes AfterSelect event.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void tvSchedules_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
+        {
+            e.Node.TreeView.SelectedNode = e.Node;
+        }
+
+        /// <summary>
+        /// Useless code now... Good place to test something.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
 		private void mnuTest1_Click(object sender, System.EventArgs e)
 		{
@@ -2718,8 +2752,7 @@
 		private void calendarGrid1_CGSelectionChanged(object sender, IndianHealthService.ClinicalScheduling.CGSelectionChangedArgs e)
 		{
-			string sAccessType = "";
-			string sAvailabilityMessage = "";
-			m_nSlots = m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage);
-			UpdateStatusBar(e.StartTime, e.EndTime, sAccessType, sAvailabilityMessage);
+            CGAvailability resultantAvail;
+            m_nSlots = m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail);
+			UpdateStatusBar(e.StartTime, e.EndTime, resultantAvail);
 		}
 
@@ -2758,6 +2791,4 @@
 
 				//20040909 Cherokee Replaced this block with following
-				string sAccessType = "";
-				string sAvailabilityMessage = "";
 				//				if (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) < 1)
 				//				{
@@ -2775,5 +2806,6 @@
 					bModSchedule =  (bool) this.m_htModifySchedule[e.Resource.ToString()];
 				}
-				bool bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0);
+                CGAvailability resultantAvail;
+                bool bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail) > 0);
 				if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) ))
 				{
@@ -2966,6 +2998,4 @@
 			try
 			{
-				string sAccessType = "";
-				string sAvailabilityMessage = "";
 				bool	bSlotsAvailable;
 				bool	bOverbook;
@@ -2990,5 +3020,7 @@
 				bOverbook = (bool) this.m_htOverbook[e.Resource.ToString()];
 				bModSchedule =  (bool) this.m_htModifySchedule[e.Resource.ToString()];
-				bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0);
+                CGAvailability resultantAvail;
+
+                bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail) > 0);
 
 				if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) ))
@@ -3339,4 +3371,8 @@
         }
 
+
+
+
+
         
 
Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/CalendarGrid.cs
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/CalendarGrid.cs	(revision 1104)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/CalendarGrid.cs	(revision 1106)
@@ -24,5 +24,5 @@
         private bool m_bDrawWalkIns = true;
         private bool m_bGridEnter;
-        private bool m_bInitialUpdate;
+        //private bool m_bInitialUpdate;
         private bool m_bMouseDown;
         private bool m_bScroll;
@@ -49,9 +49,11 @@
         private StringFormat m_sfRight;
         private ArrayList m_sResourcesArray;
-        private Timer m_Timer;                  // Timeer used in Drag and Drop Operations
+        private Timer m_Timer;                  // Timer used in Drag and Drop Operations
         private ToolTip m_toolTip;
         private const int WM_HSCROLL = 0x114;       // Horizontal Scrolling Windows Message
         private const int WM_VSCROLL = 0x115;       // Vertical Scrolling Windows Message
         private const int WM_MOUSEWHEEL = 0x20a;    // Windows Mouse Scrolling Message
+        private System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
+
 
         public delegate void CGAppointmentChangedHandler(object sender, CGAppointmentChangedArgs e);
@@ -90,5 +92,5 @@
             this.m_sfHour.LineAlignment = StringAlignment.Center;
             this.m_sfHour.Alignment = StringAlignment.Far;
-            this.m_bInitialUpdate = false;
+            // this.m_bInitialUpdate = false;
         }
 
@@ -113,4 +115,5 @@
             {
                 this.m_Timer.Stop();
+                this.m_Timer.Tick -= new EventHandler(this.tickEventHandler);
                 this.m_Timer.Dispose();
                 this.m_Timer = null;
@@ -232,4 +235,5 @@
         private void CalendarGrid_MouseDown(object sender, MouseEventArgs e)
         {
+            //watch.Restart();
             if (e.Button == MouseButtons.Left)
             {
@@ -247,13 +251,23 @@
         private void CalendarGrid_MouseMove(object Sender, MouseEventArgs e)
         {
+            //test
+            //System.Diagnostics.Debug.Write(watch.ElapsedMilliseconds + "\n");
+            //test
+
+            //if the left mouse button is down and we are moving the mouse...
             if (this.m_bMouseDown)
             {
+                //if Y axis is outside the top or bottom
                 if ((e.Y >= base.ClientRectangle.Bottom) || (e.Y <= base.ClientRectangle.Top))
                 {
+                    //start auto scrolling. m_bScrollDown decides whether we scroll up or down.
                     this.m_bScrollDown = e.Y >= base.ClientRectangle.Bottom;
-                }
+                    AutoDragStart();
+                }
+
+                //if Y axis within client rectagle, stop dragging (whether you started or not)
                 if ((e.Y < base.ClientRectangle.Bottom) && (e.Y > base.ClientRectangle.Top))
                 {
-                    bool bAutoDrag = this.m_bAutoDrag;
+                    AutoDragStop();
                 }
                 if (this.m_bSelectingRange)
@@ -278,4 +292,7 @@
             else
             {
+                //test
+                AutoDragStop(); //is this needed?
+                //test
                 int y = e.Y - base.AutoScrollPosition.Y;
                 int x = e.X - base.AutoScrollPosition.X;
@@ -348,4 +365,5 @@
             {
                 this.DrawGrid(e.Graphics);
+                /*
                 if (!this.m_bInitialUpdate)
                 {
@@ -354,4 +372,5 @@
                     this.m_bInitialUpdate = true;
                 }
+                 */
             }
         }
@@ -602,7 +621,11 @@
                         if (this.m_sResourcesArray.Count > 0)
                         {
+                            //IMP
+                            //this is the place where we the selected cells are drawn in Light Light Blue.
+                            //IMP
                             if (this.m_selectedRange.CellIsInRange(cellFromRowCol))
                             {
                                 g.FillRectangle(Brushes.Aquamarine, r);
+                                //g.FillRectangle(Brushes.AntiqueWhite, r);
                             }
                             else
@@ -1142,10 +1165,18 @@
         }
 
+        /// <summary>
+        /// Handles scrolling when the mouse button is down
+        /// </summary>
+        /// <param name="o"></param>
+        /// <param name="e"></param>
         private void tickEventHandler(object o, EventArgs e)
         {
+            //if there are still WM_TIME messages in the Queue after the timer is dead, don't do anything.
+            if (this.m_Timer == null) return;
+
             Point point = new Point(base.AutoScrollPosition.X, base.AutoScrollPosition.Y);
             int x = point.X;
             int num = point.Y * -1;
-            num = this.m_bScrollDown ? (num + 5) : (num - 5);
+            num = this.m_bScrollDown ? (num + 2) : (num - 2);
             point.Y = num;
             base.AutoScrollPosition = point;
Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj	(revision 1104)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj	(revision 1106)
@@ -302,4 +302,5 @@
     </Compile>
     <Compile Include="Options.cs" />
+    <Compile Include="Patient.cs" />
     <Compile Include="Printing.cs" />
     <Compile Include="UCPatientAppts.cs">
Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.sln
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.sln	(revision 1104)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.sln	(revision 1106)
@@ -11,10 +11,10 @@
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.ActiveCfg = Release|Any CPU
-		{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.Build.0 = Release|Any CPU
+		{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Release|Any CPU.Build.0 = Release|Any CPU
-		{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.ActiveCfg = Release|Any CPU
-		{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.Build.0 = Release|Any CPU
+		{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Release|Any CPU.Build.0 = Release|Any CPU
Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/CustomPrinting.cs
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/CustomPrinting.cs	(revision 1104)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/CustomPrinting.cs	(revision 1106)
@@ -112,5 +112,36 @@
             }
         }
-       
+
+        /// <summary>
+        /// Prints a single appointment slip to give to the patient
+        /// </summary>
+        /// <param name="appt">The Appointment to print</param>
+        /// <param name="e">PrintPageEventArgs from PrintDocument Print handler</param>
+        public virtual void PrintAppointmentSlip(CGAppointment appt, PrintPageEventArgs e)
+        {
+            Rectangle printArea = e.MarginBounds;
+            Graphics g = e.Graphics;
+            StringFormat sf = new StringFormat();
+            sf.Alignment = StringAlignment.Center; //for title
+            Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title
+            Font fBody = new Font(FontFamily.GenericSerif, 12);
+            string s = "Appointment Reminder Slip";
+            g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
+
+            // move down
+            int titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height;
+            printArea.Y += titleHeight;
+            printArea.Height -= titleHeight;
+
+            // draw underline
+            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
+            printArea.Y += 15;
+            printArea.Height -= 15;
+
+
+
+        }
+
+
         /// <summary>
         /// Print Letter to be given or mailed to the patient
Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.cs
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.cs	(revision 1104)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.cs	(revision 1106)
@@ -63,4 +63,5 @@
         private Label label7;
         private TextBox txtCountry;
+        private CheckBox chkPrint;
         private IContainer components;
 
@@ -125,4 +126,5 @@
             this.dsPatientApptDisplay2BindingSource = new System.Windows.Forms.BindingSource(this.components);
             this.dsPatientApptDisplay2 = new IndianHealthService.ClinicalScheduling.dsPatientApptDisplay2();
+            this.chkPrint = new System.Windows.Forms.CheckBox();
             this.tabControl1.SuspendLayout();
             this.tabAppointment.SuspendLayout();
@@ -532,4 +534,5 @@
             // panel1
             // 
+            this.panel1.Controls.Add(this.chkPrint);
             this.panel1.Controls.Add(this.cmdCancel);
             this.panel1.Controls.Add(this.cmdOK);
@@ -573,4 +576,14 @@
             this.dsPatientApptDisplay2.DataSetName = "dsPatientApptDisplay2";
             this.dsPatientApptDisplay2.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
+            // 
+            // chkPrint
+            // 
+            this.chkPrint.AutoSize = true;
+            this.chkPrint.Location = new System.Drawing.Point(13, 14);
+            this.chkPrint.Name = "chkPrint";
+            this.chkPrint.Size = new System.Drawing.Size(144, 17);
+            this.chkPrint.TabIndex = 2;
+            this.chkPrint.Text = "Print Appointment Letter";
+            this.chkPrint.UseVisualStyleBackColor = true;
             // 
             // DAppointPage
@@ -596,4 +609,5 @@
             this.groupBox2.PerformLayout();
             this.panel1.ResumeLayout(false);
+            this.panel1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.patientApptsBindingSource)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.dsPatientApptDisplay2BindingSource)).EndInit();
@@ -611,5 +625,5 @@
 		private string			m_sPatientHRN;
 		private string			m_sPatientIEN;
-		private string			m_sPatientDOB;
+		private DateTime		m_dPatientDOB;
 		private string			m_sPatientPID;
 
@@ -623,4 +637,5 @@
 		private string			m_sNote;
 		private	DateTime		m_dStartTime;
+        private DateTime        m_dEndTime;
 		private int				m_nDuration;
 		private string			m_sClinic;
@@ -629,4 +644,5 @@
         private string          m_sEmail;
         private string          m_sCountry;
+        private int          m_iAccessTypeID;
 
 		#endregion //fields
@@ -636,11 +652,13 @@
 		public void InitializePage(CGAppointment a)
 		{
-			InitializePage(a.PatientID.ToString(), a.StartTime, a.Duration, "", a.Note);
+			InitializePage(a.PatientID.ToString(), a.StartTime, a.EndTime, "", a.Note, a.AccessTypeID);
 		}
 
-		public void InitializePage(string sPatientIEN, DateTime dStart, int nDuration, string sClinic, string sNote)
+		public void InitializePage(string sPatientIEN, DateTime dStart, DateTime dEnd, string sClinic, string sNote, int iAccessTypeID)
 		{
 			m_dStartTime = dStart;
-			m_nDuration = nDuration;
+            m_dEndTime = dEnd;
+			m_nDuration = (int)(dEnd - dStart).TotalMinutes;
+            m_iAccessTypeID = iAccessTypeID;
 			m_sClinic = sClinic;
 			m_sPatientIEN = sPatientIEN;
@@ -659,6 +677,5 @@
 				this.m_sPatientIEN = r["IEN"].ToString();
                 this.m_sPatientPID = r["PID"].ToString();
-				DateTime dDob =(DateTime) r["DOB"]; //what if it's null?
-				this.m_sPatientDOB = dDob.ToShortDateString();
+				this.m_dPatientDOB = (DateTime) r["DOB"];
 				this.m_sStreet = r["STREET"].ToString();
 				this.m_sCity = r["CITY"].ToString();
@@ -695,5 +712,5 @@
 
 				txtCity.Text = this.m_sCity;
-				txtDOB.Text = this.m_sPatientDOB;
+				txtDOB.Text = this.m_dPatientDOB.ToShortDateString();
 				txtHRN.Text = this.m_sPatientHRN;
 				txtNote.Text = this.m_sNote;
@@ -767,4 +784,48 @@
 		}
 
+        public bool PrintAppointmentSlip
+        {
+            get { return chkPrint.Checked; }
+        }
+
+        public CGAppointment Appointment
+        {
+            get
+            {
+                Patient pt = new Patient
+                {
+                    DFN = Int32.Parse(m_sPatientIEN),
+                    Name = m_sPatientName,
+                    DOB = m_dPatientDOB,
+                    ID = m_sPatientPID,
+                    HRN = m_sPatientHRN,
+                    Appointments = null, //for now
+                    Street = m_sStreet,
+                    City = m_sCity,
+                    State = m_sState,
+                    Zip = m_sZip,
+                    Country = m_sCountry,
+                    Email = m_sEmail,
+                    HomePhone = m_sPhoneHome,
+                    WorkPHone = m_sPhoneOffice,
+                    CellPhone = m_sPhoneCell
+                };
+
+                CGAppointment appt = new CGAppointment()
+                {
+                    PatientID = Convert.ToInt32(m_sPatientIEN),
+                    PatientName = m_sPatientName,
+                    StartTime = m_dStartTime,
+                    EndTime = m_dEndTime,
+                    Resource = m_sClinic,
+                    Note = m_sNote,
+                    HealthRecordNumber = m_sPatientHRN,
+                    AccessTypeID = m_iAccessTypeID,
+                    Patient = pt
+                };
+
+                return appt;
+            }
+        }
 		#endregion //Properties
 
Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.resx
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.resx	(revision 1104)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.resx	(revision 1106)
@@ -113,16 +113,16 @@
   </resheader>
   <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
-  <metadata name="patientApptsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <metadata name="patientApptsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>412, 17</value>
   </metadata>
-  <metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>179, 17</value>
   </metadata>
-  <metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
Index: Scheduling/trunk/cs/bsdx0200GUISourceCode/DApptSearch.cs
===================================================================
--- Scheduling/trunk/cs/bsdx0200GUISourceCode/DApptSearch.cs	(revision 1104)
+++ Scheduling/trunk/cs/bsdx0200GUISourceCode/DApptSearch.cs	(revision 1106)
@@ -53,4 +53,5 @@
         private ColumnHeader colDOW;
         private ColumnHeader colID;
+        private Label lblMessage;
       
         private System.ComponentModel.IContainer components;
@@ -312,4 +313,5 @@
             this.colSlots = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.colAccessType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.lblMessage = new System.Windows.Forms.Label();
             this.panel1.SuspendLayout();
             this.pnlDescription.SuspendLayout();
@@ -323,4 +325,5 @@
             // panel1
             // 
+            this.panel1.Controls.Add(this.lblMessage);
             this.panel1.Controls.Add(this.cmdSearch);
             this.panel1.Controls.Add(this.cmdCancel);
@@ -334,5 +337,5 @@
             // cmdSearch
             // 
-            this.cmdSearch.Location = new System.Drawing.Point(536, 8);
+            this.cmdSearch.Location = new System.Drawing.Point(33, 6);
             this.cmdSearch.Name = "cmdSearch";
             this.cmdSearch.Size = new System.Drawing.Size(72, 24);
@@ -344,5 +347,5 @@
             // 
             this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-            this.cmdCancel.Location = new System.Drawing.Point(616, 8);
+            this.cmdCancel.Location = new System.Drawing.Point(828, 8);
             this.cmdCancel.Name = "cmdCancel";
             this.cmdCancel.Size = new System.Drawing.Size(64, 24);
@@ -353,5 +356,5 @@
             // 
             this.btnAccept.DialogResult = System.Windows.Forms.DialogResult.OK;
-            this.btnAccept.Location = new System.Drawing.Point(128, 8);
+            this.btnAccept.Location = new System.Drawing.Point(135, 8);
             this.btnAccept.Name = "btnAccept";
             this.btnAccept.Size = new System.Drawing.Size(176, 24);
@@ -436,4 +439,5 @@
             this.dtEnd.Size = new System.Drawing.Size(200, 20);
             this.dtEnd.TabIndex = 65;
+            this.dtEnd.ValueChanged += new System.EventHandler(this.dtEnd_ValueChanged);
             // 
             // dtStart
@@ -443,4 +447,5 @@
             this.dtStart.Size = new System.Drawing.Size(200, 20);
             this.dtStart.TabIndex = 64;
+            this.dtStart.ValueChanged += new System.EventHandler(this.dtStart_ValueChanged);
             // 
             // label3
@@ -672,4 +677,14 @@
             this.colAccessType.Width = 101;
             // 
+            // lblMessage
+            // 
+            this.lblMessage.AutoSize = true;
+            this.lblMessage.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.lblMessage.ForeColor = System.Drawing.Color.Red;
+            this.lblMessage.Location = new System.Drawing.Point(337, 16);
+            this.lblMessage.Name = "lblMessage";
+            this.lblMessage.Size = new System.Drawing.Size(0, 16);
+            this.lblMessage.TabIndex = 3;
+            // 
             // DApptSearch
             // 
@@ -685,4 +700,5 @@
             this.Text = "Find Clinic Availability";
             this.panel1.ResumeLayout(false);
+            this.panel1.PerformLayout();
             this.pnlDescription.ResumeLayout(false);
             this.grpDescription.ResumeLayout(false);
@@ -703,5 +719,6 @@
 			//Tell user we are processing
             this.Cursor = Cursors.WaitCursor;
-            
+            this.lblMessage.Text = String.Empty;
+
             //Get the control data into local vars
 			UpdateDialogData(false);
@@ -879,6 +896,6 @@
             lstResults.Items.Clear(); //empty it from old data
 
-            //if (items.Length == 0) lstResults.Items.Add(new ListViewItem(new string[] { "", "", "", "" , "", "No Slots found", "", "" })); // no results
             if (items.Length > 0) lstResults.Items.AddRange(items); // add new data
+            else this.lblMessage.Text = "No available Appointment Slots Found!";
 
             lstResults.EndUpdate(); // ok done adding items, draw now.
@@ -904,42 +921,26 @@
 		}
 
-		private void grdResult_DoubleClick(object sender, System.EventArgs e)
-		{
-			/*
-            if (lstResults.DataSource == null)
-				return;
-
-			DataGridViewCell dgCell;
-			dgCell = this.grdResult.CurrentCell;
-            this.m_sSelectedResource = grdResult.SelectedRows[0].Cells[2].ToString();
-            this.m_sSelectedDate = (DateTime)grdResult.SelectedRows[0].Cells[0].Value;
-			this.DialogResult = DialogResult.OK;
-			this.Close();
-             */
-		}
-
-		private void grdResult_CurrentCellChanged(object sender, System.EventArgs e)
-		{
-			/*
-            DataGridViewCell dgCell;
-            dgCell = this.grdResult.CurrentCell;
-             */
-        }
-
-        /// <summary>
-        /// BAAAAAAAAAAAAAAAAAD. Use a shared method instead.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
+
         private void lstResults_DoubleClick(object sender, EventArgs e)
         {
-            btnAccept_Click(sender, e);
+            ProcessChoice(sender, e);
         }
 
         private void btnAccept_Click(object sender, EventArgs e)
+        {
+            ProcessChoice(sender, e);
+        }
+
+        /// <summary>
+        /// Shared method to process a user's choice
+        /// </summary>
+        /// <param name="s">sender</param>
+        /// <param name="e">EventArgs</param>
+        private void ProcessChoice(object s, EventArgs e)
         {
             if (lstResults.SelectedIndices.Count == 0)
             {
                 this.DialogResult = DialogResult.None;
+                lblMessage.Text = "No Appointment Slot selected!";
                 return;
             }
@@ -952,8 +953,27 @@
         }
 
+        /// <summary>
+        /// Adjust start date based on end date.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void dtStart_ValueChanged(object sender, EventArgs e)
+        {
+            if (dtEnd.Value < dtStart.Value) dtEnd.Value = dtStart.Value;
+        }
+
+        /// <summary>
+        /// Adjust end date based on start date.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void dtEnd_ValueChanged(object sender, EventArgs e)
+        {
+            if (dtStart.Value > dtEnd.Value) dtStart.Value = dtEnd.Value;
+        }
+
         #endregion  Event Handlers
 
         #region Properties
-
         
         /// <summary>
@@ -966,4 +986,6 @@
 
 		#endregion Properties
+
+
     }
 }
