Index: Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CGAppointment.cs
===================================================================
--- Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CGAppointment.cs	(revision 1134)
+++ Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CGAppointment.cs	(revision 1140)
@@ -4,46 +4,74 @@
     using System.Drawing;
     /// <summary>
-    /// Data Structuer to Represent an Appointment
-    /// 
+    /// Data Structure to Represent an Appointment
     /// </summary>
     [Serializable]
     public class CGAppointment
     {
-        private bool m_bAccessBlock;
-        private bool m_bNoShow;
-        private bool m_bSelected = false;
-        private bool m_bWalkIn;
-        public DateTime m_dAuxTime;
-        public DateTime m_dCheckIn;
-        private DateTime m_EndTime;
-        public int m_nAccessTypeID = -1;
-        private int m_nColumn;
-        public int m_nKey;
-        private string m_Note;
-        public int m_nPatientID;
-        public int m_nSlots;
-        private Rectangle m_rectangle;
-        public string m_sAccessTypeName;
-        private string m_sHRN = "";
-        private string m_sPatientName;
-        public string m_sResource;
-        private DateTime m_StartTime;
-        private string m_Text;
+        public int AccessTypeID { get; set; }
+        public string AccessTypeName { get; set; }
+
+        public int AppointmentKey { get; set; }
+
+        public DateTime AuxTime { get; set; }
+        public DateTime CheckInTime { get; set; }
+        public DateTime EndTime { get; set; }
+        public DateTime StartTime { get; set; }
+
+        public int GridColumn { get; set; }
+        public Rectangle GridRectangle { get; set; }
+        
+        public bool IsAccessBlock { get; set; }
+
+        public bool NoShow { get; set; }
+
+        public string Note { get; set; }
+
+        public int PatientID { get; set; }
+        public string PatientName { get; set; }
+        public string Resource { get; set; }
+        public string HealthRecordNumber { get; set; }
+        
+        public bool Selected { get; set; }
+
+        public int Slots { get; set; }
+
+        public bool WalkIn { get; set; }
+
+        public Patient Patient { get; set; }
+        public Provider Provider { get; set; }
+
+        public int? RadiologyExamIEN { get; set; }
+
+
+        public CGAppointment()
+        {
+            AccessTypeID = -1;
+            Selected = false;
+            HealthRecordNumber = "";
+        }
 
         public void CreateAppointment(DateTime StartTime, DateTime EndTime, string Note, int Key, string sResource)
         {
-            this.m_StartTime = StartTime;
-            this.m_EndTime = EndTime;
-            this.m_Note = Note;
-            this.m_nKey = Key;
-            this.m_sResource = sResource;
+            this.StartTime = StartTime;
+            this.EndTime = EndTime;
+            this.Note = Note;
+            this.AppointmentKey = Key;
+            this.Resource = sResource;
+        }
+
+        public int Duration
+        {
+            get
+            {
+                TimeSpan span = (TimeSpan) (this.EndTime - this.StartTime);
+                return (int) span.TotalMinutes;
+            }
         }
 
         public override string ToString()
         {
-            //StringFormat sf = new StringFormat();
-            //sf.SetDigitSubstitution(System.Threading.Thread.CurrentThread.CurrentCulture.LCID, StringDigitSubstitute.National);
             string patientName = "";
-            if (this.m_bAccessBlock)
+            if (this.IsAccessBlock)
             {
                 string str2 = (this.Slots == 1) ? " Slot, " : " Slots, ";
@@ -57,253 +85,4 @@
             return (patientName + " " + this.Note);
         }
-
-        public int AccessTypeID
-        {
-            get
-            {
-                return this.m_nAccessTypeID;
-            }
-            set
-            {
-                this.m_nAccessTypeID = value;
-            }
-        }
-
-        public string AccessTypeName
-        {
-            get
-            {
-                return this.m_sAccessTypeName;
-            }
-            set
-            {
-                this.m_sAccessTypeName = value;
-            }
-        }
-
-        public int AppointmentKey
-        {
-            get
-            {
-                return this.m_nKey;
-            }
-            set
-            {
-                this.m_nKey = value;
-            }
-        }
-
-        public DateTime AuxTime
-        {
-            get
-            {
-                return this.m_dAuxTime;
-            }
-            set
-            {
-                this.m_dAuxTime = value;
-            }
-        }
-
-        public DateTime CheckInTime
-        {
-            get
-            {
-                return this.m_dCheckIn;
-            }
-            set
-            {
-                this.m_dCheckIn = value;
-            }
-        }
-
-        public int Duration
-        {
-            get
-            {
-                TimeSpan span = (TimeSpan) (this.EndTime - this.StartTime);
-                return (int) span.TotalMinutes;
-            }
-        }
-
-        public DateTime EndTime
-        {
-            get
-            {
-                return this.m_EndTime;
-            }
-            set
-            {
-                this.m_EndTime = value;
-            }
-        }
-
-        public int GridColumn
-        {
-            get
-            {
-                return this.m_nColumn;
-            }
-            set
-            {
-                this.m_nColumn = value;
-            }
-        }
-
-        public Rectangle GridRectangle
-        {
-            get
-            {
-                return this.m_rectangle;
-            }
-            set
-            {
-                this.m_rectangle = value;
-            }
-        }
-
-        public string HealthRecordNumber
-        {
-            get
-            {
-                return this.m_sHRN;
-            }
-            set
-            {
-                this.m_sHRN = value;
-            }
-        }
-
-        public bool IsAccessBlock
-        {
-            get
-            {
-                return this.m_bAccessBlock;
-            }
-            set
-            {
-                this.m_bAccessBlock = value;
-            }
-        }
-
-        public bool NoShow
-        {
-            get
-            {
-                return this.m_bNoShow;
-            }
-            set
-            {
-                this.m_bNoShow = value;
-            }
-        }
-
-        public string Note
-        {
-            get
-            {
-                return this.m_Note;
-            }
-            set
-            {
-                this.m_Note = value;
-            }
-        }
-
-        public int PatientID
-        {
-            get
-            {
-                return this.m_nPatientID;
-            }
-            set
-            {
-                this.m_nPatientID = value;
-            }
-        }
-
-        public string PatientName
-        {
-            get
-            {
-                return this.m_sPatientName;
-            }
-            set
-            {
-                this.m_sPatientName = value;
-            }
-        }
-
-        public string Resource
-        {
-            get
-            {
-                return this.m_sResource;
-            }
-            set
-            {
-                this.m_sResource = value;
-            }
-        }
-
-        public bool Selected
-        {
-            get
-            {
-                return this.m_bSelected;
-            }
-            set
-            {
-                this.m_bSelected = value;
-            }
-        }
-
-        public int Slots
-        {
-            get
-            {
-                return this.m_nSlots;
-            }
-            set
-            {
-                this.m_nSlots = value;
-            }
-        }
-
-        public DateTime StartTime
-        {
-            get
-            {
-                return this.m_StartTime;
-            }
-            set
-            {
-                this.m_StartTime = value;
-            }
-        }
-
-        public string Text
-        {
-            get
-            {
-                this.m_Text = this.m_sPatientName;
-                return this.m_Text;
-            }
-        }
-
-        public bool WalkIn
-        {
-            get
-            {
-                return this.m_bWalkIn;
-            }
-            set
-            {
-                this.m_bWalkIn = value;
-            }
-        }
-
-        public Patient Patient { get; set; }
-        public Provider Provider { get; set; }
     }
 }
Index: Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CGDocument.cs
===================================================================
--- Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CGDocument.cs	(revision 1134)
+++ Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CGDocument.cs	(revision 1140)
@@ -238,4 +238,5 @@
                     sWalkIn = r["WALKIN"].ToString();
                     bWalkIn = (sWalkIn == "1") ? true : false;
+                    int? RadiologyExamIEN = r["RADIOLOGY_EXAM"] as Int32?;
 
                     Patient pt = new Patient()
@@ -262,4 +263,5 @@
                     pAppointment.AccessTypeID = nAccessTypeID;
                     pAppointment.WalkIn = bWalkIn;
+                    pAppointment.RadiologyExamIEN = RadiologyExamIEN;
                     this.m_appointments.AddAppointment(pAppointment);
 
@@ -973,5 +975,5 @@
             }
 
-            string sSql = "BSDX ADD NEW APPOINTMENT^" + sStart + "^" + sEnd + "^" + sPatID + "^" + sResource + "^" + sLen + "^" + sNote + "^" + sApptID;
+            string sSql = "BSDX ADD NEW APPOINTMENT^" + sStart + "^" + sEnd + "^" + sPatID + "^" + sResource + "^" + sLen + "^" + sNote + "^" + sApptID + "^" + rApptInfo.RadiologyExamIEN;
             System.Data.DataTable dtAppt = m_DocManager.RPMSDataTable(sSql, "NewAppointment");
 
@@ -1079,4 +1081,5 @@
         }
 
+        //TODO: MUST SEE IF RADIOLOGY STUFF WORKS WITH THIS ***
         public string AutoRebook(CGAppointment a, int nSearchType, int nMinimumDays, int nMaximumDays, out CGAppointment aRebook)
         {
Index: Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CGView.cs
===================================================================
--- Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CGView.cs	(revision 1134)
+++ Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CGView.cs	(revision 1140)
@@ -1,4 +1,5 @@
 using System;
 using System.Collections;
+using System.Collections.Generic;
 using System.ComponentModel;
 using System.Windows.Forms;
@@ -106,4 +107,6 @@
         private MenuItem menuItem12;
         private MenuItem mnuRefresh;
+        private MenuItem ctxCalGridMkRadAppt;
+        private MenuItem ctxCalGridCancelRadAppt;
         private IContainer components;
 
@@ -246,6 +249,8 @@
             this.ctxCalendarGrid = new System.Windows.Forms.ContextMenu();
             this.ctxCalGridAdd = new System.Windows.Forms.MenuItem();
+            this.ctxCalGridMkRadAppt = new System.Windows.Forms.MenuItem();
             this.ctxCalGridEdit = new System.Windows.Forms.MenuItem();
             this.ctxCalGridDelete = new System.Windows.Forms.MenuItem();
+            this.ctxCalGridCancelRadAppt = new System.Windows.Forms.MenuItem();
             this.ctxCalGridCheckIn = new System.Windows.Forms.MenuItem();
             this.ctxCalGridUndoCheckin = new System.Windows.Forms.MenuItem();
@@ -647,5 +652,5 @@
             this.tvSchedules.Location = new System.Drawing.Point(0, 0);
             this.tvSchedules.Name = "tvSchedules";
-            this.tvSchedules.Size = new System.Drawing.Size(128, 359);
+            this.tvSchedules.Size = new System.Drawing.Size(128, 254);
             this.tvSchedules.Sorted = true;
             this.tvSchedules.TabIndex = 1;
@@ -716,5 +721,5 @@
             this.panelRight.Location = new System.Drawing.Point(996, 0);
             this.panelRight.Name = "panelRight";
-            this.panelRight.Size = new System.Drawing.Size(128, 359);
+            this.panelRight.Size = new System.Drawing.Size(128, 254);
             this.panelRight.TabIndex = 3;
             this.panelRight.Visible = false;
@@ -812,5 +817,5 @@
             this.panelCenter.Location = new System.Drawing.Point(136, 24);
             this.panelCenter.Name = "panelCenter";
-            this.panelCenter.Size = new System.Drawing.Size(857, 311);
+            this.panelCenter.Size = new System.Drawing.Size(857, 206);
             this.panelCenter.TabIndex = 7;
             // 
@@ -819,6 +824,8 @@
             this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
             this.ctxCalGridAdd,
+            this.ctxCalGridMkRadAppt,
             this.ctxCalGridEdit,
             this.ctxCalGridDelete,
+            this.ctxCalGridCancelRadAppt,
             this.ctxCalGridCheckIn,
             this.ctxCalGridUndoCheckin,
@@ -838,7 +845,13 @@
             this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
             // 
+            // ctxCalGridMkRadAppt
+            // 
+            this.ctxCalGridMkRadAppt.Index = 1;
+            this.ctxCalGridMkRadAppt.Text = "Make Radiology Appointment";
+            this.ctxCalGridMkRadAppt.Click += new System.EventHandler(this.ctxCalGridMkRadAppt_Click);
+            // 
             // ctxCalGridEdit
             // 
-            this.ctxCalGridEdit.Index = 1;
+            this.ctxCalGridEdit.Index = 2;
             this.ctxCalGridEdit.Text = "Edit Appointment";
             this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
@@ -846,11 +859,16 @@
             // ctxCalGridDelete
             // 
-            this.ctxCalGridDelete.Index = 2;
+            this.ctxCalGridDelete.Index = 3;
             this.ctxCalGridDelete.Text = "Cancel Appointment";
             this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
             // 
+            // ctxCalGridCancelRadAppt
+            // 
+            this.ctxCalGridCancelRadAppt.Index = 4;
+            this.ctxCalGridCancelRadAppt.Text = "Cancel Radiology Appointment";
+            // 
             // ctxCalGridCheckIn
             // 
-            this.ctxCalGridCheckIn.Index = 3;
+            this.ctxCalGridCheckIn.Index = 5;
             this.ctxCalGridCheckIn.Text = "Check In Patient";
             this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click);
@@ -858,5 +876,5 @@
             // ctxCalGridUndoCheckin
             // 
-            this.ctxCalGridUndoCheckin.Index = 4;
+            this.ctxCalGridUndoCheckin.Index = 6;
             this.ctxCalGridUndoCheckin.Text = "&Undo Check In";
             this.ctxCalGridUndoCheckin.Click += new System.EventHandler(this.ctxCalGridUndoCheckin_Click);
@@ -864,10 +882,10 @@
             // menuItem2
             // 
-            this.menuItem2.Index = 5;
+            this.menuItem2.Index = 7;
             this.menuItem2.Text = "-";
             // 
             // ctxCalGridNoShow
             // 
-            this.ctxCalGridNoShow.Index = 6;
+            this.ctxCalGridNoShow.Index = 8;
             this.ctxCalGridNoShow.Text = "Mark as No Show";
             this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click);
@@ -875,5 +893,5 @@
             // ctxCalGridNoShowUndo
             // 
-            this.ctxCalGridNoShowUndo.Index = 7;
+            this.ctxCalGridNoShowUndo.Index = 9;
             this.ctxCalGridNoShowUndo.Text = "Undo NoShow";
             this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click);
@@ -881,10 +899,10 @@
             // menuItem9
             // 
-            this.menuItem9.Index = 8;
+            this.menuItem9.Index = 10;
             this.menuItem9.Text = "-";
             // 
             // ctxCalGridWalkin
             // 
-            this.ctxCalGridWalkin.Index = 9;
+            this.ctxCalGridWalkin.Index = 11;
             this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment";
             this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click);
@@ -892,10 +910,10 @@
             // menuItem10
             // 
-            this.menuItem10.Index = 10;
+            this.menuItem10.Index = 12;
             this.menuItem10.Text = "-";
             // 
             // ctxCalGridReprintApptSlip
             // 
-            this.ctxCalGridReprintApptSlip.Index = 11;
+            this.ctxCalGridReprintApptSlip.Index = 13;
             this.ctxCalGridReprintApptSlip.Text = "&Reprint Appointment Slip";
             this.ctxCalGridReprintApptSlip.Click += new System.EventHandler(this.ctxCalGridReprintApptSlip_Click);
@@ -905,5 +923,5 @@
             this.panelBottom.Controls.Add(this.statusBar1);
             this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
-            this.panelBottom.Location = new System.Drawing.Point(136, 335);
+            this.panelBottom.Location = new System.Drawing.Point(136, 230);
             this.panelBottom.Name = "panelBottom";
             this.panelBottom.Size = new System.Drawing.Size(857, 24);
@@ -923,5 +941,5 @@
             this.splitter1.Location = new System.Drawing.Point(128, 24);
             this.splitter1.Name = "splitter1";
-            this.splitter1.Size = new System.Drawing.Size(8, 335);
+            this.splitter1.Size = new System.Drawing.Size(8, 230);
             this.splitter1.TabIndex = 9;
             this.splitter1.TabStop = false;
@@ -932,5 +950,5 @@
             this.splitter2.Location = new System.Drawing.Point(993, 24);
             this.splitter2.Name = "splitter2";
-            this.splitter2.Size = new System.Drawing.Size(3, 335);
+            this.splitter2.Size = new System.Drawing.Size(3, 230);
             this.splitter2.TabIndex = 10;
             this.splitter2.TabStop = false;
@@ -955,5 +973,5 @@
             this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources")));
             this.calendarGrid1.SelectedAppointment = 0;
-            this.calendarGrid1.Size = new System.Drawing.Size(857, 311);
+            this.calendarGrid1.Size = new System.Drawing.Size(857, 206);
             this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
             this.calendarGrid1.TabIndex = 0;
@@ -968,5 +986,5 @@
             // 
             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
-            this.ClientSize = new System.Drawing.Size(1124, 359);
+            this.ClientSize = new System.Drawing.Size(1124, 254);
             this.Controls.Add(this.panelCenter);
             this.Controls.Add(this.panelBottom);
@@ -1289,8 +1307,42 @@
 		private void ctxCalendarGrid_Popup(object sender, System.EventArgs e)
 		{
+            bool bEditAppointments = (EditAppointmentEnabled() && (calendarGrid1.SelectedAppointment > 0)) ;
+
+            if (IsThisARadiologyResource())//this is a radiology resource
+            {
+                ctxCalGridAdd.Visible = false;
+                ctxCalGridDelete.Visible = false;
+                ctxCalGridEdit.Visible = false;
+                ctxCalGridCheckIn.Visible = false;
+                ctxCalGridNoShow.Visible = false;
+                ctxCalGridNoShowUndo.Visible = false;
+                ctxCalGridWalkin.Visible = false;
+                ctxCalGridUndoCheckin.Visible = false;
+
+                ctxCalGridMkRadAppt.Visible = true;
+                ctxCalGridCancelRadAppt.Visible = true;
+
+                
+            }
+
+            else // this is a normal resource
+            {
+                ctxCalGridAdd.Visible = true;
+                ctxCalGridDelete.Visible = true;
+                ctxCalGridEdit.Visible = true;
+                ctxCalGridCheckIn.Visible = true;
+                ctxCalGridNoShow.Visible = true;
+                ctxCalGridNoShowUndo.Visible = true;
+                ctxCalGridWalkin.Visible = true;
+                ctxCalGridUndoCheckin.Visible = true;
+
+                ctxCalGridMkRadAppt.Visible = false;
+                ctxCalGridCancelRadAppt.Visible = false;
+            }
+
 			//Toggle availability of make, edit, checkin and delete appointments
 			//based on whether appropriate element is selected.
 			ctxCalGridAdd.Enabled = AddAppointmentEnabled();
-			bool bEditAppointments = (EditAppointmentEnabled() && (calendarGrid1.SelectedAppointment > 0)) ;
+			
 			ctxCalGridDelete.Enabled = bEditAppointments;
 			ctxCalGridEdit.Enabled = bEditAppointments;
@@ -1299,8 +1351,10 @@
             ctxCalGridNoShowUndo.Enabled = !NoShowEnabled() && calendarGrid1.SelectedAppointment > 0;
 			ctxCalGridWalkin.Enabled = ctxCalGridAdd.Enabled;
-            //smh new code
             ctxCalGridReprintApptSlip.Enabled = bEditAppointments;
             ctxCalGridUndoCheckin.Enabled = UndoCheckinEnabled();
-            //end new code
+
+            //if the rad ones are visible, then these apply
+            ctxCalGridMkRadAppt.Enabled = !bEditAppointments;
+            ctxCalGridCancelRadAppt.Enabled = bEditAppointments;
         }
 
@@ -1357,4 +1411,30 @@
 		#region Methods
 
+        private bool IsThisARadiologyResource()
+        {
+            // I don't like this logic!!!
+            if (this.calendarGrid1.SelectedRange.Cells.CellCount < 1 && this.calendarGrid1.SelectedAppointment < 1)
+                return false;
+            if (this.calendarGrid1.SelectedAppointment > 0)
+                if ((this.Appointments.AppointmentTable[this.calendarGrid1.SelectedAppointment] as CGAppointment).RadiologyExamIEN > 0)
+                    return true;
+
+            DateTime dStart;
+            DateTime dEnd;
+            string sResource;
+            bool bRet = this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource);
+            if (bRet == false)
+            {
+                return false;
+            }
+
+            return (from hl in CGDocumentManager.Current.GlobalDataSet.Tables["HospitalLocation"].AsEnumerable()
+                       where hl.Field<string>("IS_RADIOLOGY_LOCATION")=="1"
+                       join res in CGDocumentManager.Current.GlobalDataSet.Tables["Resources"].AsEnumerable()
+                       on hl.Field<int>("HOSPITAL_LOCATION_ID") equals res.Field<int>("HOSPITAL_LOCATION_ID")
+                       where res.Field<string>("RESOURCE_NAME") == sResource
+                       select hl).Any();
+        }
+        
         private bool EditAppointmentEnabled()
         {
@@ -3544,4 +3624,57 @@
         }
 
+        private void ctxCalGridMkRadAppt_Click(object sender, EventArgs e)
+        {
+            DateTime dStart, dEnd;
+            string sResource;
+            int nAccessTypeID = 0;
+
+            this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource);
+            this.calendarGrid1.GetSelectedType(out nAccessTypeID);
+            //Display a dialog to collect Patient Name
+            DPatientLookup dPat = new DPatientLookup();
+            dPat.DocManager = m_DocManager;
+
+            if (dPat.ShowDialog(this) == DialogResult.Cancel)
+            {
+                return;
+            }
+
+            int DFN = Int32.Parse(dPat.PatientIEN);
+            int hlIEN = (from resource in CGDocumentManager.Current.GlobalDataSet.Tables["Resources"].AsEnumerable()
+                        where resource.Field<string>("RESOURCE_NAME") == sResource
+                        select resource.Field<int>("HOSPITAL_LOCATION_ID")).FirstOrDefault();
+
+            List<RadiologyExam> _radExams = CGDocumentManager.Current.DAL.GetRadiologyExamsForPatientinHL(DFN, hlIEN);
+
+            if (!_radExams.Any())
+            {
+                MessageBox.Show("Patient does not have any radiology exams to register.");
+                return;
+            }
+
+            DRadExamsSelect _radform = new DRadExamsSelect(_radExams);
+
+            if (_radform.ShowDialog() == DialogResult.Cancel) return;
+
+            int _examien = _radform.ExamIEN;
+            string _procedurename = _radform.ProcedureName;
+
+            CGDocumentManager.Current.DAL.ScheduleRadiologyExam(DFN, _examien);
+
+            //Now create and save the appointment
+            CGAppointment appt = new CGAppointment();
+            string _sNote = "Radiology Exam (" + _examien + "): " + _procedurename;
+            appt.CreateAppointment(dStart, dEnd, _sNote, 0, sResource);
+            appt.PatientID = Int32.Parse(dPat.PatientIEN);
+            appt.PatientName = dPat.PatientName;
+            appt.AccessTypeID = nAccessTypeID;
+            appt.RadiologyExamIEN = _examien;
+            this.Document.CreateAppointment(appt);
+
+            //Now redraw the grid to display the new appointments
+            this.UpdateArrays();
+        }
+
 
 
Index: Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CalendarGrid.cs
===================================================================
--- Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CalendarGrid.cs	(revision 1134)
+++ Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CalendarGrid.cs	(revision 1140)
@@ -409,5 +409,5 @@
                     {
                         rect.Inflate(-10, 0);
-                        num = (int) this.m_ApptOverlapTable[appointment.m_nKey];
+                        num = (int) this.m_ApptOverlapTable[appointment.AppointmentKey];
                         num2 = rect.Right - rect.Left;
                         x = num2 / (num + 1);
@@ -1128,5 +1128,5 @@
                     x = (this.m_sResourcesArray.Count > 1) ? (((int) this.m_ColumnInfoTable[resource]) + 1) : appointment.StartTime.DayOfYear;
                     Rectangle rectangle = new Rectangle(x, y, 1, num2 - y);
-                    hashtable.Add(appointment.m_nKey, rectangle);
+                    hashtable.Add(appointment.AppointmentKey, rectangle);
                 }
             }
Index: Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj
===================================================================
--- Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj	(revision 1134)
+++ Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj	(revision 1140)
@@ -140,5 +140,12 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="DRadExamsSelect.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="DRadExamsSelect.Designer.cs">
+      <DependentUpon>DRadExamsSelect.cs</DependentUpon>
+    </Compile>
     <Compile Include="Provider.cs" />
+    <Compile Include="RadiologyExam.cs" />
     <Compile Include="strings.ar.Designer.cs">
       <AutoGen>True</AutoGen>
@@ -152,5 +159,4 @@
     </Compile>
     <Compile Include="UserPreferences.cs" />
-    <None Include="app.config" />
     <None Include="dsPatientApptDisplay2.xsc">
       <DependentUpon>dsPatientApptDisplay2.xsd</DependentUpon>
@@ -391,4 +397,7 @@
       <DependentUpon>DPatientLookup.cs</DependentUpon>
       <SubType>Designer</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="DRadExamsSelect.resx">
+      <DependentUpon>DRadExamsSelect.cs</DependentUpon>
     </EmbeddedResource>
     <EmbeddedResource Include="DResource.resx">
Index: Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user
===================================================================
--- Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user	(revision 1134)
+++ Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user	(revision 1140)
@@ -37,5 +37,5 @@
     </RemoteDebugMachine>
     <StartAction>Project</StartAction>
-    <StartArguments>/s=172.16.16.108 /p=9250 /a=BASMA.ALDWAIRI /v=SELEN.123</StartArguments>
+    <StartArguments>/s=172.16.16.108 /p=9255 /a=s.habiel /v=catdog.66</StartArguments>
     <StartPage>
     </StartPage>
Index: Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DAL.cs
===================================================================
--- Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DAL.cs	(revision 1134)
+++ Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DAL.cs	(revision 1140)
@@ -187,4 +187,30 @@
 
         /// <summary>
+        /// TODO
+        /// </summary>
+        /// <param name="DFN"></param>
+        /// <param name="SCIEN"></param>
+        /// <returns></returns>
+        public List<RadiologyExam> GetRadiologyExamsForPatientinHL(int DFN, int SCIEN)
+        {
+            string cmd = string.Format("BSDX GET RAD EXAM FOR PT^{0}^{1}", DFN, SCIEN);
+            DataTable tbl = RPMSDataTable(cmd, "");
+            return (from row in tbl.AsEnumerable()
+                    select new RadiologyExam
+                    {
+                        IEN = row.Field<int>("BMXIEN"),
+                        Status = row.Field<string>("STATUS"),
+                        Procedure = row.Field<string>("PROCEDURE"),
+                        RequestDate = row.Field<DateTime>("REQUEST_DATE")
+                    }).ToList();
+        }
+
+        public bool ScheduleRadiologyExam(int DFN, int examIEN)
+        {
+            string result = _thisConnection.bmxNetLib.TransmitRPC("BSDX SCHEDULE RAD EXAM", string.Format("{0}^{1}",DFN,examIEN));
+            return result == "1" ? true : false;
+        }
+
+        /// <summary>
         /// Save User Preference in DB For Printing Routing Slip
         /// Uses Parameter BSDX AUTO PRINT RS
Index: Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DRadExamsSelect.Designer.cs
===================================================================
--- Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DRadExamsSelect.Designer.cs	(revision 1140)
+++ Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DRadExamsSelect.Designer.cs	(revision 1140)
@@ -0,0 +1,151 @@
+﻿namespace IndianHealthService.ClinicalScheduling
+{
+    partial class DRadExamsSelect
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.lstExams = new System.Windows.Forms.ListBox();
+            this.tableOKCancel = new System.Windows.Forms.TableLayoutPanel();
+            this.btnOK = new System.Windows.Forms.Button();
+            this.btnCancel = new System.Windows.Forms.Button();
+            this.label1 = new System.Windows.Forms.Label();
+            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+            this.tableOKCancel.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+            this.splitContainer1.Panel1.SuspendLayout();
+            this.splitContainer1.Panel2.SuspendLayout();
+            this.splitContainer1.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // lstExams
+            // 
+            this.lstExams.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.lstExams.FormattingEnabled = true;
+            this.lstExams.Location = new System.Drawing.Point(0, 0);
+            this.lstExams.Name = "lstExams";
+            this.lstExams.Size = new System.Drawing.Size(497, 193);
+            this.lstExams.TabIndex = 0;
+            this.lstExams.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lstExams_MouseDoubleClick);
+            // 
+            // tableOKCancel
+            // 
+            this.tableOKCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.tableOKCancel.ColumnCount = 2;
+            this.tableOKCancel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.tableOKCancel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.tableOKCancel.Controls.Add(this.btnOK, 0, 0);
+            this.tableOKCancel.Controls.Add(this.btnCancel, 1, 0);
+            this.tableOKCancel.Location = new System.Drawing.Point(328, 5);
+            this.tableOKCancel.Name = "tableOKCancel";
+            this.tableOKCancel.RowCount = 1;
+            this.tableOKCancel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.tableOKCancel.Size = new System.Drawing.Size(166, 29);
+            this.tableOKCancel.TabIndex = 1;
+            // 
+            // btnOK
+            // 
+            this.btnOK.Location = new System.Drawing.Point(3, 3);
+            this.btnOK.Name = "btnOK";
+            this.btnOK.Size = new System.Drawing.Size(75, 23);
+            this.btnOK.TabIndex = 0;
+            this.btnOK.Text = "OK";
+            this.btnOK.UseVisualStyleBackColor = true;
+            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
+            // 
+            // btnCancel
+            // 
+            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+            this.btnCancel.Location = new System.Drawing.Point(86, 3);
+            this.btnCancel.Name = "btnCancel";
+            this.btnCancel.Size = new System.Drawing.Size(75, 23);
+            this.btnCancel.TabIndex = 1;
+            this.btnCancel.Text = "Cancel";
+            this.btnCancel.UseVisualStyleBackColor = true;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(12, 9);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(245, 13);
+            this.label1.TabIndex = 2;
+            this.label1.Text = "Select an Exam from the exams listed to Schedule";
+            // 
+            // splitContainer1
+            // 
+            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+            this.splitContainer1.Name = "splitContainer1";
+            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
+            // 
+            // splitContainer1.Panel1
+            // 
+            this.splitContainer1.Panel1.Controls.Add(this.lstExams);
+            // 
+            // splitContainer1.Panel2
+            // 
+            this.splitContainer1.Panel2.Controls.Add(this.tableOKCancel);
+            this.splitContainer1.Panel2.Controls.Add(this.label1);
+            this.splitContainer1.Size = new System.Drawing.Size(497, 234);
+            this.splitContainer1.SplitterDistance = 193;
+            this.splitContainer1.TabIndex = 3;
+            // 
+            // DRadExamsSelect
+            // 
+            this.AcceptButton = this.btnOK;
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.CancelButton = this.btnCancel;
+            this.ClientSize = new System.Drawing.Size(497, 234);
+            this.ControlBox = false;
+            this.Controls.Add(this.splitContainer1);
+            this.MinimumSize = new System.Drawing.Size(500, 250);
+            this.Name = "DRadExamsSelect";
+            this.Text = "Select an Exam";
+            this.tableOKCancel.ResumeLayout(false);
+            this.splitContainer1.Panel1.ResumeLayout(false);
+            this.splitContainer1.Panel2.ResumeLayout(false);
+            this.splitContainer1.Panel2.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+            this.splitContainer1.ResumeLayout(false);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.ListBox lstExams;
+        private System.Windows.Forms.TableLayoutPanel tableOKCancel;
+        private System.Windows.Forms.Button btnOK;
+        private System.Windows.Forms.Button btnCancel;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.SplitContainer splitContainer1;
+
+
+
+    }
+}
Index: Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DRadExamsSelect.cs
===================================================================
--- Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DRadExamsSelect.cs	(revision 1140)
+++ Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DRadExamsSelect.cs	(revision 1140)
@@ -0,0 +1,60 @@
+﻿using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace IndianHealthService.ClinicalScheduling
+{
+    /// <summary>
+    /// Form which displays exams for User so that the user would pick one of them
+    /// for which to make an appointment
+    /// </summary>
+    public partial class DRadExamsSelect : Form
+    {
+        //return values
+        public int ExamIEN { get; private set; }
+        public string ProcedureName { get; private set; }
+        //end return values
+
+        /// <summary>
+        /// ctor
+        /// </summary>
+        /// <param name="_radExams">Strongly Typed Table of Exams</param>
+        public DRadExamsSelect(List<RadiologyExam> _radExams)
+        {
+            InitializeComponent();
+
+            this.lstExams.DataSource = _radExams;
+            this.lstExams.SelectionMode = SelectionMode.One;
+        }
+
+        private void btnOK_Click(object sender, EventArgs e)
+        {
+            SharedFinishLine();
+        }
+
+        private void lstExams_MouseDoubleClick(object sender, MouseEventArgs e)
+        {
+            SharedFinishLine();
+        }
+
+        private void SharedFinishLine()
+        {
+            if (lstExams.SelectedIndex < 0)
+            {
+                this.DialogResult = DialogResult.None;
+                return;
+            }
+
+            ExamIEN = (lstExams.Items[lstExams.SelectedIndex] as RadiologyExam).IEN;
+            ProcedureName = (lstExams.Items[lstExams.SelectedIndex] as RadiologyExam).Procedure;
+            this.DialogResult = DialogResult.OK;
+        }
+
+
+    }
+}
Index: Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DRadExamsSelect.resx
===================================================================
--- Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DRadExamsSelect.resx	(revision 1140)
+++ Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/DRadExamsSelect.resx	(revision 1140)
@@ -0,0 +1,120 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
Index: Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/RadiologyExam.cs
===================================================================
--- Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/RadiologyExam.cs	(revision 1140)
+++ Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/RadiologyExam.cs	(revision 1140)
@@ -0,0 +1,23 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace IndianHealthService.ClinicalScheduling
+{   
+    /// <summary>
+    /// TODO: Sam would like to document this later
+    /// </summary>
+    public class RadiologyExam
+    {
+        public int IEN { get; set; }
+        public string Status { get; set; }
+        public string Procedure { get; set; }
+        public DateTime RequestDate { get; set; }
+
+        public override string ToString()
+        {
+            return Procedure + "\t" + "Requested: " + RequestDate.ToString();
+        }
+    }
+}
