Index: /Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs
===================================================================
--- /Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs	(revision 793)
+++ /Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs	(revision 794)
@@ -240,18 +240,40 @@
                 m_ds.Refresh();
 				bool bRetry = true;
+
+                //Try to connect using supplied values for Server and Port
+                //Why am I doing this? The library BMX net uses prompts for access and verify code
+                //whether you can connect or not. Not good. So I test first whether
+                //we can connect at all by doing a simple connection and disconnect.
+                //TODO: Make this more robust by sending a TCPConnect message and seeing if you get a response.
+
+                if (m_Server != "" && m_Port != 0)
+                {
+                    System.Net.Sockets.TcpClient tcpClient = new System.Net.Sockets.TcpClient();
+                    try
+                    {
+                        tcpClient.Connect(m_Server, m_Port); // open it
+                        tcpClient.Close();                  // then close it
+                    }
+                    catch (System.Net.Sockets.SocketException ex)
+                    {
+                        throw ex;
+                    }
+                }
 				do
 				{
-					try 
-					{
-						if (bReLogin == true)
-						{
-							//Prompt for Access and Verify codes
-							_current.m_ConnectInfo.LoadConnectInfo("", "");
-						}
-						else
-						{
+                    try
+                    {
+                        if (bReLogin == true)
+                        {
+                            //Prompt for Access and Verify codes
+                            _current.m_ConnectInfo.LoadConnectInfo("", "");
+                        }
+                        else
+                        {
                             if (m_Server != String.Empty && m_Port != 0 && m_AccessCode != String.Empty
                                 && m_VerifyCode != String.Empty)
+                            {
                                 m_ConnectInfo.LoadConnectInfo(m_Server, m_Port, m_AccessCode, m_VerifyCode);
+                            }
                             else if (m_Server != String.Empty && m_Port != 0)
                                 m_ConnectInfo.LoadConnectInfo(m_Server, m_Port, "", "");
@@ -259,20 +281,24 @@
                                 m_ConnectInfo.LoadConnectInfo();
                         }
-						bRetry = false;
-					}
-					catch (Exception ex)
-					{
-						m_ds.Close(); 
-						if (MessageBox.Show("Unable to connect to VistA.  " + ex.Message , "Clinical Scheduling", MessageBoxButtons.RetryCancel) == DialogResult.Retry)
-						{
-							bRetry = true;
-							_current.m_ConnectInfo.ChangeServerInfo();
-						}
-						else
-						{
-							bRetry = false;
-							throw ex;
-						}
-					}
+                        bRetry = false;
+                    }
+                    catch (System.Net.Sockets.SocketException)
+                    {
+                        MessageBox.Show("Cannot connect to VistA. ");
+                    }
+                    catch (Exception ex)
+                    {
+                        m_ds.Close();
+                        if (MessageBox.Show("Unable to connect to VistA.  " + ex.Message, "Clinical Scheduling", MessageBoxButtons.RetryCancel) == DialogResult.Retry)
+                        {
+                            bRetry = true;
+                            _current.m_ConnectInfo.ChangeServerInfo();
+                        }
+                        else
+                        {
+                            bRetry = false;
+                            throw ex;
+                        }
+                    }
 				}while (bRetry == true);
 
@@ -415,4 +441,5 @@
 		}
 
+        //TODO:REMOVE THIS
 		public void LoadClinicSetupTable()
 		{
@@ -613,5 +640,5 @@
 
 			//Build active provider table
-			sCommandText = "SELECT BMXIEN, NAME FROM NEW_PERSON WHERE INACTIVE_DATE = '' AND INTERNAL[PROVIDER_CLASS] > 0";
+			sCommandText = "SELECT BMXIEN, NAME FROM NEW_PERSON WHERE INACTIVE_DATE = ''";
 			ConnectInfo.RPMSDataTable(sCommandText, "Provider", m_dsGlobal);
 			Debug.Write("LoadGlobalRecordsets -- Provider loaded\n");
@@ -626,4 +653,9 @@
 			sCommandText = "SELECT NAME, DATE FROM HOLIDAY WHERE DATE > '" + DateTime.Today.ToShortDateString() + "'";
 			ConnectInfo.RPMSDataTable(sCommandText, "HOLIDAY", m_dsGlobal);
+            Debug.Write("LoadingGlobalRecordsets -- Holidays loaded\n");
+
+            sCommandText = @"SELECT HOSPITAL_LOCATION.BMXIEN 'BMXIEN', HOSPITAL_LOCATION.PROVIDER.PROVIDER 'PROVIDER', HOSPITAL_LOCATION.PROVIDER.DEFAULT_PROVIDER 'DEFAULT' FROM HOSPITAL_LOCATION";
+            ConnectInfo.RPMSDataTable(sCommandText, "ClinicProviders", m_dsGlobal);
+            Debug.Write("LoadingGlobalRecordsets -- ClinicProviders loaded\n");
 
 			//Save the xml schema
Index: /Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs
===================================================================
--- /Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs	(revision 793)
+++ /Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs	(revision 794)
@@ -266,4 +266,5 @@
             this.lblResource = new System.Windows.Forms.Label();
             this.panelCenter = new System.Windows.Forms.Panel();
+            this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid();
             this.ctxCalendarGrid = new System.Windows.Forms.ContextMenu();
             this.ctxCalGridAdd = new System.Windows.Forms.MenuItem();
@@ -280,5 +281,4 @@
             this.splitter1 = new System.Windows.Forms.Splitter();
             this.splitter2 = new System.Windows.Forms.Splitter();
-            this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid();
             this.panelRight.SuspendLayout();
             this.panelClip.SuspendLayout();
@@ -331,4 +331,5 @@
             // 
             this.mnuOpenMultipleSchedules.Index = 1;
+            this.mnuOpenMultipleSchedules.Shortcut = System.Windows.Forms.Shortcut.CtrlM;
             this.mnuOpenMultipleSchedules.Text = "Open M&ultiple Schedules";
             this.mnuOpenMultipleSchedules.Click += new System.EventHandler(this.mnuOpenMultipleSchedules_Click);
@@ -533,4 +534,5 @@
             // 
             this.mnu1Day.Index = 1;
+            this.mnu1Day.Shortcut = System.Windows.Forms.Shortcut.Ctrl1;
             this.mnu1Day.Text = "&1-Day View";
             this.mnu1Day.Click += new System.EventHandler(this.mnu1Day_Click);
@@ -539,4 +541,5 @@
             // 
             this.mnu5Day.Index = 2;
+            this.mnu5Day.Shortcut = System.Windows.Forms.Shortcut.Ctrl5;
             this.mnu5Day.Text = "&5-Day View";
             this.mnu5Day.Click += new System.EventHandler(this.mnu5Day_Click);
@@ -545,4 +548,5 @@
             // 
             this.mnu7Day.Index = 3;
+            this.mnu7Day.Shortcut = System.Windows.Forms.Shortcut.Ctrl7;
             this.mnu7Day.Text = "&7-Day View";
             this.mnu7Day.Click += new System.EventHandler(this.mnu7Day_Click);
@@ -566,4 +570,5 @@
             // 
             this.mnu10Minute.Index = 0;
+            this.mnu10Minute.Shortcut = System.Windows.Forms.Shortcut.Ctrl0;
             this.mnu10Minute.Text = "&10-Minute";
             this.mnu10Minute.Click += new System.EventHandler(this.mnu10Minute_Click);
@@ -572,4 +577,5 @@
             // 
             this.mnu15Minute.Index = 1;
+            this.mnu15Minute.Shortcut = System.Windows.Forms.Shortcut.Ctrl4;
             this.mnu15Minute.Text = "1&5-Minute";
             this.mnu15Minute.Click += new System.EventHandler(this.mnu15Minute_Click);
@@ -578,4 +584,5 @@
             // 
             this.mnu20Minute.Index = 2;
+            this.mnu20Minute.Shortcut = System.Windows.Forms.Shortcut.Ctrl3;
             this.mnu20Minute.Text = "&20-Minute";
             this.mnu20Minute.Click += new System.EventHandler(this.mnu20Minute_Click);
@@ -584,4 +591,5 @@
             // 
             this.mnu30Minute.Index = 3;
+            this.mnu30Minute.Shortcut = System.Windows.Forms.Shortcut.Ctrl2;
             this.mnu30Minute.Text = "&30-Minute";
             this.mnu30Minute.Click += new System.EventHandler(this.mnu30Minute_Click);
@@ -635,5 +643,5 @@
             this.tvSchedules.Location = new System.Drawing.Point(0, 0);
             this.tvSchedules.Name = "tvSchedules";
-            this.tvSchedules.Size = new System.Drawing.Size(128, 410);
+            this.tvSchedules.Size = new System.Drawing.Size(128, 422);
             this.tvSchedules.Sorted = true;
             this.tvSchedules.TabIndex = 1;
@@ -681,7 +689,7 @@
             this.panelRight.Controls.Add(this.panelClip);
             this.panelRight.Dock = System.Windows.Forms.DockStyle.Right;
-            this.panelRight.Location = new System.Drawing.Point(676, 0);
+            this.panelRight.Location = new System.Drawing.Point(807, 0);
             this.panelRight.Name = "panelRight";
-            this.panelRight.Size = new System.Drawing.Size(128, 410);
+            this.panelRight.Size = new System.Drawing.Size(128, 422);
             this.panelRight.TabIndex = 3;
             this.panelRight.Visible = false;
@@ -749,5 +757,5 @@
             this.panelTop.Location = new System.Drawing.Point(128, 0);
             this.panelTop.Name = "panelTop";
-            this.panelTop.Size = new System.Drawing.Size(548, 24);
+            this.panelTop.Size = new System.Drawing.Size(679, 24);
             this.panelTop.TabIndex = 6;
             // 
@@ -757,5 +765,5 @@
             this.dateTimePicker1.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right;
             this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Short;
-            this.dateTimePicker1.Location = new System.Drawing.Point(420, 0);
+            this.dateTimePicker1.Location = new System.Drawing.Point(551, 0);
             this.dateTimePicker1.Name = "dateTimePicker1";
             this.dateTimePicker1.Size = new System.Drawing.Size(128, 20);
@@ -779,107 +787,6 @@
             this.panelCenter.Location = new System.Drawing.Point(136, 24);
             this.panelCenter.Name = "panelCenter";
-            this.panelCenter.Size = new System.Drawing.Size(537, 362);
+            this.panelCenter.Size = new System.Drawing.Size(668, 374);
             this.panelCenter.TabIndex = 7;
-            // 
-            // ctxCalendarGrid
-            // 
-            this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
-            this.ctxCalGridAdd,
-            this.ctxCalGridEdit,
-            this.ctxCalGridDelete,
-            this.ctxCalGridCheckIn,
-            this.menuItem2,
-            this.ctxCalGridNoShow,
-            this.ctxCalGridNoShowUndo,
-            this.menuItem9,
-            this.ctxCalGridWalkin});
-            this.ctxCalendarGrid.Popup += new System.EventHandler(this.ctxCalendarGrid_Popup);
-            // 
-            // ctxCalGridAdd
-            // 
-            this.ctxCalGridAdd.Index = 0;
-            this.ctxCalGridAdd.Text = "Add Appointment";
-            this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
-            // 
-            // ctxCalGridEdit
-            // 
-            this.ctxCalGridEdit.Index = 1;
-            this.ctxCalGridEdit.Text = "Edit Appointment";
-            this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
-            // 
-            // ctxCalGridDelete
-            // 
-            this.ctxCalGridDelete.Index = 2;
-            this.ctxCalGridDelete.Text = "Cancel Appointment";
-            this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
-            // 
-            // ctxCalGridCheckIn
-            // 
-            this.ctxCalGridCheckIn.Index = 3;
-            this.ctxCalGridCheckIn.Text = "Check In Patient";
-            this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click);
-            // 
-            // menuItem2
-            // 
-            this.menuItem2.Index = 4;
-            this.menuItem2.Text = "-";
-            // 
-            // ctxCalGridNoShow
-            // 
-            this.ctxCalGridNoShow.Index = 5;
-            this.ctxCalGridNoShow.Text = "Mark as No Show";
-            this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click);
-            // 
-            // ctxCalGridNoShowUndo
-            // 
-            this.ctxCalGridNoShowUndo.Index = 6;
-            this.ctxCalGridNoShowUndo.Text = "Undo NoShow";
-            this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click);
-            // 
-            // menuItem9
-            // 
-            this.menuItem9.Index = 7;
-            this.menuItem9.Text = "-";
-            // 
-            // ctxCalGridWalkin
-            // 
-            this.ctxCalGridWalkin.Index = 8;
-            this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment";
-            this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click);
-            // 
-            // panelBottom
-            // 
-            this.panelBottom.Controls.Add(this.statusBar1);
-            this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
-            this.panelBottom.Location = new System.Drawing.Point(136, 386);
-            this.panelBottom.Name = "panelBottom";
-            this.panelBottom.Size = new System.Drawing.Size(537, 24);
-            this.panelBottom.TabIndex = 8;
-            // 
-            // statusBar1
-            // 
-            this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.statusBar1.Location = new System.Drawing.Point(0, 0);
-            this.statusBar1.Name = "statusBar1";
-            this.statusBar1.Size = new System.Drawing.Size(537, 24);
-            this.statusBar1.SizingGrip = false;
-            this.statusBar1.TabIndex = 0;
-            // 
-            // splitter1
-            // 
-            this.splitter1.Location = new System.Drawing.Point(128, 24);
-            this.splitter1.Name = "splitter1";
-            this.splitter1.Size = new System.Drawing.Size(8, 386);
-            this.splitter1.TabIndex = 9;
-            this.splitter1.TabStop = false;
-            // 
-            // splitter2
-            // 
-            this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
-            this.splitter2.Location = new System.Drawing.Point(673, 24);
-            this.splitter2.Name = "splitter2";
-            this.splitter2.Size = new System.Drawing.Size(3, 386);
-            this.splitter2.TabIndex = 10;
-            this.splitter2.TabStop = false;
             // 
             // calendarGrid1
@@ -902,5 +809,5 @@
             this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources")));
             this.calendarGrid1.SelectedAppointment = 0;
-            this.calendarGrid1.Size = new System.Drawing.Size(537, 362);
+            this.calendarGrid1.Size = new System.Drawing.Size(668, 374);
             this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
             this.calendarGrid1.TabIndex = 0;
@@ -911,8 +818,109 @@
             this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded);
             // 
+            // ctxCalendarGrid
+            // 
+            this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+            this.ctxCalGridAdd,
+            this.ctxCalGridEdit,
+            this.ctxCalGridDelete,
+            this.ctxCalGridCheckIn,
+            this.menuItem2,
+            this.ctxCalGridNoShow,
+            this.ctxCalGridNoShowUndo,
+            this.menuItem9,
+            this.ctxCalGridWalkin});
+            this.ctxCalendarGrid.Popup += new System.EventHandler(this.ctxCalendarGrid_Popup);
+            // 
+            // ctxCalGridAdd
+            // 
+            this.ctxCalGridAdd.Index = 0;
+            this.ctxCalGridAdd.Text = "Add Appointment";
+            this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
+            // 
+            // ctxCalGridEdit
+            // 
+            this.ctxCalGridEdit.Index = 1;
+            this.ctxCalGridEdit.Text = "Edit Appointment";
+            this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
+            // 
+            // ctxCalGridDelete
+            // 
+            this.ctxCalGridDelete.Index = 2;
+            this.ctxCalGridDelete.Text = "Cancel Appointment";
+            this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
+            // 
+            // ctxCalGridCheckIn
+            // 
+            this.ctxCalGridCheckIn.Index = 3;
+            this.ctxCalGridCheckIn.Text = "Check In Patient";
+            this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click);
+            // 
+            // menuItem2
+            // 
+            this.menuItem2.Index = 4;
+            this.menuItem2.Text = "-";
+            // 
+            // ctxCalGridNoShow
+            // 
+            this.ctxCalGridNoShow.Index = 5;
+            this.ctxCalGridNoShow.Text = "Mark as No Show";
+            this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click);
+            // 
+            // ctxCalGridNoShowUndo
+            // 
+            this.ctxCalGridNoShowUndo.Index = 6;
+            this.ctxCalGridNoShowUndo.Text = "Undo NoShow";
+            this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click);
+            // 
+            // menuItem9
+            // 
+            this.menuItem9.Index = 7;
+            this.menuItem9.Text = "-";
+            // 
+            // ctxCalGridWalkin
+            // 
+            this.ctxCalGridWalkin.Index = 8;
+            this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment";
+            this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click);
+            // 
+            // panelBottom
+            // 
+            this.panelBottom.Controls.Add(this.statusBar1);
+            this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.panelBottom.Location = new System.Drawing.Point(136, 398);
+            this.panelBottom.Name = "panelBottom";
+            this.panelBottom.Size = new System.Drawing.Size(668, 24);
+            this.panelBottom.TabIndex = 8;
+            // 
+            // statusBar1
+            // 
+            this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.statusBar1.Location = new System.Drawing.Point(0, 0);
+            this.statusBar1.Name = "statusBar1";
+            this.statusBar1.Size = new System.Drawing.Size(668, 24);
+            this.statusBar1.SizingGrip = false;
+            this.statusBar1.TabIndex = 0;
+            // 
+            // splitter1
+            // 
+            this.splitter1.Location = new System.Drawing.Point(128, 24);
+            this.splitter1.Name = "splitter1";
+            this.splitter1.Size = new System.Drawing.Size(8, 398);
+            this.splitter1.TabIndex = 9;
+            this.splitter1.TabStop = false;
+            // 
+            // splitter2
+            // 
+            this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
+            this.splitter2.Location = new System.Drawing.Point(804, 24);
+            this.splitter2.Name = "splitter2";
+            this.splitter2.Size = new System.Drawing.Size(3, 398);
+            this.splitter2.TabIndex = 10;
+            this.splitter2.TabStop = false;
+            // 
             // CGView
             // 
             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
-            this.ClientSize = new System.Drawing.Size(804, 410);
+            this.ClientSize = new System.Drawing.Size(935, 422);
             this.Controls.Add(this.panelCenter);
             this.Controls.Add(this.panelBottom);
@@ -1950,5 +1958,7 @@
 					sStopCode = drHL["STOP_CODE_NUMBER"].ToString();
 
-					DataRow[] draCS = drHL.GetChildRows(m_DocManager.GlobalDataSet.Relations["HospitalLocationClinic"]);
+					
+                    //TODO: Remove this. This doesn't exist in VISTA.
+                    DataRow[] draCS = drHL.GetChildRows(m_DocManager.GlobalDataSet.Relations["HospitalLocationClinic"]);
 					if (draCS.GetLength(0) > 0)
 					{
@@ -2151,8 +2161,4 @@
 				Debug.Assert(nDuration > 0);
 
-				/*
-				 * 7-19-05 Added overbook prompt
-				 * 8-10-05 Copied code block prior to patient selection
-				*/
 				this.Document.RefreshDocument();
 				string sAccessType = "";
@@ -2202,22 +2208,8 @@
 				appt.AccessTypeID = nAccessTypeID;
 
-				/*
-				 * 7-19-05 Added overbook prompt
-				 * 8-10-05 Copied code block prior to patient selection
-				*/
-				this.Document.RefreshDocument();
-				m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);
-
-				if (m_nSlots < 1)
-				{
-					DialogResult dr = MessageBox.Show(this, "There are no slots available at the selected time.  Do you want to overbook this appointment?", "Clinical Scheduling",MessageBoxButtons.YesNo);
-					if (dr != DialogResult.Yes)
-					{
-						return;
-					}
-				}
-
 				//Call Document to add a new appointment
 				this.Document.CreateAppointment(appt);
+                this.Document.RefreshDocument();
+
 			}
 			catch (Exception ex)
Index: /Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user
===================================================================
--- /Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user	(revision 793)
+++ /Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user	(revision 794)
@@ -36,5 +36,5 @@
     </RemoteDebugMachine>
     <StartAction>Project</StartAction>
-    <StartArguments>/s=192.168.254.129 /p=9260 /a=shabiel12 /v=catdog.44</StartArguments>
+    <StartArguments>/s=s0110.sequencemanagers.com /p=8110 /a=wizard.11 /v=storm.11</StartArguments>
     <StartPage>
     </StartPage>
@@ -55,5 +55,5 @@
     </RemoteDebugMachine>
     <StartAction>Project</StartAction>
-    <StartArguments>/s=192.168.254.129 /p=9260 /a=shabiel12 /v=catdog.44</StartArguments>
+    <StartArguments>/s=s0110.sequencemanagers.com /p=8110 /a=wizard.11 /v=storm.11</StartArguments>
     <StartPage>
     </StartPage>
