source: Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs@ 1070

Last change on this file since 1070 was 1070, checked in by Sam Habiel, 14 years ago

LoadingSplash: New Form that does... pretty much nothing. Just shows a splash when updating data from server.
CGView:

CGDocumentManager:

CGDocument:

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