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

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

CGDocument:

  • Better constructor to set default values.
  • Removed OnNewDocument and used constructor plus extra arguments instead.
  • Added IsRefreshNeeded method to see if we need to get data from server.

CGDocumentManager:

  • Refactored OnNewDocument out (was going to use Application.Run with the CGView form as argument, that didn't work for re-logging in)
  • Refactored all ChangeServer and ChangeLogin handlers b/c they got broken with previous work.

CGView:

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