source: Scheduling/trunk/cs/bsdx0200GUISourceCode/CGAVView.cs@ 908

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

StartDate for CGAVView, 1st try.
CGDocument uses StartDate from Current thread locale rather than current culture.

File size: 49.7 KB
Line 
1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Diagnostics;
7using System.Data;
8using System.Data.OleDb;
9using System.IO;
10using System.Runtime.Serialization;
11using System.Runtime.Serialization.Formatters.Binary;
12using IndianHealthService.BMXNet;
13
14
15namespace IndianHealthService.ClinicalScheduling
16{
17 /// <summary>
18 /// Summary description for CGAVView.
19 /// </summary>
20 public class CGAVView : System.Windows.Forms.Form
21 {
22
23
24 public CGAVView()
25 {
26 //
27 // Required for Windows Form Designer support
28 //
29 InitializeComponent();
30
31 //
32 // TODO: Add any constructor code after InitializeComponent call
33 //
34 this.panelRight.Visible = false;
35 this.tvSchedules.Visible = false;
36 m_ClipList = new CGAppointments();
37 }
38
39 #region Windows Form Designer generated code
40 /// <summary>
41 /// Required method for Designer support - do not modify
42 /// the contents of this method with the code editor.
43 /// </summary>
44 private void InitializeComponent()
45 {
46 this.components = new System.ComponentModel.Container();
47 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CGAVView));
48 this.panelRight = new System.Windows.Forms.Panel();
49 this.panelClip = new System.Windows.Forms.Panel();
50 this.lstClip = new System.Windows.Forms.ListBox();
51 this.ctxApptClipMenu = new System.Windows.Forms.ContextMenu();
52 this.mnuRemoveClipItem = new System.Windows.Forms.MenuItem();
53 this.mnuClearClipItems = new System.Windows.Forms.MenuItem();
54 this.label1 = new System.Windows.Forms.Label();
55 this.panelBottom = new System.Windows.Forms.Panel();
56 this.statusBar1 = new System.Windows.Forms.StatusBar();
57 this.panelTop = new System.Windows.Forms.Panel();
58 this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
59 this.lblResource = new System.Windows.Forms.Label();
60 this.panelCenter = new System.Windows.Forms.Panel();
61 this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid();
62 this.ctxCalendarGrid = new System.Windows.Forms.ContextMenu();
63 this.ctxCalGridAdd = new System.Windows.Forms.MenuItem();
64 this.ctxCalGridEdit = new System.Windows.Forms.MenuItem();
65 this.ctxCalGridDelete = new System.Windows.Forms.MenuItem();
66 this.tvSchedules = new System.Windows.Forms.TreeView();
67 this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
68 this.menuItem1 = new System.Windows.Forms.MenuItem();
69 this.mnuLoadTemplate = new System.Windows.Forms.MenuItem();
70 this.mnuSaveTemplate = new System.Windows.Forms.MenuItem();
71 this.menuItem6 = new System.Windows.Forms.MenuItem();
72 this.mnuSchedulingManagment = new System.Windows.Forms.MenuItem();
73 this.menuItem5 = new System.Windows.Forms.MenuItem();
74 this.mnuClose = new System.Windows.Forms.MenuItem();
75 this.mnuAvailability = new System.Windows.Forms.MenuItem();
76 this.mnuAddNewAV = new System.Windows.Forms.MenuItem();
77 this.mnuRemoveAV = new System.Windows.Forms.MenuItem();
78 this.mnuEditAV = new System.Windows.Forms.MenuItem();
79 this.mnuCalendar = new System.Windows.Forms.MenuItem();
80 this.mnu1Day = new System.Windows.Forms.MenuItem();
81 this.mnu5Day = new System.Windows.Forms.MenuItem();
82 this.mnu7Day = new System.Windows.Forms.MenuItem();
83 this.menuItem7 = new System.Windows.Forms.MenuItem();
84 this.mnuTimeScale = new System.Windows.Forms.MenuItem();
85 this.mnu10Minute = new System.Windows.Forms.MenuItem();
86 this.mnu15Minute = new System.Windows.Forms.MenuItem();
87 this.mnu20Minute = new System.Windows.Forms.MenuItem();
88 this.mnu30Minute = new System.Windows.Forms.MenuItem();
89 this.mnuViewRightPanel = new System.Windows.Forms.MenuItem();
90 this.mnuHelp = new System.Windows.Forms.MenuItem();
91 this.mnuHelpAbout = new System.Windows.Forms.MenuItem();
92 this.splitter1 = new System.Windows.Forms.Splitter();
93 this.panelRight.SuspendLayout();
94 this.panelClip.SuspendLayout();
95 this.panelBottom.SuspendLayout();
96 this.panelTop.SuspendLayout();
97 this.panelCenter.SuspendLayout();
98 this.SuspendLayout();
99 //
100 // panelRight
101 //
102 this.panelRight.Controls.Add(this.panelClip);
103 this.panelRight.Dock = System.Windows.Forms.DockStyle.Right;
104 this.panelRight.Location = new System.Drawing.Point(728, 0);
105 this.panelRight.Name = "panelRight";
106 this.panelRight.Size = new System.Drawing.Size(120, 450);
107 this.panelRight.TabIndex = 1;
108 //
109 // panelClip
110 //
111 this.panelClip.Controls.Add(this.lstClip);
112 this.panelClip.Controls.Add(this.label1);
113 this.panelClip.Dock = System.Windows.Forms.DockStyle.Top;
114 this.panelClip.Location = new System.Drawing.Point(0, 0);
115 this.panelClip.Name = "panelClip";
116 this.panelClip.Size = new System.Drawing.Size(120, 448);
117 this.panelClip.TabIndex = 1;
118 //
119 // lstClip
120 //
121 this.lstClip.AllowDrop = true;
122 this.lstClip.ContextMenu = this.ctxApptClipMenu;
123 this.lstClip.DisplayMember = "ToString()";
124 this.lstClip.Dock = System.Windows.Forms.DockStyle.Fill;
125 this.lstClip.Location = new System.Drawing.Point(0, 32);
126 this.lstClip.Name = "lstClip";
127 this.lstClip.Size = new System.Drawing.Size(120, 407);
128 this.lstClip.TabIndex = 0;
129 this.lstClip.DragDrop += new System.Windows.Forms.DragEventHandler(this.lstClip_DragDrop);
130 this.lstClip.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lstClip_MouseMove);
131 this.lstClip.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstClip_MouseDown);
132 this.lstClip.DragEnter += new System.Windows.Forms.DragEventHandler(this.lstClip_DragEnter);
133 //
134 // ctxApptClipMenu
135 //
136 this.ctxApptClipMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
137 this.mnuRemoveClipItem,
138 this.mnuClearClipItems});
139 this.ctxApptClipMenu.Popup += new System.EventHandler(this.ctxApptClipMenu_Popup);
140 //
141 // mnuRemoveClipItem
142 //
143 this.mnuRemoveClipItem.Index = 0;
144 this.mnuRemoveClipItem.Text = "Remove Item";
145 this.mnuRemoveClipItem.Click += new System.EventHandler(this.mnuRemoveClipItem_Click);
146 //
147 // mnuClearClipItems
148 //
149 this.mnuClearClipItems.Index = 1;
150 this.mnuClearClipItems.Text = "Clear All";
151 this.mnuClearClipItems.Click += new System.EventHandler(this.mnuClearClipItems_Click);
152 //
153 // label1
154 //
155 this.label1.Dock = System.Windows.Forms.DockStyle.Top;
156 this.label1.Location = new System.Drawing.Point(0, 0);
157 this.label1.Name = "label1";
158 this.label1.Size = new System.Drawing.Size(120, 32);
159 this.label1.TabIndex = 1;
160 this.label1.Text = "Access Block Clipboard";
161 this.label1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
162 //
163 // panelBottom
164 //
165 this.panelBottom.Controls.Add(this.statusBar1);
166 this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
167 this.panelBottom.Location = new System.Drawing.Point(8, 426);
168 this.panelBottom.Name = "panelBottom";
169 this.panelBottom.Size = new System.Drawing.Size(720, 24);
170 this.panelBottom.TabIndex = 2;
171 //
172 // statusBar1
173 //
174 this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill;
175 this.statusBar1.Location = new System.Drawing.Point(0, 0);
176 this.statusBar1.Name = "statusBar1";
177 this.statusBar1.Size = new System.Drawing.Size(720, 24);
178 this.statusBar1.SizingGrip = false;
179 this.statusBar1.TabIndex = 1;
180 //
181 // panelTop
182 //
183 this.panelTop.Controls.Add(this.dateTimePicker1);
184 this.panelTop.Controls.Add(this.lblResource);
185 this.panelTop.Dock = System.Windows.Forms.DockStyle.Top;
186 this.panelTop.Location = new System.Drawing.Point(8, 0);
187 this.panelTop.Name = "panelTop";
188 this.panelTop.Size = new System.Drawing.Size(720, 24);
189 this.panelTop.TabIndex = 3;
190 //
191 // dateTimePicker1
192 //
193 this.dateTimePicker1.Dock = System.Windows.Forms.DockStyle.Right;
194 this.dateTimePicker1.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right;
195 this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Short;
196 this.dateTimePicker1.Location = new System.Drawing.Point(592, 0);
197 this.dateTimePicker1.Name = "dateTimePicker1";
198 this.dateTimePicker1.Size = new System.Drawing.Size(128, 20);
199 this.dateTimePicker1.TabIndex = 4;
200 this.dateTimePicker1.ValueChanged += new System.EventHandler(this.dateTimePicker1_ValueChanged);
201 //
202 // lblResource
203 //
204 this.lblResource.Dock = System.Windows.Forms.DockStyle.Fill;
205 this.lblResource.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
206 this.lblResource.ForeColor = System.Drawing.SystemColors.Highlight;
207 this.lblResource.Location = new System.Drawing.Point(0, 0);
208 this.lblResource.Name = "lblResource";
209 this.lblResource.Size = new System.Drawing.Size(720, 24);
210 this.lblResource.TabIndex = 3;
211 this.lblResource.Text = "lblResource";
212 //
213 // panelCenter
214 //
215 this.panelCenter.Controls.Add(this.calendarGrid1);
216 this.panelCenter.Dock = System.Windows.Forms.DockStyle.Fill;
217 this.panelCenter.Location = new System.Drawing.Point(8, 24);
218 this.panelCenter.Name = "panelCenter";
219 this.panelCenter.Size = new System.Drawing.Size(712, 402);
220 this.panelCenter.TabIndex = 4;
221 //
222 // calendarGrid1
223 //
224 this.calendarGrid1.AllowDrop = true;
225 this.calendarGrid1.Appointments = null;
226 this.calendarGrid1.ApptDragSource = null;
227 this.calendarGrid1.AutoScroll = true;
228 this.calendarGrid1.AutoScrollMinSize = new System.Drawing.Size(600, 1898);
229 this.calendarGrid1.AvailabilityArray = null;
230 this.calendarGrid1.BackColor = System.Drawing.SystemColors.Window;
231 this.calendarGrid1.Columns = 5;
232 this.calendarGrid1.ContextMenu = this.ctxCalendarGrid;
233 this.calendarGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
234 this.calendarGrid1.DrawWalkIns = true;
235 this.calendarGrid1.GridBackColor = "blue";
236 this.calendarGrid1.GridEnter = false;
237 this.calendarGrid1.Location = new System.Drawing.Point(0, 0);
238 this.calendarGrid1.Name = "calendarGrid1";
239 this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources")));
240 this.calendarGrid1.SelectedAppointment = 0;
241 this.calendarGrid1.Size = new System.Drawing.Size(712, 402);
242 this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
243 this.calendarGrid1.TabIndex = 2;
244 this.calendarGrid1.TimeScale = 20;
245 this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick);
246 this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged);
247 this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged);
248 this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded);
249 //
250 // ctxCalendarGrid
251 //
252 this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
253 this.ctxCalGridAdd,
254 this.ctxCalGridEdit,
255 this.ctxCalGridDelete});
256 this.ctxCalendarGrid.Popup += new System.EventHandler(this.ctxCalendarGrid_Popup);
257 //
258 // ctxCalGridAdd
259 //
260 this.ctxCalGridAdd.Index = 0;
261 this.ctxCalGridAdd.Text = "Add New Access Block";
262 this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
263 //
264 // ctxCalGridEdit
265 //
266 this.ctxCalGridEdit.Index = 1;
267 this.ctxCalGridEdit.Text = "Edit Access Block";
268 this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
269 //
270 // ctxCalGridDelete
271 //
272 this.ctxCalGridDelete.Index = 2;
273 this.ctxCalGridDelete.Text = "Delete Access Block";
274 this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
275 //
276 // tvSchedules
277 //
278 this.tvSchedules.BackColor = System.Drawing.SystemColors.ControlLight;
279 this.tvSchedules.Dock = System.Windows.Forms.DockStyle.Left;
280 this.tvSchedules.HotTracking = true;
281 this.tvSchedules.Location = new System.Drawing.Point(0, 0);
282 this.tvSchedules.Name = "tvSchedules";
283 this.tvSchedules.Size = new System.Drawing.Size(8, 450);
284 this.tvSchedules.Sorted = true;
285 this.tvSchedules.TabIndex = 5;
286 //
287 // mainMenu1
288 //
289 this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
290 this.menuItem1,
291 this.mnuAvailability,
292 this.mnuCalendar,
293 this.mnuHelp});
294 //
295 // menuItem1
296 //
297 this.menuItem1.Index = 0;
298 this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
299 this.mnuLoadTemplate,
300 this.mnuSaveTemplate,
301 this.menuItem6,
302 this.mnuSchedulingManagment,
303 this.menuItem5,
304 this.mnuClose});
305 this.menuItem1.Text = "&File";
306 //
307 // mnuLoadTemplate
308 //
309 this.mnuLoadTemplate.Index = 0;
310 this.mnuLoadTemplate.Text = "&Apply Template";
311 this.mnuLoadTemplate.Click += new System.EventHandler(this.mnuLoadTemplate_Click);
312 //
313 // mnuSaveTemplate
314 //
315 this.mnuSaveTemplate.Index = 1;
316 this.mnuSaveTemplate.Text = "&Save Template";
317 this.mnuSaveTemplate.Click += new System.EventHandler(this.mnuSaveTemplate_Click);
318 //
319 // menuItem6
320 //
321 this.menuItem6.Index = 2;
322 this.menuItem6.Text = "-";
323 //
324 // mnuSchedulingManagment
325 //
326 this.mnuSchedulingManagment.Index = 3;
327 this.mnuSchedulingManagment.Text = "Scheduling &Management";
328 this.mnuSchedulingManagment.Click += new System.EventHandler(this.mnuSchedulingManagment_Click);
329 //
330 // menuItem5
331 //
332 this.menuItem5.Index = 4;
333 this.menuItem5.Text = "-";
334 //
335 // mnuClose
336 //
337 this.mnuClose.Index = 5;
338 this.mnuClose.Text = "&Close";
339 this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click);
340 //
341 // mnuAvailability
342 //
343 this.mnuAvailability.Index = 1;
344 this.mnuAvailability.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
345 this.mnuAddNewAV,
346 this.mnuRemoveAV,
347 this.mnuEditAV});
348 this.mnuAvailability.Text = "&Access Blocks";
349 this.mnuAvailability.Popup += new System.EventHandler(this.mnuAvailability_Popup);
350 //
351 // mnuAddNewAV
352 //
353 this.mnuAddNewAV.Index = 0;
354 this.mnuAddNewAV.Text = "&Add New Block";
355 this.mnuAddNewAV.Click += new System.EventHandler(this.mnuAddNewAV_Click);
356 //
357 // mnuRemoveAV
358 //
359 this.mnuRemoveAV.Index = 1;
360 this.mnuRemoveAV.Text = "&Remove Block";
361 this.mnuRemoveAV.Click += new System.EventHandler(this.mnuRemoveAV_Click);
362 //
363 // mnuEditAV
364 //
365 this.mnuEditAV.Index = 2;
366 this.mnuEditAV.Text = "&Edit Block";
367 this.mnuEditAV.Click += new System.EventHandler(this.mnuEditAV_Click);
368 //
369 // mnuCalendar
370 //
371 this.mnuCalendar.Index = 2;
372 this.mnuCalendar.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
373 this.mnu1Day,
374 this.mnu5Day,
375 this.mnu7Day,
376 this.menuItem7,
377 this.mnuTimeScale,
378 this.mnuViewRightPanel});
379 this.mnuCalendar.Text = "&View";
380 //
381 // mnu1Day
382 //
383 this.mnu1Day.Index = 0;
384 this.mnu1Day.Text = "&1-Day View";
385 this.mnu1Day.Click += new System.EventHandler(this.mnu1Day_Click);
386 //
387 // mnu5Day
388 //
389 this.mnu5Day.Index = 1;
390 this.mnu5Day.Text = "&5-Day View";
391 this.mnu5Day.Click += new System.EventHandler(this.mnu5Day_Click);
392 //
393 // mnu7Day
394 //
395 this.mnu7Day.Index = 2;
396 this.mnu7Day.Text = "&7-Day View";
397 this.mnu7Day.Click += new System.EventHandler(this.mnu7Day_Click);
398 //
399 // menuItem7
400 //
401 this.menuItem7.Index = 3;
402 this.menuItem7.Text = "-";
403 //
404 // mnuTimeScale
405 //
406 this.mnuTimeScale.Index = 4;
407 this.mnuTimeScale.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
408 this.mnu10Minute,
409 this.mnu15Minute,
410 this.mnu20Minute,
411 this.mnu30Minute});
412 this.mnuTimeScale.Text = "&Time Scale";
413 //
414 // mnu10Minute
415 //
416 this.mnu10Minute.Index = 0;
417 this.mnu10Minute.Text = "&10-Minute";
418 this.mnu10Minute.Click += new System.EventHandler(this.mnu10Minute_Click);
419 //
420 // mnu15Minute
421 //
422 this.mnu15Minute.Index = 1;
423 this.mnu15Minute.Text = "&15-Minute";
424 this.mnu15Minute.Click += new System.EventHandler(this.mnu15Minute_Click);
425 //
426 // mnu20Minute
427 //
428 this.mnu20Minute.Index = 2;
429 this.mnu20Minute.Text = "&20-Minute";
430 this.mnu20Minute.Click += new System.EventHandler(this.mnu20Minute_Click);
431 //
432 // mnu30Minute
433 //
434 this.mnu30Minute.Index = 3;
435 this.mnu30Minute.Text = "&30-Minute";
436 this.mnu30Minute.Click += new System.EventHandler(this.mnu30Minute_Click);
437 //
438 // mnuViewRightPanel
439 //
440 this.mnuViewRightPanel.Index = 5;
441 this.mnuViewRightPanel.Text = "&Access Block Clipboard";
442 this.mnuViewRightPanel.Click += new System.EventHandler(this.mnuViewRightPanel_Click);
443 //
444 // mnuHelp
445 //
446 this.mnuHelp.Index = 3;
447 this.mnuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
448 this.mnuHelpAbout});
449 this.mnuHelp.Text = "&Help";
450 //
451 // mnuHelpAbout
452 //
453 this.mnuHelpAbout.Index = 0;
454 this.mnuHelpAbout.Text = "&About";
455 this.mnuHelpAbout.Click += new System.EventHandler(this.mnuHelpAbout_Click);
456 //
457 // splitter1
458 //
459 this.splitter1.Dock = System.Windows.Forms.DockStyle.Right;
460 this.splitter1.Location = new System.Drawing.Point(720, 24);
461 this.splitter1.Name = "splitter1";
462 this.splitter1.Size = new System.Drawing.Size(8, 402);
463 this.splitter1.TabIndex = 6;
464 this.splitter1.TabStop = false;
465 //
466 // CGAVView
467 //
468 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
469 this.ClientSize = new System.Drawing.Size(848, 450);
470 this.Controls.Add(this.panelCenter);
471 this.Controls.Add(this.splitter1);
472 this.Controls.Add(this.panelTop);
473 this.Controls.Add(this.panelBottom);
474 this.Controls.Add(this.panelRight);
475 this.Controls.Add(this.tvSchedules);
476 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
477 this.Menu = this.mainMenu1;
478 this.Name = "CGAVView";
479 this.Text = "CGAVView";
480 this.Load += new System.EventHandler(this.CGAVView_Load);
481 this.Closing += new System.ComponentModel.CancelEventHandler(this.CGAVView_Closing);
482 this.panelRight.ResumeLayout(false);
483 this.panelClip.ResumeLayout(false);
484 this.panelBottom.ResumeLayout(false);
485 this.panelTop.ResumeLayout(false);
486 this.panelCenter.ResumeLayout(false);
487 this.ResumeLayout(false);
488
489 }
490 #endregion
491
492 private IContainer components;
493
494 #region Member Variables
495
496 private CGAVDocument m_Document;
497 private System.Windows.Forms.Panel panelRight;
498 private System.Windows.Forms.Panel panelBottom;
499 private System.Windows.Forms.Panel panelTop;
500 private System.Windows.Forms.Panel panelCenter;
501 private System.Windows.Forms.Label lblResource;
502 private System.Windows.Forms.TreeView tvSchedules;
503 private System.Windows.Forms.DateTimePicker dateTimePicker1;
504 private IndianHealthService.ClinicalScheduling.CalendarGrid calendarGrid1;
505 private System.Windows.Forms.StatusBar statusBar1;
506 private System.Windows.Forms.MainMenu mainMenu1;
507 private System.Windows.Forms.MenuItem mnuAvailability;
508 private System.Windows.Forms.MenuItem mnuAddNewAV;
509 private System.Windows.Forms.MenuItem mnuRemoveAV;
510 private System.Windows.Forms.MenuItem mnuEditAV;
511 private System.Windows.Forms.MenuItem menuItem1;
512 private System.Windows.Forms.MenuItem mnuSchedulingManagment;
513 private System.Windows.Forms.MenuItem menuItem5;
514 private System.Windows.Forms.MenuItem menuItem6;
515 private System.Windows.Forms.MenuItem mnuClose;
516 private System.Windows.Forms.MenuItem mnuHelp;
517 private System.Windows.Forms.MenuItem mnuHelpAbout;
518 private System.Windows.Forms.MenuItem mnuLoadTemplate;
519 private System.Windows.Forms.MenuItem mnuSaveTemplate;
520 private System.Windows.Forms.Panel panelClip;
521 private System.Windows.Forms.ListBox lstClip;
522 private System.Windows.Forms.Label label1;
523 private System.Windows.Forms.MenuItem mnuCalendar;
524 private System.Windows.Forms.MenuItem mnuViewRightPanel;
525 private System.Windows.Forms.MenuItem mnuTimeScale;
526 private System.Windows.Forms.MenuItem mnu10Minute;
527 private System.Windows.Forms.MenuItem mnu15Minute;
528 private System.Windows.Forms.MenuItem mnu20Minute;
529 private System.Windows.Forms.MenuItem mnu30Minute;
530 private System.Windows.Forms.MenuItem menuItem7;
531 private System.Windows.Forms.MenuItem mnu1Day;
532 private System.Windows.Forms.MenuItem mnu5Day;
533 private System.Windows.Forms.MenuItem mnu7Day;
534 private System.Windows.Forms.Splitter splitter1;
535 private CGDocumentManager m_DocManager;
536 private CGAppointments m_ClipList;
537 private System.Windows.Forms.ContextMenu ctxApptClipMenu;
538 private System.Windows.Forms.MenuItem mnuRemoveClipItem;
539 private System.Windows.Forms.MenuItem mnuClearClipItems;
540 private System.Windows.Forms.ContextMenu ctxCalendarGrid;
541 private System.Windows.Forms.MenuItem ctxCalGridAdd;
542 private System.Windows.Forms.MenuItem ctxCalGridEdit;
543 private System.Windows.Forms.MenuItem ctxCalGridDelete;
544 private bool m_bDragDropStart = false;
545
546 #endregion
547
548 #region Properties
549
550 /// <summary>
551 /// Access the CalendarGrid associated with this view
552 /// </summary>
553 public CalendarGrid CGrid
554 {
555 get
556 {
557 return this.calendarGrid1;
558 }
559 }
560 /// <summary>
561 /// Accesses the document associated with this view
562 /// </summary>
563 public CGAVDocument Document
564 {
565 get
566 {
567 return this.m_Document;
568 }
569 set
570 {
571 this.m_Document = value;
572 }
573 }
574
575 public CGDocumentManager DocManager
576 {
577 get
578 {
579 return m_DocManager;
580 }
581 set
582 {
583 m_DocManager = value;
584 }
585
586 }
587
588 public CGAppointments AVBlocks
589 {
590 get
591 {
592 return this.calendarGrid1.Appointments;
593 }
594 set
595 {
596 this.calendarGrid1.Appointments = value;
597 }
598 }
599
600 public DateTime StartDate
601 {
602 get
603 {
604 return this.calendarGrid1.StartDate;
605 }
606 set
607 {
608 this.calendarGrid1.StartDate = value;
609 }
610 }
611
612 #endregion //Properties
613
614 #region Methods
615
616 private void RaiseRPMSEvent(string sEvent, string sParams)
617 {
618 try
619 {
620 //Signal RPMS to raise an event
621// string sSql;
622// sSql = "BSDX RAISE EVENT^" + sEvent + "^" + sParams + "^^";
623// DataTable dtAppt =m_DocManager.RPMSDataTable(sSql, "RaiseEvent");
624 this.m_DocManager.ConnectInfo.RaiseEvent(sEvent, sParams, true);
625 }
626 catch (Exception ex)
627 {
628 Debug.Write(ex.Message);
629 }
630 }
631
632 void UpdateStatusBar(DateTime dStart, DateTime dEnd)
633 {
634 string sMsg = dStart.ToShortTimeString() + " to " + dEnd.ToShortTimeString();
635 this.statusBar1.Text = sMsg;
636 }
637
638 private void AvailabilityEdit()
639 {
640 try
641 {
642 int nApptID = this.calendarGrid1.SelectedAppointment;
643 if (nApptID != 0)
644 {
645
646 CGAppointment pAppt = this.Document.AVBlocks.GetAppointment(nApptID);
647 DAccessBlock dA = new DAccessBlock();
648 dA.InitializePage(pAppt, m_DocManager.GlobalDataSet);
649 calendarGrid1.CGToolTip.Active = false;
650 if (dA.ShowDialog(this) == DialogResult.Cancel)
651 {
652 calendarGrid1.CGToolTip.Active = true;
653 return;
654 }
655 calendarGrid1.CGToolTip.Active = true;
656 this.Document.DeleteAvailability(nApptID);
657 this.Document.CreateAppointment(dA.Appointment);
658 this.calendarGrid1.Invalidate();
659 this.m_DocManager.UpdateViews((string) this.m_Document.Resources[0], "");
660 }
661 }
662 catch (Exception ex)
663 {
664 MessageBox.Show("Unable to add new access block " + ex.Message, "Clinical Scheduling");
665 return;
666 }
667 try
668 {
669 RaiseRPMSEvent("BSDX SCHEDULE", m_Document.DocName);
670 this.calendarGrid1.Invalidate();
671 }
672 catch (Exception ex)
673 {
674 Debug.Write(ex.Message);
675 }
676 }
677
678 private void AvailabilityAddNew()
679 {
680 try
681 {
682 CGAppointment appt = new CGAppointment();
683
684 //Get Time and Resource from Selected Cell
685 DateTime dStart = DateTime.Today;
686 DateTime dEnd = DateTime.Today;
687 string sResource = "";
688 bool bRet = this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource);
689 if (bRet == false)
690 return;
691
692 foreach (CGAppointment a in this.Document.m_AVBlocks.AppointmentTable.Values)
693 {
694 DateTime sStart2 = a.StartTime;
695 DateTime sEnd2 = a.EndTime;
696 if (CGSchedLib.TimesOverlap(dStart, dEnd, a.StartTime, a.EndTime))
697 {
698 MessageBox.Show("Access blocks may not overlap.","Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
699 return;
700 }
701 }
702
703 string sNote = "";
704 DAccessBlock dA = new DAccessBlock();
705 dA.InitializePage(dStart, dEnd, sResource, sNote, this.m_DocManager.GlobalDataSet);
706 if (dA.ShowDialog(this) == DialogResult.Cancel)
707 {
708 return;
709 }
710 appt.StartTime = dStart;
711 appt.EndTime = dEnd;
712 appt.Resource = sResource;
713 appt.Note = " " + dA.Note; // + ": " + dA.Slots.ToString()+ " Slots";
714 appt.AccessTypeID = dA.AccessTypeID;
715 appt.Slots = dA.Slots;
716
717 //Call Document to add a new appointment
718 this.Document.CreateAppointment(appt);
719 this.m_DocManager.UpdateViews((string) this.m_Document.Resources[0], "");
720 }
721 catch (Exception ex)
722 {
723 MessageBox.Show("Unable to add new access block " + ex.Message, "Clinical Scheduling");
724 return;
725 }
726 try
727 {
728 RaiseRPMSEvent("BSDX SCHEDULE", m_Document.DocName);
729 this.calendarGrid1.Invalidate();
730 }
731 catch (Exception ex)
732 {
733 Debug.Write(ex.Message);
734 }
735 }//End AvailabilityAddNew
736
737 private void AppointmentDelete()
738 {
739 calendarGrid1.CGToolTip.Active = false;
740 string sMsg = " this access block?";
741 if (calendarGrid1.SelectedAppointments.AppointmentTable.Count > 1)
742 sMsg = " these access blocks?";
743
744 if (MessageBox.Show("Are you sure you want to delete" + sMsg, "Clinical Scheduling", MessageBoxButtons.YesNo) != DialogResult.Yes)
745 {
746 calendarGrid1.CGToolTip.Active = true;
747 return;
748 }
749 calendarGrid1.CGToolTip.Active = true;
750
751 bool bDeleted = false;
752 foreach (CGAppointment a in this.calendarGrid1.SelectedAppointments.AppointmentTable.Values)
753 {
754 int nApptID = a.AppointmentKey;
755 Debug.Assert(nApptID != 0);
756 try
757 {
758 Document.DeleteAvailability(nApptID);
759 bDeleted = true;
760 }
761 catch (Exception ex)
762 {
763 MessageBox.Show("Unable to delete access block" + ex.Message, "Clinical Scheduling");
764 }
765 }
766 if (bDeleted == true)
767 {
768 try
769 {
770 this.m_DocManager.UpdateViews((string) this.m_Document.Resources[0], "");
771 RaiseRPMSEvent("BSDX SCHEDULE", m_Document.DocName);
772 }
773 catch (Exception ex)
774 {
775 Debug.Write(ex.Message);
776 }
777 this.calendarGrid1.Invalidate();
778 }
779 }
780
781 private void AccessTypeManage()
782 {
783// DAccessType dAT = new DAccessType();
784// dAT.InitializePage(0, this.m_DocManager.GlobalDataSet, this.m_DocManager.ADOConnection);
785// if (dAT.ShowDialog(this) == DialogResult.Cancel)
786// {
787// return;
788// }
789 }
790
791 private void SchedulingManagement()
792 {
793 try
794 {
795 bool bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXMGR", "+");
796 if (bLock == false)
797 {
798 throw new Exception("Another user is currently in Scheduling Management. Try later.");
799 }
800
801 DManagement dMgm = new DManagement();
802 dMgm.InitializeDialog(this.m_DocManager);
803
804 if (dMgm.ShowDialog(this) == DialogResult.Cancel)
805 {
806 return;
807 }
808 bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXMGR", "-");
809 }
810 catch (Exception ex)
811 {
812 MessageBox.Show("Scheduling Management Error: " + ex.Message, "Clinical Scheduling");
813 }
814 }
815
816 public void UpdateArrays()
817 {
818 //TODO: Create these components
819 this.calendarGrid1.Resources = this.m_Document.Resources;
820 this.calendarGrid1.OnUpdateArrays();
821 this.lblResource.Text = this.m_Document.DocName;
822
823 }
824
825 /// <summary>
826 /// Clean up any resources being used.
827 /// </summary>
828 protected override void Dispose( bool disposing )
829 {
830 if( disposing )
831 {
832 if(components != null)
833 {
834 components.Dispose();
835 }
836 }
837 base.Dispose( disposing );
838 }
839 #endregion //Methods
840
841 #region Events
842
843 private void dateTimePicker1_ValueChanged(object sender, System.EventArgs e)
844 {
845 DateTime dDate = dateTimePicker1.Value;
846 dDate = dDate.Date;
847 this.Document.SelectedDate = dDate;
848 if (this.calendarGrid1.Columns > 1)
849 {
850 this.StartDate = this.Document.StartDate;
851 }
852 else
853 {
854 this.StartDate = this.Document.SelectedDate;
855 }
856 this.Document.UpdateAllViews();
857 this.calendarGrid1.Invalidate();
858 }
859
860 private void CGAVView_Load(object sender, System.EventArgs e)
861 {
862 Debug.Assert (this.Document != null);
863
864 //Register the view
865 CGDocumentManager.Current.RegisterAVDocumentView(this.Document, this);
866 this.mnu5Day.Click += new System.EventHandler(this.dateTimePicker1_ValueChanged); // MJL 1/17/2007
867 this.mnu7Day.Click += new System.EventHandler(this.dateTimePicker1_ValueChanged);
868
869 //Set start date
870 DateTime startDate,endDate;
871 Document.WeekNeedsRefresh(1, DateTime.Today, out startDate, out endDate);
872 this.StartDate = startDate;
873 //Draw the calendar
874 this.calendarGrid1.OnUpdateArrays();
875 this.calendarGrid1.Invalidate();
876
877 }
878
879 private void CGAVView_Closing(object sender, System.ComponentModel.CancelEventArgs e)
880 {
881 this.calendarGrid1.CloseGrid();
882 DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXRES(" + Document.ResourceID.ToString() + ")", "-");
883 }
884
885 private void calendarGrid1_CGSelectionChanged(object sender, IndianHealthService.ClinicalScheduling.CGSelectionChangedArgs e)
886 {
887 UpdateStatusBar(e.StartTime, e.EndTime);
888 }
889
890 private void calendarGrid1_CGAppointmentChanged(object sender, IndianHealthService.ClinicalScheduling.CGAppointmentChangedArgs e)
891 {
892 try
893 {
894// this.DocManager.EnableAutoRefresh(false);
895
896 if (MessageBox.Show("Are you sure you want to move this access block?", "Clinical Scheduling", MessageBoxButtons.YesNo) != DialogResult.Yes)
897 return;
898
899 m_Document.ChangeAppointmentTime(e.Appointment, e.StartTime, e.EndTime, e.Resource);
900 this.m_DocManager.UpdateViews((string) this.m_Document.Resources[0], "");
901 }
902 catch (Exception ex)
903 {
904 MessageBox.Show("Unable to change access block " + ex.Message, "Clinical Scheduling");
905 this.m_DocManager.UpdateViews();
906 return;
907 }
908 finally
909 {
910// this.DocManager.EnableAutoRefresh(true);
911 }
912 try
913 {
914 RaiseRPMSEvent("BSDX SCHEDULE", m_Document.DocName);
915 this.calendarGrid1.Invalidate();
916 }
917 catch (Exception ex)
918 {
919 Debug.Write(ex.Message);
920 }
921 }
922
923 private void mnuAddNewAV_Click(object sender, System.EventArgs e)
924 {
925 AvailabilityAddNew();
926 }
927
928 private void mnuRemoveAV_Click(object sender, System.EventArgs e)
929 {
930 this.AppointmentDelete();
931 }
932
933 private void mnuManageAT_Click(object sender, System.EventArgs e)
934 {
935 AccessTypeManage();
936 }
937
938 private void mnuEditAV_Click(object sender, System.EventArgs e)
939 {
940 AvailabilityEdit();
941 }
942
943 private void mnuAvailability_Popup(object sender, System.EventArgs e)
944 {
945 this.mnuAddNewAV.Enabled = (this.calendarGrid1.SelectedRange.Cells.CellCount > 0);
946 this.mnuEditAV.Enabled = (this.calendarGrid1.SelectedAppointment > 0);
947 this.mnuRemoveAV.Enabled = (this.calendarGrid1.SelectedAppointment > 0);
948 }
949
950 private void mnuSchedulingManagment_Click(object sender, System.EventArgs e)
951 {
952 SchedulingManagement();
953 }
954
955 #endregion //Events
956
957 private void mnuClose_Click(object sender, System.EventArgs e)
958 {
959 DialogResult dr = MessageBox.Show("Are you sure you want to close this schedule?", Application.ProductName, MessageBoxButtons.OKCancel);
960 if (dr != DialogResult.OK)
961 return;
962
963 this.Close();
964 }
965
966 private void mnuHelpAbout_Click(object sender, System.EventArgs e)
967 {
968 MessageBox.Show("Clinical Scheduling Version " + Application.ProductVersion, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Information);
969 }
970
971 private void ImplementMsg()
972 {
973 MessageBox.Show("Clinical Scheduling", "TODO: Implement this function");
974 }
975
976 private void mnuLoadTemplate_Click(object sender, System.EventArgs e)
977 {
978 /*
979 * Display dialog to collect:
980 * - Number of weeks to apply template
981 * - Starting week Monday
982 * - Template path & filename
983 *
984 * for each week,
985 * Delete all availability during that week
986 * apply the template
987 *
988 */
989 DAccessTemplate dlg = new DAccessTemplate();
990 dlg.InitializePage();
991 if (dlg.ShowDialog(this) == DialogResult.Cancel)
992 {
993 return;
994 }
995
996 try
997 {
998 OpenFileDialog openFileDialog1 = dlg.FileDialog;
999 Stream streamFile;
1000 if((streamFile = openFileDialog1.OpenFile())== null)
1001 {
1002 MessageBox.Show("Unable to open template file.");
1003 return;
1004 }
1005
1006 BinaryFormatter formatter = new BinaryFormatter();
1007 CGAppointments cgaTemp = (CGAppointments) formatter.Deserialize(streamFile);
1008 streamFile.Close();
1009
1010 DateTime dtStart = dlg.StartDate;
1011 int nWeeksToApply = dlg.WeeksToApply;
1012 DateTime dtEnd = dtStart.AddDays(6); // or 7?
1013 string sResourceID = this.m_Document.ResourceID.ToString();
1014 DataTable dt;
1015
1016 for (int j=1; j < nWeeksToApply + 1; j++)
1017 {
1018 //Convert start and end to string
1019 //string sStart = dtStart.ToString("M/d/yyyy");
1020 //string sEnd = dtEnd.ToString("M/d/yyyy");
1021 //i18n
1022 string sStart = FMDateTime.Create(dtStart).DateOnly.FMDateString;
1023 string sEnd = FMDateTime.Create(dtEnd).DateOnly.FMDateString;
1024 //Cancel all existing access blocks in the date range
1025 string sSql = "BSDX CANCEL AV BY DATE^" + sResourceID + "^" + sStart + "^" + sEnd;
1026 dt = this.m_DocManager.RPMSDataTable(sSql, "Cancelled");
1027
1028 //for each CGAppointment in AVBlocks, call AddNew
1029 string sResource = "";
1030 sResource = (string) this.Document.Resources[0];
1031 foreach (CGAppointment a in cgaTemp.AppointmentTable.Values)
1032 {
1033 //Change the resource to the current one
1034 a.Resource = sResource;
1035
1036 //Change the date to correspond to the GridColumn member
1037 int col = a.GridColumn;
1038 col--;
1039 DateTime dBuildDate = dtStart.Date;
1040 dBuildDate = dBuildDate.AddDays(col);
1041 dBuildDate = dBuildDate.AddHours(a.StartTime.Hour);
1042 dBuildDate = dBuildDate.AddMinutes(a.StartTime.Minute);
1043 a.StartTime = dBuildDate;
1044 dBuildDate = dtStart.Date;
1045 dBuildDate = dBuildDate.AddDays(col);
1046 dBuildDate = dBuildDate.AddHours(a.EndTime.Hour);
1047 dBuildDate = dBuildDate.AddMinutes(a.EndTime.Minute);
1048 a.EndTime = dBuildDate;
1049
1050 //Call Document to add a new appointment
1051 this.Document.CreateAppointmentAuto(a);
1052 }
1053
1054 //Increment start and end
1055 dtStart = dtStart.AddDays(7);
1056 dtEnd = dtStart.AddDays(6);
1057
1058 }//end for
1059 try
1060 {
1061 RaiseRPMSEvent("BSDX SCHEDULE", m_Document.DocName);
1062 }
1063 catch (Exception ex)
1064 {
1065 Debug.Write(ex.Message);
1066 }
1067 this.calendarGrid1.Invalidate();
1068 this.m_DocManager.UpdateViews((string) this.m_Document.Resources[0], "");
1069 }
1070 catch (Exception ex)
1071 {
1072 MessageBox.Show(this, "Error loading template: " + ex.Message, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
1073 }
1074 }
1075
1076 //Check that there are no blocks in document
1077// if (this.Document.AVBlocks.AppointmentTable.Count > 0)
1078// {
1079// Exception bmxex = new Exception("You may not load a template if there are already access blocks defined for the week.");
1080// throw bmxex;
1081// }
1082// OpenFileDialog openFileDialog1 = new OpenFileDialog();
1083// string sPath = "";
1084// sPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
1085//
1086// openFileDialog1.InitialDirectory = "c:\\" ;
1087// openFileDialog1.InitialDirectory = sPath ;
1088// openFileDialog1.Filter = "Schedule Template Files (*.bsdxa)|*.bsdxa|All files (*.*)|*.*" ;
1089// openFileDialog1.FilterIndex = 0 ;
1090// openFileDialog1.RestoreDirectory = true ;
1091
1092// Stream streamFile;
1093// if(openFileDialog1.ShowDialog() == DialogResult.OK)
1094// {
1095// if((streamFile = openFileDialog1.OpenFile())!= null)
1096// {
1097// BinaryFormatter formatter = new BinaryFormatter();
1098// CGAppointments cgaTemp = (CGAppointments) formatter.Deserialize(streamFile);
1099// streamFile.Close();
1100//
1101// //for each CGAppointment in AVBlocks, call AddNew
1102// string sResource = "";
1103// sResource = (string) this.Document.Resources[0];
1104// foreach (CGAppointment a in cgaTemp.AppointmentTable.Values)
1105// {
1106// //Change the resource to the current one
1107// a.Resource = sResource;
1108//
1109// //Change the date to correspond to the GridColumn member
1110// int col = a.GridColumn;
1111// Rectangle r = new Rectangle(0,0,0,0);
1112// int row = 5;
1113// CGCell c = new CGCell(r, row, col);
1114// DateTime dTemp = this.calendarGrid1.GetTimeFromCell(c);
1115// DateTime dBuildDate = dTemp.Date;
1116// dBuildDate = dBuildDate.AddHours(a.StartTime.Hour);
1117// dBuildDate = dBuildDate.AddMinutes(a.StartTime.Minute);
1118// a.StartTime = dBuildDate;
1119// dBuildDate = dTemp.Date;
1120// dBuildDate = dBuildDate.AddHours(a.EndTime.Hour);
1121// dBuildDate = dBuildDate.AddMinutes(a.EndTime.Minute);
1122// a.EndTime = dBuildDate;
1123//
1124// //Call Document to add a new appointment
1125// this.Document.CreateAppointment(a);
1126// }
1127// try
1128// {
1129// RaiseRPMSEvent("SCHEDULE-" + m_Document.DocName, "");
1130// }
1131// catch (Exception ex)
1132// {
1133// Debug.Write(ex.Message);
1134// }
1135// this.calendarGrid1.Invalidate();
1136// this.m_DocManager.UpdateViews((string) this.m_Document.Resources[0], "");
1137// }
1138// }
1139// }//end try
1140// catch (Exception ex)
1141// {
1142// MessageBox.Show(this, "Error loading template: " + ex.Message, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
1143// }
1144// }
1145
1146 private void mnuSaveTemplate_Click(object sender, System.EventArgs e)
1147 {
1148 try
1149 {
1150 //Check that there is at least one block in document
1151// if (this.Document.AVBlocks.AppointmentTable.Count == 0)
1152// {
1153// Exception bmxex = new Exception("You may not save a template if there are no access blocks defined for the week.");
1154// throw bmxex;
1155// }
1156
1157 Stream streamFile ;
1158 SaveFileDialog saveFileDialog1 = new SaveFileDialog();
1159
1160 saveFileDialog1.Filter = "Schedule Template Files (*.bsdxa)|*.bsdxa|All files (*.*)|*.*" ;
1161 saveFileDialog1.FilterIndex = 0 ;
1162 saveFileDialog1.RestoreDirectory = true ;
1163 saveFileDialog1.AddExtension = true;
1164 saveFileDialog1.DefaultExt = "bsdxa";
1165
1166 //Iterate through AVBlocks and set the GridColumn member based on the date
1167 foreach (CGAppointment a in this.Document.AVBlocks.AppointmentTable.Values)
1168 {
1169 //Get the column by subtracting the grid's Start day from dStart.
1170 int col =(int) a.StartTime.DayOfWeek - (int) this.calendarGrid1.StartDate.DayOfWeek + 1;
1171 a.GridColumn = col;
1172 }
1173
1174 if(saveFileDialog1.ShowDialog() == DialogResult.OK)
1175 {
1176 if((streamFile = saveFileDialog1.OpenFile()) != null)
1177 {
1178 BinaryFormatter formatter = new BinaryFormatter();
1179
1180 formatter.Serialize(streamFile, this.Document.AVBlocks);
1181
1182 streamFile.Close();
1183 }
1184 }
1185 }
1186 catch (Exception ex)
1187 {
1188 MessageBox.Show(this, "Error saving template: " + ex.Message, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
1189 }
1190 }
1191
1192 private void mnuViewRightPanel_Click(object sender, System.EventArgs e)
1193 {
1194 this.mnuViewRightPanel.Checked = this.panelRight.Visible;
1195 this.panelRight.Visible = !(this.panelRight.Visible);
1196 this.mnuViewRightPanel.Checked = !(this.mnuViewRightPanel.Checked);
1197 }
1198
1199 private void lstClip_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
1200 {
1201 try
1202 {
1203 CGAppointment a = (CGAppointment) e.Data.GetData(typeof(CGAppointment));
1204 if (m_ClipList.AppointmentTable.Contains((int) a.AppointmentKey))
1205 {
1206 return;
1207 }
1208 m_ClipList.AddAppointment(a);
1209 lstClip.Items.Add(a);
1210 }
1211 catch(Exception ex)
1212 {
1213 Debug.Write(ex.Message);
1214 }
1215 }
1216
1217 private void lstClip_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
1218 {
1219 bool b = e.Data.GetDataPresent(typeof(CGAppointment));
1220 if (b == true)
1221 {
1222 e.Effect = DragDropEffects.Move;
1223 }
1224 else
1225 {
1226 e.Effect = DragDropEffects.None;
1227 }
1228 }
1229
1230 private void lstClip_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
1231 {
1232 m_bDragDropStart = false;
1233 }
1234
1235 private void lstClip_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
1236 {
1237 try
1238 {
1239 if ((m_bDragDropStart == false)&&(lstClip.SelectedIndex > -1))
1240 {
1241 CGAppointment a = (CGAppointment) lstClip.Items[lstClip.SelectedIndex];
1242 this.calendarGrid1.ApptDragSource = "list";
1243 DragDropEffects effect = DoDragDrop(a, DragDropEffects.Move);
1244 m_bDragDropStart = true;
1245 }
1246 }
1247 catch (Exception ex)
1248 {
1249 Debug.Write(ex.Message);
1250 }
1251 }
1252
1253 private void calendarGrid1_CGAppointmentAdded(object sender, IndianHealthService.ClinicalScheduling.CGAppointmentChangedArgs e)
1254 {
1255 //CalendarGrid Event raised when appointment is dragdropped onto the grid
1256
1257 try
1258 {
1259 CGAppointment aCopy = new CGAppointment();
1260 aCopy.CreateAppointment(e.StartTime, e.EndTime, e.Appointment.Note, 0, e.Resource);
1261 aCopy.AccessTypeID = e.AccessTypeID;
1262 aCopy.Slots = e.Slots;
1263
1264 m_Document.CreateAppointment(aCopy);
1265 // RaiseRPMSEvent("SCHEDULE-" + e.Resource , "");
1266 this.m_DocManager.UpdateViews(e.Resource, e.OldResource);
1267 }
1268 catch (Exception ex)
1269 {
1270 MessageBox.Show("Unable to add new access block " + ex.Message, "Clinical Scheduling");
1271 return;
1272 }
1273 try
1274 {
1275 RaiseRPMSEvent("BSDX SCHEDULE", m_Document.DocName);
1276 if (e.Resource != e.OldResource)
1277 RaiseRPMSEvent("BSDX SCHEDULE", m_Document.DocName);
1278 this.calendarGrid1.Invalidate();
1279 }
1280 catch (Exception ex)
1281 {
1282 Debug.Write(ex.Message);
1283 }
1284 }
1285
1286 #region ctxApptClipMenu Handlers
1287
1288 private void ctxApptClipMenu_Popup(object sender, System.EventArgs e)
1289 {
1290 mnuClearClipItems.Enabled = (m_ClipList.AppointmentTable.Count > 0);
1291 mnuRemoveClipItem.Enabled = (lstClip.SelectedIndex > -1);
1292 }
1293
1294 private void mnuRemoveClipItem_Click(object sender, System.EventArgs e)
1295 {
1296 int i = lstClip.SelectedIndex;
1297 CGAppointment a = (CGAppointment) lstClip.SelectedItem;
1298 int nKey = a.AppointmentKey;
1299 if (i > -1)
1300 {
1301 m_ClipList.RemoveAppointment(nKey);
1302 lstClip.Items.RemoveAt(i);
1303 }
1304 }
1305
1306 private void mnuClearClipItems_Click(object sender, System.EventArgs e)
1307 {
1308 this.m_ClipList.ClearAllAppointments();
1309 lstClip.Items.Clear();
1310 }
1311
1312 #endregion ctxApptClipMenu Handlers
1313
1314 #region ctxCalGridMenu Handlers
1315
1316 private void ctxCalGridAdd_Click(object sender, System.EventArgs e)
1317 {
1318 AvailabilityAddNew();
1319 }
1320
1321 private void ctxCalGridEdit_Click(object sender, System.EventArgs e)
1322 {
1323 AvailabilityEdit();
1324 }
1325
1326 private void ctxCalGridDelete_Click(object sender, System.EventArgs e)
1327 {
1328 AppointmentDelete();
1329 }
1330
1331 private void ctxCalendarGrid_Popup(object sender, System.EventArgs e)
1332 {
1333 //Toggle availability of make, edit and delete appointments
1334 //based on whether appropriate element is selected.
1335 ctxCalGridAdd.Enabled = ((calendarGrid1.SelectedRange.Cells.CellCount > 0) );
1336 ctxCalGridDelete.Enabled = (calendarGrid1.SelectedAppointment > 0);
1337 ctxCalGridEdit.Enabled = (calendarGrid1.SelectedAppointment > 0);
1338 }
1339
1340 private void calendarGrid1_DoubleClick(object sender, System.EventArgs e)
1341 {
1342 if (calendarGrid1.SelectedAppointment > 0)
1343 AvailabilityEdit();
1344 }
1345
1346 #endregion ctxCalGridMenu Handlers
1347
1348 private void mnu10Minute_Click(object sender, System.EventArgs e)
1349 {
1350 CalendarGrid cg = this.calendarGrid1;
1351 cg.TimeScale = 10;
1352 PositionGrid(cg, 7);
1353 }
1354
1355 private void mnu15Minute_Click(object sender, System.EventArgs e)
1356 {
1357 CalendarGrid cg = this.calendarGrid1;
1358 cg.TimeScale = 15;
1359 PositionGrid(cg, 7);
1360 }
1361
1362 private void mnu20Minute_Click(object sender, System.EventArgs e)
1363 {
1364 CalendarGrid cg = this.calendarGrid1;
1365 cg.TimeScale = 20;
1366 PositionGrid(cg, 7);
1367 }
1368
1369 private void mnu30Minute_Click(object sender, System.EventArgs e)
1370 {
1371 CalendarGrid cg = this.calendarGrid1;
1372 cg.TimeScale = 30;
1373 PositionGrid(cg, 7);
1374 }
1375
1376 private void mnu1Day_Click(object sender, System.EventArgs e)
1377 {
1378 DateTime dtPicker = dateTimePicker1.Value;
1379 DateTime DayOnly = new DateTime(dtPicker.Year, dtPicker.Month, dtPicker.Day);
1380 this.calendarGrid1.StartDate = DayOnly;
1381 this.calendarGrid1.Columns = 1;
1382 }
1383
1384 private void mnu5Day_Click(object sender, System.EventArgs e)
1385 {
1386 if (this.calendarGrid1.Columns == 1)
1387 {
1388 this.StartDate = this.Document.StartDate;
1389 }
1390
1391 this.calendarGrid1.Columns = 5;
1392 this.Document.UpdateAllViews();
1393 }
1394
1395 private void mnu7Day_Click(object sender, System.EventArgs e)
1396 {
1397 this.calendarGrid1.Columns = 7;
1398 }
1399
1400 private void PositionGrid(CalendarGrid cg, int nHour)
1401 {
1402 //Position grid to nHour
1403 int nRow = 0, nCol = 0;
1404 DateTime dStart = DateTime.Today;
1405 dStart = dStart.AddHours(nHour);
1406 cg.GetCellFromTime(dStart, ref nRow, ref nCol, false, "");
1407 int nHeight = cg.CellHeight;
1408 nHeight *= nRow;
1409 cg.AutoScrollPosition = new Point(50, nHeight);
1410 cg.Invalidate();
1411 }
1412 }
1413}
Note: See TracBrowser for help on using the repository browser.