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

Last change on this file since 643 was 627, checked in by Sam Habiel, 15 years ago

Removed user-interface references to RPMS.

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