| 1 | using System; | 
|---|
| 2 | using System.Drawing; | 
|---|
| 3 | using System.Collections; | 
|---|
| 4 | using System.ComponentModel; | 
|---|
| 5 | using System.Windows.Forms; | 
|---|
| 6 | using System.Diagnostics; | 
|---|
| 7 | using System.Data; | 
|---|
| 8 | using System.Threading; | 
|---|
| 9 | using IndianHealthService.BMXNet; | 
|---|
| 10 | using System.Runtime.InteropServices; | 
|---|
| 11 |  | 
|---|
| 12 | namespace IndianHealthService.ClinicalScheduling | 
|---|
| 13 | { | 
|---|
| 14 | /// <summary> | 
|---|
| 15 | /// Main Form: Shows Tree of Clinics and Calendar Grid | 
|---|
| 16 | /// </summary> | 
|---|
| 17 | public class CGView : System.Windows.Forms.Form | 
|---|
| 18 | { | 
|---|
| 19 | private System.Windows.Forms.MainMenu mainMenu1; | 
|---|
| 20 | private System.Windows.Forms.MenuItem mnuFile; | 
|---|
| 21 | private System.Windows.Forms.MenuItem mnuTest; | 
|---|
| 22 | private System.Windows.Forms.MenuItem mnuAppointment; | 
|---|
| 23 | private System.Windows.Forms.MenuItem mnuNewAppointment; | 
|---|
| 24 | private System.Windows.Forms.MenuItem mnu1Day; | 
|---|
| 25 | private System.Windows.Forms.MenuItem mnu7Day; | 
|---|
| 26 | private System.Windows.Forms.MenuItem menuItem4; | 
|---|
| 27 | private System.Windows.Forms.MenuItem mnu5Day; | 
|---|
| 28 | private System.Windows.Forms.MenuItem mnu10Minute; | 
|---|
| 29 | private System.Windows.Forms.MenuItem mnu20Minute; | 
|---|
| 30 | private System.Windows.Forms.MenuItem mnu30Minute; | 
|---|
| 31 | private System.Windows.Forms.MenuItem mnuTimeScale; | 
|---|
| 32 | private System.Windows.Forms.MenuItem mnu15Minute; | 
|---|
| 33 | private System.Windows.Forms.MenuItem mnuOpenSchedule; | 
|---|
| 34 | private System.Windows.Forms.MenuItem menuItem1; | 
|---|
| 35 | private System.Windows.Forms.TreeView tvSchedules; | 
|---|
| 36 | private System.Windows.Forms.MenuItem mnuViewScheduleTree; | 
|---|
| 37 | private System.Windows.Forms.MenuItem mnuDeleteAppointment; | 
|---|
| 38 | private System.Windows.Forms.MenuItem mnuTest1; | 
|---|
| 39 | private System.Windows.Forms.Splitter splitter1; | 
|---|
| 40 | private System.Windows.Forms.Splitter splitter2; | 
|---|
| 41 | private System.Windows.Forms.StatusBar statusBar1; | 
|---|
| 42 | private System.Windows.Forms.DateTimePicker dateTimePicker1; | 
|---|
| 43 | private System.Windows.Forms.MenuItem mnuViewRightPanel; | 
|---|
| 44 | private System.Windows.Forms.Panel panelRight; | 
|---|
| 45 | private System.Windows.Forms.Panel panelTop; | 
|---|
| 46 | private System.Windows.Forms.Panel panelCenter; | 
|---|
| 47 | private System.Windows.Forms.Panel panelBottom; | 
|---|
| 48 | private System.Windows.Forms.Label lblResource; | 
|---|
| 49 | private System.Windows.Forms.ContextMenu contextMenu1; | 
|---|
| 50 | private System.Windows.Forms.MenuItem ctxOpenSchedule; | 
|---|
| 51 | private System.Windows.Forms.MenuItem ctxEditAvailability; | 
|---|
| 52 | private System.Windows.Forms.MenuItem ctxProperties; | 
|---|
| 53 | private System.Windows.Forms.MenuItem mnuSchedulingManagment; | 
|---|
| 54 | private System.Windows.Forms.MenuItem ctxFindAppt; | 
|---|
| 55 | private System.Windows.Forms.MenuItem mnuFindAppt; | 
|---|
| 56 | internal System.Windows.Forms.MenuItem mnuRPMSServer; | 
|---|
| 57 | internal System.Windows.Forms.MenuItem mnuRPMSLogin; | 
|---|
| 58 | private System.Windows.Forms.MenuItem mnuCheckIn; | 
|---|
| 59 | private System.Windows.Forms.MenuItem menuItem3; | 
|---|
| 60 | private System.Windows.Forms.MenuItem mnuHelpAbout; | 
|---|
| 61 | private System.Windows.Forms.MenuItem mnuCalendar; | 
|---|
| 62 | private System.Windows.Forms.MenuItem mnuHelp; | 
|---|
| 63 | private System.Windows.Forms.MenuItem mnuClose; | 
|---|
| 64 | private System.Windows.Forms.MenuItem mnuViewPatientAppts; | 
|---|
| 65 | private IndianHealthService.ClinicalScheduling.CalendarGrid calendarGrid1; | 
|---|
| 66 | private System.Windows.Forms.MenuItem mnuCopyAppointment; | 
|---|
| 67 | private System.Windows.Forms.Panel panelClip; | 
|---|
| 68 | private System.Windows.Forms.ListBox lstClip; | 
|---|
| 69 | private System.Windows.Forms.Label label1; | 
|---|
| 70 | private System.Windows.Forms.ContextMenu ctxApptClipMenu; | 
|---|
| 71 | private System.Windows.Forms.MenuItem mnuRemoveClipItem; | 
|---|
| 72 | private System.Windows.Forms.MenuItem mnuClearClipItems; | 
|---|
| 73 | private System.Windows.Forms.MenuItem mnuEditAppointment; | 
|---|
| 74 | private System.Windows.Forms.ContextMenu ctxCalendarGrid; | 
|---|
| 75 | private System.Windows.Forms.MenuItem ctxCalGridAdd; | 
|---|
| 76 | private System.Windows.Forms.MenuItem ctxCalGridEdit; | 
|---|
| 77 | private System.Windows.Forms.MenuItem ctxCalGridDelete; | 
|---|
| 78 | private System.Windows.Forms.MenuItem ctxCalGridCheckIn; | 
|---|
| 79 | private System.Windows.Forms.MenuItem menuItem6; | 
|---|
| 80 | private System.Windows.Forms.MenuItem menuItem7; | 
|---|
| 81 | private System.Windows.Forms.MenuItem mnuPrintReminderLetters; | 
|---|
| 82 | private System.Windows.Forms.MenuItem mnuPrintPatientLetter; | 
|---|
| 83 | private System.Windows.Forms.MenuItem mnuPrintClinicSchedules; | 
|---|
| 84 | private System.Windows.Forms.MenuItem ctxCalGridNoShow; | 
|---|
| 85 | private System.Windows.Forms.MenuItem ctxCalGridNoShowUndo; | 
|---|
| 86 | private System.Windows.Forms.MenuItem mnuNoShow; | 
|---|
| 87 | private System.Windows.Forms.MenuItem mnuNoShowUndo; | 
|---|
| 88 | private System.Windows.Forms.MenuItem mnuPrintRebookLetters; | 
|---|
| 89 | private System.Windows.Forms.MenuItem mnuPrintCancellationLetters; | 
|---|
| 90 | private System.Windows.Forms.MenuItem mnuWalkIn; | 
|---|
| 91 | private System.Windows.Forms.MenuItem menuItem5; | 
|---|
| 92 | private System.Windows.Forms.MenuItem menuItem8; | 
|---|
| 93 | private System.Windows.Forms.MenuItem ctxCalGridWalkin; | 
|---|
| 94 | private System.Windows.Forms.MenuItem menuItem2; | 
|---|
| 95 | private System.Windows.Forms.MenuItem menuItem9; | 
|---|
| 96 | private System.Windows.Forms.MenuItem mnuOpenMultipleSchedules; | 
|---|
| 97 | private System.Windows.Forms.MenuItem mnuDisplayWalkIns; | 
|---|
| 98 | private System.Windows.Forms.MenuItem mnuRPMSDivision; | 
|---|
| 99 | private System.Drawing.Printing.PrintDocument printRoutingSlip; | 
|---|
| 100 | private MenuItem menuItem10; | 
|---|
| 101 | private MenuItem ctxCalGridReprintRoutingSlip; | 
|---|
| 102 | private IContainer components; | 
|---|
| 103 |  | 
|---|
| 104 | #region Initialization | 
|---|
| 105 | public CGView() | 
|---|
| 106 | { | 
|---|
| 107 | // | 
|---|
| 108 | // Required for Windows Form Designer support | 
|---|
| 109 | // | 
|---|
| 110 | InitializeComponent(); | 
|---|
| 111 |  | 
|---|
| 112 | m_nSlots = 0; | 
|---|
| 113 | m_alSelectedTreeResourceArray = new ArrayList(); | 
|---|
| 114 | m_ClipList = new CGAppointments(); | 
|---|
| 115 |  | 
|---|
| 116 | } | 
|---|
| 117 |  | 
|---|
| 118 | public void InitializeDocView(string sText) | 
|---|
| 119 | { | 
|---|
| 120 | this.Text = this.DocManager.ConnectInfo.UserName; | 
|---|
| 121 | if (sText != null) | 
|---|
| 122 | this.Text += " - " + sText; | 
|---|
| 123 | if (DocManager.ConnectInfo.DivisionName != null) | 
|---|
| 124 | this.Text += " - " + DocManager.ConnectInfo.DivisionName; | 
|---|
| 125 | } | 
|---|
| 126 |  | 
|---|
| 127 | public void InitializeDocView(CGDocument doc, | 
|---|
| 128 | CGDocumentManager docMgr, | 
|---|
| 129 | DateTime dStartDate, | 
|---|
| 130 | string sText) | 
|---|
| 131 | { | 
|---|
| 132 | System.IntPtr pHandle = this.Handle; | 
|---|
| 133 | this.DocManager = docMgr; | 
|---|
| 134 | this.StartDate = dStartDate; | 
|---|
| 135 | this.Document = doc; | 
|---|
| 136 |  | 
|---|
| 137 | //Rather strangely, this line is needed for God knows Why... | 
|---|
| 138 | //Without it, the Grid tries to draw appointments, but can't. | 
|---|
| 139 | //Making a constructor in the Calendar Grid itself didn't work. Don't know why. | 
|---|
| 140 | //XXX: For later investigation. | 
|---|
| 141 | this.Appointments = new CGAppointments(); | 
|---|
| 142 |  | 
|---|
| 143 |  | 
|---|
| 144 | // Set username and division up top | 
|---|
| 145 | this.Text = this.DocManager.ConnectInfo.UserName; | 
|---|
| 146 | if (sText != null) | 
|---|
| 147 | this.Text += " - " + sText; | 
|---|
| 148 | if (DocManager.ConnectInfo.DivisionName != null) | 
|---|
| 149 | this.Text += " - " + DocManager.ConnectInfo.DivisionName; | 
|---|
| 150 |  | 
|---|
| 151 | this.m_ConnectInfo = m_DocManager.ConnectInfo; | 
|---|
| 152 | m_bmxDelegate = new BMXNetConnectInfo.BMXNetEventDelegate(BMXNetEventHandler); | 
|---|
| 153 | m_ConnectInfo.BMXNetEvent += m_bmxDelegate; | 
|---|
| 154 | } | 
|---|
| 155 |  | 
|---|
| 156 | private BMXNetConnectInfo.BMXNetEventDelegate m_bmxDelegate; | 
|---|
| 157 |  | 
|---|
| 158 |  | 
|---|
| 159 | #endregion initialization | 
|---|
| 160 |  | 
|---|
| 161 | #region Windows Form Designer generated code | 
|---|
| 162 | /// <summary> | 
|---|
| 163 | /// Required method for Designer support - do not modify | 
|---|
| 164 | /// the contents of this method with the code editor. | 
|---|
| 165 | /// </summary> | 
|---|
| 166 | private void InitializeComponent() | 
|---|
| 167 | { | 
|---|
| 168 | this.components = new System.ComponentModel.Container(); | 
|---|
| 169 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CGView)); | 
|---|
| 170 | this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components); | 
|---|
| 171 | this.mnuFile = new System.Windows.Forms.MenuItem(); | 
|---|
| 172 | this.mnuOpenSchedule = new System.Windows.Forms.MenuItem(); | 
|---|
| 173 | this.mnuOpenMultipleSchedules = new System.Windows.Forms.MenuItem(); | 
|---|
| 174 | this.menuItem1 = new System.Windows.Forms.MenuItem(); | 
|---|
| 175 | this.mnuRPMSServer = new System.Windows.Forms.MenuItem(); | 
|---|
| 176 | this.mnuRPMSLogin = new System.Windows.Forms.MenuItem(); | 
|---|
| 177 | this.mnuRPMSDivision = new System.Windows.Forms.MenuItem(); | 
|---|
| 178 | this.menuItem3 = new System.Windows.Forms.MenuItem(); | 
|---|
| 179 | this.mnuSchedulingManagment = new System.Windows.Forms.MenuItem(); | 
|---|
| 180 | this.menuItem6 = new System.Windows.Forms.MenuItem(); | 
|---|
| 181 | this.mnuPrintClinicSchedules = new System.Windows.Forms.MenuItem(); | 
|---|
| 182 | this.mnuPrintReminderLetters = new System.Windows.Forms.MenuItem(); | 
|---|
| 183 | this.mnuPrintRebookLetters = new System.Windows.Forms.MenuItem(); | 
|---|
| 184 | this.mnuPrintCancellationLetters = new System.Windows.Forms.MenuItem(); | 
|---|
| 185 | this.mnuPrintPatientLetter = new System.Windows.Forms.MenuItem(); | 
|---|
| 186 | this.menuItem7 = new System.Windows.Forms.MenuItem(); | 
|---|
| 187 | this.mnuClose = new System.Windows.Forms.MenuItem(); | 
|---|
| 188 | this.mnuAppointment = new System.Windows.Forms.MenuItem(); | 
|---|
| 189 | this.mnuNewAppointment = new System.Windows.Forms.MenuItem(); | 
|---|
| 190 | this.mnuEditAppointment = new System.Windows.Forms.MenuItem(); | 
|---|
| 191 | this.mnuDeleteAppointment = new System.Windows.Forms.MenuItem(); | 
|---|
| 192 | this.menuItem5 = new System.Windows.Forms.MenuItem(); | 
|---|
| 193 | this.mnuNoShow = new System.Windows.Forms.MenuItem(); | 
|---|
| 194 | this.mnuNoShowUndo = new System.Windows.Forms.MenuItem(); | 
|---|
| 195 | this.menuItem8 = new System.Windows.Forms.MenuItem(); | 
|---|
| 196 | this.mnuCopyAppointment = new System.Windows.Forms.MenuItem(); | 
|---|
| 197 | this.mnuWalkIn = new System.Windows.Forms.MenuItem(); | 
|---|
| 198 | this.mnuFindAppt = new System.Windows.Forms.MenuItem(); | 
|---|
| 199 | this.mnuCheckIn = new System.Windows.Forms.MenuItem(); | 
|---|
| 200 | this.mnuViewPatientAppts = new System.Windows.Forms.MenuItem(); | 
|---|
| 201 | this.mnuCalendar = new System.Windows.Forms.MenuItem(); | 
|---|
| 202 | this.mnuDisplayWalkIns = new System.Windows.Forms.MenuItem(); | 
|---|
| 203 | this.mnu1Day = new System.Windows.Forms.MenuItem(); | 
|---|
| 204 | this.mnu5Day = new System.Windows.Forms.MenuItem(); | 
|---|
| 205 | this.mnu7Day = new System.Windows.Forms.MenuItem(); | 
|---|
| 206 | this.menuItem4 = new System.Windows.Forms.MenuItem(); | 
|---|
| 207 | this.mnuTimeScale = new System.Windows.Forms.MenuItem(); | 
|---|
| 208 | this.mnu10Minute = new System.Windows.Forms.MenuItem(); | 
|---|
| 209 | this.mnu15Minute = new System.Windows.Forms.MenuItem(); | 
|---|
| 210 | this.mnu20Minute = new System.Windows.Forms.MenuItem(); | 
|---|
| 211 | this.mnu30Minute = new System.Windows.Forms.MenuItem(); | 
|---|
| 212 | this.mnuViewScheduleTree = new System.Windows.Forms.MenuItem(); | 
|---|
| 213 | this.mnuViewRightPanel = new System.Windows.Forms.MenuItem(); | 
|---|
| 214 | this.mnuHelp = new System.Windows.Forms.MenuItem(); | 
|---|
| 215 | this.mnuHelpAbout = new System.Windows.Forms.MenuItem(); | 
|---|
| 216 | this.mnuTest = new System.Windows.Forms.MenuItem(); | 
|---|
| 217 | this.mnuTest1 = new System.Windows.Forms.MenuItem(); | 
|---|
| 218 | this.tvSchedules = new System.Windows.Forms.TreeView(); | 
|---|
| 219 | this.contextMenu1 = new System.Windows.Forms.ContextMenu(); | 
|---|
| 220 | this.ctxOpenSchedule = new System.Windows.Forms.MenuItem(); | 
|---|
| 221 | this.ctxEditAvailability = new System.Windows.Forms.MenuItem(); | 
|---|
| 222 | this.ctxProperties = new System.Windows.Forms.MenuItem(); | 
|---|
| 223 | this.ctxFindAppt = new System.Windows.Forms.MenuItem(); | 
|---|
| 224 | this.panelRight = new System.Windows.Forms.Panel(); | 
|---|
| 225 | this.panelClip = new System.Windows.Forms.Panel(); | 
|---|
| 226 | this.lstClip = new System.Windows.Forms.ListBox(); | 
|---|
| 227 | this.ctxApptClipMenu = new System.Windows.Forms.ContextMenu(); | 
|---|
| 228 | this.mnuRemoveClipItem = new System.Windows.Forms.MenuItem(); | 
|---|
| 229 | this.mnuClearClipItems = new System.Windows.Forms.MenuItem(); | 
|---|
| 230 | this.label1 = new System.Windows.Forms.Label(); | 
|---|
| 231 | this.panelTop = new System.Windows.Forms.Panel(); | 
|---|
| 232 | this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); | 
|---|
| 233 | this.lblResource = new System.Windows.Forms.Label(); | 
|---|
| 234 | this.panelCenter = new System.Windows.Forms.Panel(); | 
|---|
| 235 | this.ctxCalendarGrid = new System.Windows.Forms.ContextMenu(); | 
|---|
| 236 | this.ctxCalGridAdd = new System.Windows.Forms.MenuItem(); | 
|---|
| 237 | this.ctxCalGridEdit = new System.Windows.Forms.MenuItem(); | 
|---|
| 238 | this.ctxCalGridDelete = new System.Windows.Forms.MenuItem(); | 
|---|
| 239 | this.ctxCalGridCheckIn = new System.Windows.Forms.MenuItem(); | 
|---|
| 240 | this.menuItem2 = new System.Windows.Forms.MenuItem(); | 
|---|
| 241 | this.ctxCalGridNoShow = new System.Windows.Forms.MenuItem(); | 
|---|
| 242 | this.ctxCalGridNoShowUndo = new System.Windows.Forms.MenuItem(); | 
|---|
| 243 | this.menuItem9 = new System.Windows.Forms.MenuItem(); | 
|---|
| 244 | this.ctxCalGridWalkin = new System.Windows.Forms.MenuItem(); | 
|---|
| 245 | this.menuItem10 = new System.Windows.Forms.MenuItem(); | 
|---|
| 246 | this.ctxCalGridReprintRoutingSlip = new System.Windows.Forms.MenuItem(); | 
|---|
| 247 | this.panelBottom = new System.Windows.Forms.Panel(); | 
|---|
| 248 | this.statusBar1 = new System.Windows.Forms.StatusBar(); | 
|---|
| 249 | this.splitter1 = new System.Windows.Forms.Splitter(); | 
|---|
| 250 | this.splitter2 = new System.Windows.Forms.Splitter(); | 
|---|
| 251 | this.printRoutingSlip = new System.Drawing.Printing.PrintDocument(); | 
|---|
| 252 | this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid(); | 
|---|
| 253 | this.panelRight.SuspendLayout(); | 
|---|
| 254 | this.panelClip.SuspendLayout(); | 
|---|
| 255 | this.panelTop.SuspendLayout(); | 
|---|
| 256 | this.panelCenter.SuspendLayout(); | 
|---|
| 257 | this.panelBottom.SuspendLayout(); | 
|---|
| 258 | this.SuspendLayout(); | 
|---|
| 259 | // | 
|---|
| 260 | // mainMenu1 | 
|---|
| 261 | // | 
|---|
| 262 | this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 
|---|
| 263 | this.mnuFile, | 
|---|
| 264 | this.mnuAppointment, | 
|---|
| 265 | this.mnuCalendar, | 
|---|
| 266 | this.mnuHelp, | 
|---|
| 267 | this.mnuTest}); | 
|---|
| 268 | // | 
|---|
| 269 | // mnuFile | 
|---|
| 270 | // | 
|---|
| 271 | this.mnuFile.Index = 0; | 
|---|
| 272 | this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 
|---|
| 273 | this.mnuOpenSchedule, | 
|---|
| 274 | this.mnuOpenMultipleSchedules, | 
|---|
| 275 | this.menuItem1, | 
|---|
| 276 | this.mnuRPMSServer, | 
|---|
| 277 | this.mnuRPMSLogin, | 
|---|
| 278 | this.mnuRPMSDivision, | 
|---|
| 279 | this.menuItem3, | 
|---|
| 280 | this.mnuSchedulingManagment, | 
|---|
| 281 | this.menuItem6, | 
|---|
| 282 | this.mnuPrintClinicSchedules, | 
|---|
| 283 | this.mnuPrintReminderLetters, | 
|---|
| 284 | this.mnuPrintRebookLetters, | 
|---|
| 285 | this.mnuPrintCancellationLetters, | 
|---|
| 286 | this.mnuPrintPatientLetter, | 
|---|
| 287 | this.menuItem7, | 
|---|
| 288 | this.mnuClose}); | 
|---|
| 289 | this.mnuFile.Text = "&File"; | 
|---|
| 290 | this.mnuFile.Popup += new System.EventHandler(this.mnuFile_Popup); | 
|---|
| 291 | // | 
|---|
| 292 | // mnuOpenSchedule | 
|---|
| 293 | // | 
|---|
| 294 | this.mnuOpenSchedule.Enabled = false; | 
|---|
| 295 | this.mnuOpenSchedule.Index = 0; | 
|---|
| 296 | this.mnuOpenSchedule.Text = "&Open Schedule"; | 
|---|
| 297 | this.mnuOpenSchedule.Visible = false; | 
|---|
| 298 | this.mnuOpenSchedule.Click += new System.EventHandler(this.mnuOpenSchedule_Click); | 
|---|
| 299 | // | 
|---|
| 300 | // mnuOpenMultipleSchedules | 
|---|
| 301 | // | 
|---|
| 302 | this.mnuOpenMultipleSchedules.Index = 1; | 
|---|
| 303 | this.mnuOpenMultipleSchedules.Shortcut = System.Windows.Forms.Shortcut.CtrlM; | 
|---|
| 304 | this.mnuOpenMultipleSchedules.Text = "Open M&ultiple Schedules"; | 
|---|
| 305 | this.mnuOpenMultipleSchedules.Click += new System.EventHandler(this.mnuOpenMultipleSchedules_Click); | 
|---|
| 306 | // | 
|---|
| 307 | // menuItem1 | 
|---|
| 308 | // | 
|---|
| 309 | this.menuItem1.Index = 2; | 
|---|
| 310 | this.menuItem1.Text = "-"; | 
|---|
| 311 | // | 
|---|
| 312 | // mnuRPMSServer | 
|---|
| 313 | // | 
|---|
| 314 | this.mnuRPMSServer.Index = 3; | 
|---|
| 315 | this.mnuRPMSServer.Shortcut = System.Windows.Forms.Shortcut.CtrlShiftS; | 
|---|
| 316 | this.mnuRPMSServer.Text = "Change VistA &Server"; | 
|---|
| 317 | this.mnuRPMSServer.Click += new System.EventHandler(this.mnuRPMSServer_Click); | 
|---|
| 318 | // | 
|---|
| 319 | // mnuRPMSLogin | 
|---|
| 320 | // | 
|---|
| 321 | this.mnuRPMSLogin.Index = 4; | 
|---|
| 322 | this.mnuRPMSLogin.Shortcut = System.Windows.Forms.Shortcut.CtrlShiftL; | 
|---|
| 323 | this.mnuRPMSLogin.Text = "Change VistA &Login"; | 
|---|
| 324 | this.mnuRPMSLogin.Click += new System.EventHandler(this.mnuRPMSLogin_Click); | 
|---|
| 325 | // | 
|---|
| 326 | // mnuRPMSDivision | 
|---|
| 327 | // | 
|---|
| 328 | this.mnuRPMSDivision.Index = 5; | 
|---|
| 329 | this.mnuRPMSDivision.Shortcut = System.Windows.Forms.Shortcut.CtrlShiftD; | 
|---|
| 330 | this.mnuRPMSDivision.Text = "Change VistA &Division"; | 
|---|
| 331 | this.mnuRPMSDivision.Click += new System.EventHandler(this.mnuRPMSDivision_Click); | 
|---|
| 332 | // | 
|---|
| 333 | // menuItem3 | 
|---|
| 334 | // | 
|---|
| 335 | this.menuItem3.Index = 6; | 
|---|
| 336 | this.menuItem3.Text = "-"; | 
|---|
| 337 | // | 
|---|
| 338 | // mnuSchedulingManagment | 
|---|
| 339 | // | 
|---|
| 340 | this.mnuSchedulingManagment.Index = 7; | 
|---|
| 341 | this.mnuSchedulingManagment.Shortcut = System.Windows.Forms.Shortcut.CtrlShiftM; | 
|---|
| 342 | this.mnuSchedulingManagment.Text = "Scheduling &Management"; | 
|---|
| 343 | this.mnuSchedulingManagment.Click += new System.EventHandler(this.mnuSchedulingManagment_Click); | 
|---|
| 344 | // | 
|---|
| 345 | // menuItem6 | 
|---|
| 346 | // | 
|---|
| 347 | this.menuItem6.Index = 8; | 
|---|
| 348 | this.menuItem6.Text = "-"; | 
|---|
| 349 | // | 
|---|
| 350 | // mnuPrintClinicSchedules | 
|---|
| 351 | // | 
|---|
| 352 | this.mnuPrintClinicSchedules.Index = 9; | 
|---|
| 353 | this.mnuPrintClinicSchedules.Shortcut = System.Windows.Forms.Shortcut.CtrlP; | 
|---|
| 354 | this.mnuPrintClinicSchedules.Text = "&Print Clinic Schedules"; | 
|---|
| 355 | this.mnuPrintClinicSchedules.Click += new System.EventHandler(this.mnuPrintClinicSchedules_Click); | 
|---|
| 356 | // | 
|---|
| 357 | // mnuPrintReminderLetters | 
|---|
| 358 | // | 
|---|
| 359 | this.mnuPrintReminderLetters.Index = 10; | 
|---|
| 360 | this.mnuPrintReminderLetters.Shortcut = System.Windows.Forms.Shortcut.CtrlI; | 
|---|
| 361 | this.mnuPrintReminderLetters.Text = "Print Rem&inder Letters"; | 
|---|
| 362 | this.mnuPrintReminderLetters.Click += new System.EventHandler(this.mnuPrintReminderLetters_Click); | 
|---|
| 363 | // | 
|---|
| 364 | // mnuPrintRebookLetters | 
|---|
| 365 | // | 
|---|
| 366 | this.mnuPrintRebookLetters.Index = 11; | 
|---|
| 367 | this.mnuPrintRebookLetters.Shortcut = System.Windows.Forms.Shortcut.CtrlR; | 
|---|
| 368 | this.mnuPrintRebookLetters.Text = "Print &Rebook Letters"; | 
|---|
| 369 | this.mnuPrintRebookLetters.Click += new System.EventHandler(this.mnuPrintRebookLetters_Click); | 
|---|
| 370 | // | 
|---|
| 371 | // mnuPrintCancellationLetters | 
|---|
| 372 | // | 
|---|
| 373 | this.mnuPrintCancellationLetters.Index = 12; | 
|---|
| 374 | this.mnuPrintCancellationLetters.Shortcut = System.Windows.Forms.Shortcut.CtrlShiftC; | 
|---|
| 375 | this.mnuPrintCancellationLetters.Text = "Print C&ancellation Letters"; | 
|---|
| 376 | this.mnuPrintCancellationLetters.Click += new System.EventHandler(this.mnuPrintCancellationLetters_Click); | 
|---|
| 377 | // | 
|---|
| 378 | // mnuPrintPatientLetter | 
|---|
| 379 | // | 
|---|
| 380 | this.mnuPrintPatientLetter.Index = 13; | 
|---|
| 381 | this.mnuPrintPatientLetter.Shortcut = System.Windows.Forms.Shortcut.CtrlL; | 
|---|
| 382 | this.mnuPrintPatientLetter.Text = "Print Patient Le&tter"; | 
|---|
| 383 | this.mnuPrintPatientLetter.Click += new System.EventHandler(this.mnuPrintPatientLetter_Click); | 
|---|
| 384 | // | 
|---|
| 385 | // menuItem7 | 
|---|
| 386 | // | 
|---|
| 387 | this.menuItem7.Index = 14; | 
|---|
| 388 | this.menuItem7.Text = "-"; | 
|---|
| 389 | // | 
|---|
| 390 | // mnuClose | 
|---|
| 391 | // | 
|---|
| 392 | this.mnuClose.Index = 15; | 
|---|
| 393 | this.mnuClose.Shortcut = System.Windows.Forms.Shortcut.CtrlW; | 
|---|
| 394 | this.mnuClose.Text = "&Close Schedule"; | 
|---|
| 395 | this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click); | 
|---|
| 396 | // | 
|---|
| 397 | // mnuAppointment | 
|---|
| 398 | // | 
|---|
| 399 | this.mnuAppointment.Index = 1; | 
|---|
| 400 | this.mnuAppointment.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 
|---|
| 401 | this.mnuNewAppointment, | 
|---|
| 402 | this.mnuEditAppointment, | 
|---|
| 403 | this.mnuDeleteAppointment, | 
|---|
| 404 | this.menuItem5, | 
|---|
| 405 | this.mnuNoShow, | 
|---|
| 406 | this.mnuNoShowUndo, | 
|---|
| 407 | this.menuItem8, | 
|---|
| 408 | this.mnuCopyAppointment, | 
|---|
| 409 | this.mnuWalkIn, | 
|---|
| 410 | this.mnuFindAppt, | 
|---|
| 411 | this.mnuCheckIn, | 
|---|
| 412 | this.mnuViewPatientAppts}); | 
|---|
| 413 | this.mnuAppointment.Text = "&Appointment"; | 
|---|
| 414 | this.mnuAppointment.Popup += new System.EventHandler(this.mnuAppointment_Popup); | 
|---|
| 415 | // | 
|---|
| 416 | // mnuNewAppointment | 
|---|
| 417 | // | 
|---|
| 418 | this.mnuNewAppointment.Index = 0; | 
|---|
| 419 | this.mnuNewAppointment.Text = "&New Appointment"; | 
|---|
| 420 | this.mnuNewAppointment.Click += new System.EventHandler(this.mnuNewAppointment_Click); | 
|---|
| 421 | // | 
|---|
| 422 | // mnuEditAppointment | 
|---|
| 423 | // | 
|---|
| 424 | this.mnuEditAppointment.Index = 1; | 
|---|
| 425 | this.mnuEditAppointment.Text = "&Edit Appointment"; | 
|---|
| 426 | this.mnuEditAppointment.Click += new System.EventHandler(this.mnuEditAppointment_Click); | 
|---|
| 427 | // | 
|---|
| 428 | // mnuDeleteAppointment | 
|---|
| 429 | // | 
|---|
| 430 | this.mnuDeleteAppointment.Index = 2; | 
|---|
| 431 | this.mnuDeleteAppointment.Text = "Cance&l Appointment"; | 
|---|
| 432 | this.mnuDeleteAppointment.Click += new System.EventHandler(this.mnuDeleteAppointment_Click); | 
|---|
| 433 | // | 
|---|
| 434 | // menuItem5 | 
|---|
| 435 | // | 
|---|
| 436 | this.menuItem5.Index = 3; | 
|---|
| 437 | this.menuItem5.Text = "-"; | 
|---|
| 438 | // | 
|---|
| 439 | // mnuNoShow | 
|---|
| 440 | // | 
|---|
| 441 | this.mnuNoShow.Index = 4; | 
|---|
| 442 | this.mnuNoShow.Text = "Mark as No Sho&w"; | 
|---|
| 443 | this.mnuNoShow.Click += new System.EventHandler(this.mnuNoShow_Click); | 
|---|
| 444 | // | 
|---|
| 445 | // mnuNoShowUndo | 
|---|
| 446 | // | 
|---|
| 447 | this.mnuNoShowUndo.Index = 5; | 
|---|
| 448 | this.mnuNoShowUndo.Text = "&Undo No Show"; | 
|---|
| 449 | this.mnuNoShowUndo.Click += new System.EventHandler(this.mnuNoShowUndo_Click); | 
|---|
| 450 | // | 
|---|
| 451 | // menuItem8 | 
|---|
| 452 | // | 
|---|
| 453 | this.menuItem8.Index = 6; | 
|---|
| 454 | this.menuItem8.Text = "-"; | 
|---|
| 455 | // | 
|---|
| 456 | // mnuCopyAppointment | 
|---|
| 457 | // | 
|---|
| 458 | this.mnuCopyAppointment.Index = 7; | 
|---|
| 459 | this.mnuCopyAppointment.Text = "&Copy  Appointment to Clipboard"; | 
|---|
| 460 | this.mnuCopyAppointment.Click += new System.EventHandler(this.mnuCopyAppointment_Click); | 
|---|
| 461 | // | 
|---|
| 462 | // mnuWalkIn | 
|---|
| 463 | // | 
|---|
| 464 | this.mnuWalkIn.Index = 8; | 
|---|
| 465 | this.mnuWalkIn.Text = "Create Wal&k-In Appointment"; | 
|---|
| 466 | this.mnuWalkIn.Click += new System.EventHandler(this.mnuWalkIn_Click); | 
|---|
| 467 | // | 
|---|
| 468 | // mnuFindAppt | 
|---|
| 469 | // | 
|---|
| 470 | this.mnuFindAppt.Index = 9; | 
|---|
| 471 | this.mnuFindAppt.Text = "&Find Available Appointment"; | 
|---|
| 472 | this.mnuFindAppt.Click += new System.EventHandler(this.mnuFindAppt_Click); | 
|---|
| 473 | // | 
|---|
| 474 | // mnuCheckIn | 
|---|
| 475 | // | 
|---|
| 476 | this.mnuCheckIn.Index = 10; | 
|---|
| 477 | this.mnuCheckIn.Text = "Check &In Patient"; | 
|---|
| 478 | this.mnuCheckIn.Click += new System.EventHandler(this.mnuCheckIn_Click); | 
|---|
| 479 | // | 
|---|
| 480 | // mnuViewPatientAppts | 
|---|
| 481 | // | 
|---|
| 482 | this.mnuViewPatientAppts.Index = 11; | 
|---|
| 483 | this.mnuViewPatientAppts.Text = "&View Patient Appointments"; | 
|---|
| 484 | this.mnuViewPatientAppts.Click += new System.EventHandler(this.mnuViewPatientAppts_Click); | 
|---|
| 485 | // | 
|---|
| 486 | // mnuCalendar | 
|---|
| 487 | // | 
|---|
| 488 | this.mnuCalendar.Index = 2; | 
|---|
| 489 | this.mnuCalendar.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 
|---|
| 490 | this.mnuDisplayWalkIns, | 
|---|
| 491 | this.mnu1Day, | 
|---|
| 492 | this.mnu5Day, | 
|---|
| 493 | this.mnu7Day, | 
|---|
| 494 | this.menuItem4, | 
|---|
| 495 | this.mnuTimeScale, | 
|---|
| 496 | this.mnuViewScheduleTree, | 
|---|
| 497 | this.mnuViewRightPanel}); | 
|---|
| 498 | this.mnuCalendar.Text = "&View"; | 
|---|
| 499 | // | 
|---|
| 500 | // mnuDisplayWalkIns | 
|---|
| 501 | // | 
|---|
| 502 | this.mnuDisplayWalkIns.Checked = true; | 
|---|
| 503 | this.mnuDisplayWalkIns.Index = 0; | 
|---|
| 504 | this.mnuDisplayWalkIns.Text = "&Display Walk-Ins"; | 
|---|
| 505 | this.mnuDisplayWalkIns.Click += new System.EventHandler(this.mnuDisplayWalkIns_Click); | 
|---|
| 506 | // | 
|---|
| 507 | // mnu1Day | 
|---|
| 508 | // | 
|---|
| 509 | this.mnu1Day.Index = 1; | 
|---|
| 510 | this.mnu1Day.Shortcut = System.Windows.Forms.Shortcut.Ctrl1; | 
|---|
| 511 | this.mnu1Day.Text = "&1-Day View"; | 
|---|
| 512 | this.mnu1Day.Click += new System.EventHandler(this.mnu1Day_Click); | 
|---|
| 513 | // | 
|---|
| 514 | // mnu5Day | 
|---|
| 515 | // | 
|---|
| 516 | this.mnu5Day.Index = 2; | 
|---|
| 517 | this.mnu5Day.Shortcut = System.Windows.Forms.Shortcut.Ctrl5; | 
|---|
| 518 | this.mnu5Day.Text = "&5-Day View"; | 
|---|
| 519 | this.mnu5Day.Click += new System.EventHandler(this.mnu5Day_Click); | 
|---|
| 520 | // | 
|---|
| 521 | // mnu7Day | 
|---|
| 522 | // | 
|---|
| 523 | this.mnu7Day.Index = 3; | 
|---|
| 524 | this.mnu7Day.Shortcut = System.Windows.Forms.Shortcut.Ctrl7; | 
|---|
| 525 | this.mnu7Day.Text = "&7-Day View"; | 
|---|
| 526 | this.mnu7Day.Click += new System.EventHandler(this.mnu7Day_Click); | 
|---|
| 527 | // | 
|---|
| 528 | // menuItem4 | 
|---|
| 529 | // | 
|---|
| 530 | this.menuItem4.Index = 4; | 
|---|
| 531 | this.menuItem4.Text = "-"; | 
|---|
| 532 | // | 
|---|
| 533 | // mnuTimeScale | 
|---|
| 534 | // | 
|---|
| 535 | this.mnuTimeScale.Index = 5; | 
|---|
| 536 | this.mnuTimeScale.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 
|---|
| 537 | this.mnu10Minute, | 
|---|
| 538 | this.mnu15Minute, | 
|---|
| 539 | this.mnu20Minute, | 
|---|
| 540 | this.mnu30Minute}); | 
|---|
| 541 | this.mnuTimeScale.Text = "&Time Scale"; | 
|---|
| 542 | // | 
|---|
| 543 | // mnu10Minute | 
|---|
| 544 | // | 
|---|
| 545 | this.mnu10Minute.Index = 0; | 
|---|
| 546 | this.mnu10Minute.Shortcut = System.Windows.Forms.Shortcut.Ctrl0; | 
|---|
| 547 | this.mnu10Minute.Text = "&10-Minute"; | 
|---|
| 548 | this.mnu10Minute.Click += new System.EventHandler(this.mnu10Minute_Click); | 
|---|
| 549 | // | 
|---|
| 550 | // mnu15Minute | 
|---|
| 551 | // | 
|---|
| 552 | this.mnu15Minute.Index = 1; | 
|---|
| 553 | this.mnu15Minute.Shortcut = System.Windows.Forms.Shortcut.Ctrl4; | 
|---|
| 554 | this.mnu15Minute.Text = "1&5-Minute"; | 
|---|
| 555 | this.mnu15Minute.Click += new System.EventHandler(this.mnu15Minute_Click); | 
|---|
| 556 | // | 
|---|
| 557 | // mnu20Minute | 
|---|
| 558 | // | 
|---|
| 559 | this.mnu20Minute.Index = 2; | 
|---|
| 560 | this.mnu20Minute.Shortcut = System.Windows.Forms.Shortcut.Ctrl3; | 
|---|
| 561 | this.mnu20Minute.Text = "&20-Minute"; | 
|---|
| 562 | this.mnu20Minute.Click += new System.EventHandler(this.mnu20Minute_Click); | 
|---|
| 563 | // | 
|---|
| 564 | // mnu30Minute | 
|---|
| 565 | // | 
|---|
| 566 | this.mnu30Minute.Index = 3; | 
|---|
| 567 | this.mnu30Minute.Shortcut = System.Windows.Forms.Shortcut.Ctrl2; | 
|---|
| 568 | this.mnu30Minute.Text = "&30-Minute"; | 
|---|
| 569 | this.mnu30Minute.Click += new System.EventHandler(this.mnu30Minute_Click); | 
|---|
| 570 | // | 
|---|
| 571 | // mnuViewScheduleTree | 
|---|
| 572 | // | 
|---|
| 573 | this.mnuViewScheduleTree.Index = 6; | 
|---|
| 574 | this.mnuViewScheduleTree.Text = "&Schedule Tree"; | 
|---|
| 575 | this.mnuViewScheduleTree.Click += new System.EventHandler(this.mnuViewScheduleTree_Click); | 
|---|
| 576 | // | 
|---|
| 577 | // mnuViewRightPanel | 
|---|
| 578 | // | 
|---|
| 579 | this.mnuViewRightPanel.Index = 7; | 
|---|
| 580 | this.mnuViewRightPanel.Text = "&Appointment Clipboard"; | 
|---|
| 581 | this.mnuViewRightPanel.Click += new System.EventHandler(this.mnuViewRightPanel_Click); | 
|---|
| 582 | // | 
|---|
| 583 | // mnuHelp | 
|---|
| 584 | // | 
|---|
| 585 | this.mnuHelp.Index = 3; | 
|---|
| 586 | this.mnuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 
|---|
| 587 | this.mnuHelpAbout}); | 
|---|
| 588 | this.mnuHelp.Text = "&Help"; | 
|---|
| 589 | // | 
|---|
| 590 | // mnuHelpAbout | 
|---|
| 591 | // | 
|---|
| 592 | this.mnuHelpAbout.Index = 0; | 
|---|
| 593 | this.mnuHelpAbout.Text = "&About"; | 
|---|
| 594 | this.mnuHelpAbout.Click += new System.EventHandler(this.mnuHelpAbout_Click); | 
|---|
| 595 | // | 
|---|
| 596 | // mnuTest | 
|---|
| 597 | // | 
|---|
| 598 | this.mnuTest.Enabled = false; | 
|---|
| 599 | this.mnuTest.Index = 4; | 
|---|
| 600 | this.mnuTest.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 
|---|
| 601 | this.mnuTest1}); | 
|---|
| 602 | this.mnuTest.Text = "&Test"; | 
|---|
| 603 | this.mnuTest.Visible = false; | 
|---|
| 604 | // | 
|---|
| 605 | // mnuTest1 | 
|---|
| 606 | // | 
|---|
| 607 | this.mnuTest1.Index = 0; | 
|---|
| 608 | this.mnuTest1.Text = "Test1"; | 
|---|
| 609 | this.mnuTest1.Click += new System.EventHandler(this.mnuTest1_Click); | 
|---|
| 610 | // | 
|---|
| 611 | // tvSchedules | 
|---|
| 612 | // | 
|---|
| 613 | this.tvSchedules.BackColor = System.Drawing.SystemColors.ControlLight; | 
|---|
| 614 | this.tvSchedules.ContextMenu = this.contextMenu1; | 
|---|
| 615 | this.tvSchedules.Dock = System.Windows.Forms.DockStyle.Left; | 
|---|
| 616 | this.tvSchedules.HotTracking = true; | 
|---|
| 617 | this.tvSchedules.Location = new System.Drawing.Point(0, 0); | 
|---|
| 618 | this.tvSchedules.Name = "tvSchedules"; | 
|---|
| 619 | this.tvSchedules.Size = new System.Drawing.Size(128, 400); | 
|---|
| 620 | this.tvSchedules.Sorted = true; | 
|---|
| 621 | this.tvSchedules.TabIndex = 1; | 
|---|
| 622 | this.tvSchedules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSchedules_AfterSelect); | 
|---|
| 623 | this.tvSchedules.Click += new System.EventHandler(this.tvSchedules_Click); | 
|---|
| 624 | this.tvSchedules.DoubleClick += new System.EventHandler(this.tvSchedules_DoubleClick); | 
|---|
| 625 | // | 
|---|
| 626 | // contextMenu1 | 
|---|
| 627 | // | 
|---|
| 628 | this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 
|---|
| 629 | this.ctxOpenSchedule, | 
|---|
| 630 | this.ctxEditAvailability, | 
|---|
| 631 | this.ctxProperties, | 
|---|
| 632 | this.ctxFindAppt}); | 
|---|
| 633 | this.contextMenu1.Popup += new System.EventHandler(this.contextMenu1_Popup); | 
|---|
| 634 | // | 
|---|
| 635 | // ctxOpenSchedule | 
|---|
| 636 | // | 
|---|
| 637 | this.ctxOpenSchedule.DefaultItem = true; | 
|---|
| 638 | this.ctxOpenSchedule.Index = 0; | 
|---|
| 639 | this.ctxOpenSchedule.Text = "&Open Schedule"; | 
|---|
| 640 | this.ctxOpenSchedule.Click += new System.EventHandler(this.ctxOpenSchedule_Click); | 
|---|
| 641 | // | 
|---|
| 642 | // ctxEditAvailability | 
|---|
| 643 | // | 
|---|
| 644 | this.ctxEditAvailability.Index = 1; | 
|---|
| 645 | this.ctxEditAvailability.Text = "&Edit Resource Availability"; | 
|---|
| 646 | this.ctxEditAvailability.Click += new System.EventHandler(this.ctxEditAvailability_Click); | 
|---|
| 647 | // | 
|---|
| 648 | // ctxProperties | 
|---|
| 649 | // | 
|---|
| 650 | this.ctxProperties.Index = 2; | 
|---|
| 651 | this.ctxProperties.Text = "&Properties"; | 
|---|
| 652 | this.ctxProperties.Click += new System.EventHandler(this.ctxProperties_Click); | 
|---|
| 653 | // | 
|---|
| 654 | // ctxFindAppt | 
|---|
| 655 | // | 
|---|
| 656 | this.ctxFindAppt.Index = 3; | 
|---|
| 657 | this.ctxFindAppt.Text = "Find Available Appointment"; | 
|---|
| 658 | this.ctxFindAppt.Click += new System.EventHandler(this.ctxFindAppt_Click); | 
|---|
| 659 | // | 
|---|
| 660 | // panelRight | 
|---|
| 661 | // | 
|---|
| 662 | this.panelRight.Controls.Add(this.panelClip); | 
|---|
| 663 | this.panelRight.Dock = System.Windows.Forms.DockStyle.Right; | 
|---|
| 664 | this.panelRight.Location = new System.Drawing.Point(941, 0); | 
|---|
| 665 | this.panelRight.Name = "panelRight"; | 
|---|
| 666 | this.panelRight.Size = new System.Drawing.Size(128, 400); | 
|---|
| 667 | this.panelRight.TabIndex = 3; | 
|---|
| 668 | this.panelRight.Visible = false; | 
|---|
| 669 | // | 
|---|
| 670 | // panelClip | 
|---|
| 671 | // | 
|---|
| 672 | this.panelClip.Controls.Add(this.lstClip); | 
|---|
| 673 | this.panelClip.Controls.Add(this.label1); | 
|---|
| 674 | this.panelClip.Dock = System.Windows.Forms.DockStyle.Top; | 
|---|
| 675 | this.panelClip.Location = new System.Drawing.Point(0, 0); | 
|---|
| 676 | this.panelClip.Name = "panelClip"; | 
|---|
| 677 | this.panelClip.Size = new System.Drawing.Size(128, 448); | 
|---|
| 678 | this.panelClip.TabIndex = 0; | 
|---|
| 679 | // | 
|---|
| 680 | // lstClip | 
|---|
| 681 | // | 
|---|
| 682 | this.lstClip.AllowDrop = true; | 
|---|
| 683 | this.lstClip.ContextMenu = this.ctxApptClipMenu; | 
|---|
| 684 | this.lstClip.DisplayMember = "PatientName"; | 
|---|
| 685 | this.lstClip.Dock = System.Windows.Forms.DockStyle.Fill; | 
|---|
| 686 | this.lstClip.Location = new System.Drawing.Point(0, 32); | 
|---|
| 687 | this.lstClip.Name = "lstClip"; | 
|---|
| 688 | this.lstClip.Size = new System.Drawing.Size(128, 416); | 
|---|
| 689 | this.lstClip.TabIndex = 0; | 
|---|
| 690 | this.lstClip.SelectedIndexChanged += new System.EventHandler(this.lstClip_SelectedIndexChanged); | 
|---|
| 691 | this.lstClip.DragDrop += new System.Windows.Forms.DragEventHandler(this.lstClip_DragDrop); | 
|---|
| 692 | this.lstClip.DragEnter += new System.Windows.Forms.DragEventHandler(this.lstClip_DragEnter); | 
|---|
| 693 | this.lstClip.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstClip_MouseDown); | 
|---|
| 694 | this.lstClip.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lstClip_MouseMove); | 
|---|
| 695 | // | 
|---|
| 696 | // ctxApptClipMenu | 
|---|
| 697 | // | 
|---|
| 698 | this.ctxApptClipMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 
|---|
| 699 | this.mnuRemoveClipItem, | 
|---|
| 700 | this.mnuClearClipItems}); | 
|---|
| 701 | this.ctxApptClipMenu.Popup += new System.EventHandler(this.ctxApptClipMenu_Popup); | 
|---|
| 702 | // | 
|---|
| 703 | // mnuRemoveClipItem | 
|---|
| 704 | // | 
|---|
| 705 | this.mnuRemoveClipItem.Index = 0; | 
|---|
| 706 | this.mnuRemoveClipItem.Text = "Remove Item"; | 
|---|
| 707 | this.mnuRemoveClipItem.Click += new System.EventHandler(this.mnuRemoveClipItem_Click); | 
|---|
| 708 | // | 
|---|
| 709 | // mnuClearClipItems | 
|---|
| 710 | // | 
|---|
| 711 | this.mnuClearClipItems.Index = 1; | 
|---|
| 712 | this.mnuClearClipItems.Text = "Clear All"; | 
|---|
| 713 | this.mnuClearClipItems.Click += new System.EventHandler(this.mnuClearClipItems_Click); | 
|---|
| 714 | // | 
|---|
| 715 | // label1 | 
|---|
| 716 | // | 
|---|
| 717 | this.label1.Dock = System.Windows.Forms.DockStyle.Top; | 
|---|
| 718 | this.label1.Location = new System.Drawing.Point(0, 0); | 
|---|
| 719 | this.label1.Name = "label1"; | 
|---|
| 720 | this.label1.Size = new System.Drawing.Size(128, 32); | 
|---|
| 721 | this.label1.TabIndex = 1; | 
|---|
| 722 | this.label1.Text = "Appointment Clipboard"; | 
|---|
| 723 | this.label1.TextAlign = System.Drawing.ContentAlignment.BottomCenter; | 
|---|
| 724 | // | 
|---|
| 725 | // panelTop | 
|---|
| 726 | // | 
|---|
| 727 | this.panelTop.Controls.Add(this.dateTimePicker1); | 
|---|
| 728 | this.panelTop.Controls.Add(this.lblResource); | 
|---|
| 729 | this.panelTop.Dock = System.Windows.Forms.DockStyle.Top; | 
|---|
| 730 | this.panelTop.Location = new System.Drawing.Point(128, 0); | 
|---|
| 731 | this.panelTop.Name = "panelTop"; | 
|---|
| 732 | this.panelTop.Size = new System.Drawing.Size(813, 24); | 
|---|
| 733 | this.panelTop.TabIndex = 6; | 
|---|
| 734 | // | 
|---|
| 735 | // dateTimePicker1 | 
|---|
| 736 | // | 
|---|
| 737 | this.dateTimePicker1.Dock = System.Windows.Forms.DockStyle.Right; | 
|---|
| 738 | this.dateTimePicker1.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right; | 
|---|
| 739 | this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Short; | 
|---|
| 740 | this.dateTimePicker1.Location = new System.Drawing.Point(685, 0); | 
|---|
| 741 | this.dateTimePicker1.Name = "dateTimePicker1"; | 
|---|
| 742 | this.dateTimePicker1.Size = new System.Drawing.Size(128, 20); | 
|---|
| 743 | this.dateTimePicker1.TabIndex = 1; | 
|---|
| 744 | this.dateTimePicker1.CloseUp += new System.EventHandler(this.dateTimePicker1_CloseUp); | 
|---|
| 745 | this.dateTimePicker1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.dateTimePicker1_KeyPress); | 
|---|
| 746 | this.dateTimePicker1.Leave += new System.EventHandler(this.dateTimePicker1_Leave); | 
|---|
| 747 | // | 
|---|
| 748 | // lblResource | 
|---|
| 749 | // | 
|---|
| 750 | this.lblResource.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | 
|---|
| 751 | this.lblResource.ForeColor = System.Drawing.SystemColors.Highlight; | 
|---|
| 752 | this.lblResource.Location = new System.Drawing.Point(8, 5); | 
|---|
| 753 | this.lblResource.Name = "lblResource"; | 
|---|
| 754 | this.lblResource.Size = new System.Drawing.Size(456, 19); | 
|---|
| 755 | this.lblResource.TabIndex = 2; | 
|---|
| 756 | // | 
|---|
| 757 | // panelCenter | 
|---|
| 758 | // | 
|---|
| 759 | this.panelCenter.Controls.Add(this.calendarGrid1); | 
|---|
| 760 | this.panelCenter.Dock = System.Windows.Forms.DockStyle.Fill; | 
|---|
| 761 | this.panelCenter.Location = new System.Drawing.Point(136, 24); | 
|---|
| 762 | this.panelCenter.Name = "panelCenter"; | 
|---|
| 763 | this.panelCenter.Size = new System.Drawing.Size(802, 352); | 
|---|
| 764 | this.panelCenter.TabIndex = 7; | 
|---|
| 765 | // | 
|---|
| 766 | // ctxCalendarGrid | 
|---|
| 767 | // | 
|---|
| 768 | this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 
|---|
| 769 | this.ctxCalGridAdd, | 
|---|
| 770 | this.ctxCalGridEdit, | 
|---|
| 771 | this.ctxCalGridDelete, | 
|---|
| 772 | this.ctxCalGridCheckIn, | 
|---|
| 773 | this.menuItem2, | 
|---|
| 774 | this.ctxCalGridNoShow, | 
|---|
| 775 | this.ctxCalGridNoShowUndo, | 
|---|
| 776 | this.menuItem9, | 
|---|
| 777 | this.ctxCalGridWalkin, | 
|---|
| 778 | this.menuItem10, | 
|---|
| 779 | this.ctxCalGridReprintRoutingSlip}); | 
|---|
| 780 | this.ctxCalendarGrid.Popup += new System.EventHandler(this.ctxCalendarGrid_Popup); | 
|---|
| 781 | // | 
|---|
| 782 | // ctxCalGridAdd | 
|---|
| 783 | // | 
|---|
| 784 | this.ctxCalGridAdd.Index = 0; | 
|---|
| 785 | this.ctxCalGridAdd.Text = "Add Appointment"; | 
|---|
| 786 | this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click); | 
|---|
| 787 | // | 
|---|
| 788 | // ctxCalGridEdit | 
|---|
| 789 | // | 
|---|
| 790 | this.ctxCalGridEdit.Index = 1; | 
|---|
| 791 | this.ctxCalGridEdit.Text = "Edit Appointment"; | 
|---|
| 792 | this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click); | 
|---|
| 793 | // | 
|---|
| 794 | // ctxCalGridDelete | 
|---|
| 795 | // | 
|---|
| 796 | this.ctxCalGridDelete.Index = 2; | 
|---|
| 797 | this.ctxCalGridDelete.Text = "Cancel Appointment"; | 
|---|
| 798 | this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click); | 
|---|
| 799 | // | 
|---|
| 800 | // ctxCalGridCheckIn | 
|---|
| 801 | // | 
|---|
| 802 | this.ctxCalGridCheckIn.Index = 3; | 
|---|
| 803 | this.ctxCalGridCheckIn.Text = "Check In Patient"; | 
|---|
| 804 | this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click); | 
|---|
| 805 | // | 
|---|
| 806 | // menuItem2 | 
|---|
| 807 | // | 
|---|
| 808 | this.menuItem2.Index = 4; | 
|---|
| 809 | this.menuItem2.Text = "-"; | 
|---|
| 810 | // | 
|---|
| 811 | // ctxCalGridNoShow | 
|---|
| 812 | // | 
|---|
| 813 | this.ctxCalGridNoShow.Index = 5; | 
|---|
| 814 | this.ctxCalGridNoShow.Text = "Mark as No Show"; | 
|---|
| 815 | this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click); | 
|---|
| 816 | // | 
|---|
| 817 | // ctxCalGridNoShowUndo | 
|---|
| 818 | // | 
|---|
| 819 | this.ctxCalGridNoShowUndo.Index = 6; | 
|---|
| 820 | this.ctxCalGridNoShowUndo.Text = "Undo NoShow"; | 
|---|
| 821 | this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click); | 
|---|
| 822 | // | 
|---|
| 823 | // menuItem9 | 
|---|
| 824 | // | 
|---|
| 825 | this.menuItem9.Index = 7; | 
|---|
| 826 | this.menuItem9.Text = "-"; | 
|---|
| 827 | // | 
|---|
| 828 | // ctxCalGridWalkin | 
|---|
| 829 | // | 
|---|
| 830 | this.ctxCalGridWalkin.Index = 8; | 
|---|
| 831 | this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment"; | 
|---|
| 832 | this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click); | 
|---|
| 833 | // | 
|---|
| 834 | // menuItem10 | 
|---|
| 835 | // | 
|---|
| 836 | this.menuItem10.Index = 9; | 
|---|
| 837 | this.menuItem10.Text = "-"; | 
|---|
| 838 | // | 
|---|
| 839 | // ctxCalGridReprintRoutingSlip | 
|---|
| 840 | // | 
|---|
| 841 | this.ctxCalGridReprintRoutingSlip.Index = 10; | 
|---|
| 842 | this.ctxCalGridReprintRoutingSlip.Text = "&Reprint Routing Slip"; | 
|---|
| 843 | this.ctxCalGridReprintRoutingSlip.Click += new System.EventHandler(this.ctxCalGridReprintRoutingSlip_Click); | 
|---|
| 844 | // | 
|---|
| 845 | // panelBottom | 
|---|
| 846 | // | 
|---|
| 847 | this.panelBottom.Controls.Add(this.statusBar1); | 
|---|
| 848 | this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom; | 
|---|
| 849 | this.panelBottom.Location = new System.Drawing.Point(136, 376); | 
|---|
| 850 | this.panelBottom.Name = "panelBottom"; | 
|---|
| 851 | this.panelBottom.Size = new System.Drawing.Size(802, 24); | 
|---|
| 852 | this.panelBottom.TabIndex = 8; | 
|---|
| 853 | // | 
|---|
| 854 | // statusBar1 | 
|---|
| 855 | // | 
|---|
| 856 | this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill; | 
|---|
| 857 | this.statusBar1.Location = new System.Drawing.Point(0, 0); | 
|---|
| 858 | this.statusBar1.Name = "statusBar1"; | 
|---|
| 859 | this.statusBar1.Size = new System.Drawing.Size(802, 24); | 
|---|
| 860 | this.statusBar1.SizingGrip = false; | 
|---|
| 861 | this.statusBar1.TabIndex = 0; | 
|---|
| 862 | // | 
|---|
| 863 | // splitter1 | 
|---|
| 864 | // | 
|---|
| 865 | this.splitter1.Location = new System.Drawing.Point(128, 24); | 
|---|
| 866 | this.splitter1.Name = "splitter1"; | 
|---|
| 867 | this.splitter1.Size = new System.Drawing.Size(8, 376); | 
|---|
| 868 | this.splitter1.TabIndex = 9; | 
|---|
| 869 | this.splitter1.TabStop = false; | 
|---|
| 870 | // | 
|---|
| 871 | // splitter2 | 
|---|
| 872 | // | 
|---|
| 873 | this.splitter2.Dock = System.Windows.Forms.DockStyle.Right; | 
|---|
| 874 | this.splitter2.Location = new System.Drawing.Point(938, 24); | 
|---|
| 875 | this.splitter2.Name = "splitter2"; | 
|---|
| 876 | this.splitter2.Size = new System.Drawing.Size(3, 376); | 
|---|
| 877 | this.splitter2.TabIndex = 10; | 
|---|
| 878 | this.splitter2.TabStop = false; | 
|---|
| 879 | // | 
|---|
| 880 | // printRoutingSlip | 
|---|
| 881 | // | 
|---|
| 882 | this.printRoutingSlip.DocumentName = "Routing Slip"; | 
|---|
| 883 | this.printRoutingSlip.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printRoutingSlip_PrintPage); | 
|---|
| 884 | // | 
|---|
| 885 | // calendarGrid1 | 
|---|
| 886 | // | 
|---|
| 887 | this.calendarGrid1.AllowDrop = true; | 
|---|
| 888 | this.calendarGrid1.Appointments = null; | 
|---|
| 889 | this.calendarGrid1.ApptDragSource = null; | 
|---|
| 890 | this.calendarGrid1.AutoScroll = true; | 
|---|
| 891 | this.calendarGrid1.AutoScrollMinSize = new System.Drawing.Size(600, 1898); | 
|---|
| 892 | this.calendarGrid1.AvailabilityArray = null; | 
|---|
| 893 | this.calendarGrid1.BackColor = System.Drawing.SystemColors.Window; | 
|---|
| 894 | this.calendarGrid1.Columns = 5; | 
|---|
| 895 | this.calendarGrid1.ContextMenu = this.ctxCalendarGrid; | 
|---|
| 896 | this.calendarGrid1.Dock = System.Windows.Forms.DockStyle.Fill; | 
|---|
| 897 | this.calendarGrid1.DrawWalkIns = true; | 
|---|
| 898 | this.calendarGrid1.GridBackColor = null; | 
|---|
| 899 | this.calendarGrid1.GridEnter = false; | 
|---|
| 900 | this.calendarGrid1.Location = new System.Drawing.Point(0, 0); | 
|---|
| 901 | this.calendarGrid1.Name = "calendarGrid1"; | 
|---|
| 902 | this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources"))); | 
|---|
| 903 | this.calendarGrid1.SelectedAppointment = 0; | 
|---|
| 904 | this.calendarGrid1.Size = new System.Drawing.Size(802, 352); | 
|---|
| 905 | this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0); | 
|---|
| 906 | this.calendarGrid1.TabIndex = 0; | 
|---|
| 907 | this.calendarGrid1.TimeScale = 20; | 
|---|
| 908 | this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged); | 
|---|
| 909 | this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded); | 
|---|
| 910 | this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged); | 
|---|
| 911 | this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick); | 
|---|
| 912 | this.calendarGrid1.MouseEnter += new System.EventHandler(this.calendarGrid1_MouseEnter); | 
|---|
| 913 | // | 
|---|
| 914 | // CGView | 
|---|
| 915 | // | 
|---|
| 916 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | 
|---|
| 917 | this.ClientSize = new System.Drawing.Size(1069, 400); | 
|---|
| 918 | this.Controls.Add(this.panelCenter); | 
|---|
| 919 | this.Controls.Add(this.panelBottom); | 
|---|
| 920 | this.Controls.Add(this.splitter2); | 
|---|
| 921 | this.Controls.Add(this.splitter1); | 
|---|
| 922 | this.Controls.Add(this.panelTop); | 
|---|
| 923 | this.Controls.Add(this.panelRight); | 
|---|
| 924 | this.Controls.Add(this.tvSchedules); | 
|---|
| 925 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); | 
|---|
| 926 | this.Menu = this.mainMenu1; | 
|---|
| 927 | this.Name = "CGView"; | 
|---|
| 928 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; | 
|---|
| 929 | this.Text = "CGView"; | 
|---|
| 930 | this.Activated += new System.EventHandler(this.CGView_Activated); | 
|---|
| 931 | this.Closing += new System.ComponentModel.CancelEventHandler(this.CGView_Closing); | 
|---|
| 932 | this.Load += new System.EventHandler(this.CGView_Load); | 
|---|
| 933 | this.CursorChanged += new System.EventHandler(this.CGView_CursorChanged); | 
|---|
| 934 | this.panelRight.ResumeLayout(false); | 
|---|
| 935 | this.panelClip.ResumeLayout(false); | 
|---|
| 936 | this.panelTop.ResumeLayout(false); | 
|---|
| 937 | this.panelCenter.ResumeLayout(false); | 
|---|
| 938 | this.panelBottom.ResumeLayout(false); | 
|---|
| 939 | this.ResumeLayout(false); | 
|---|
| 940 |  | 
|---|
| 941 | } | 
|---|
| 942 | #endregion | 
|---|
| 943 |  | 
|---|
| 944 | #region Fields | 
|---|
| 945 |  | 
|---|
| 946 | private CGDocument                      m_Document; | 
|---|
| 947 | private CGDocumentManager       m_DocManager; | 
|---|
| 948 | private int                                     m_nSlots; | 
|---|
| 949 | bool                                            bSchedulesClicked = false; | 
|---|
| 950 | private ArrayList                       m_alSelectedTreeResourceArray = new ArrayList(); | 
|---|
| 951 | private string                          m_sDocName; | 
|---|
| 952 | private CGAppointments          m_ClipList; | 
|---|
| 953 | private bool                            m_bDragDropStart = false; | 
|---|
| 954 | private Hashtable                       m_htOverbook; | 
|---|
| 955 | private Hashtable                       m_htModifySchedule; | 
|---|
| 956 | private Hashtable                       m_htChangeAppts; | 
|---|
| 957 | private BMXNetConnectInfo       m_ConnectInfo = null; | 
|---|
| 958 | public BMXNetConnectInfo.BMXNetEventDelegate    BMXNetEvent; | 
|---|
| 959 |  | 
|---|
| 960 | #endregion Fields | 
|---|
| 961 |  | 
|---|
| 962 | #region Properties | 
|---|
| 963 |  | 
|---|
| 964 | /// <summary> | 
|---|
| 965 | /// Access the CalendarGrid associated with this view | 
|---|
| 966 | /// </summary> | 
|---|
| 967 | public CalendarGrid CGrid | 
|---|
| 968 | { | 
|---|
| 969 | get | 
|---|
| 970 | { | 
|---|
| 971 | return this.calendarGrid1; | 
|---|
| 972 | } | 
|---|
| 973 | } | 
|---|
| 974 |  | 
|---|
| 975 | /// <summary> | 
|---|
| 976 | /// Accesses the document associated with this view | 
|---|
| 977 | /// </summary> | 
|---|
| 978 | public CGDocument Document | 
|---|
| 979 | { | 
|---|
| 980 | get | 
|---|
| 981 | { | 
|---|
| 982 | return this.m_Document; | 
|---|
| 983 | } | 
|---|
| 984 | set | 
|---|
| 985 | { | 
|---|
| 986 | this.m_Document = value; | 
|---|
| 987 | } | 
|---|
| 988 | } | 
|---|
| 989 |  | 
|---|
| 990 | public CGDocumentManager DocManager | 
|---|
| 991 | { | 
|---|
| 992 | get | 
|---|
| 993 | { | 
|---|
| 994 | return m_DocManager; | 
|---|
| 995 | } | 
|---|
| 996 | set | 
|---|
| 997 | { | 
|---|
| 998 | m_DocManager = value; | 
|---|
| 999 | } | 
|---|
| 1000 | } | 
|---|
| 1001 |  | 
|---|
| 1002 | public DateTime StartDate | 
|---|
| 1003 | { | 
|---|
| 1004 | get | 
|---|
| 1005 | { | 
|---|
| 1006 | return this.calendarGrid1.StartDate; | 
|---|
| 1007 | } | 
|---|
| 1008 | set | 
|---|
| 1009 | { | 
|---|
| 1010 | this.calendarGrid1.StartDate = value; | 
|---|
| 1011 | } | 
|---|
| 1012 | } | 
|---|
| 1013 |  | 
|---|
| 1014 | public CGAppointments Appointments | 
|---|
| 1015 | { | 
|---|
| 1016 | get | 
|---|
| 1017 | { | 
|---|
| 1018 | return this.calendarGrid1.Appointments; | 
|---|
| 1019 | } | 
|---|
| 1020 | set | 
|---|
| 1021 | { | 
|---|
| 1022 | this.calendarGrid1.Appointments = value; | 
|---|
| 1023 | } | 
|---|
| 1024 | } | 
|---|
| 1025 |  | 
|---|
| 1026 |  | 
|---|
| 1027 | #endregion | 
|---|
| 1028 |  | 
|---|
| 1029 |  | 
|---|
| 1030 | #region AppointmentMenu Handlers | 
|---|
| 1031 |  | 
|---|
| 1032 | private void mnuAppointment_Popup(object sender, System.EventArgs e) | 
|---|
| 1033 | { | 
|---|
| 1034 | bool bEnabled = (this.Document.Resources.Count > 0)? true : false ; | 
|---|
| 1035 | this.mnuFindAppt.Enabled = bEnabled; | 
|---|
| 1036 |  | 
|---|
| 1037 | //Toggle availability of make, edit, checkin and delete appointments | 
|---|
| 1038 | //based on whether a range is selected. | 
|---|
| 1039 |  | 
|---|
| 1040 | mnuNewAppointment.Enabled = AddAppointmentEnabled(); | 
|---|
| 1041 | this.mnuWalkIn.Enabled = mnuNewAppointment.Enabled; | 
|---|
| 1042 | bool bEditAppointments = this.EditAppointmentEnabled(); | 
|---|
| 1043 |  | 
|---|
| 1044 | mnuDeleteAppointment.Enabled = bEditAppointments; | 
|---|
| 1045 | mnuCheckIn.Enabled = bEditAppointments; | 
|---|
| 1046 | mnuEditAppointment.Enabled = bEditAppointments; | 
|---|
| 1047 | mnuNoShow.Enabled = bEditAppointments; | 
|---|
| 1048 | mnuNoShowUndo.Enabled = bEditAppointments; | 
|---|
| 1049 | } | 
|---|
| 1050 |  | 
|---|
| 1051 | private void mnuCheckIn_Click(object sender, System.EventArgs e) | 
|---|
| 1052 | { | 
|---|
| 1053 | AppointmentCheckIn(); | 
|---|
| 1054 | } | 
|---|
| 1055 |  | 
|---|
| 1056 | private void mnuCopyAppointment_Click(object sender, System.EventArgs e) | 
|---|
| 1057 | { | 
|---|
| 1058 | //For each appointment in the grid's selected list, | 
|---|
| 1059 | //add to the clip list | 
|---|
| 1060 | //and add to m_ClipList | 
|---|
| 1061 | try | 
|---|
| 1062 | { | 
|---|
| 1063 | foreach (CGAppointment a in this.calendarGrid1.SelectedAppointments.AppointmentTable.Values) | 
|---|
| 1064 | { | 
|---|
| 1065 | if (m_ClipList.AppointmentTable.Contains((int) a.AppointmentKey)) | 
|---|
| 1066 | { | 
|---|
| 1067 | return; | 
|---|
| 1068 | } | 
|---|
| 1069 | m_ClipList.AddAppointment(a); | 
|---|
| 1070 | lstClip.Items.Add(a.PatientName); | 
|---|
| 1071 | } | 
|---|
| 1072 | } | 
|---|
| 1073 | catch (Exception ex) | 
|---|
| 1074 | { | 
|---|
| 1075 | string s = ex.Message; | 
|---|
| 1076 | Debug.Write(s); | 
|---|
| 1077 | return; | 
|---|
| 1078 | } | 
|---|
| 1079 | } | 
|---|
| 1080 |  | 
|---|
| 1081 | private void mnuDeleteAppointment_Click(object sender, System.EventArgs e) | 
|---|
| 1082 | { | 
|---|
| 1083 | AppointmentDelete(); | 
|---|
| 1084 | } | 
|---|
| 1085 |  | 
|---|
| 1086 | private void mnuEditAppointment_Click(object sender, System.EventArgs e) | 
|---|
| 1087 | { | 
|---|
| 1088 | AppointmentEdit(); | 
|---|
| 1089 | } | 
|---|
| 1090 |  | 
|---|
| 1091 | private void mnuNewAppointment_Click(object sender, System.EventArgs e) | 
|---|
| 1092 | { | 
|---|
| 1093 | AppointmentAddNew(); | 
|---|
| 1094 | } | 
|---|
| 1095 |  | 
|---|
| 1096 | private void mnuNoShow_Click(object sender, System.EventArgs e) | 
|---|
| 1097 | { | 
|---|
| 1098 | AppointmentNoShow(true); | 
|---|
| 1099 | } | 
|---|
| 1100 |  | 
|---|
| 1101 | private void mnuNoShowUndo_Click(object sender, System.EventArgs e) | 
|---|
| 1102 | { | 
|---|
| 1103 | AppointmentNoShow(false); | 
|---|
| 1104 | } | 
|---|
| 1105 |  | 
|---|
| 1106 | #endregion AppointmentMenu Handlers | 
|---|
| 1107 |  | 
|---|
| 1108 | #region ContextMenu1 Handlers | 
|---|
| 1109 |  | 
|---|
| 1110 | private void contextMenu1_Popup(object sender, System.EventArgs e) | 
|---|
| 1111 | { | 
|---|
| 1112 | //Enable/disable OpenSchedule and Find Appointment options | 
|---|
| 1113 | bool bEnabled = (m_alSelectedTreeResourceArray.Count > 0)? true : false ; | 
|---|
| 1114 | this.ctxOpenSchedule.Enabled = bEnabled; | 
|---|
| 1115 | this.ctxFindAppt.Enabled = bEnabled; | 
|---|
| 1116 |  | 
|---|
| 1117 | //properties not supported now | 
|---|
| 1118 | this.ctxProperties.Enabled = false; | 
|---|
| 1119 | this.ctxProperties.Visible = false; | 
|---|
| 1120 |  | 
|---|
| 1121 | //Enable/disable Availability menu option | 
|---|
| 1122 | if (m_alSelectedTreeResourceArray.Count != 1) | 
|---|
| 1123 | { | 
|---|
| 1124 | this.ctxEditAvailability.Enabled = false; | 
|---|
| 1125 | return; | 
|---|
| 1126 | } | 
|---|
| 1127 |  | 
|---|
| 1128 | if (this.DocManager.ScheduleManager == true) | 
|---|
| 1129 | { | 
|---|
| 1130 | ctxEditAvailability.Enabled = true; | 
|---|
| 1131 | return; | 
|---|
| 1132 | } | 
|---|
| 1133 |  | 
|---|
| 1134 | string sResource = (string) m_alSelectedTreeResourceArray[0]; | 
|---|
| 1135 | DataTable dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"]; | 
|---|
| 1136 | DataView dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows); | 
|---|
| 1137 | string sDuz = this.DocManager.ConnectInfo.DUZ; | 
|---|
| 1138 | bool bModSchedule = false; | 
|---|
| 1139 | DataRowView[] drvA = dv.FindRows(sResource); | 
|---|
| 1140 | if (drvA.Length == 0) | 
|---|
| 1141 | { | 
|---|
| 1142 | this.ctxEditAvailability.Enabled = false; | 
|---|
| 1143 | } | 
|---|
| 1144 | else | 
|---|
| 1145 | { | 
|---|
| 1146 | string sModSchedule = "NO"; | 
|---|
| 1147 | foreach (DataRowView drv in drvA) | 
|---|
| 1148 | { | 
|---|
| 1149 | if (drv["USERID"].ToString() == sDuz) | 
|---|
| 1150 | { | 
|---|
| 1151 | sModSchedule = drv["MODIFY_SCHEDULE"].ToString(); | 
|---|
| 1152 | break; | 
|---|
| 1153 | } | 
|---|
| 1154 | } | 
|---|
| 1155 |  | 
|---|
| 1156 | bModSchedule = (sModSchedule == "YES")?true:false; | 
|---|
| 1157 | this.ctxEditAvailability.Enabled = bModSchedule; | 
|---|
| 1158 | } | 
|---|
| 1159 | } | 
|---|
| 1160 |  | 
|---|
| 1161 | private void ctxEditAvailability_Click(object sender, System.EventArgs e) | 
|---|
| 1162 | { | 
|---|
| 1163 | this.EditScheduleAvailability(); | 
|---|
| 1164 | } | 
|---|
| 1165 |  | 
|---|
| 1166 | private void ctxOpenSchedule_Click(object sender, System.EventArgs e) | 
|---|
| 1167 | { | 
|---|
| 1168 | OpenSelectedSchedule(m_alSelectedTreeResourceArray, DateTime.Today); | 
|---|
| 1169 | } | 
|---|
| 1170 |  | 
|---|
| 1171 | private void ctxProperties_Click(object sender, System.EventArgs e) | 
|---|
| 1172 | { | 
|---|
| 1173 | //TODO: Implement Properties dialog | 
|---|
| 1174 | MessageBox.Show("TODO: Implement Properties dialog"); | 
|---|
| 1175 | } | 
|---|
| 1176 |  | 
|---|
| 1177 | private void ctxFindAppt_Click(object sender, System.EventArgs e) | 
|---|
| 1178 | { | 
|---|
| 1179 | FindAvailableAppointment(m_alSelectedTreeResourceArray); | 
|---|
| 1180 | } | 
|---|
| 1181 |  | 
|---|
| 1182 | #endregion ContextMenu1 Handlers | 
|---|
| 1183 |  | 
|---|
| 1184 | #region ctxApptClipMenu Handlers | 
|---|
| 1185 |  | 
|---|
| 1186 | private void mnuClearClipItems_Click(object sender, System.EventArgs e) | 
|---|
| 1187 | { | 
|---|
| 1188 | this.m_ClipList.ClearAllAppointments(); | 
|---|
| 1189 | lstClip.Items.Clear(); | 
|---|
| 1190 | } | 
|---|
| 1191 |  | 
|---|
| 1192 | private void mnuRemoveClipItem_Click(object sender, System.EventArgs e) | 
|---|
| 1193 | { | 
|---|
| 1194 | int i = lstClip.SelectedIndex; | 
|---|
| 1195 | CGAppointment a = (CGAppointment) lstClip.SelectedItem; | 
|---|
| 1196 | int nKey = a.AppointmentKey; | 
|---|
| 1197 | if (i > -1) | 
|---|
| 1198 | { | 
|---|
| 1199 | m_ClipList.RemoveAppointment(nKey); | 
|---|
| 1200 | lstClip.Items.RemoveAt(i); | 
|---|
| 1201 | } | 
|---|
| 1202 | } | 
|---|
| 1203 |  | 
|---|
| 1204 | private void ctxApptClipMenu_Popup(object sender, System.EventArgs e) | 
|---|
| 1205 | { | 
|---|
| 1206 | mnuClearClipItems.Enabled = (m_ClipList.AppointmentTable.Count > 0); | 
|---|
| 1207 | mnuRemoveClipItem.Enabled = (lstClip.SelectedIndex > -1); | 
|---|
| 1208 | } | 
|---|
| 1209 |  | 
|---|
| 1210 | #endregion ctxApptClipMenu Handlers | 
|---|
| 1211 |  | 
|---|
| 1212 | #region ctxCalGridMenu Handlers | 
|---|
| 1213 |  | 
|---|
| 1214 | private void ctxCalendarGrid_Popup(object sender, System.EventArgs e) | 
|---|
| 1215 | { | 
|---|
| 1216 | //Toggle availability of make, edit, checkin and delete appointments | 
|---|
| 1217 | //based on whether appropriate element is selected. | 
|---|
| 1218 | ctxCalGridAdd.Enabled = AddAppointmentEnabled(); | 
|---|
| 1219 | bool bEditAppointments = (EditAppointmentEnabled() && (calendarGrid1.SelectedAppointment > 0)) ; | 
|---|
| 1220 | ctxCalGridDelete.Enabled = bEditAppointments; | 
|---|
| 1221 | ctxCalGridEdit.Enabled = bEditAppointments; | 
|---|
| 1222 | ctxCalGridCheckIn.Enabled = bEditAppointments; | 
|---|
| 1223 | ctxCalGridNoShow.Enabled = bEditAppointments; | 
|---|
| 1224 | ctxCalGridNoShowUndo.Enabled = bEditAppointments; | 
|---|
| 1225 | ctxCalGridWalkin.Enabled = ctxCalGridAdd.Enabled; | 
|---|
| 1226 | //smh new code | 
|---|
| 1227 | ctxCalGridReprintRoutingSlip.Enabled = ctxCalGridEdit.Enabled; | 
|---|
| 1228 | //end new code | 
|---|
| 1229 | } | 
|---|
| 1230 |  | 
|---|
| 1231 | private void ctxCalGridAdd_Click(object sender, System.EventArgs e) | 
|---|
| 1232 | { | 
|---|
| 1233 | AppointmentAddNew(); | 
|---|
| 1234 | } | 
|---|
| 1235 |  | 
|---|
| 1236 | private void calendarGrid1_DoubleClick(object sender, System.EventArgs e) | 
|---|
| 1237 | { | 
|---|
| 1238 | if (calendarGrid1.SelectedAppointment > 0) | 
|---|
| 1239 | AppointmentEdit(); | 
|---|
| 1240 | } | 
|---|
| 1241 |  | 
|---|
| 1242 | private void ctxCalGridEdit_Click(object sender, System.EventArgs e) | 
|---|
| 1243 | { | 
|---|
| 1244 | AppointmentEdit(); | 
|---|
| 1245 | } | 
|---|
| 1246 |  | 
|---|
| 1247 | private void ctxCalGridDelete_Click(object sender, System.EventArgs e) | 
|---|
| 1248 | { | 
|---|
| 1249 | AppointmentDelete(); | 
|---|
| 1250 | } | 
|---|
| 1251 |  | 
|---|
| 1252 | private void ctxCalGridCheckIn_Click(object sender, System.EventArgs e) | 
|---|
| 1253 | { | 
|---|
| 1254 | AppointmentCheckIn(); | 
|---|
| 1255 | } | 
|---|
| 1256 |  | 
|---|
| 1257 | private void ctxCalGridNoShow_Click(object sender, System.EventArgs e) | 
|---|
| 1258 | { | 
|---|
| 1259 | AppointmentNoShow(true); | 
|---|
| 1260 | } | 
|---|
| 1261 |  | 
|---|
| 1262 | private void ctxCalGridNoShowUndo_Click(object sender, System.EventArgs e) | 
|---|
| 1263 | { | 
|---|
| 1264 | AppointmentNoShow(false); | 
|---|
| 1265 | } | 
|---|
| 1266 |  | 
|---|
| 1267 | //new code smh | 
|---|
| 1268 | private void ctxCalGridReprintRoutingSlip_Click(object sender, EventArgs e) | 
|---|
| 1269 | { | 
|---|
| 1270 | printRoutingSlip.Print(); | 
|---|
| 1271 | } | 
|---|
| 1272 | //end new code | 
|---|
| 1273 |  | 
|---|
| 1274 | #endregion ctxCalGridMenu Handlers | 
|---|
| 1275 |  | 
|---|
| 1276 | #region Methods | 
|---|
| 1277 |  | 
|---|
| 1278 | private bool EditAppointmentEnabled() | 
|---|
| 1279 | { | 
|---|
| 1280 | try | 
|---|
| 1281 | { | 
|---|
| 1282 | //Call here if there is a selected appointment in the grid | 
|---|
| 1283 | if (calendarGrid1.SelectedAppointment < 1) | 
|---|
| 1284 | return false; | 
|---|
| 1285 | CGAppointment appt = (CGAppointment)this.Appointments.AppointmentTable[calendarGrid1.SelectedAppointment]; | 
|---|
| 1286 | string sResource = appt.Resource; | 
|---|
| 1287 | return EditAppointmentEnabled(sResource); | 
|---|
| 1288 |  | 
|---|
| 1289 | } | 
|---|
| 1290 | catch (Exception ex) | 
|---|
| 1291 | { | 
|---|
| 1292 | string sMsg = ex.Message; | 
|---|
| 1293 | return false; | 
|---|
| 1294 | } | 
|---|
| 1295 | } | 
|---|
| 1296 |  | 
|---|
| 1297 | private bool EditAppointmentEnabled(string sResource) | 
|---|
| 1298 | { | 
|---|
| 1299 |  | 
|---|
| 1300 | bool bManager = this.DocManager.ScheduleManager; | 
|---|
| 1301 | if (bManager == true) | 
|---|
| 1302 | { | 
|---|
| 1303 | return (true); | 
|---|
| 1304 | } | 
|---|
| 1305 | else | 
|---|
| 1306 | { | 
|---|
| 1307 | bool bModAppts; | 
|---|
| 1308 | bModAppts = (bool)this.m_htChangeAppts[sResource]; | 
|---|
| 1309 | return bModAppts; | 
|---|
| 1310 | } | 
|---|
| 1311 | } | 
|---|
| 1312 |  | 
|---|
| 1313 | private bool AddAppointmentEnabled() | 
|---|
| 1314 | { | 
|---|
| 1315 | if (this.calendarGrid1.SelectedRange.Cells.CellCount < 1) | 
|---|
| 1316 | return false; | 
|---|
| 1317 |  | 
|---|
| 1318 | bool bManager = this.DocManager.ScheduleManager; | 
|---|
| 1319 | if (bManager == true) | 
|---|
| 1320 | { | 
|---|
| 1321 | return (true); | 
|---|
| 1322 | } | 
|---|
| 1323 | else | 
|---|
| 1324 | { | 
|---|
| 1325 | DateTime dStart = DateTime.Today; | 
|---|
| 1326 | DateTime dEnd = DateTime.Today; | 
|---|
| 1327 | string sResource = ""; | 
|---|
| 1328 | bool bRet = this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource); | 
|---|
| 1329 | if (bRet == false) | 
|---|
| 1330 | { | 
|---|
| 1331 | return false; | 
|---|
| 1332 | } | 
|---|
| 1333 | bool bSlotsAvailable; | 
|---|
| 1334 | bool bOverbook; | 
|---|
| 1335 | bool bModSchedule; | 
|---|
| 1336 | bool bModAppts; | 
|---|
| 1337 | bOverbook = (bool)this.m_htOverbook[sResource]; | 
|---|
| 1338 | bModSchedule = (bool)this.m_htModifySchedule[sResource]; | 
|---|
| 1339 | bModAppts = (bool)this.m_htChangeAppts[sResource]; | 
|---|
| 1340 | if (bModAppts == false) | 
|---|
| 1341 | return false; | 
|---|
| 1342 |  | 
|---|
| 1343 | bSlotsAvailable = (this.m_nSlots > 0); | 
|---|
| 1344 | return ((bSlotsAvailable) || (bModSchedule) || (bOverbook)); | 
|---|
| 1345 | } | 
|---|
| 1346 | } | 
|---|
| 1347 |  | 
|---|
| 1348 | /// <summary> | 
|---|
| 1349 | /// Clean up any resources being used. | 
|---|
| 1350 | /// </summary> | 
|---|
| 1351 | protected override void Dispose( bool disposing ) | 
|---|
| 1352 | { | 
|---|
| 1353 | if( disposing ) | 
|---|
| 1354 | { | 
|---|
| 1355 | if(components != null) | 
|---|
| 1356 | { | 
|---|
| 1357 | components.Dispose(); | 
|---|
| 1358 | } | 
|---|
| 1359 | } | 
|---|
| 1360 | base.Dispose( disposing ); | 
|---|
| 1361 | } | 
|---|
| 1362 |  | 
|---|
| 1363 | void UpdateStatusBar(DateTime dStart, DateTime dEnd, string sAccessType, string sAvailabilityMessage) | 
|---|
| 1364 | { | 
|---|
| 1365 | string sMsg =  dStart.ToShortTimeString() + " to " + dEnd.ToShortTimeString(); | 
|---|
| 1366 | if (m_nSlots > 0) | 
|---|
| 1367 | { | 
|---|
| 1368 | sMsg = sMsg + ": " + m_nSlots.ToString() + " slot"; | 
|---|
| 1369 | sMsg = sMsg + ((m_nSlots > 1)?"s " : " "); | 
|---|
| 1370 | sMsg = sMsg + "available"; | 
|---|
| 1371 | if (sAccessType != "") | 
|---|
| 1372 | { | 
|---|
| 1373 | sMsg = sMsg + " for " + sAccessType; | 
|---|
| 1374 | } | 
|---|
| 1375 | sMsg = sMsg + "."; | 
|---|
| 1376 | if (sAvailabilityMessage != "") | 
|---|
| 1377 | { | 
|---|
| 1378 | sMsg = sMsg + "  Note: " + sAvailabilityMessage; | 
|---|
| 1379 | } | 
|---|
| 1380 | } | 
|---|
| 1381 | else | 
|---|
| 1382 | { | 
|---|
| 1383 | sMsg += ": No appointment slots available."; | 
|---|
| 1384 | } | 
|---|
| 1385 |  | 
|---|
| 1386 | this.statusBar1.Text = sMsg; | 
|---|
| 1387 | } | 
|---|
| 1388 |  | 
|---|
| 1389 | private void EditScheduleAvailability() | 
|---|
| 1390 | { | 
|---|
| 1391 | CGAVDocument doc = new CGAVDocument(); | 
|---|
| 1392 | try | 
|---|
| 1393 | { | 
|---|
| 1394 | //If resource already open, then navigate to its window | 
|---|
| 1395 | CGAVView v =this.DocManager.GetAVViewByResource(m_alSelectedTreeResourceArray); | 
|---|
| 1396 |  | 
|---|
| 1397 | if (v != null) | 
|---|
| 1398 | { | 
|---|
| 1399 | v.Activate(); | 
|---|
| 1400 | } | 
|---|
| 1401 | else | 
|---|
| 1402 | { | 
|---|
| 1403 | //If not already open, get a lock and open it | 
|---|
| 1404 | doc.DocManager = this.DocManager; | 
|---|
| 1405 | for (int j=0; j < m_alSelectedTreeResourceArray.Count; j++) | 
|---|
| 1406 | { | 
|---|
| 1407 | doc.AddResource((string) m_alSelectedTreeResourceArray[j]); | 
|---|
| 1408 | } | 
|---|
| 1409 | doc.DocName = this.m_sDocName; | 
|---|
| 1410 |  | 
|---|
| 1411 | //Get preferred time scale from resource info | 
|---|
| 1412 |  | 
|---|
| 1413 | DataTable dt = this.DocManager.GlobalDataSet.Tables["Resources"]; | 
|---|
| 1414 | DataView dv = new DataView(dt, "", "RESOURCE_NAME ASC", DataViewRowState.OriginalRows); | 
|---|
| 1415 | int nScale = 60; | 
|---|
| 1416 | int nTest=0; | 
|---|
| 1417 | string sResource; | 
|---|
| 1418 | int nDataRow; | 
|---|
| 1419 | DataRowView drv; | 
|---|
| 1420 | string sResourceID=""; | 
|---|
| 1421 | for (int j=0; j < m_alSelectedTreeResourceArray.Count; j++) | 
|---|
| 1422 | { | 
|---|
| 1423 | sResource = (string) m_alSelectedTreeResourceArray[j]; | 
|---|
| 1424 | nDataRow = dv.Find(sResource); | 
|---|
| 1425 | Debug.Assert(nDataRow != -1); | 
|---|
| 1426 | drv = dv[nDataRow]; | 
|---|
| 1427 | if (drv["TIMESCALE"].ToString() == "") | 
|---|
| 1428 | { | 
|---|
| 1429 | nTest = 15; //15 minute default | 
|---|
| 1430 | } | 
|---|
| 1431 | else | 
|---|
| 1432 | { | 
|---|
| 1433 | nTest = (int) drv["TIMESCALE"]; | 
|---|
| 1434 | } | 
|---|
| 1435 | nScale = (nTest < nScale)?nTest : nScale ; | 
|---|
| 1436 | sResourceID = drv["RESOURCEID"].ToString(); | 
|---|
| 1437 | } | 
|---|
| 1438 |  | 
|---|
| 1439 | doc.ResourceID = Convert.ToInt32(sResourceID); | 
|---|
| 1440 |  | 
|---|
| 1441 | bool bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXRES(" + sResourceID + ")", "+"); | 
|---|
| 1442 | if (bLock == false) | 
|---|
| 1443 | { | 
|---|
| 1444 | throw new BMXNetException("Another user is currently editing availability for this resource.  Try later."); | 
|---|
| 1445 | } | 
|---|
| 1446 |  | 
|---|
| 1447 | doc.OnOpenDocument(); | 
|---|
| 1448 | v =this.DocManager.GetAVViewByResource(m_alSelectedTreeResourceArray); | 
|---|
| 1449 | CalendarGrid cg = v.CGrid; | 
|---|
| 1450 |  | 
|---|
| 1451 | cg.TimeScale = nScale; | 
|---|
| 1452 |  | 
|---|
| 1453 | //Position grid to 0700 | 
|---|
| 1454 | cg.PositionGrid(7); | 
|---|
| 1455 | } | 
|---|
| 1456 | } | 
|---|
| 1457 | catch (Exception ex) | 
|---|
| 1458 | { | 
|---|
| 1459 | MessageBox.Show("Unable to edit availability for " + m_sDocName + " schedule.  " +  ex.Message, "Clinical Scheduling"); | 
|---|
| 1460 | this.m_DocManager.CloseAllViews(doc); | 
|---|
| 1461 | return; | 
|---|
| 1462 | } | 
|---|
| 1463 | } | 
|---|
| 1464 |  | 
|---|
| 1465 | /// <summary> | 
|---|
| 1466 | /// Opens a view of the Schedule a user requested to open at a specific date | 
|---|
| 1467 | /// </summary> | 
|---|
| 1468 | /// <param name="sSelectedTreeResourceArray">A set of resources to open (?pending more investigation)</param> | 
|---|
| 1469 | /// <param name="dDate">Date at which to show the Grid</param> | 
|---|
| 1470 | private void OpenSelectedSchedule(ArrayList sSelectedTreeResourceArray, DateTime dDate) | 
|---|
| 1471 | { | 
|---|
| 1472 | //If resource already open, then navigate to its window | 
|---|
| 1473 | CGView v =this.DocManager.GetViewByResource(sSelectedTreeResourceArray); | 
|---|
| 1474 | if (v != null) | 
|---|
| 1475 | { | 
|---|
| 1476 | v.Activate(); | 
|---|
| 1477 | v.dateTimePicker1.Value = dDate; | 
|---|
| 1478 | return; | 
|---|
| 1479 | } | 
|---|
| 1480 |  | 
|---|
| 1481 | //So if it is not a view that's already open, it means we have to grab the data for | 
|---|
| 1482 | //So we tell the user to wait wait wait | 
|---|
| 1483 | this.Cursor = Cursors.WaitCursor; | 
|---|
| 1484 | this.LoadSplash();  //Open "Loading" splash | 
|---|
| 1485 |  | 
|---|
| 1486 |  | 
|---|
| 1487 | //If this Document has no resources then use it (happens when the GUI has nothing open, typically after log-in) | 
|---|
| 1488 | //Else, create a new document | 
|---|
| 1489 | CGDocument doc; | 
|---|
| 1490 | if (this.Document.m_sResourcesArray.Count == 0) | 
|---|
| 1491 | { | 
|---|
| 1492 | doc = this.Document; | 
|---|
| 1493 | } | 
|---|
| 1494 | else | 
|---|
| 1495 | { | 
|---|
| 1496 | doc = new CGDocument(); | 
|---|
| 1497 | doc.DocManager = this.DocManager; | 
|---|
| 1498 | } | 
|---|
| 1499 |  | 
|---|
| 1500 | //Add resources to Document | 
|---|
| 1501 | for (int j=0; j < sSelectedTreeResourceArray.Count; j++) | 
|---|
| 1502 | { | 
|---|
| 1503 | doc.AddResource((string) sSelectedTreeResourceArray[j]); | 
|---|
| 1504 | } | 
|---|
| 1505 |  | 
|---|
| 1506 | doc.DocName = this.m_sDocName; | 
|---|
| 1507 |  | 
|---|
| 1508 | try | 
|---|
| 1509 | { | 
|---|
| 1510 | doc.OnOpenDocument(); | 
|---|
| 1511 | } | 
|---|
| 1512 |  | 
|---|
| 1513 | catch (Exception ex) | 
|---|
| 1514 | { | 
|---|
| 1515 | MessageBox.Show("Unable to open " + m_sDocName + " schedule.  " +  ex.Message, "Clinical Scheduling"); | 
|---|
| 1516 | this.m_DocManager.CloseAllViews(doc); | 
|---|
| 1517 | return; | 
|---|
| 1518 | } | 
|---|
| 1519 |  | 
|---|
| 1520 | //We are doing this--Again? | 
|---|
| 1521 | v =this.DocManager.GetViewByResource(sSelectedTreeResourceArray); | 
|---|
| 1522 |  | 
|---|
| 1523 | //Position the Grid to start at a certain day. | 
|---|
| 1524 | //XXX: This must be a better way to do this. | 
|---|
| 1525 | v.dateTimePicker1.Value = dDate; | 
|---|
| 1526 | v.StartDate = doc.StartDate; | 
|---|
| 1527 |  | 
|---|
| 1528 | //Get preferred time scale from resource info | 
|---|
| 1529 | //If more than one resource, get smallest time scale | 
|---|
| 1530 | CalendarGrid cg = v.CGrid; | 
|---|
| 1531 | DataTable dt = this.DocManager.GlobalDataSet.Tables["Resources"]; | 
|---|
| 1532 | DataView dv = new DataView(dt, "", "RESOURCE_NAME ASC", DataViewRowState.OriginalRows); | 
|---|
| 1533 | int nScale = 60; | 
|---|
| 1534 | int nTest=0; | 
|---|
| 1535 | string sResource; | 
|---|
| 1536 | int nDataRow; | 
|---|
| 1537 | DataRowView drv; | 
|---|
| 1538 | for (int j=0; j < sSelectedTreeResourceArray.Count; j++) | 
|---|
| 1539 | { | 
|---|
| 1540 | sResource = (string) sSelectedTreeResourceArray[j]; | 
|---|
| 1541 | nDataRow = dv.Find(sResource); | 
|---|
| 1542 | Debug.Assert(nDataRow != -1); | 
|---|
| 1543 | drv = dv[nDataRow]; | 
|---|
| 1544 | if (drv["TIMESCALE"].ToString() == "") | 
|---|
| 1545 | { | 
|---|
| 1546 | nTest = 15; //15 minute default | 
|---|
| 1547 | } | 
|---|
| 1548 | else | 
|---|
| 1549 | { | 
|---|
| 1550 | nTest = (int) drv["TIMESCALE"]; | 
|---|
| 1551 | } | 
|---|
| 1552 | nScale = (nTest < nScale)?nTest : nScale ; | 
|---|
| 1553 | } | 
|---|
| 1554 |  | 
|---|
| 1555 | cg.TimeScale = nScale; | 
|---|
| 1556 |  | 
|---|
| 1557 | cg.PositionGrid(7); | 
|---|
| 1558 |  | 
|---|
| 1559 | //Get the OverBook and ModifySchedule permissions from ResourceUser table | 
|---|
| 1560 | //and populate the hashtables | 
|---|
| 1561 | string  sOverbook; | 
|---|
| 1562 | string  sModSchedule; | 
|---|
| 1563 | string  sModAppts; | 
|---|
| 1564 | bool    bOverbook; | 
|---|
| 1565 | bool    bModSchedule; | 
|---|
| 1566 | bool    bModAppts; | 
|---|
| 1567 | v.m_htOverbook = new Hashtable(sSelectedTreeResourceArray.Count); | 
|---|
| 1568 | v.m_htModifySchedule = new Hashtable(sSelectedTreeResourceArray.Count); | 
|---|
| 1569 | v.m_htChangeAppts = new Hashtable(sSelectedTreeResourceArray.Count); | 
|---|
| 1570 | dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"]; | 
|---|
| 1571 | dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows); | 
|---|
| 1572 | dv.RowFilter = "USERNAME = '" + this.DocManager.ConnectInfo.UserName + "'"; | 
|---|
| 1573 | for (int j=0; j < dv.Count; j++) | 
|---|
| 1574 | { | 
|---|
| 1575 | drv = dv[j]; | 
|---|
| 1576 | sResource = drv["RESOURCENAME"].ToString(); | 
|---|
| 1577 | sOverbook = drv["OVERBOOK"].ToString(); | 
|---|
| 1578 | bOverbook = (sOverbook == "YES")?true:false; | 
|---|
| 1579 | sModSchedule = drv["MODIFY_SCHEDULE"].ToString(); | 
|---|
| 1580 | bModSchedule = (sModSchedule == "YES")?true:false; | 
|---|
| 1581 | sModAppts = drv["MODIFY_APPOINTMENTS"].ToString(); | 
|---|
| 1582 | bModAppts = (sModAppts == "YES")?true:false; | 
|---|
| 1583 | v.m_htOverbook[sResource] = bOverbook; | 
|---|
| 1584 | v.m_htModifySchedule[sResource] = bModSchedule; | 
|---|
| 1585 | v.m_htChangeAppts[sResource] = bModAppts; | 
|---|
| 1586 | } | 
|---|
| 1587 |  | 
|---|
| 1588 | //For programmers and scheduling managers, set all permissions for all resources | 
|---|
| 1589 | if (this.DocManager.ScheduleManager == true) | 
|---|
| 1590 | { | 
|---|
| 1591 | dt = this.DocManager.GlobalDataSet.Tables["Resources"]; | 
|---|
| 1592 | foreach (DataRow dr in dt.Rows) | 
|---|
| 1593 | { | 
|---|
| 1594 | sResource = dr["RESOURCE_NAME"].ToString(); | 
|---|
| 1595 | v.m_htOverbook[sResource] = true; | 
|---|
| 1596 | v.m_htModifySchedule[sResource] = true; | 
|---|
| 1597 | v.m_htChangeAppts[sResource] = true; | 
|---|
| 1598 | } | 
|---|
| 1599 | } | 
|---|
| 1600 |  | 
|---|
| 1601 | v.calendarGrid1.SetOverlapTable(); | 
|---|
| 1602 | v.calendarGrid1.Refresh(); | 
|---|
| 1603 |  | 
|---|
| 1604 | // Set cursor back and stop splash screen | 
|---|
| 1605 | this.Cursor = Cursors.Default; | 
|---|
| 1606 | StopSplash(); | 
|---|
| 1607 | } | 
|---|
| 1608 |  | 
|---|
| 1609 | private void LoadTree() | 
|---|
| 1610 | { | 
|---|
| 1611 | //Navigate from ResourceGroup table to Resources table | 
|---|
| 1612 | DataRow[] arrRows; | 
|---|
| 1613 | DataRelation dr = DocManager.GlobalDataSet.Relations["GroupResource"]; | 
|---|
| 1614 | string sGroup; | 
|---|
| 1615 | string sResource; | 
|---|
| 1616 | int nIndex = 0; | 
|---|
| 1617 | foreach (DataRow r in DocManager.GlobalDataSet.Tables["ResourceGroup"].Rows) | 
|---|
| 1618 | { | 
|---|
| 1619 | sGroup = r["RESOURCE_GROUP"].ToString(); | 
|---|
| 1620 | TreeNode deptNode = new TreeNode(sGroup); | 
|---|
| 1621 | nIndex = this.tvSchedules.Nodes.Add(deptNode); | 
|---|
| 1622 | tvSchedules.Nodes[nIndex].Tag = "Dept"; | 
|---|
| 1623 | arrRows = r.GetChildRows(dr); | 
|---|
| 1624 | for (int i=0; i< arrRows.Length; i++) | 
|---|
| 1625 | { | 
|---|
| 1626 | sResource = arrRows[i]["RESOURCE_NAME"].ToString(); | 
|---|
| 1627 | TreeNode resNode = new TreeNode(sResource); | 
|---|
| 1628 | int nResIndex = deptNode.Nodes.Add(resNode); | 
|---|
| 1629 | deptNode.Nodes[nResIndex].Tag = "Resource"; | 
|---|
| 1630 | } | 
|---|
| 1631 | } | 
|---|
| 1632 | } | 
|---|
| 1633 |  | 
|---|
| 1634 | public void CreateNewSchedule() | 
|---|
| 1635 | { | 
|---|
| 1636 | //Create a new document and open it | 
|---|
| 1637 | CGDocument doc = new CGDocument(); | 
|---|
| 1638 | doc.DocManager = this.DocManager; | 
|---|
| 1639 | try | 
|---|
| 1640 | { | 
|---|
| 1641 | doc.OnOpenDocument(); | 
|---|
| 1642 | } | 
|---|
| 1643 | catch (Exception ex) | 
|---|
| 1644 | { | 
|---|
| 1645 | MessageBox.Show("Unable to open " + m_sDocName + " schedule.  " +  ex.Message, "Clinical Scheduling"); | 
|---|
| 1646 | this.m_DocManager.CloseAllViews(doc); | 
|---|
| 1647 | return; | 
|---|
| 1648 | } | 
|---|
| 1649 | } | 
|---|
| 1650 |  | 
|---|
| 1651 | private void AppointmentEdit() | 
|---|
| 1652 | { | 
|---|
| 1653 | try | 
|---|
| 1654 | { | 
|---|
| 1655 | int nApptID = this.calendarGrid1.SelectedAppointment; | 
|---|
| 1656 | Debug.Assert(nApptID != 0); | 
|---|
| 1657 |  | 
|---|
| 1658 | CGAppointment a = (CGAppointment) this.Appointments.AppointmentTable[nApptID]; | 
|---|
| 1659 |  | 
|---|
| 1660 | DAppointPage dAppt = new DAppointPage(); | 
|---|
| 1661 | dAppt.DocManager = this.m_DocManager; | 
|---|
| 1662 | dAppt.InitializePage(a); | 
|---|
| 1663 |  | 
|---|
| 1664 | calendarGrid1.CGToolTip.Active = false; | 
|---|
| 1665 |  | 
|---|
| 1666 | if (dAppt.ShowDialog(this) == DialogResult.Cancel) | 
|---|
| 1667 | { | 
|---|
| 1668 | calendarGrid1.CGToolTip.Active = true; | 
|---|
| 1669 | return; | 
|---|
| 1670 | } | 
|---|
| 1671 | calendarGrid1.CGToolTip.Active = true; | 
|---|
| 1672 |  | 
|---|
| 1673 | string sNote = dAppt.Note; | 
|---|
| 1674 |  | 
|---|
| 1675 | //Call Document to edit appointment | 
|---|
| 1676 | this.Document.EditAppointment(a, sNote); | 
|---|
| 1677 |  | 
|---|
| 1678 | } | 
|---|
| 1679 | catch (Exception ex) | 
|---|
| 1680 | { | 
|---|
| 1681 | Debug.Write("CGView.AppointmentEdit Failed:  " + ex.Message); | 
|---|
| 1682 | } | 
|---|
| 1683 | } | 
|---|
| 1684 |  | 
|---|
| 1685 | /// <summary> | 
|---|
| 1686 | /// Marks all selected appointments as No Show | 
|---|
| 1687 | /// </summary> | 
|---|
| 1688 | /// <param name="nApptID"></param> | 
|---|
| 1689 | /// <returns></returns> | 
|---|
| 1690 | private void AppointmentNoShow(bool bNoShow) | 
|---|
| 1691 | { | 
|---|
| 1692 |  | 
|---|
| 1693 | //bNoShow indicates whether to mark or un-mark as noshow | 
|---|
| 1694 | bool                    bMarked = false;        //Indicates at least one attempt to mark as noshow succeeded | 
|---|
| 1695 | bool                    bRebook = false;        //Stores user's response to auto-rebook dialog question | 
|---|
| 1696 | CGAppointments  alRebookList = new CGAppointments(); | 
|---|
| 1697 | DNoShow dlg = new DNoShow();; | 
|---|
| 1698 | if (bNoShow == true) | 
|---|
| 1699 | { | 
|---|
| 1700 | if (dlg.ShowDialog(this) == DialogResult.Cancel) | 
|---|
| 1701 | { | 
|---|
| 1702 | return; | 
|---|
| 1703 | } | 
|---|
| 1704 | } | 
|---|
| 1705 |  | 
|---|
| 1706 | bRebook = dlg.AutoRebook; | 
|---|
| 1707 |  | 
|---|
| 1708 | foreach (CGAppointment a in this.calendarGrid1.SelectedAppointments.AppointmentTable.Values) | 
|---|
| 1709 | { | 
|---|
| 1710 | int nApptID = a.AppointmentKey; | 
|---|
| 1711 | Debug.Assert(nApptID != 0); | 
|---|
| 1712 | try | 
|---|
| 1713 | { | 
|---|
| 1714 | if ((bNoShow == true) | 
|---|
| 1715 | && | 
|---|
| 1716 | (a.StartTime.Date > DateTime.Today.Date) | 
|---|
| 1717 | && | 
|---|
| 1718 | (MessageBox.Show(this, "The appointment for " + a.PatientName + " is in the future.  Are you sure you want to No-Show?", "Windows Scheduling", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)) | 
|---|
| 1719 | { | 
|---|
| 1720 | } | 
|---|
| 1721 | else | 
|---|
| 1722 | { | 
|---|
| 1723 | string sError = Document.AppointmentNoShow(nApptID, bNoShow); | 
|---|
| 1724 | if (sError != "1") | 
|---|
| 1725 | throw new Exception(sError); | 
|---|
| 1726 |  | 
|---|
| 1727 | bMarked = true; | 
|---|
| 1728 | } | 
|---|
| 1729 | } | 
|---|
| 1730 | catch (Exception ex) | 
|---|
| 1731 | { | 
|---|
| 1732 | MessageBox.Show("Unable to mark appointment No Show: " +  ex.Message, "Clinical Scheduling"); | 
|---|
| 1733 | } | 
|---|
| 1734 | if (bRebook == true) | 
|---|
| 1735 | { | 
|---|
| 1736 | try | 
|---|
| 1737 | { | 
|---|
| 1738 | CGAppointment aRebook; | 
|---|
| 1739 | int nMinimumdays = dlg.RebookStartDays; | 
|---|
| 1740 | int nMaximumdays = dlg.RebookMaxDays; | 
|---|
| 1741 | int nAccessType = dlg.RebookAccessType; | 
|---|
| 1742 | //-1 means use current type | 
|---|
| 1743 |  | 
|---|
| 1744 | if (nAccessType == -1) | 
|---|
| 1745 | { | 
|---|
| 1746 | //Get access type from grid | 
|---|
| 1747 | int nRow = 0; | 
|---|
| 1748 | int nCol = 0; | 
|---|
| 1749 | CGCell cgCell = new CGCell(); | 
|---|
| 1750 | this.calendarGrid1.GetCellFromTime(a.StartTime, ref nRow, ref nCol, true , a.Resource); | 
|---|
| 1751 | cgCell.CellColumn = nCol; | 
|---|
| 1752 | cgCell.CellRow = nRow; | 
|---|
| 1753 | this.calendarGrid1.GetTypeFromCell(cgCell, out nAccessType); | 
|---|
| 1754 | a.AccessTypeID = nAccessType; | 
|---|
| 1755 | } | 
|---|
| 1756 | string sResult = Document.AutoRebook(a, nAccessType, nMinimumdays, nMaximumdays, out aRebook); | 
|---|
| 1757 | if (sResult == "1") | 
|---|
| 1758 | { | 
|---|
| 1759 | //Add appointment to list of rebooked appointments | 
|---|
| 1760 | alRebookList.AddAppointment(a); | 
|---|
| 1761 | } | 
|---|
| 1762 | else | 
|---|
| 1763 | { | 
|---|
| 1764 | MessageBox.Show("Unable to rebook this patient: " + a.PatientName); | 
|---|
| 1765 | } | 
|---|
| 1766 |  | 
|---|
| 1767 | } | 
|---|
| 1768 | catch (Exception ex) | 
|---|
| 1769 | { | 
|---|
| 1770 | MessageBox.Show("Unable to rebook: " + ex.Message); | 
|---|
| 1771 | } | 
|---|
| 1772 | } | 
|---|
| 1773 | } | 
|---|
| 1774 |  | 
|---|
| 1775 | if (bMarked == true) | 
|---|
| 1776 | { | 
|---|
| 1777 | //Notify other scheduling users that this schedule has changed | 
|---|
| 1778 | try | 
|---|
| 1779 | { | 
|---|
| 1780 | this.Document.RefreshDocument(); | 
|---|
| 1781 | RaiseRPMSEvent("BSDX SCHEDULE" , m_Document.DocName); | 
|---|
| 1782 | } | 
|---|
| 1783 | catch (Exception ex) | 
|---|
| 1784 | { | 
|---|
| 1785 | Debug.Write(ex.Message); | 
|---|
| 1786 | } | 
|---|
| 1787 | this.calendarGrid1.Invalidate(); | 
|---|
| 1788 |  | 
|---|
| 1789 | AutoRebookFromList(alRebookList); | 
|---|
| 1790 | } | 
|---|
| 1791 | } | 
|---|
| 1792 |  | 
|---|
| 1793 | private void AutoRebookFromList(CGAppointments alRebookList) | 
|---|
| 1794 | { | 
|---|
| 1795 | //Print AutoRebook letters. | 
|---|
| 1796 | if (alRebookList.AppointmentCount > 0) | 
|---|
| 1797 | { | 
|---|
| 1798 | //build |-delimited list of ApptIDs to pass to BSDX REBOOK LIST | 
|---|
| 1799 | string sApptIDList = ""; | 
|---|
| 1800 |  | 
|---|
| 1801 | System.Collections.ArrayList a = new ArrayList(); | 
|---|
| 1802 |  | 
|---|
| 1803 | foreach (CGAppointment appt in alRebookList.AppointmentTable.Values) | 
|---|
| 1804 | { | 
|---|
| 1805 | string sApptID = appt.AppointmentKey.ToString() + "|"; | 
|---|
| 1806 | sApptIDList += sApptID; | 
|---|
| 1807 | if (a.Contains(appt.Resource) == false) | 
|---|
| 1808 | a.Add(appt.Resource); | 
|---|
| 1809 | } | 
|---|
| 1810 |  | 
|---|
| 1811 | // Print rebooks | 
|---|
| 1812 | string sClinicList = ""; | 
|---|
| 1813 | foreach (string sRes in a) | 
|---|
| 1814 | { | 
|---|
| 1815 | sClinicList = sClinicList + sRes + "|"; | 
|---|
| 1816 | } | 
|---|
| 1817 | DPatientLetter dpl = new DPatientLetter(); | 
|---|
| 1818 | dpl.InitializeFormRebookLetters(this.DocManager, sClinicList, sApptIDList); | 
|---|
| 1819 | dpl.ShowDialog(this); | 
|---|
| 1820 | } | 
|---|
| 1821 | } | 
|---|
| 1822 |  | 
|---|
| 1823 | /// <summary> | 
|---|
| 1824 | /// Delete appointment ApptID | 
|---|
| 1825 | /// </summary> | 
|---|
| 1826 | /// <param name="nApptID"></param> | 
|---|
| 1827 | /// <returns></returns> | 
|---|
| 1828 | private string AppointmentDeleteOne(int nApptID) | 
|---|
| 1829 | { | 
|---|
| 1830 | return Document.DeleteAppointment(nApptID); | 
|---|
| 1831 | } | 
|---|
| 1832 |  | 
|---|
| 1833 | /// <summary> | 
|---|
| 1834 | /// Delete all selected appointments | 
|---|
| 1835 | /// </summary> | 
|---|
| 1836 | private void AppointmentDelete() | 
|---|
| 1837 | { | 
|---|
| 1838 | calendarGrid1.CGToolTip.Active = false; | 
|---|
| 1839 | CGAppointments alRebookList = new CGAppointments(); | 
|---|
| 1840 |  | 
|---|
| 1841 | DCancelAppt dCancel = new DCancelAppt(); | 
|---|
| 1842 | dCancel.InitializePage(this.m_DocManager); | 
|---|
| 1843 | if (dCancel.ShowDialog(this) != DialogResult.OK) | 
|---|
| 1844 | { | 
|---|
| 1845 | calendarGrid1.CGToolTip.Active = true; | 
|---|
| 1846 | return; | 
|---|
| 1847 | } | 
|---|
| 1848 |  | 
|---|
| 1849 | bool bClinic = dCancel.ClinicCancelled; | 
|---|
| 1850 | int nReason = dCancel.CancelReason; | 
|---|
| 1851 | string sRemarks = dCancel.CancelRemarks; | 
|---|
| 1852 | bool bRebook = dCancel.AutoRebook; | 
|---|
| 1853 | int nRebookStart = dCancel.RebookStartDays; | 
|---|
| 1854 | int nRebookMax = dCancel.RebookMaxDays; | 
|---|
| 1855 | int nRebookAccessType = dCancel.RebookAccessType; | 
|---|
| 1856 |  | 
|---|
| 1857 | calendarGrid1.CGToolTip.Active = true; | 
|---|
| 1858 |  | 
|---|
| 1859 | bool bDeleted = false; | 
|---|
| 1860 | foreach (CGAppointment a in this.calendarGrid1.SelectedAppointments.AppointmentTable.Values) | 
|---|
| 1861 | { | 
|---|
| 1862 | int nApptID = a.AppointmentKey; | 
|---|
| 1863 | Debug.Assert(nApptID != 0); | 
|---|
| 1864 | try | 
|---|
| 1865 | { | 
|---|
| 1866 | string sError = Document.DeleteAppointment(nApptID,bClinic, nReason, sRemarks); | 
|---|
| 1867 | if (sError != "") | 
|---|
| 1868 | throw new Exception(sError); | 
|---|
| 1869 |  | 
|---|
| 1870 | bDeleted = true; | 
|---|
| 1871 | if (bRebook == true) | 
|---|
| 1872 | { | 
|---|
| 1873 | try | 
|---|
| 1874 | { | 
|---|
| 1875 | //TODO: Parameterize  or dialogize the minum and maximum rebook days | 
|---|
| 1876 | CGAppointment aRebook; | 
|---|
| 1877 | int nMinimumdays = nRebookStart; | 
|---|
| 1878 | int nMaximumdays = nRebookMax; | 
|---|
| 1879 | string sResult = Document.AutoRebook(a, nRebookAccessType, nMinimumdays, nMaximumdays, out aRebook); | 
|---|
| 1880 | if (sResult == "1") | 
|---|
| 1881 | { | 
|---|
| 1882 | //Add appointment to list of rebooked appointments | 
|---|
| 1883 | alRebookList.AddAppointment(a); | 
|---|
| 1884 | } | 
|---|
| 1885 |  | 
|---|
| 1886 | } | 
|---|
| 1887 | catch (Exception ex) | 
|---|
| 1888 | { | 
|---|
| 1889 | MessageBox.Show("Unable to rebook: " + ex.Message); | 
|---|
| 1890 | } | 
|---|
| 1891 | } | 
|---|
| 1892 | } | 
|---|
| 1893 | catch (Exception ex) | 
|---|
| 1894 | { | 
|---|
| 1895 | MessageBox.Show("Unable to delete appointment.  " +  ex.Message, "Clinical Scheduling"); | 
|---|
| 1896 | } | 
|---|
| 1897 |  | 
|---|
| 1898 | } | 
|---|
| 1899 | if (bDeleted == true) | 
|---|
| 1900 | { | 
|---|
| 1901 | try | 
|---|
| 1902 | { | 
|---|
| 1903 | this.UpdateArrays(); | 
|---|
| 1904 | RaiseRPMSEvent("BSDX SCHEDULE" , m_Document.DocName); | 
|---|
| 1905 |  | 
|---|
| 1906 | //Get the appointments and availabilities, async, from Server. Callback updates this thread's controls. | 
|---|
| 1907 | OnUpdateScheduleDelegate ousd = new OnUpdateScheduleDelegate(OnUpdateSchedule); | 
|---|
| 1908 | ousd.BeginInvoke(OnUpdateScheduleCallback, null); | 
|---|
| 1909 | } | 
|---|
| 1910 | catch (Exception ex) | 
|---|
| 1911 | { | 
|---|
| 1912 | Debug.Write(ex.Message); | 
|---|
| 1913 | } | 
|---|
| 1914 | this.calendarGrid1.Invalidate(); | 
|---|
| 1915 | if (bRebook == true) | 
|---|
| 1916 | { | 
|---|
| 1917 | AutoRebookFromList(alRebookList); | 
|---|
| 1918 | } | 
|---|
| 1919 | } | 
|---|
| 1920 |  | 
|---|
| 1921 | } | 
|---|
| 1922 |  | 
|---|
| 1923 | private void AppointmentCheckIn() | 
|---|
| 1924 | { | 
|---|
| 1925 |  | 
|---|
| 1926 | int nApptID = this.calendarGrid1.SelectedAppointment; | 
|---|
| 1927 | Debug.Assert(nApptID != 0); | 
|---|
| 1928 |  | 
|---|
| 1929 | //smh | 
|---|
| 1930 | //CGAppointment a = (CGAppointment) this.Appointments.AppointmentTable[nApptID]; | 
|---|
| 1931 | CGAppointment a = (CGAppointment)this.Document.Appointments.AppointmentTable[nApptID]; | 
|---|
| 1932 | try | 
|---|
| 1933 | { | 
|---|
| 1934 | bool bAlreadyCheckedIn = false; | 
|---|
| 1935 | if (a.CheckInTime.Ticks > 0) | 
|---|
| 1936 | bAlreadyCheckedIn = true; | 
|---|
| 1937 |  | 
|---|
| 1938 | if ((bAlreadyCheckedIn == false) | 
|---|
| 1939 | && | 
|---|
| 1940 | (a.StartTime.Date > DateTime.Today.Date)) | 
|---|
| 1941 | { | 
|---|
| 1942 | MessageBox.Show(this, "It is too early to check in " + a.PatientName, "Windows Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); | 
|---|
| 1943 | return; | 
|---|
| 1944 | } | 
|---|
| 1945 | //Find the default provider for the resource & load into combo box | 
|---|
| 1946 | DataView rv = new DataView(this.m_DocManager.GlobalDataSet.Tables["Resources"]); | 
|---|
| 1947 | rv.Sort="RESOURCE_NAME ASC"; | 
|---|
| 1948 | int nFind = rv.Find((string) a.Resource); | 
|---|
| 1949 | DataRowView drv = rv[nFind]; | 
|---|
| 1950 |  | 
|---|
| 1951 | string sHospLoc = drv["HOSPITAL_LOCATION_ID"].ToString(); | 
|---|
| 1952 | sHospLoc = (sHospLoc == "")?"0":sHospLoc; | 
|---|
| 1953 | int nHospLoc = 0; | 
|---|
| 1954 | try | 
|---|
| 1955 | { | 
|---|
| 1956 | nHospLoc = Convert.ToInt32(sHospLoc); | 
|---|
| 1957 | } | 
|---|
| 1958 | catch(Exception ex) | 
|---|
| 1959 | { | 
|---|
| 1960 | Debug.Write("CGView.AppointmentCheckIn Error: " + ex.Message); | 
|---|
| 1961 | } | 
|---|
| 1962 |  | 
|---|
| 1963 | string sProv = ""; | 
|---|
| 1964 |  | 
|---|
| 1965 | if (nHospLoc > 0) | 
|---|
| 1966 | { | 
|---|
| 1967 | DataRow dr = drv.Row; | 
|---|
| 1968 | DataRow drHL = dr.GetParentRow(m_DocManager.GlobalDataSet.Relations["HospitalLocationResource"]); | 
|---|
| 1969 | sProv = drHL["DEFAULT_PROVIDER"].ToString(); | 
|---|
| 1970 | } | 
|---|
| 1971 |  | 
|---|
| 1972 | DCheckIn dlgCheckin = new DCheckIn(); | 
|---|
| 1973 | dlgCheckin.InitializePage(a, this.m_DocManager, sProv, nHospLoc); | 
|---|
| 1974 | calendarGrid1.CGToolTip.Active = false; | 
|---|
| 1975 | if (dlgCheckin.ShowDialog(this) != DialogResult.OK) | 
|---|
| 1976 | { | 
|---|
| 1977 | calendarGrid1.CGToolTip.Active = true; | 
|---|
| 1978 | return; | 
|---|
| 1979 | } | 
|---|
| 1980 | calendarGrid1.CGToolTip.Active = true; | 
|---|
| 1981 |  | 
|---|
| 1982 | if (bAlreadyCheckedIn == true) | 
|---|
| 1983 | return; | 
|---|
| 1984 |  | 
|---|
| 1985 | DateTime dtCheckIn = dlgCheckin.CheckInTime; | 
|---|
| 1986 |  | 
|---|
| 1987 | //Save to Database | 
|---|
| 1988 | this.Document.CheckInAppointment(nApptID, dtCheckIn); | 
|---|
| 1989 |  | 
|---|
| 1990 | //Tell appointment that it is checked in--smh cancel that! | 
|---|
| 1991 | //a.CheckInTime = DateTime.Now; | 
|---|
| 1992 |  | 
|---|
| 1993 | //smh new code | 
|---|
| 1994 | if (dlgCheckin.PrintRouteSlip) | 
|---|
| 1995 | this.printRoutingSlip.Print(); | 
|---|
| 1996 | // end new code | 
|---|
| 1997 |  | 
|---|
| 1998 | //redraw grid (would this work???) | 
|---|
| 1999 | this.calendarGrid1.Invalidate(); | 
|---|
| 2000 | } | 
|---|
| 2001 | catch (Exception ex) | 
|---|
| 2002 | { | 
|---|
| 2003 | MessageBox.Show("Error checking in patient:  " +  ex.Message, "Clinical Scheduling"); | 
|---|
| 2004 | } | 
|---|
| 2005 |  | 
|---|
| 2006 | } | 
|---|
| 2007 |  | 
|---|
| 2008 | private void AppointmentAddWalkin() | 
|---|
| 2009 | { | 
|---|
| 2010 | try | 
|---|
| 2011 | { | 
|---|
| 2012 | CGAppointment appt = new CGAppointment(); | 
|---|
| 2013 |  | 
|---|
| 2014 | //Get Time and Resource from Selected Cell | 
|---|
| 2015 | DateTime dStart = DateTime.Today; | 
|---|
| 2016 | DateTime dEnd = DateTime.Today; | 
|---|
| 2017 | string sResource = ""; | 
|---|
| 2018 | bool bRet = this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource); | 
|---|
| 2019 | if (bRet == false) | 
|---|
| 2020 | return; | 
|---|
| 2021 |  | 
|---|
| 2022 | TimeSpan tsDuration = dEnd - dStart; | 
|---|
| 2023 | int nDuration = (int) tsDuration.TotalMinutes; | 
|---|
| 2024 | Debug.Assert(nDuration > 0); | 
|---|
| 2025 |  | 
|---|
| 2026 | /* | 
|---|
| 2027 | * 8-10-05 Added check to prevent walkin from being created | 
|---|
| 2028 | * on a date later than today. | 
|---|
| 2029 | */ | 
|---|
| 2030 |  | 
|---|
| 2031 | if (dStart.Date > DateTime.Today.Date) | 
|---|
| 2032 | { | 
|---|
| 2033 | MessageBox.Show(this, "You cannot create a walk-in appointment for a date in the future.\n Select today's date and try again.", "Windows Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); | 
|---|
| 2034 | return; | 
|---|
| 2035 | } | 
|---|
| 2036 |  | 
|---|
| 2037 | // Added check for making Walk-ins in the past. 9/28/2010 | 
|---|
| 2038 | if (dStart.Date < DateTime.Today.Date) | 
|---|
| 2039 | { | 
|---|
| 2040 | var result = MessageBox.Show("Are you sure you want to make a Walk-in in the past?", "Windows Scheduling", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); | 
|---|
| 2041 | if (result == DialogResult.No) return; | 
|---|
| 2042 | } | 
|---|
| 2043 |  | 
|---|
| 2044 | /* | 
|---|
| 2045 | * 8-10-05 Added overbook prompt for walkin | 
|---|
| 2046 | */ | 
|---|
| 2047 | //SMH: Takes too long to do. | 
|---|
| 2048 | //this.Document.RefreshDocument(); | 
|---|
| 2049 | string sAccessType = ""; | 
|---|
| 2050 | string sAvailabilityMessage = ""; | 
|---|
| 2051 | m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage); | 
|---|
| 2052 |  | 
|---|
| 2053 | if (m_nSlots < 1) | 
|---|
| 2054 | { | 
|---|
| 2055 | 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); | 
|---|
| 2056 | if (dr != DialogResult.Yes) | 
|---|
| 2057 | { | 
|---|
| 2058 | return; | 
|---|
| 2059 | } | 
|---|
| 2060 | } | 
|---|
| 2061 |  | 
|---|
| 2062 | //Display a dialog to collect Patient Name | 
|---|
| 2063 | DPatientLookup dPat = new DPatientLookup(); | 
|---|
| 2064 | dPat.DocManager = m_DocManager; | 
|---|
| 2065 |  | 
|---|
| 2066 | int nAccessTypeID = 0; | 
|---|
| 2067 | bRet = calendarGrid1.GetSelectedType(out nAccessTypeID); | 
|---|
| 2068 |  | 
|---|
| 2069 | if (dPat.ShowDialog(this) == DialogResult.Cancel) | 
|---|
| 2070 | { | 
|---|
| 2071 | return; | 
|---|
| 2072 | } | 
|---|
| 2073 |  | 
|---|
| 2074 | appt.PatientID = Convert.ToInt32(dPat.PatientIEN); | 
|---|
| 2075 | appt.PatientName = dPat.PatientName; | 
|---|
| 2076 | appt.StartTime = dStart; | 
|---|
| 2077 | appt.EndTime = dEnd; | 
|---|
| 2078 | appt.Resource = sResource; | 
|---|
| 2079 | appt.HealthRecordNumber = dPat.HealthRecordNumber; | 
|---|
| 2080 |  | 
|---|
| 2081 | //smh: Takes too long | 
|---|
| 2082 | //this.Document.RefreshDocument(); | 
|---|
| 2083 |  | 
|---|
| 2084 | //Call Document to add a walkin appointment | 
|---|
| 2085 | int nApptID = this.Document.CreateAppointment(appt, true); | 
|---|
| 2086 |  | 
|---|
| 2087 | //Now check them in. | 
|---|
| 2088 | calendarGrid1.SelectedAppointment = nApptID; | 
|---|
| 2089 | AppointmentCheckIn(); | 
|---|
| 2090 |  | 
|---|
| 2091 | //Show the new set of appointments by calling UpdateArrays. Fetches Document's CGAppointments | 
|---|
| 2092 | this.UpdateArrays(); | 
|---|
| 2093 |  | 
|---|
| 2094 | //Get the appointments and availabilities, async, from Server. Callback updates this thread's controls. | 
|---|
| 2095 | OnUpdateScheduleDelegate ousd = new OnUpdateScheduleDelegate(OnUpdateSchedule); | 
|---|
| 2096 | ousd.BeginInvoke(OnUpdateScheduleCallback, null); | 
|---|
| 2097 |  | 
|---|
| 2098 |  | 
|---|
| 2099 | } | 
|---|
| 2100 | catch (Exception ex) | 
|---|
| 2101 | { | 
|---|
| 2102 | string msg; | 
|---|
| 2103 | if (BMXNetLib.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error. | 
|---|
| 2104 | msg = BMXNetLib.Piece(ex.Message, "~", 4); | 
|---|
| 2105 | else | 
|---|
| 2106 | msg = ex.Message; | 
|---|
| 2107 |  | 
|---|
| 2108 | MessageBox.Show("VISTA says: \r\n" + msg, "Unable to Make Walk-in Appointment"); | 
|---|
| 2109 | return; | 
|---|
| 2110 | } | 
|---|
| 2111 |  | 
|---|
| 2112 | try | 
|---|
| 2113 | { | 
|---|
| 2114 | RaiseRPMSEvent("BSDX SCHEDULE", m_Document.DocName); | 
|---|
| 2115 | } | 
|---|
| 2116 | catch (Exception ex) | 
|---|
| 2117 | { | 
|---|
| 2118 | Debug.Write(ex.Message); | 
|---|
| 2119 | } | 
|---|
| 2120 |  | 
|---|
| 2121 |  | 
|---|
| 2122 | } | 
|---|
| 2123 |  | 
|---|
| 2124 | private void AppointmentAddNew() | 
|---|
| 2125 | { | 
|---|
| 2126 | try | 
|---|
| 2127 | { | 
|---|
| 2128 |  | 
|---|
| 2129 |  | 
|---|
| 2130 | //Get Time and Resource from Selected Cell | 
|---|
| 2131 | DateTime dStart = DateTime.Today; | 
|---|
| 2132 | DateTime dEnd = DateTime.Today; | 
|---|
| 2133 | string sResource = ""; | 
|---|
| 2134 | bool bRet = this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource); | 
|---|
| 2135 | if (bRet == false) | 
|---|
| 2136 | return; | 
|---|
| 2137 |  | 
|---|
| 2138 | // Added check for making Walk-ins in the past. 9/28/2010 | 
|---|
| 2139 | if (dStart.Date < DateTime.Today.Date) | 
|---|
| 2140 | { | 
|---|
| 2141 | var result = MessageBox.Show("Are you sure you want to make an appointment in the past?", "Windows Scheduling", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); | 
|---|
| 2142 | if (result == DialogResult.No) return; | 
|---|
| 2143 | } | 
|---|
| 2144 |  | 
|---|
| 2145 | //Test dStart for Holiday | 
|---|
| 2146 | DataView dvHoliday = new DataView(this.DocManager.GlobalDataSet.Tables["HOLIDAY"]); | 
|---|
| 2147 | dvHoliday.Sort="DATE ASC"; | 
|---|
| 2148 | int nFind = dvHoliday.Find(dStart.Date); | 
|---|
| 2149 | if (nFind > -1) | 
|---|
| 2150 | { | 
|---|
| 2151 | string sHoliday = ""; | 
|---|
| 2152 | DataRowView drv = dvHoliday[nFind]; | 
|---|
| 2153 | sHoliday = drv["NAME"].ToString(); | 
|---|
| 2154 | if (MessageBox.Show(this, dStart.ToShortDateString() + " is a holiday (" + sHoliday + ").  Are you sure you want to make this appointment?","Clinical Scheduling", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) | 
|---|
| 2155 | return; | 
|---|
| 2156 | } | 
|---|
| 2157 |  | 
|---|
| 2158 | TimeSpan tsDuration = dEnd - dStart; | 
|---|
| 2159 | int nDuration = (int) tsDuration.TotalMinutes; | 
|---|
| 2160 | Debug.Assert(nDuration > 0); | 
|---|
| 2161 |  | 
|---|
| 2162 |  | 
|---|
| 2163 | //Sam: takes too long. Remove this call; deal with the issue of concurrent appointments another way. | 
|---|
| 2164 | //this.Document.RefreshDocument(); | 
|---|
| 2165 | string sAccessType = ""; | 
|---|
| 2166 | string sAvailabilityMessage = ""; | 
|---|
| 2167 | m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage); | 
|---|
| 2168 |  | 
|---|
| 2169 | if (m_nSlots < 1) | 
|---|
| 2170 | { | 
|---|
| 2171 | 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); | 
|---|
| 2172 | if (dr != DialogResult.Yes) | 
|---|
| 2173 | { | 
|---|
| 2174 | return; | 
|---|
| 2175 | } | 
|---|
| 2176 | } | 
|---|
| 2177 |  | 
|---|
| 2178 | //Display a dialog to collect Patient Name | 
|---|
| 2179 | DPatientLookup dPat = new DPatientLookup(); | 
|---|
| 2180 | dPat.DocManager = m_DocManager; | 
|---|
| 2181 |  | 
|---|
| 2182 | int nAccessTypeID = 0; | 
|---|
| 2183 | bRet = calendarGrid1.GetSelectedType(out nAccessTypeID); | 
|---|
| 2184 |  | 
|---|
| 2185 | if (dPat.ShowDialog(this) == DialogResult.Cancel) | 
|---|
| 2186 | { | 
|---|
| 2187 | return; | 
|---|
| 2188 | } | 
|---|
| 2189 |  | 
|---|
| 2190 | //Call the appointment dialog to collect the appointment info | 
|---|
| 2191 | Debug.Assert(dPat.PatientIEN != ""); | 
|---|
| 2192 | DAppointPage dAppt = new DAppointPage(); | 
|---|
| 2193 | dAppt.DocManager = this.m_DocManager; | 
|---|
| 2194 | string sNote = ""; | 
|---|
| 2195 | dAppt.InitializePage(dPat.PatientIEN, dStart, nDuration, sResource, sNote); | 
|---|
| 2196 |  | 
|---|
| 2197 | if (dAppt.ShowDialog(this) == DialogResult.Cancel) | 
|---|
| 2198 | { | 
|---|
| 2199 | return; | 
|---|
| 2200 | } | 
|---|
| 2201 |  | 
|---|
| 2202 | CGAppointment appt = new CGAppointment(); | 
|---|
| 2203 | appt.PatientID = Convert.ToInt32(dPat.PatientIEN); | 
|---|
| 2204 | appt.PatientName = dPat.PatientName; | 
|---|
| 2205 | appt.StartTime = dStart; | 
|---|
| 2206 | appt.EndTime = dEnd; | 
|---|
| 2207 | appt.Resource = sResource; | 
|---|
| 2208 | appt.Note = dAppt.Note; | 
|---|
| 2209 | appt.HealthRecordNumber = dPat.HealthRecordNumber; | 
|---|
| 2210 | appt.AccessTypeID = nAccessTypeID; | 
|---|
| 2211 |  | 
|---|
| 2212 | //Call Document to add a new appointment. Document adds appointment to CGAppointments array. | 
|---|
| 2213 | this.Document.CreateAppointment(appt); | 
|---|
| 2214 |  | 
|---|
| 2215 | //Show the new set of appointments by calling UpdateArrays. Fetches Document's CGAppointments | 
|---|
| 2216 | this.UpdateArrays(); | 
|---|
| 2217 |  | 
|---|
| 2218 | //Get the appointments and availabilities, async, from Server. Callback updates this thread's controls. | 
|---|
| 2219 | OnUpdateScheduleDelegate ousd = new OnUpdateScheduleDelegate(OnUpdateSchedule); | 
|---|
| 2220 | ousd.BeginInvoke(OnUpdateScheduleCallback, null); | 
|---|
| 2221 | } | 
|---|
| 2222 | catch (Exception ex) | 
|---|
| 2223 | { | 
|---|
| 2224 | string msg; | 
|---|
| 2225 | if (BMXNetLib.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error. | 
|---|
| 2226 | msg = BMXNetLib.Piece(ex.Message, "~", 4); | 
|---|
| 2227 | else | 
|---|
| 2228 | msg = ex.Message; | 
|---|
| 2229 |  | 
|---|
| 2230 | MessageBox.Show("VISTA says: \r\n" + msg, "Unable to Make Appointment"); | 
|---|
| 2231 | return; | 
|---|
| 2232 | } | 
|---|
| 2233 |  | 
|---|
| 2234 | try | 
|---|
| 2235 | { | 
|---|
| 2236 | RaiseRPMSEvent("BSDX SCHEDULE" , m_Document.DocName); | 
|---|
| 2237 | this.calendarGrid1.Invalidate(); | 
|---|
| 2238 | } | 
|---|
| 2239 | catch (Exception ex) | 
|---|
| 2240 | { | 
|---|
| 2241 | Debug.Write(ex.Message); | 
|---|
| 2242 | } | 
|---|
| 2243 | } | 
|---|
| 2244 |  | 
|---|
| 2245 | #region BMX Event Processing and Callbacks | 
|---|
| 2246 | /// <summary> | 
|---|
| 2247 | /// Loosely typed delegate used several times below. | 
|---|
| 2248 | /// </summary> | 
|---|
| 2249 | delegate void OnUpdateScheduleDelegate(); | 
|---|
| 2250 |  | 
|---|
| 2251 | /// <summary> | 
|---|
| 2252 | /// Subscription point for each CGView to process BMX events polled from the server | 
|---|
| 2253 | /// </summary> | 
|---|
| 2254 | /// <param name="obj">Not used</param> | 
|---|
| 2255 | /// <param name="e">BMXEvent Args: | 
|---|
| 2256 | /// e.BMXEvent is free text for Event Type; e.BMXParam is free text for Event Arguments</param> | 
|---|
| 2257 | private void BMXNetEventHandler(Object obj, BMXNet.BMXNetEventArgs e) | 
|---|
| 2258 | { | 
|---|
| 2259 | try | 
|---|
| 2260 | { | 
|---|
| 2261 | // if this class is undefined (e.g. if the user just closed the form, do nothing | 
|---|
| 2262 | if (this == null) return; | 
|---|
| 2263 |  | 
|---|
| 2264 | // if event is Autofire event | 
|---|
| 2265 | if (e.BMXEvent == "BMXNet AutoFire") | 
|---|
| 2266 | { | 
|---|
| 2267 | Debug.Write("CGView caught AutoFire event.\n"); | 
|---|
| 2268 |  | 
|---|
| 2269 | //Create a delegate to OnUpdateSchedule and call Async | 
|---|
| 2270 | //Once Async Call is done, go to OnUpdateScheduleCallback | 
|---|
| 2271 | OnUpdateScheduleDelegate ousd = new OnUpdateScheduleDelegate(OnUpdateSchedule); | 
|---|
| 2272 | ousd.BeginInvoke(OnUpdateScheduleCallback, null); | 
|---|
| 2273 |  | 
|---|
| 2274 | return; | 
|---|
| 2275 | } | 
|---|
| 2276 |  | 
|---|
| 2277 | // if event is BSDX SCHEDULE | 
|---|
| 2278 | else if (e.BMXEvent == "BSDX SCHEDULE") | 
|---|
| 2279 | { | 
|---|
| 2280 | //See if any of the resources in the event argument matches BSDX Schedule. | 
|---|
| 2281 | //If yes, fire off the delegate | 
|---|
| 2282 | string sResourceName; | 
|---|
| 2283 | for (int j = 0; j < m_Document.m_sResourcesArray.Count; j++) | 
|---|
| 2284 | { | 
|---|
| 2285 | sResourceName = m_Document.m_sResourcesArray[j].ToString(); | 
|---|
| 2286 | if (e.BMXParam == sResourceName) | 
|---|
| 2287 | { | 
|---|
| 2288 | Debug.Write("CGView caught BSDX SCHEDULE event.\n"); | 
|---|
| 2289 |  | 
|---|
| 2290 | //Create a delegate to OnUpdateSchedule and call Async | 
|---|
| 2291 | //Once Async Call is done, go to OnUpdateScheduleCallb | 
|---|
| 2292 | OnUpdateScheduleDelegate ousd = new OnUpdateScheduleDelegate(OnUpdateSchedule); | 
|---|
| 2293 | ousd.BeginInvoke(OnUpdateScheduleCallback, null); | 
|---|
| 2294 |  | 
|---|
| 2295 | break; | 
|---|
| 2296 | } | 
|---|
| 2297 | } | 
|---|
| 2298 | } | 
|---|
| 2299 | } | 
|---|
| 2300 | catch (Exception ex) | 
|---|
| 2301 | { | 
|---|
| 2302 | Debug.Write(ex.Message); | 
|---|
| 2303 | } | 
|---|
| 2304 | } | 
|---|
| 2305 |  | 
|---|
| 2306 | /// <summary> | 
|---|
| 2307 | /// Update Appointments and Availabilites using Document.RefreshDocumentAsync on a different thread | 
|---|
| 2308 | /// </summary> | 
|---|
| 2309 | /// <remarks> | 
|---|
| 2310 | /// This method is expected to be called asynchornously. | 
|---|
| 2311 | /// </remarks> | 
|---|
| 2312 | public void OnUpdateSchedule() | 
|---|
| 2313 | { | 
|---|
| 2314 | try | 
|---|
| 2315 | { | 
|---|
| 2316 | m_Document.RefreshDocumentAsync(); //new | 
|---|
| 2317 | } | 
|---|
| 2318 | catch (Exception ex) | 
|---|
| 2319 | { | 
|---|
| 2320 | MessageBox.Show("Unable to refresh document " +  ex.Message, "Clinical Scheduling"); | 
|---|
| 2321 | } | 
|---|
| 2322 | } | 
|---|
| 2323 |  | 
|---|
| 2324 | /// <summary> | 
|---|
| 2325 | /// Callback for when OnUpdateSchedule is done. Triggers the Grid to redraw itself by calling UpdateArrays. | 
|---|
| 2326 | /// </summary> | 
|---|
| 2327 | /// <param name="itfAR">not used</param> | 
|---|
| 2328 | /// <remarks>Calls UpdateArrays via this.Invoke to make sure that the grid is redrawn on the UI thread</remarks> | 
|---|
| 2329 | private void OnUpdateScheduleCallback(IAsyncResult itfAR) | 
|---|
| 2330 | { | 
|---|
| 2331 | OnUpdateScheduleDelegate d = new OnUpdateScheduleDelegate(UpdateArrays); | 
|---|
| 2332 |  | 
|---|
| 2333 | //try catch just in case that the view closed in the meantime. | 
|---|
| 2334 | try | 
|---|
| 2335 | { | 
|---|
| 2336 | this.Invoke(d); | 
|---|
| 2337 | } | 
|---|
| 2338 | catch (InvalidOperationException) | 
|---|
| 2339 | { | 
|---|
| 2340 | return; | 
|---|
| 2341 | } | 
|---|
| 2342 | } | 
|---|
| 2343 |  | 
|---|
| 2344 | /// <summary> | 
|---|
| 2345 | /// Create a new event in RPMS. Wrapper around BMXConnectInfo.RaiseEvent | 
|---|
| 2346 | /// </summary> | 
|---|
| 2347 | /// <param name="sEvent">Name of Event to Raise</param> | 
|---|
| 2348 | /// <param name="sParams">Parameter of Event to Raise</param> | 
|---|
| 2349 | public void RaiseRPMSEvent(string sEvent, string sParams) | 
|---|
| 2350 | { | 
|---|
| 2351 | try | 
|---|
| 2352 | { | 
|---|
| 2353 | //Signal RPMS to raise an event | 
|---|
| 2354 | m_ConnectInfo.RaiseEvent(sEvent, sParams, true); | 
|---|
| 2355 | } | 
|---|
| 2356 | catch (Exception ex) | 
|---|
| 2357 | { | 
|---|
| 2358 | Debug.Write(ex.Message); | 
|---|
| 2359 | } | 
|---|
| 2360 | } | 
|---|
| 2361 |  | 
|---|
| 2362 | #endregion | 
|---|
| 2363 |  | 
|---|
| 2364 | /// <summary> | 
|---|
| 2365 | /// This is how you set how the grid will look | 
|---|
| 2366 | /// </summary> | 
|---|
| 2367 | public void UpdateArrays() | 
|---|
| 2368 | { | 
|---|
| 2369 | // Make sure that we are called synchronously | 
|---|
| 2370 | Debug.Assert(this.InvokeRequired == false,"CGView.UpdateArrays InvokeRequired"); | 
|---|
| 2371 | // This is where you set how the grid will look | 
|---|
| 2372 |  | 
|---|
| 2373 | //Create Deep copy of Availability Array | 
|---|
| 2374 | ArrayList availArrayCopy = new ArrayList(); | 
|---|
| 2375 | foreach (CGAvailability av in this.m_Document.AvailabilityArray) | 
|---|
| 2376 | availArrayCopy.Add(av); | 
|---|
| 2377 |  | 
|---|
| 2378 | try | 
|---|
| 2379 | { | 
|---|
| 2380 | //Tell the grid about Avails, Appts, and Resources. | 
|---|
| 2381 | this.calendarGrid1.AvailabilityArray = availArrayCopy; | 
|---|
| 2382 | //Appts are cloned b/c if we tie into  the class directly, we shoot off errors when we manipulate it. | 
|---|
| 2383 | this.calendarGrid1.Appointments = (CGAppointments)this.m_Document.Appointments.Clone(); | 
|---|
| 2384 | this.calendarGrid1.Resources = this.m_Document.Resources; | 
|---|
| 2385 | //Redraw the calendar grid | 
|---|
| 2386 | this.calendarGrid1.OnUpdateArrays(); // this draws the Calendar | 
|---|
| 2387 | this.lblResource.Text = this.m_Document.DocName; | 
|---|
| 2388 | this.calendarGrid1.Invalidate(); | 
|---|
| 2389 | } | 
|---|
| 2390 | catch (Exception ex) | 
|---|
| 2391 | { | 
|---|
| 2392 | MessageBox.Show("Unable to update arrays " +  ex.Message, "Clinical Scheduling"); | 
|---|
| 2393 | } | 
|---|
| 2394 | } | 
|---|
| 2395 |  | 
|---|
| 2396 | private void SchedulingManagement() | 
|---|
| 2397 | { | 
|---|
| 2398 | try | 
|---|
| 2399 | { | 
|---|
| 2400 | bool bLock = DocManager.ConnectInfo.Lock("^BSDXMGR", "+", ""); | 
|---|
| 2401 | if (bLock == false) | 
|---|
| 2402 | { | 
|---|
| 2403 | throw new Exception("Another user is currently in Scheduling Management.  Try later."); | 
|---|
| 2404 | } | 
|---|
| 2405 |  | 
|---|
| 2406 | DManagement dMgm = new DManagement(); | 
|---|
| 2407 | dMgm.InitializeDialog(this.m_DocManager); | 
|---|
| 2408 |  | 
|---|
| 2409 | if (dMgm.ShowDialog(this) == DialogResult.Cancel) | 
|---|
| 2410 | { | 
|---|
| 2411 | } | 
|---|
| 2412 |  | 
|---|
| 2413 | m_DocManager.GlobalDataSet.Tables["ResourceUser"].Clear(); | 
|---|
| 2414 | m_DocManager.LoadResourceUserTable(false); | 
|---|
| 2415 | bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXMGR", "-"); | 
|---|
| 2416 | } | 
|---|
| 2417 | catch (ApplicationException aex) | 
|---|
| 2418 | { | 
|---|
| 2419 | string sMsg = aex.Message; | 
|---|
| 2420 | MessageBox.Show("Unable to acquire transmit lock.  Try later."); | 
|---|
| 2421 | } | 
|---|
| 2422 | catch (Exception ex) | 
|---|
| 2423 | { | 
|---|
| 2424 | MessageBox.Show("Scheduling Management Error:  " + ex.Message, "Clinical Scheduling"); | 
|---|
| 2425 | } | 
|---|
| 2426 | } | 
|---|
| 2427 |  | 
|---|
| 2428 | public void UpdateTree() | 
|---|
| 2429 | { | 
|---|
| 2430 | this.tvSchedules.Nodes.Clear(); | 
|---|
| 2431 | this.LoadTree(); | 
|---|
| 2432 | } | 
|---|
| 2433 |  | 
|---|
| 2434 | public void ViewPatientAppointments() | 
|---|
| 2435 | { | 
|---|
| 2436 | try | 
|---|
| 2437 | { | 
|---|
| 2438 | //Display a dialog to collect Patient Name | 
|---|
| 2439 | DPatientLookup dPat = new DPatientLookup(); | 
|---|
| 2440 | dPat.DocManager = m_DocManager; | 
|---|
| 2441 | if (dPat.ShowDialog(this) == DialogResult.Cancel) | 
|---|
| 2442 | { | 
|---|
| 2443 | return; | 
|---|
| 2444 | } | 
|---|
| 2445 |  | 
|---|
| 2446 | Debug.Assert(dPat.PatientIEN != ""); | 
|---|
| 2447 | int nPatientID = Convert.ToInt32(dPat.PatientIEN); | 
|---|
| 2448 | ViewPatientAppointments(nPatientID); | 
|---|
| 2449 | } | 
|---|
| 2450 | catch (Exception ex) | 
|---|
| 2451 | { | 
|---|
| 2452 | MessageBox.Show(this, ex.Message, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); | 
|---|
| 2453 | } | 
|---|
| 2454 | } | 
|---|
| 2455 |  | 
|---|
| 2456 | public void ViewPatientAppointments(int PatientID) | 
|---|
| 2457 | { | 
|---|
| 2458 | DPatientApptDisplay dPa = new DPatientApptDisplay(); | 
|---|
| 2459 |  | 
|---|
| 2460 | dPa.InitializeForm(this.DocManager, PatientID); | 
|---|
| 2461 |  | 
|---|
| 2462 |  | 
|---|
| 2463 | if (dPa.ShowDialog(this) != DialogResult.Cancel) | 
|---|
| 2464 | { | 
|---|
| 2465 |  | 
|---|
| 2466 | } | 
|---|
| 2467 |  | 
|---|
| 2468 | } | 
|---|
| 2469 |  | 
|---|
| 2470 | private void FindAvailableAppointment(ArrayList alResourceArray) | 
|---|
| 2471 | { | 
|---|
| 2472 | DApptSearch dSearch = new DApptSearch(); | 
|---|
| 2473 | dSearch.InitializePage(alResourceArray, this.m_DocManager); | 
|---|
| 2474 | if (dSearch.ShowDialog(this) == DialogResult.Cancel) | 
|---|
| 2475 | return; | 
|---|
| 2476 |  | 
|---|
| 2477 | string sResource = dSearch.SelectedResource; | 
|---|
| 2478 | ArrayList alResource = new ArrayList(); | 
|---|
| 2479 | alResource.Add(sResource); | 
|---|
| 2480 | DateTime sDate = dSearch.SelectedDate; | 
|---|
| 2481 | m_sDocName = sResource; | 
|---|
| 2482 | OpenSelectedSchedule(alResource, sDate); | 
|---|
| 2483 |  | 
|---|
| 2484 | } | 
|---|
| 2485 |  | 
|---|
| 2486 | #endregion Methods | 
|---|
| 2487 |  | 
|---|
| 2488 | #region Events | 
|---|
| 2489 |  | 
|---|
| 2490 | /// <summary> | 
|---|
| 2491 | /// Special import to get the GetActiveWindow method from Win32 | 
|---|
| 2492 | /// </summary> | 
|---|
| 2493 | /// <returns>Windows Handle number for Foregreound Active Window</returns> | 
|---|
| 2494 | [DllImport("user32.dll")] | 
|---|
| 2495 | static extern IntPtr GetActiveWindow(); | 
|---|
| 2496 |  | 
|---|
| 2497 | /// <summary> | 
|---|
| 2498 | /// If a mouse enters the grid, check if the grid is on the active form first before stealing the focus | 
|---|
| 2499 | /// </summary> | 
|---|
| 2500 | /// <param name="sender"></param> | 
|---|
| 2501 | /// <param name="e"></param> | 
|---|
| 2502 | private void calendarGrid1_MouseEnter(object sender, EventArgs e) | 
|---|
| 2503 | { | 
|---|
| 2504 | if (GetActiveWindow() == this.Handle) | 
|---|
| 2505 | calendarGrid1.Focus(); | 
|---|
| 2506 | } | 
|---|
| 2507 |  | 
|---|
| 2508 | private void CGView_Load(object sender, System.EventArgs e) | 
|---|
| 2509 | { | 
|---|
| 2510 | Debug.Assert (this.Document != null); | 
|---|
| 2511 |  | 
|---|
| 2512 | //Register the view | 
|---|
| 2513 | CGDocumentManager.Current.RegisterDocumentView(this.Document, this); | 
|---|
| 2514 |  | 
|---|
| 2515 | //Load the Group-Resource treeview | 
|---|
| 2516 | LoadTree(); | 
|---|
| 2517 |  | 
|---|
| 2518 | this.SetDesktopLocation(this.DesktopLocation.X + 10, this.DesktopLocation.Y + 10); | 
|---|
| 2519 |  | 
|---|
| 2520 | //Show the Form | 
|---|
| 2521 | this.Activate(); | 
|---|
| 2522 | } | 
|---|
| 2523 |  | 
|---|
| 2524 | private void mnuOpenSchedule_Click(object sender, System.EventArgs e) | 
|---|
| 2525 | { | 
|---|
| 2526 | CreateNewSchedule(); | 
|---|
| 2527 | } | 
|---|
| 2528 |  | 
|---|
| 2529 | private void mnu1Day_Click(object sender, System.EventArgs e) | 
|---|
| 2530 | { | 
|---|
| 2531 | DateTime dtPicker = dateTimePicker1.Value; | 
|---|
| 2532 | DateTime DayOnly = new DateTime(dtPicker.Year, dtPicker.Month, dtPicker.Day); | 
|---|
| 2533 | this.calendarGrid1.StartDate = DayOnly; | 
|---|
| 2534 | this.calendarGrid1.Columns = 1; | 
|---|
| 2535 | } | 
|---|
| 2536 |  | 
|---|
| 2537 | private void mnu5Day_Click(object sender, System.EventArgs e) | 
|---|
| 2538 | { | 
|---|
| 2539 | if (this.calendarGrid1.Columns == 1) | 
|---|
| 2540 | { | 
|---|
| 2541 | this.StartDate = this.Document.StartDate; | 
|---|
| 2542 | } | 
|---|
| 2543 |  | 
|---|
| 2544 | this.calendarGrid1.Columns = 5; | 
|---|
| 2545 | this.Document.m_nColumnCount = 5; // MJL 1/17/2007 | 
|---|
| 2546 | //this.Document.UpdateAllViews(); | 
|---|
| 2547 | //TODO: Is there a way to just reuse the existing arrays? How far in the future do they go? | 
|---|
| 2548 | RequestRefreshGrid(); | 
|---|
| 2549 | } | 
|---|
| 2550 |  | 
|---|
| 2551 | private void mnu7Day_Click(object sender, System.EventArgs e) | 
|---|
| 2552 | { | 
|---|
| 2553 | this.calendarGrid1.Columns = 7; | 
|---|
| 2554 | this.Document.m_nColumnCount = 7; // MJL 1/17/2007 | 
|---|
| 2555 | //TODO: Is there a way to just reuse the existing arrays? How far in the future do they go? | 
|---|
| 2556 | RequestRefreshGrid(); | 
|---|
| 2557 | } | 
|---|
| 2558 |  | 
|---|
| 2559 | private void mnu10Minute_Click(object sender, System.EventArgs e) | 
|---|
| 2560 | { | 
|---|
| 2561 | CalendarGrid cg = this.calendarGrid1; | 
|---|
| 2562 | cg.TimeScale = 10; | 
|---|
| 2563 | cg.PositionGrid(7); | 
|---|
| 2564 | } | 
|---|
| 2565 |  | 
|---|
| 2566 | private void mnu15Minute_Click(object sender, System.EventArgs e) | 
|---|
| 2567 | { | 
|---|
| 2568 | CalendarGrid cg = this.calendarGrid1; | 
|---|
| 2569 | cg.TimeScale = 15; | 
|---|
| 2570 | cg.PositionGrid(7); | 
|---|
| 2571 | } | 
|---|
| 2572 |  | 
|---|
| 2573 | private void mnu20Minute_Click(object sender, System.EventArgs e) | 
|---|
| 2574 | { | 
|---|
| 2575 | CalendarGrid cg = this.calendarGrid1; | 
|---|
| 2576 | cg.TimeScale = 20; | 
|---|
| 2577 | cg.PositionGrid(7); | 
|---|
| 2578 | } | 
|---|
| 2579 |  | 
|---|
| 2580 | private void mnu30Minute_Click(object sender, System.EventArgs e) | 
|---|
| 2581 | { | 
|---|
| 2582 | CalendarGrid cg = this.calendarGrid1; | 
|---|
| 2583 | cg.TimeScale = 30; | 
|---|
| 2584 | cg.PositionGrid(7); | 
|---|
| 2585 | } | 
|---|
| 2586 |  | 
|---|
| 2587 | private void mnuViewScheduleTree_Click(object sender, System.EventArgs e) | 
|---|
| 2588 | { | 
|---|
| 2589 | this.mnuViewScheduleTree.Checked = this.tvSchedules.Visible; | 
|---|
| 2590 | this.tvSchedules.Visible = !(this.tvSchedules.Visible); | 
|---|
| 2591 | this.mnuViewScheduleTree.Checked = !(this.mnuViewScheduleTree.Checked); | 
|---|
| 2592 | } | 
|---|
| 2593 |  | 
|---|
| 2594 | private void tvSchedules_Click(object sender, System.EventArgs e) | 
|---|
| 2595 | { | 
|---|
| 2596 | bSchedulesClicked = true; | 
|---|
| 2597 | } | 
|---|
| 2598 |  | 
|---|
| 2599 | private void tvSchedules_DoubleClick(object sender, System.EventArgs e) | 
|---|
| 2600 | { | 
|---|
| 2601 | if (m_alSelectedTreeResourceArray == null) | 
|---|
| 2602 | return; | 
|---|
| 2603 | if (m_alSelectedTreeResourceArray.Count < 1) | 
|---|
| 2604 | { | 
|---|
| 2605 | if (this.tvSchedules.SelectedNode.Text != "") | 
|---|
| 2606 | { | 
|---|
| 2607 | SetResourceArrayFromGroup(tvSchedules.SelectedNode.Text); | 
|---|
| 2608 | } | 
|---|
| 2609 | else | 
|---|
| 2610 | { | 
|---|
| 2611 | return; | 
|---|
| 2612 | } | 
|---|
| 2613 | } | 
|---|
| 2614 | OpenSelectedSchedule(m_alSelectedTreeResourceArray, DateTime.Today); | 
|---|
| 2615 | } | 
|---|
| 2616 |  | 
|---|
| 2617 | //20041109 Added | 
|---|
| 2618 | private void SetResourceArrayFromGroup(string sGroup) | 
|---|
| 2619 | { | 
|---|
| 2620 | //Navigate from ResourceGroup table to Resources table | 
|---|
| 2621 | DataRow[] arrRows; | 
|---|
| 2622 | DataRelation dr = DocManager.GlobalDataSet.Relations["GroupResource"]; | 
|---|
| 2623 | DataRow r = DocManager.GlobalDataSet.Tables["ResourceGroup"].Rows.Find(sGroup); | 
|---|
| 2624 | arrRows = r.GetChildRows(dr); | 
|---|
| 2625 | for (int i=0; i< arrRows.Length; i++) | 
|---|
| 2626 | { | 
|---|
| 2627 | string sResource = arrRows[i]["RESOURCE_NAME"].ToString(); | 
|---|
| 2628 | m_alSelectedTreeResourceArray.Add(sResource); | 
|---|
| 2629 | } | 
|---|
| 2630 | m_sDocName = sGroup; | 
|---|
| 2631 | } | 
|---|
| 2632 |  | 
|---|
| 2633 | public void SyncTree() | 
|---|
| 2634 | { | 
|---|
| 2635 |  | 
|---|
| 2636 | } | 
|---|
| 2637 |  | 
|---|
| 2638 | private void tvSchedules_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) | 
|---|
| 2639 | { | 
|---|
| 2640 | if (bSchedulesClicked == false) | 
|---|
| 2641 | return; | 
|---|
| 2642 | bSchedulesClicked = false; | 
|---|
| 2643 |  | 
|---|
| 2644 | m_alSelectedTreeResourceArray = new ArrayList(); | 
|---|
| 2645 | string sResource = e.Node.FullPath; | 
|---|
| 2646 | string[] ss = sResource.Split((char) 92); | 
|---|
| 2647 | int l = ss.GetUpperBound(0); | 
|---|
| 2648 |  | 
|---|
| 2649 | if (l == 0) //a resource group was checked, so get all underying resources | 
|---|
| 2650 | { | 
|---|
| 2651 | SetResourceArrayFromGroup(ss[0]); | 
|---|
| 2652 | } | 
|---|
| 2653 | else | 
|---|
| 2654 | { | 
|---|
| 2655 | sResource = ss[l]; | 
|---|
| 2656 | m_alSelectedTreeResourceArray.Add(ss[1]); | 
|---|
| 2657 | } | 
|---|
| 2658 |  | 
|---|
| 2659 | m_sDocName = ss[l]; | 
|---|
| 2660 | return; | 
|---|
| 2661 |  | 
|---|
| 2662 | } | 
|---|
| 2663 |  | 
|---|
| 2664 | private void mnuTest1_Click(object sender, System.EventArgs e) | 
|---|
| 2665 | { | 
|---|
| 2666 | ReaderWriterLock m_rwl = this.DocManager.ConnectInfo.bmxNetLib.BMXRWL; | 
|---|
| 2667 | try | 
|---|
| 2668 | { | 
|---|
| 2669 | m_rwl.AcquireWriterLock(50); | 
|---|
| 2670 | Debug.Write("\nTest Button 1 Acquired first lock\n"); | 
|---|
| 2671 | m_rwl.AcquireWriterLock(50); | 
|---|
| 2672 | Debug.Write("Test Button 1 Acquired second lock\n"); | 
|---|
| 2673 | this.DocManager.ViewRefresh(); | 
|---|
| 2674 | Thread.Sleep(5000); | 
|---|
| 2675 | try | 
|---|
| 2676 | { | 
|---|
| 2677 | } | 
|---|
| 2678 | catch | 
|---|
| 2679 | { | 
|---|
| 2680 | } | 
|---|
| 2681 | finally | 
|---|
| 2682 | { | 
|---|
| 2683 | m_rwl.ReleaseWriterLock(); | 
|---|
| 2684 | Debug.Write ("Test Button 1 released first lock.\n"); | 
|---|
| 2685 | m_rwl.ReleaseWriterLock(); | 
|---|
| 2686 | Debug.Write ("Test Button 1 released second lock.\n"); | 
|---|
| 2687 | } | 
|---|
| 2688 |  | 
|---|
| 2689 | return; | 
|---|
| 2690 | } | 
|---|
| 2691 | catch (Exception ex) | 
|---|
| 2692 | { | 
|---|
| 2693 | Debug.Write("Test Button 1 exception: " + ex.Message + "\n"); | 
|---|
| 2694 | } | 
|---|
| 2695 | } | 
|---|
| 2696 |  | 
|---|
| 2697 | private void CGView_Closing(object sender, System.ComponentModel.CancelEventArgs e) | 
|---|
| 2698 | { | 
|---|
| 2699 | try | 
|---|
| 2700 | { | 
|---|
| 2701 | m_ConnectInfo.BMXNetEvent -= m_bmxDelegate; | 
|---|
| 2702 | this.calendarGrid1.CloseGrid(); | 
|---|
| 2703 | } | 
|---|
| 2704 | catch (Exception ex) | 
|---|
| 2705 | { | 
|---|
| 2706 | Debug.Write("CGView_Closing exception: " + ex.Message + "\n"); | 
|---|
| 2707 | } | 
|---|
| 2708 | } | 
|---|
| 2709 |  | 
|---|
| 2710 | private void mnuViewRightPanel_Click(object sender, System.EventArgs e) | 
|---|
| 2711 | { | 
|---|
| 2712 | this.mnuViewRightPanel.Checked = this.panelRight.Visible; | 
|---|
| 2713 | this.panelRight.Visible = !(this.panelRight.Visible); | 
|---|
| 2714 | this.mnuViewRightPanel.Checked = !(this.mnuViewRightPanel.Checked); | 
|---|
| 2715 | } | 
|---|
| 2716 |  | 
|---|
| 2717 |  | 
|---|
| 2718 | private void calendarGrid1_CGSelectionChanged(object sender, IndianHealthService.ClinicalScheduling.CGSelectionChangedArgs e) | 
|---|
| 2719 | { | 
|---|
| 2720 | string sAccessType = ""; | 
|---|
| 2721 | string sAvailabilityMessage = ""; | 
|---|
| 2722 | m_nSlots = m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage); | 
|---|
| 2723 | UpdateStatusBar(e.StartTime, e.EndTime, sAccessType, sAvailabilityMessage); | 
|---|
| 2724 | } | 
|---|
| 2725 |  | 
|---|
| 2726 | /// <summary> | 
|---|
| 2727 | /// Fired during drag and drop, on the drop action. | 
|---|
| 2728 | /// </summary> | 
|---|
| 2729 | /// <param name="sender"></param> | 
|---|
| 2730 | /// <param name="e"></param> | 
|---|
| 2731 | private void calendarGrid1_CGAppointmentChanged(object sender, IndianHealthService.ClinicalScheduling.CGAppointmentChangedArgs e) | 
|---|
| 2732 | { | 
|---|
| 2733 | try | 
|---|
| 2734 | { | 
|---|
| 2735 | if (e.Appointment.CheckInTime.Ticks > 0) | 
|---|
| 2736 | { | 
|---|
| 2737 | MessageBox.Show("You cannot change the appointment time because the patient has already checked in.", "Clinical Scheduling",  MessageBoxButtons.OKCancel, MessageBoxIcon.Information); | 
|---|
| 2738 | return; | 
|---|
| 2739 | } | 
|---|
| 2740 |  | 
|---|
| 2741 | // Added check for making Walk-ins/appts in the past. 9/28/2010 //smh | 
|---|
| 2742 | if (e.StartTime < DateTime.Today.Date) | 
|---|
| 2743 | { | 
|---|
| 2744 | var result = MessageBox.Show("Are you sure you want to make an appointment in the past?", "Windows Scheduling", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); | 
|---|
| 2745 | if (result == DialogResult.No) return; | 
|---|
| 2746 | } | 
|---|
| 2747 |  | 
|---|
| 2748 | //Can user edit destination resource? | 
|---|
| 2749 | if (EditAppointmentEnabled(e.Resource) == false) | 
|---|
| 2750 | return; | 
|---|
| 2751 |  | 
|---|
| 2752 | //Can user edit original schedule? | 
|---|
| 2753 | if (EditAppointmentEnabled(e.Appointment.Resource) == false) | 
|---|
| 2754 | return; | 
|---|
| 2755 |  | 
|---|
| 2756 | if (MessageBox.Show("Are you sure you want to move this appointment?", "Clinical Scheduling",  MessageBoxButtons.YesNo) != DialogResult.Yes) | 
|---|
| 2757 | return; | 
|---|
| 2758 |  | 
|---|
| 2759 | //20040909 Cherokee Replaced this block with following | 
|---|
| 2760 | string sAccessType = ""; | 
|---|
| 2761 | string sAvailabilityMessage = ""; | 
|---|
| 2762 | //                              if (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) < 1) | 
|---|
| 2763 | //                              { | 
|---|
| 2764 | //                                      MessageBox.Show("There are no appointment slots available for the selected time."); | 
|---|
| 2765 | //                                      return; | 
|---|
| 2766 | //                              } | 
|---|
| 2767 | bool bOverbook =false; | 
|---|
| 2768 | if (m_htOverbook.Count > 0) | 
|---|
| 2769 | { | 
|---|
| 2770 | bOverbook = (bool) this.m_htOverbook[e.Resource.ToString()]; | 
|---|
| 2771 | } | 
|---|
| 2772 | bool bModSchedule =false; | 
|---|
| 2773 | if (m_htModifySchedule.Count > 0) | 
|---|
| 2774 | { | 
|---|
| 2775 | bModSchedule =  (bool) this.m_htModifySchedule[e.Resource.ToString()]; | 
|---|
| 2776 | } | 
|---|
| 2777 | bool bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0); | 
|---|
| 2778 | if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) )) | 
|---|
| 2779 | { | 
|---|
| 2780 | MessageBox.Show("There are no appointment slots available for the selected time."); | 
|---|
| 2781 | return; | 
|---|
| 2782 | } | 
|---|
| 2783 |  | 
|---|
| 2784 | /* | 
|---|
| 2785 | * 7-19-05 Added overbook prompt | 
|---|
| 2786 | */ | 
|---|
| 2787 | if (bSlotsAvailable == false) | 
|---|
| 2788 | { | 
|---|
| 2789 | 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); | 
|---|
| 2790 | if (dr != DialogResult.Yes) | 
|---|
| 2791 | { | 
|---|
| 2792 | return; | 
|---|
| 2793 | } | 
|---|
| 2794 | } | 
|---|
| 2795 |  | 
|---|
| 2796 | //Create a new appointment using old data for patient demographics and note and new data | 
|---|
| 2797 | //for StartTime, EndTime, Resource, AccessTypeID | 
|---|
| 2798 | CGAppointment appt = new CGAppointment(); | 
|---|
| 2799 | appt.PatientID = e.Appointment.PatientID; | 
|---|
| 2800 | appt.PatientName = e.Appointment.PatientName; | 
|---|
| 2801 | appt.StartTime = e.StartTime; | 
|---|
| 2802 | appt.EndTime = e.EndTime; | 
|---|
| 2803 | appt.Resource = e.Resource; | 
|---|
| 2804 | appt.Note = e.Appointment.Note; | 
|---|
| 2805 | appt.HealthRecordNumber = e.Appointment.HealthRecordNumber; | 
|---|
| 2806 | appt.AccessTypeID = e.AccessTypeID; | 
|---|
| 2807 | this.Document.CreateAppointment(appt); | 
|---|
| 2808 |  | 
|---|
| 2809 | //CGAppointment a = new CGAppointment(); | 
|---|
| 2810 | //a.StartTime = e.StartTime; | 
|---|
| 2811 | ////e.Appointment.StartTime = e.StartTime | 
|---|
| 2812 | //a.EndTime = e.EndTime; | 
|---|
| 2813 | ////e.Appointment.EndTime = e.EndTime; | 
|---|
| 2814 | //a.Resource = e.Resource; | 
|---|
| 2815 | ////e.Appointment.Resource = e.Resource; | 
|---|
| 2816 | //a.AccessTypeID = e.AccessTypeID; | 
|---|
| 2817 | ////e.Appointment.AccessTypeID = e.AccessTypeID; | 
|---|
| 2818 | //m_Document.CreateAppointment(a); | 
|---|
| 2819 |  | 
|---|
| 2820 |  | 
|---|
| 2821 | string sError = AppointmentDeleteOne(e.Appointment.AppointmentKey); | 
|---|
| 2822 | if (sError != "") | 
|---|
| 2823 | { | 
|---|
| 2824 | MessageBox.Show(sError); | 
|---|
| 2825 | return; | 
|---|
| 2826 | } | 
|---|
| 2827 |  | 
|---|
| 2828 | } | 
|---|
| 2829 | catch (Exception ex) | 
|---|
| 2830 | { | 
|---|
| 2831 | MessageBox.Show("Unable to change appointment  " +  ex.Message, "Clinical Scheduling"); | 
|---|
| 2832 | //this.m_DocManager.UpdateViews(); | 
|---|
| 2833 | return; | 
|---|
| 2834 | } | 
|---|
| 2835 | finally | 
|---|
| 2836 | { | 
|---|
| 2837 | this.UpdateArrays(); | 
|---|
| 2838 | } | 
|---|
| 2839 | try | 
|---|
| 2840 | { | 
|---|
| 2841 | RaiseRPMSEvent("BSDX SCHEDULE"  , e.Resource); | 
|---|
| 2842 | if (e.Resource != e.OldResource) | 
|---|
| 2843 | RaiseRPMSEvent("BSDX SCHEDULE", e.OldResource); | 
|---|
| 2844 |  | 
|---|
| 2845 | //That will take too long. Don't do it. Try and see what happens when you come | 
|---|
| 2846 | //this.m_DocManager.UpdateViews(e.Resource, e.OldResource); | 
|---|
| 2847 | } | 
|---|
| 2848 | catch (Exception ex) | 
|---|
| 2849 | { | 
|---|
| 2850 | Debug.Write(ex.Message); | 
|---|
| 2851 | } | 
|---|
| 2852 | } | 
|---|
| 2853 |  | 
|---|
| 2854 | private void mnuSchedulingManagment_Click(object sender, System.EventArgs e) | 
|---|
| 2855 | { | 
|---|
| 2856 | SchedulingManagement(); | 
|---|
| 2857 | } | 
|---|
| 2858 |  | 
|---|
| 2859 | private void mnuFile_Popup(object sender, System.EventArgs e) | 
|---|
| 2860 | { | 
|---|
| 2861 | this.mnuSchedulingManagment.Enabled = DocManager.ScheduleManager; | 
|---|
| 2862 | } | 
|---|
| 2863 |  | 
|---|
| 2864 | private void mnuFindAppt_Click(object sender, System.EventArgs e) | 
|---|
| 2865 | { | 
|---|
| 2866 | FindAvailableAppointment(this.Document.Resources); | 
|---|
| 2867 | } | 
|---|
| 2868 |  | 
|---|
| 2869 | private void mnuRPMSServer_Click(object sender, System.EventArgs e) | 
|---|
| 2870 | { | 
|---|
| 2871 | //Handled by DocumentManager class | 
|---|
| 2872 | } | 
|---|
| 2873 |  | 
|---|
| 2874 | private void mnuRPMSLogin_Click(object sender, System.EventArgs e) | 
|---|
| 2875 | { | 
|---|
| 2876 | //Handled by DocumentManager class | 
|---|
| 2877 | } | 
|---|
| 2878 |  | 
|---|
| 2879 | private void CGView_Activated(object sender, System.EventArgs e) | 
|---|
| 2880 | { | 
|---|
| 2881 | calendarGrid1.GridEnter = true; | 
|---|
| 2882 | } | 
|---|
| 2883 |  | 
|---|
| 2884 | private void mnuHelpAbout_Click(object sender, System.EventArgs e) | 
|---|
| 2885 | { | 
|---|
| 2886 | MessageBox.Show("Clinical Scheduling Version " + Application.ProductVersion, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Information); | 
|---|
| 2887 | } | 
|---|
| 2888 |  | 
|---|
| 2889 | private void ImplementMsg() | 
|---|
| 2890 | { | 
|---|
| 2891 | MessageBox.Show("Clinical Scheduling", "TODO: Implement this function"); | 
|---|
| 2892 | } | 
|---|
| 2893 |  | 
|---|
| 2894 | private void mnuClose_Click(object sender, System.EventArgs e) | 
|---|
| 2895 | { | 
|---|
| 2896 | DialogResult dr = MessageBox.Show("Are you sure you want to close this schedule?", Application.ProductName, MessageBoxButtons.OKCancel); | 
|---|
| 2897 | if (dr != DialogResult.OK) | 
|---|
| 2898 | return; | 
|---|
| 2899 |  | 
|---|
| 2900 | this.Close(); | 
|---|
| 2901 | } | 
|---|
| 2902 |  | 
|---|
| 2903 | private void mnuViewPatientAppts_Click(object sender, System.EventArgs e) | 
|---|
| 2904 | { | 
|---|
| 2905 | ViewPatientAppointments(); | 
|---|
| 2906 | } | 
|---|
| 2907 |  | 
|---|
| 2908 | private void lstClip_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) | 
|---|
| 2909 | { | 
|---|
| 2910 | bool b = e.Data.GetDataPresent(typeof(CGAppointment)); | 
|---|
| 2911 | if (b == true) | 
|---|
| 2912 | { | 
|---|
| 2913 | e.Effect = DragDropEffects.Move; | 
|---|
| 2914 | } | 
|---|
| 2915 | else | 
|---|
| 2916 | { | 
|---|
| 2917 | e.Effect = DragDropEffects.None; | 
|---|
| 2918 | } | 
|---|
| 2919 |  | 
|---|
| 2920 | } | 
|---|
| 2921 |  | 
|---|
| 2922 | private void lstClip_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) | 
|---|
| 2923 | { | 
|---|
| 2924 | try | 
|---|
| 2925 | { | 
|---|
| 2926 | CGAppointment a = (CGAppointment) e.Data.GetData(typeof(CGAppointment)); | 
|---|
| 2927 | if (m_ClipList.AppointmentTable.Contains((int) a.AppointmentKey)) | 
|---|
| 2928 | { | 
|---|
| 2929 | return; | 
|---|
| 2930 | } | 
|---|
| 2931 | m_ClipList.AddAppointment(a); | 
|---|
| 2932 | lstClip.Items.Add(a); | 
|---|
| 2933 | } | 
|---|
| 2934 | catch(Exception ex) | 
|---|
| 2935 | { | 
|---|
| 2936 | Debug.Write(ex.Message); | 
|---|
| 2937 | } | 
|---|
| 2938 |  | 
|---|
| 2939 | } | 
|---|
| 2940 |  | 
|---|
| 2941 | private void lstClip_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) | 
|---|
| 2942 | { | 
|---|
| 2943 | m_bDragDropStart = false; | 
|---|
| 2944 | } | 
|---|
| 2945 |  | 
|---|
| 2946 | private void lstClip_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) | 
|---|
| 2947 | { | 
|---|
| 2948 | try | 
|---|
| 2949 | { | 
|---|
| 2950 | if ((m_bDragDropStart == false)&&(lstClip.SelectedIndex > -1)) | 
|---|
| 2951 | { | 
|---|
| 2952 | CGAppointment a = (CGAppointment) lstClip.Items[lstClip.SelectedIndex]; | 
|---|
| 2953 | this.calendarGrid1.ApptDragSource = "list"; | 
|---|
| 2954 | DragDropEffects effect = DoDragDrop(a, DragDropEffects.Move); | 
|---|
| 2955 | m_bDragDropStart = true; | 
|---|
| 2956 | } | 
|---|
| 2957 | } | 
|---|
| 2958 | catch (Exception ex) | 
|---|
| 2959 | { | 
|---|
| 2960 | Debug.Write(ex.Message); | 
|---|
| 2961 | } | 
|---|
| 2962 | } | 
|---|
| 2963 |  | 
|---|
| 2964 | private void calendarGrid1_CGAppointmentAdded(object sender, IndianHealthService.ClinicalScheduling.CGAppointmentChangedArgs e) | 
|---|
| 2965 | { | 
|---|
| 2966 | try | 
|---|
| 2967 | { | 
|---|
| 2968 | string sAccessType = ""; | 
|---|
| 2969 | string sAvailabilityMessage = ""; | 
|---|
| 2970 | bool    bSlotsAvailable; | 
|---|
| 2971 | bool    bOverbook; | 
|---|
| 2972 | bool    bModSchedule; | 
|---|
| 2973 | bool    bModAppts; | 
|---|
| 2974 |  | 
|---|
| 2975 | if (this.EditAppointmentEnabled(e.Appointment.Resource) == false) | 
|---|
| 2976 | return; | 
|---|
| 2977 |  | 
|---|
| 2978 | bModAppts = (bool) this.m_htChangeAppts[e.Resource.ToString()]; | 
|---|
| 2979 | if (bModAppts == false) | 
|---|
| 2980 | return; | 
|---|
| 2981 |  | 
|---|
| 2982 | // Added check for making Walk-ins/appts in the past. 9/28/2010 //smh | 
|---|
| 2983 | if (e.StartTime < DateTime.Today.Date) | 
|---|
| 2984 | { | 
|---|
| 2985 | var result = MessageBox.Show("Are you sure you want to make an appointment in the past?", "Windows Scheduling", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); | 
|---|
| 2986 | if (result == DialogResult.No) return; | 
|---|
| 2987 | } | 
|---|
| 2988 |  | 
|---|
| 2989 |  | 
|---|
| 2990 | bOverbook = (bool) this.m_htOverbook[e.Resource.ToString()]; | 
|---|
| 2991 | bModSchedule =  (bool) this.m_htModifySchedule[e.Resource.ToString()]; | 
|---|
| 2992 | bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0); | 
|---|
| 2993 |  | 
|---|
| 2994 | if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) )) | 
|---|
| 2995 | { | 
|---|
| 2996 | MessageBox.Show("There are no appointment slots available for the selected time."); | 
|---|
| 2997 | return; | 
|---|
| 2998 | } | 
|---|
| 2999 |  | 
|---|
| 3000 | /* | 
|---|
| 3001 | * 7-19-05 Added overbook prompt | 
|---|
| 3002 | */ | 
|---|
| 3003 | if (bSlotsAvailable == false) | 
|---|
| 3004 | { | 
|---|
| 3005 | 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); | 
|---|
| 3006 | if (dr != DialogResult.Yes) | 
|---|
| 3007 | { | 
|---|
| 3008 | return; | 
|---|
| 3009 | } | 
|---|
| 3010 | } | 
|---|
| 3011 |  | 
|---|
| 3012 | e.Appointment.StartTime = e.StartTime; | 
|---|
| 3013 | e.Appointment.EndTime = e.EndTime; | 
|---|
| 3014 | e.Appointment.Resource = e.Resource; | 
|---|
| 3015 | e.Appointment.AccessTypeID = e.AccessTypeID; | 
|---|
| 3016 | m_Document.CreateAppointment(e.Appointment); | 
|---|
| 3017 | } | 
|---|
| 3018 | catch (Exception ex) | 
|---|
| 3019 | { | 
|---|
| 3020 | MessageBox.Show("Unable to add new appointment  " +  ex.Message, "Clinical Scheduling"); | 
|---|
| 3021 | return; | 
|---|
| 3022 | } | 
|---|
| 3023 | try | 
|---|
| 3024 | { | 
|---|
| 3025 | RaiseRPMSEvent("BSDX SCHEDULE"  , e.Resource); | 
|---|
| 3026 | if (e.Resource != e.OldResource) | 
|---|
| 3027 | RaiseRPMSEvent("BSDX SCHEDULE", e.OldResource); | 
|---|
| 3028 | this.m_DocManager.UpdateViews(e.Resource, e.OldResource); | 
|---|
| 3029 | } | 
|---|
| 3030 | catch (Exception ex) | 
|---|
| 3031 | { | 
|---|
| 3032 | Debug.Write(ex.Message); | 
|---|
| 3033 | } | 
|---|
| 3034 | } | 
|---|
| 3035 |  | 
|---|
| 3036 | private void lstClip_SelectedIndexChanged(object sender, System.EventArgs e) | 
|---|
| 3037 | { | 
|---|
| 3038 |  | 
|---|
| 3039 | } | 
|---|
| 3040 |  | 
|---|
| 3041 | private void mnuPrintClinicSchedules_Click(object sender, System.EventArgs e) | 
|---|
| 3042 | { | 
|---|
| 3043 | try | 
|---|
| 3044 | { | 
|---|
| 3045 | DSelectLetterClinics ds = new DSelectLetterClinics(); | 
|---|
| 3046 | ds.InitializePage(this.m_DocManager.GlobalDataSet, "Print Clinic Schedules"); | 
|---|
| 3047 | ds.SetupForReports(); | 
|---|
| 3048 | if (ds.ShowDialog(this) != DialogResult.OK) | 
|---|
| 3049 | return; | 
|---|
| 3050 |  | 
|---|
| 3051 | //get the resource names and call the letter printer | 
|---|
| 3052 |  | 
|---|
| 3053 | string sClinics = ds.SelectedClinics; | 
|---|
| 3054 | DateTime dtBegin = ds.BeginDate; | 
|---|
| 3055 | DateTime dtEnd = ds.EndDate; | 
|---|
| 3056 |  | 
|---|
| 3057 | DPatientLetter dpl = new DPatientLetter(); | 
|---|
| 3058 | dpl.InitializeFormClinicSchedule(this.DocManager, sClinics, dtBegin, dtEnd); | 
|---|
| 3059 | dpl.ShowDialog(this); | 
|---|
| 3060 |  | 
|---|
| 3061 | } | 
|---|
| 3062 | catch(Exception ex) | 
|---|
| 3063 | { | 
|---|
| 3064 | MessageBox.Show(this, ex.Message, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); | 
|---|
| 3065 | } | 
|---|
| 3066 | } | 
|---|
| 3067 |  | 
|---|
| 3068 | private void mnuPrintReminderLetters_Click(object sender, System.EventArgs e) | 
|---|
| 3069 | { | 
|---|
| 3070 | try | 
|---|
| 3071 | { | 
|---|
| 3072 | DSelectLetterClinics ds = new DSelectLetterClinics(); | 
|---|
| 3073 | ds.InitializePage(this.m_DocManager.GlobalDataSet, "Print Reminder Letters"); | 
|---|
| 3074 | if (ds.ShowDialog(this) != DialogResult.OK) | 
|---|
| 3075 | return; | 
|---|
| 3076 |  | 
|---|
| 3077 | //get the resource names and call the letter printer | 
|---|
| 3078 |  | 
|---|
| 3079 | string sClinics = ds.SelectedClinics; | 
|---|
| 3080 | DateTime dtBegin = ds.BeginDate; | 
|---|
| 3081 | DateTime dtEnd = ds.EndDate; | 
|---|
| 3082 |  | 
|---|
| 3083 | DPatientLetter dpl = new DPatientLetter(); | 
|---|
| 3084 | dpl.InitializeFormPatientReminderLetters(this.DocManager, sClinics, dtBegin, dtEnd); | 
|---|
| 3085 | dpl.ShowDialog(this); | 
|---|
| 3086 |  | 
|---|
| 3087 | } | 
|---|
| 3088 | catch(Exception ex) | 
|---|
| 3089 | { | 
|---|
| 3090 | MessageBox.Show(this, ex.Message, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); | 
|---|
| 3091 | } | 
|---|
| 3092 |  | 
|---|
| 3093 | } | 
|---|
| 3094 |  | 
|---|
| 3095 | private void mnuPrintRebookLetters_Click(object sender, System.EventArgs e) | 
|---|
| 3096 | { | 
|---|
| 3097 | try | 
|---|
| 3098 | { | 
|---|
| 3099 | DSelectLetterClinics ds = new DSelectLetterClinics(); | 
|---|
| 3100 | ds.InitializePage(this.m_DocManager.GlobalDataSet, "Print Clinic Rebook Letters"); | 
|---|
| 3101 | if (ds.ShowDialog(this) != DialogResult.OK) | 
|---|
| 3102 | return; | 
|---|
| 3103 |  | 
|---|
| 3104 | //Call the letter printer | 
|---|
| 3105 | DPatientLetter dpl = new DPatientLetter(); | 
|---|
| 3106 | dpl.InitializeFormRebookLetters(this.DocManager, ds.SelectedClinics, ds.BeginDate, ds.EndDate); | 
|---|
| 3107 | dpl.ShowDialog(this); | 
|---|
| 3108 |  | 
|---|
| 3109 | } | 
|---|
| 3110 | catch(Exception ex) | 
|---|
| 3111 | { | 
|---|
| 3112 | MessageBox.Show(this, ex.Message, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); | 
|---|
| 3113 | } | 
|---|
| 3114 | } | 
|---|
| 3115 |  | 
|---|
| 3116 | private void mnuPrintPatientLetter_Click(object sender, System.EventArgs e) | 
|---|
| 3117 | { | 
|---|
| 3118 | ViewPatientAppointments(); | 
|---|
| 3119 | } | 
|---|
| 3120 |  | 
|---|
| 3121 | private void mnuRPMSDivision_Click(object sender, System.EventArgs e) | 
|---|
| 3122 | { | 
|---|
| 3123 | this.DocManager.ChangeDivision(this); | 
|---|
| 3124 | } | 
|---|
| 3125 |  | 
|---|
| 3126 | private void CGView_CursorChanged(object sender, System.EventArgs e) | 
|---|
| 3127 | { | 
|---|
| 3128 |  | 
|---|
| 3129 | } | 
|---|
| 3130 |  | 
|---|
| 3131 | private void mnuDisplayWalkIns_Click(object sender, System.EventArgs e) | 
|---|
| 3132 | { | 
|---|
| 3133 | calendarGrid1.DrawWalkIns = !(calendarGrid1.DrawWalkIns); | 
|---|
| 3134 | mnuDisplayWalkIns.Checked = calendarGrid1.DrawWalkIns; | 
|---|
| 3135 | calendarGrid1.SetOverlapTable(); | 
|---|
| 3136 | calendarGrid1.Refresh(); | 
|---|
| 3137 | } | 
|---|
| 3138 |  | 
|---|
| 3139 | private void mnuOpenMultipleSchedules_Click(object sender, System.EventArgs e) | 
|---|
| 3140 | { | 
|---|
| 3141 |  | 
|---|
| 3142 | try | 
|---|
| 3143 | { | 
|---|
| 3144 | DSelectSchedules ds = new DSelectSchedules(); | 
|---|
| 3145 | ds.InitializePage(this.m_DocManager.GlobalDataSet, "Open Multiple Schedules"); | 
|---|
| 3146 | if (ds.ShowDialog(this) != DialogResult.OK) | 
|---|
| 3147 | return; | 
|---|
| 3148 |  | 
|---|
| 3149 | //get the resource names and open schedules | 
|---|
| 3150 |  | 
|---|
| 3151 | ArrayList sResources = ds.SelectedClinics; | 
|---|
| 3152 | if (ds.SingleWindow == true) | 
|---|
| 3153 | { | 
|---|
| 3154 | m_sDocName = (ds.GroupWindowName == "")?"Multiple Selected Schedules":ds.GroupWindowName; | 
|---|
| 3155 | OpenSelectedSchedule( sResources, DateTime.Today); | 
|---|
| 3156 | } | 
|---|
| 3157 | else | 
|---|
| 3158 | { | 
|---|
| 3159 | foreach (string sResource in sResources) | 
|---|
| 3160 | { | 
|---|
| 3161 | ArrayList alSingle = new ArrayList(1); | 
|---|
| 3162 | alSingle.Add(sResource); | 
|---|
| 3163 | m_sDocName = sResource; | 
|---|
| 3164 | OpenSelectedSchedule( alSingle, DateTime.Today); | 
|---|
| 3165 | } | 
|---|
| 3166 | } | 
|---|
| 3167 | return; | 
|---|
| 3168 |  | 
|---|
| 3169 | } | 
|---|
| 3170 | catch(Exception ex) | 
|---|
| 3171 | { | 
|---|
| 3172 | MessageBox.Show(this, ex.Message, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); | 
|---|
| 3173 | } | 
|---|
| 3174 |  | 
|---|
| 3175 | } | 
|---|
| 3176 |  | 
|---|
| 3177 | private void ctxCalGridWalkin_Click(object sender, System.EventArgs e) | 
|---|
| 3178 | { | 
|---|
| 3179 | AppointmentAddWalkin(); | 
|---|
| 3180 | } | 
|---|
| 3181 |  | 
|---|
| 3182 | private void mnuWalkIn_Click(object sender, System.EventArgs e) | 
|---|
| 3183 | { | 
|---|
| 3184 | AppointmentAddWalkin(); | 
|---|
| 3185 | } | 
|---|
| 3186 |  | 
|---|
| 3187 | private void mnuPrintCancellationLetters_Click(object sender, System.EventArgs e) | 
|---|
| 3188 | { | 
|---|
| 3189 | try | 
|---|
| 3190 | { | 
|---|
| 3191 | DSelectLetterClinics ds = new DSelectLetterClinics(); | 
|---|
| 3192 | ds.InitializePage(this.m_DocManager.GlobalDataSet, "Print Clinic Cancellation Letters"); | 
|---|
| 3193 | if (ds.ShowDialog(this) != DialogResult.OK) | 
|---|
| 3194 | return; | 
|---|
| 3195 |  | 
|---|
| 3196 | //get the resource names and call the letter printer | 
|---|
| 3197 |  | 
|---|
| 3198 | string sClinics = ds.SelectedClinics; | 
|---|
| 3199 | DateTime dtBegin = ds.BeginDate; | 
|---|
| 3200 | DateTime dtEnd = ds.EndDate; | 
|---|
| 3201 |  | 
|---|
| 3202 | DPatientLetter dpl = new DPatientLetter(); | 
|---|
| 3203 |  | 
|---|
| 3204 | dpl.InitializeFormCancellationLetters(this.DocManager, sClinics, dtBegin, dtEnd); | 
|---|
| 3205 | dpl.ShowDialog(this); | 
|---|
| 3206 | } | 
|---|
| 3207 | catch(Exception ex) | 
|---|
| 3208 | { | 
|---|
| 3209 | MessageBox.Show(this, ex.Message, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); | 
|---|
| 3210 | } | 
|---|
| 3211 | } | 
|---|
| 3212 |  | 
|---|
| 3213 | private void printRoutingSlip_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) | 
|---|
| 3214 | { | 
|---|
| 3215 | int nApptID = this.calendarGrid1.SelectedAppointment; | 
|---|
| 3216 | CGAppointment a = (CGAppointment)this.Appointments.AppointmentTable[nApptID]; | 
|---|
| 3217 | ClinicalScheduling.Printing.PrintRoutingSlip(a, "Routing Slip", e); | 
|---|
| 3218 | } | 
|---|
| 3219 |  | 
|---|
| 3220 |  | 
|---|
| 3221 | /// <summary> | 
|---|
| 3222 | /// Update Selection of date if user does not pick a date/time | 
|---|
| 3223 | /// </summary> | 
|---|
| 3224 | /// <param name="sender"></param> | 
|---|
| 3225 | /// <param name="e"></param> | 
|---|
| 3226 | private void dateTimePicker1_Leave(object sender, EventArgs e) | 
|---|
| 3227 | { | 
|---|
| 3228 | if (this.Document.SelectedDate != dateTimePicker1.Value.Date) | 
|---|
| 3229 | RequestRefreshGrid(); | 
|---|
| 3230 | } | 
|---|
| 3231 |  | 
|---|
| 3232 | /// <summary> | 
|---|
| 3233 | /// Handle Selection of Date via mouse from datetimepicker dropdown | 
|---|
| 3234 | /// </summary> | 
|---|
| 3235 | /// <param name="sender"></param> | 
|---|
| 3236 | /// <param name="e"></param> | 
|---|
| 3237 | private void dateTimePicker1_CloseUp(object sender, EventArgs e) | 
|---|
| 3238 | { | 
|---|
| 3239 | if (this.Document.SelectedDate != dateTimePicker1.Value.Date) | 
|---|
| 3240 | RequestRefreshGrid(); | 
|---|
| 3241 | } | 
|---|
| 3242 |  | 
|---|
| 3243 | /// <summary> | 
|---|
| 3244 | /// Handle Enter and Escape key on dateTimePicker | 
|---|
| 3245 | /// </summary> | 
|---|
| 3246 | /// <param name="sender"></param> | 
|---|
| 3247 | /// <param name="e"></param> | 
|---|
| 3248 | private void dateTimePicker1_KeyPress(object sender, KeyPressEventArgs e) | 
|---|
| 3249 | { | 
|---|
| 3250 | //if enter key is pressed: | 
|---|
| 3251 | //  Tell windows that we are handling this | 
|---|
| 3252 | //  Request a Refresh Grid if the date is different | 
|---|
| 3253 | //  Set-Focus to Calendar Grid | 
|---|
| 3254 | if (e.KeyChar == (char)Keys.Enter) | 
|---|
| 3255 | { | 
|---|
| 3256 | e.Handled = true; | 
|---|
| 3257 |  | 
|---|
| 3258 | if (this.Document.SelectedDate != dateTimePicker1.Value.Date) | 
|---|
| 3259 | RequestRefreshGrid(); | 
|---|
| 3260 |  | 
|---|
| 3261 | this.CGrid.Focus(); | 
|---|
| 3262 | } | 
|---|
| 3263 |  | 
|---|
| 3264 | //if escape key is pressed: | 
|---|
| 3265 | //  Tell windows that we are handling this | 
|---|
| 3266 | //  Set-Focus to Calendar Grid | 
|---|
| 3267 | if (e.KeyChar == (char)Keys.Escape) | 
|---|
| 3268 | { | 
|---|
| 3269 | e.Handled = true; | 
|---|
| 3270 | this.CGrid.Focus(); | 
|---|
| 3271 | } | 
|---|
| 3272 | } | 
|---|
| 3273 |  | 
|---|
| 3274 |  | 
|---|
| 3275 | #endregion events | 
|---|
| 3276 |  | 
|---|
| 3277 | void RequestRefreshGrid() | 
|---|
| 3278 | { | 
|---|
| 3279 | DateTime dDate = dateTimePicker1.Value.Date; | 
|---|
| 3280 | // Change Date on Document | 
|---|
| 3281 | this.Document.SelectedDate = dDate; | 
|---|
| 3282 |  | 
|---|
| 3283 | // Do we need to update? | 
|---|
| 3284 | bool isRefreshNeeded = this.Document.IsRefreshNeeded(); | 
|---|
| 3285 |  | 
|---|
| 3286 | //Splash when loading and change Cursor | 
|---|
| 3287 | if (isRefreshNeeded) | 
|---|
| 3288 | { | 
|---|
| 3289 | this.Cursor = Cursors.WaitCursor; | 
|---|
| 3290 | LoadSplash(); | 
|---|
| 3291 | this.Document.RefreshDocument(); | 
|---|
| 3292 | StopSplash(); | 
|---|
| 3293 | this.Cursor = Cursors.Default; | 
|---|
| 3294 | } | 
|---|
| 3295 |  | 
|---|
| 3296 |  | 
|---|
| 3297 | if (this.Document.Resources.Count == 1) | 
|---|
| 3298 | { | 
|---|
| 3299 | if (this.calendarGrid1.Columns > 1) | 
|---|
| 3300 | { | 
|---|
| 3301 | this.StartDate = this.Document.StartDate; | 
|---|
| 3302 | } | 
|---|
| 3303 | else | 
|---|
| 3304 | { | 
|---|
| 3305 | this.StartDate = this.Document.SelectedDate; | 
|---|
| 3306 | } | 
|---|
| 3307 | } | 
|---|
| 3308 | else | 
|---|
| 3309 | { | 
|---|
| 3310 | this.StartDate = this.Document.SelectedDate; | 
|---|
| 3311 | } | 
|---|
| 3312 |  | 
|---|
| 3313 | //Is this needed? -- Yes it is. There is a bug in the drawing code for the calendar | 
|---|
| 3314 | //First time it draws, it draws appointments, but not availability slots | 
|---|
| 3315 | //Second time it draws, it both appointments and availabilites | 
|---|
| 3316 | //XXX: Need to investigate | 
|---|
| 3317 | this.Document.UpdateAllViews(); | 
|---|
| 3318 | } | 
|---|
| 3319 |  | 
|---|
| 3320 | LoadingSplash _loadingSplash; // Splash object a data point in class | 
|---|
| 3321 |  | 
|---|
| 3322 | /// <summary> | 
|---|
| 3323 | /// Loads a splash that says "Loading" | 
|---|
| 3324 | /// </summary> | 
|---|
| 3325 | private void LoadSplash() | 
|---|
| 3326 | { | 
|---|
| 3327 | _loadingSplash = new LoadingSplash(); | 
|---|
| 3328 | _loadingSplash.StartPosition = FormStartPosition.CenterScreen;  //XXX: Don't like this, but will do for now. | 
|---|
| 3329 | _loadingSplash.UseWaitCursor = true;    // tell user we are working | 
|---|
| 3330 | Thread threadSplash = new Thread(new ThreadStart(() => _loadingSplash.ShowDialog())); // lambda | 
|---|
| 3331 | threadSplash.IsBackground = true; //expendable thread -- exit even if still running. | 
|---|
| 3332 | threadSplash.Name = "Loading Thread"; | 
|---|
| 3333 | threadSplash.Start(); | 
|---|
| 3334 | } | 
|---|
| 3335 |  | 
|---|
| 3336 | private void StopSplash() | 
|---|
| 3337 | { | 
|---|
| 3338 | _loadingSplash.RemoteClose(); | 
|---|
| 3339 | } | 
|---|
| 3340 |  | 
|---|
| 3341 |  | 
|---|
| 3342 |  | 
|---|
| 3343 |  | 
|---|
| 3344 | }//End class | 
|---|
| 3345 | } | 
|---|