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