source: Scheduling/trunk/cs/bsdx0200GUISourceCode/CalendarGrid.cs@ 1110

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

CalendarGrid:

  • Support for Autoscrolling corrected.
  • A little optimization: Grid is only drawn once now when starting, not twice (don't know why original code did that).

CGAppointment:

  • Added member Patient (new Class)

CGDocument:

  • OnOpenDocument now accepts input of DateTime to decide where to open document.
  • SlotsAvailable algorithm now includes code for scaling according to timescale and code to merge Blocks if they are adjacent.

CGDocumentManager:

  • Fix bug having to do with canceling log-in after first retry. BMX lib threw an exception which was not caught.

CGView: Many changes:

  • SlotsAvailable signature changed in CGDocument. All references to it had to be changed.
  • Opening a node in the tvSchedules by clicking on the plus sign did not select it. Code changes to make it select it.
  • UpdateStatusBar now uses a string builder; and shows a more comprehensive message on the availability in the Status Bar.
  • Focus issues on various controls.
  • Support for printing a slip after an appointment is made automatically has been added.

CustomPrinting:

  • now includes a method to print a single appointment slip

DAppointPage:

  • Checkbox to decide whether to print appt slip added.
  • New readonly property to get the appointment that has been made (of type CGAppointment).

DApptSearch:

  • StartDate and EndDate now autoadjust based on each other.
  • lblMessage added to show user message if no appointments are found.
File size: 57.9 KB
Line 
1namespace IndianHealthService.ClinicalScheduling
2{
3 using System;
4 using System.Collections;
5 using System.ComponentModel;
6 using System.Drawing;
7 using System.Globalization;
8 using System.Runtime.CompilerServices;
9 using System.Runtime.InteropServices;
10 using System.Windows.Forms;
11
12 /// <summary>
13 /// This class is reponsible for rendering the Calendar Grid.
14 /// </summary>
15 public class CalendarGrid : ScrollableControl
16 {
17 private IContainer components;
18 private Font fontArial10;
19 private Font fontArial8;
20 private CGAppointments m_Appointments;
21 private Hashtable m_ApptOverlapTable;
22 private bool m_bAutoDrag = true;
23 private bool m_bDragDropStart;
24 private bool m_bDrawWalkIns = true;
25 private bool m_bGridEnter;
26 //private bool m_bInitialUpdate;
27 private bool m_bMouseDown;
28 private bool m_bScroll;
29 private bool m_bScrollDown;
30 private bool m_bSelectingRange;
31 private int m_cellHeight;
32 private int m_cellWidth;
33 private int m_col0Width;
34 private Hashtable m_ColumnInfoTable;
35 private CGCell m_currentCell;
36 private DateTime m_dtStart;
37 private Font m_fCell;
38 private string m_GridBackColor;
39 private CGCells m_gridCells;
40 private int m_nColumns = 5;
41 private int m_nSelectID;
42 private int m_nTimeScale = 20;
43 private ArrayList m_pAvArray;
44 private string m_sDragSource;
45 private CGAppointments m_SelectedAppointments;
46 private CGRange m_selectedRange;
47 private StringFormat m_sf;
48 private StringFormat m_sfHour;
49 private StringFormat m_sfRight;
50 private ArrayList m_sResourcesArray;
51 private Timer m_Timer; // Timer used in Drag and Drop Operations
52 private ToolTip m_toolTip;
53 private const int WM_HSCROLL = 0x114; // Horizontal Scrolling Windows Message
54 private const int WM_VSCROLL = 0x115; // Vertical Scrolling Windows Message
55 private const int WM_MOUSEWHEEL = 0x20a; // Windows Mouse Scrolling Message
56 private System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
57
58
59 public delegate void CGAppointmentChangedHandler(object sender, CGAppointmentChangedArgs e);
60 public event CGAppointmentChangedHandler CGAppointmentChanged;
61 public event CGAppointmentChangedHandler CGAppointmentAdded;
62
63 public delegate void CGSelectionChangedHandler(object sender, CGSelectionChangedArgs e);
64 public event CGSelectionChangedHandler CGSelectionChanged;
65
66 public CalendarGrid()
67 {
68 this.InitializeComponent();
69 base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
70 base.SetStyle(ControlStyles.UserPaint, true);
71 base.SetStyle(ControlStyles.DoubleBuffer, true);
72 this.m_nColumns = 5;
73 this.m_gridCells = new CGCells();
74 this.m_selectedRange = new CGRange();
75 this.m_SelectedAppointments = new CGAppointments();
76 //this.m_Appointments = new CGAppointments();
77 this.m_dtStart = new DateTime(2003, 1, 27);
78 this.m_ApptOverlapTable = new Hashtable();
79 this.m_ColumnInfoTable = new Hashtable();
80 this.m_sResourcesArray = new ArrayList();
81 base.ResizeRedraw = true;
82 this.m_col0Width = 100;
83 this.fontArial8 = new Font("Arial", 8f);
84 this.fontArial10 = new Font("Arial", 10f);
85 this.m_fCell = this.fontArial10;
86 this.m_sf = new StringFormat();
87 this.m_sfRight = new StringFormat();
88 this.m_sfHour = new StringFormat();
89 this.m_sf.LineAlignment = StringAlignment.Center;
90 this.m_sfRight.LineAlignment = StringAlignment.Center;
91 this.m_sfRight.Alignment = StringAlignment.Far;
92 this.m_sfHour.LineAlignment = StringAlignment.Center;
93 this.m_sfHour.Alignment = StringAlignment.Far;
94 // this.m_bInitialUpdate = false;
95 }
96
97 private Rectangle AdjustRectForOverlap()
98 {
99 return new Rectangle();
100 }
101
102 private void AutoDragStart()
103 {
104 this.m_bAutoDrag = true;
105 this.m_Timer = new Timer();
106 this.m_Timer.Interval = 5;
107 this.m_Timer.Tick += new EventHandler(this.tickEventHandler);
108 this.m_Timer.Start();
109 }
110
111 private void AutoDragStop()
112 {
113 this.m_bAutoDrag = false;
114 if (this.m_Timer != null)
115 {
116 this.m_Timer.Stop();
117 this.m_Timer.Tick -= new EventHandler(this.tickEventHandler);
118 this.m_Timer.Dispose();
119 this.m_Timer = null;
120 }
121 }
122
123 private void BuildGridCellsArray(Graphics g)
124 {
125 try
126 {
127 SizeF ef = g.MeasureString("Test", this.m_fCell);
128 this.m_cellHeight = ((int) ef.Height) + 4;
129 int nColumns = this.m_nColumns;
130 int num2 = 60 / this.m_nTimeScale;
131 int num3 = 24 * num2;
132 nColumns++;
133 num3++;
134 this.m_cellWidth = 600 / nColumns;
135 if (base.ClientRectangle.Width > 600)
136 {
137 this.m_cellWidth = (base.ClientRectangle.Width - this.m_col0Width) / (nColumns - 1);
138 }
139 if (this.m_nColumns == 1)
140 {
141 this.m_cellWidth = base.ClientRectangle.Width - this.m_col0Width;
142 }
143 g.TranslateTransform((float) base.AutoScrollPosition.X, (float) base.AutoScrollPosition.Y);
144 for (int i = num3; i > -1; i--)
145 {
146 for (int j = 1; j < nColumns; j++)
147 {
148 int x = 0;
149 if (j == 1)
150 {
151 x = this.m_col0Width;
152 }
153 if (j > 1)
154 {
155 x = this.m_col0Width + (this.m_cellWidth * (j - 1));
156 }
157 Point point = new Point(x, i * this.m_cellHeight);
158 Rectangle r = new Rectangle(point.X, point.Y, this.m_cellWidth, this.m_cellHeight);
159 if (i != 0)
160 {
161 CGCell cell = null;
162 cell = new CGCell(r, i, j);
163 this.m_gridCells.AddCell(cell);
164 }
165 }
166 }
167 }
168 catch (Exception exception)
169 {
170 string message = exception.Message;
171 }
172 }
173
174 private void CalendarGrid_DragDrop(object Sender, DragEventArgs e)
175 {
176 CGAppointment data = (CGAppointment) e.Data.GetData(typeof(CGAppointment));
177 Point point = base.PointToClient(new Point(e.X, e.Y));
178 int x = point.X - base.AutoScrollPosition.X;
179 int y = point.Y - base.AutoScrollPosition.Y;
180 Point pt = new Point(x, y);
181 foreach (DictionaryEntry entry in this.m_gridCells.CellHashTable)
182 {
183 CGCell cgCell = (CGCell) entry.Value;
184 if (cgCell.CellRectangle.Contains(pt))
185 {
186 DateTime timeFromCell = this.GetTimeFromCell(cgCell);
187 string resourceFromColumn = this.GetResourceFromColumn(cgCell.CellColumn);
188 int duration = data.Duration;
189 TimeSpan span = new TimeSpan(0, duration, 0);
190 DateTime time2 = timeFromCell + span;
191 data.Selected = false;
192 this.m_nSelectID = 0;
193 CGAppointmentChangedArgs args = new CGAppointmentChangedArgs();
194 args.Appointment = data;
195 args.StartTime = timeFromCell;
196 args.EndTime = time2;
197 args.Resource = resourceFromColumn;
198 args.OldResource = data.Resource;
199 args.AccessTypeID = data.AccessTypeID;
200 args.Slots = data.Slots;
201 if (this.ApptDragSource == "grid")
202 {
203 this.CGAppointmentChanged(this, args);
204 }
205 else
206 {
207 this.CGAppointmentAdded(this, args);
208 }
209 break;
210 }
211 }
212 this.SetOverlapTable();
213 base.Invalidate();
214 }
215
216 private void CalendarGrid_DragEnter(object Sender, DragEventArgs e)
217 {
218 if (e.Data.GetDataPresent(typeof(CGAppointment)))
219 {
220 if ((e.KeyState & 8) == 8)
221 {
222 e.Effect = DragDropEffects.Copy;
223 }
224 else
225 {
226 e.Effect = DragDropEffects.Move;
227 }
228 }
229 else
230 {
231 e.Effect = DragDropEffects.None;
232 }
233 }
234
235 private void CalendarGrid_MouseDown(object sender, MouseEventArgs e)
236 {
237 //watch.Restart();
238 if (e.Button == MouseButtons.Left)
239 {
240 foreach (DictionaryEntry entry in this.m_gridCells.CellHashTable)
241 {
242 CGCell cell = (CGCell) entry.Value;
243 cell.IsSelected = false;
244 }
245 this.m_selectedRange.Cells.ClearAllCells();
246 this.m_bMouseDown = true;
247 this.OnLButtonDown(e.X, e.Y, true);
248 }
249 }
250
251 private void CalendarGrid_MouseMove(object Sender, MouseEventArgs e)
252 {
253 //test
254 //System.Diagnostics.Debug.Write(watch.ElapsedMilliseconds + "\n");
255 //test
256
257 //if the left mouse button is down and we are moving the mouse...
258 if (this.m_bMouseDown)
259 {
260 //if Y axis is outside the top or bottom
261 if ((e.Y >= base.ClientRectangle.Bottom) || (e.Y <= base.ClientRectangle.Top))
262 {
263 //start auto scrolling. m_bScrollDown decides whether we scroll up or down.
264 this.m_bScrollDown = e.Y >= base.ClientRectangle.Bottom;
265 AutoDragStart();
266 }
267
268 //if Y axis within client rectagle, stop dragging (whether you started or not)
269 if ((e.Y < base.ClientRectangle.Bottom) && (e.Y > base.ClientRectangle.Top))
270 {
271 AutoDragStop();
272 }
273 if (this.m_bSelectingRange)
274 {
275 this.OnLButtonDown(e.X, e.Y, false);
276 }
277 if (this.m_nSelectID != 0)
278 {
279 if (this.m_bGridEnter)
280 {
281 this.m_bGridEnter = false;
282 }
283 else if (!this.m_bDragDropStart)
284 {
285 CGAppointment data = (CGAppointment) this.m_Appointments.AppointmentTable[this.m_nSelectID];
286 this.ApptDragSource = "grid";
287 base.DoDragDrop(data, DragDropEffects.Move);
288 this.m_bDragDropStart = true;
289 }
290 }
291 }
292 else
293 {
294 //test
295 AutoDragStop(); //is this needed?
296 //test
297 int y = e.Y - base.AutoScrollPosition.Y;
298 int x = e.X - base.AutoScrollPosition.X;
299 Point pt = new Point(x, y);
300 foreach (CGAppointment appointment2 in this.m_Appointments.AppointmentTable.Values)
301 {
302 if (appointment2.GridRectangle.Contains(pt))
303 {
304 this.m_toolTip.SetToolTip(this, appointment2.ToString());
305 return;
306 }
307 }
308 this.m_toolTip.RemoveAll();
309
310 ////smh new code -- select cell
311 //int nRow = -1;
312 //int nCol = -1;
313
314 ////Is the mouse over a known cell? If so, highlight cell
315 //if (this.HitTest(x, y, ref nRow, ref nCol))
316 //{
317 // CGCell cellFromRowCol = this.m_gridCells.GetCellFromRowCol(nRow, nCol);
318 // if (cellFromRowCol != null)
319 // {
320 // this.m_currentCell = cellFromRowCol;
321 // this.m_selectedRange.StartCell = null;
322 // this.m_selectedRange.EndCell = null;
323 // this.m_selectedRange.CreateRange(this.m_gridCells, cellFromRowCol, cellFromRowCol);
324 // this.m_bSelectingRange = true;
325 // cellFromRowCol.IsSelected = true;
326 // base.Invalidate(this.m_currentCell.CellRectangle);
327 // //base.Invalidate();
328 // }
329 //}
330
331
332 }
333 }
334
335 private void CalendarGrid_MouseUp(object Sender, MouseEventArgs e)
336 {
337 if (this.m_bAutoDrag)
338 {
339 this.m_bAutoDrag = false;
340 this.AutoDragStop();
341 }
342 this.m_bMouseDown = false;
343 if (this.m_bSelectingRange)
344 {
345 CGSelectionChangedArgs args = new CGSelectionChangedArgs();
346 args.StartTime = this.GetTimeFromCell(this.m_selectedRange.StartCell);
347 args.EndTime = this.GetTimeFromCell(this.m_selectedRange.EndCell);
348 args.Resource = this.GetResourceFromColumn(this.m_selectedRange.StartCell.CellColumn);
349 if (args.EndTime < args.StartTime)
350 {
351 DateTime startTime = args.StartTime;
352 args.StartTime = args.EndTime;
353 args.EndTime = startTime;
354 }
355 TimeSpan span = new TimeSpan(0, 0, this.m_nTimeScale, 0, 0);
356 args.EndTime += span;
357 this.CGSelectionChanged(this, args);
358 this.m_bSelectingRange = false;
359 }
360 }
361
362 private void CalendarGrid_Paint(object sender, PaintEventArgs e)
363 {
364 if (e.Graphics != null)
365 {
366 this.DrawGrid(e.Graphics);
367 /*
368 if (!this.m_bInitialUpdate)
369 {
370 this.SetAppointmentTypes();
371 base.Invalidate();
372 this.m_bInitialUpdate = true;
373 }
374 */
375 }
376 }
377
378 public void CloseGrid()
379 {
380 foreach (CGAppointment appointment in this.m_Appointments.AppointmentTable.Values)
381 {
382 appointment.Selected = false;
383 }
384 this.m_nSelectID = 0;
385 }
386
387 protected override void Dispose(bool disposing)
388 {
389 if (disposing && (this.components != null))
390 {
391 this.components.Dispose();
392 }
393 base.Dispose(disposing);
394 }
395
396 private void DrawAppointments(Graphics g, int col0Width, int cellWidth, int cellHeight)
397 {
398 if (!base.DesignMode && (this.m_Appointments != null))
399 {
400 int num = 0;
401 int num2 = 0;
402 int x = 0;
403 ArrayList list = new ArrayList();
404 foreach (CGAppointment appointment in this.m_Appointments.AppointmentTable.Values)
405 {
406 bool bRet = false;
407 Rectangle rect = this.GetAppointmentRect(appointment, col0Width, cellWidth, cellHeight, out bRet);
408 if (bRet && (!appointment.WalkIn || this.m_bDrawWalkIns))
409 {
410 rect.Inflate(-10, 0);
411 num = (int) this.m_ApptOverlapTable[appointment.m_nKey];
412 num2 = rect.Right - rect.Left;
413 x = num2 / (num + 1);
414 rect.Width = x;
415 if (num > 0)
416 {
417 foreach (object obj2 in list)
418 {
419 Rectangle rectangle2 = (Rectangle) obj2;
420 if (rect.IntersectsWith(rectangle2))
421 {
422 rect.Offset(x, 0);
423 }
424 }
425 }
426 appointment.GridRectangle = rect;
427 if (appointment.Selected)
428 {
429 Pen pen = new Pen(Brushes.Black, 5f);
430 g.DrawRectangle(pen, rect);
431 pen.Dispose();
432 }
433 else
434 {
435 g.DrawRectangle(Pens.Blue, rect);
436 }
437 string s = appointment.ToString();
438 Rectangle rectangle3 = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 1, rect.Height - 1);
439 g.FillRectangle(Brushes.White, rectangle3);
440 Brush black = Brushes.Black;
441 if (appointment.CheckInTime.Ticks > 0L)
442 {
443 black = Brushes.Green;
444 g.FillRectangle(Brushes.LightGreen, rectangle3);
445 }
446 if (appointment.NoShow)
447 {
448 black = Brushes.Red;
449 g.FillRectangle(Brushes.LightPink, rectangle3);
450 }
451 if (appointment.WalkIn)
452 {
453 black = Brushes.Blue;
454 g.FillRectangle(Brushes.LightSteelBlue, rectangle3);
455 }
456 g.DrawString(s, this.fontArial8, black, rectangle3);
457 list.Add(rect);
458 }
459 }
460 }
461 }
462
463 private void DrawGrid(Graphics g)
464 {
465 //Default color of grid lines is black
466 Pen pen = new Pen(Color.Black);
467
468 //each cell's height is Height of Arial Font 10pt + 10 pixels (by default 26 pixels)
469 SizeF ef = g.MeasureString("Test", this.m_fCell);
470 int num = 10;
471 this.m_cellHeight = ((int) ef.Height) + num;
472
473 // Number of columns is dynamic based on user of Grid. See Property Columns. Default 5 in init.
474 int nColumns = this.m_nColumns;
475
476 //Time scale is also dynamic. Property TimeScale. Default 20 (minutes)
477 //num3 stands for number of cells per hour
478 int num3 = 60 / this.m_nTimeScale;
479 //num4 stands for number of cells per day (aka rows in the grid)
480 int num4 = 24 * num3;
481 //Add extra column to hold time in the left hand corner
482 nColumns++;
483 //add extra row to represent dates or resources (depending on which view we are in)
484 //Not sure of which variable controls view yet.
485 num4++;
486
487 // 100 px is reserved no matter our column sizes for displaying the time scale
488
489 // Minimum cell width is 600/columns (100 px by default)
490 this.m_cellWidth = 600 / nColumns;
491
492 // if we happen to have more than 600 pixels in our Client Window then cell
493 // is (Width-100) / (number of date columns)
494 if (base.ClientRectangle.Width > 600)
495 {
496 this.m_cellWidth = (base.ClientRectangle.Width - this.m_col0Width) / (nColumns - 1);
497 }
498
499 // If we have one column, the cell width is the itself - 100
500 if (this.m_nColumns == 1)
501 {
502 this.m_cellWidth = base.ClientRectangle.Width - this.m_col0Width;
503 }
504
505 // Our rectangle will start scrolling if width is less than 600 and height less than height of all cells comb
506 // Of course Height will scroll all the time unless you have a humungous screen
507 base.AutoScrollMinSize = new Size(600, this.m_cellHeight * num4);
508
509 // Default Rectangle is Gray
510 g.FillRectangle(Brushes.LightGray, base.ClientRectangle);
511
512 int num5 = 0; //Minutes (start at 0)
513 int num6 = 0; //Hour (starts at 0)
514
515 // flag is true only if there are no cells what so ever in the screen
516 // Only true when no resource is selected.
517 bool flag = this.m_gridCells.CellCount == 0;
518
519 // Move the base point from the client screen to the scrolling region top-left corner.
520 g.TranslateTransform((float) base.AutoScrollPosition.X, (float) base.AutoScrollPosition.Y);
521
522 // This for loop draws the time scale (although I haven't completely traced it out)
523 // For each row except the first one (i starts from 1 rather than zero)
524 for (int i = 1; i < num4; i++)
525 {
526 int x = 0;
527 //point is (0, 1st Cell Start) then (0, 2nd Cell Start) until we run out
528 Point point = new Point(x, i * this.m_cellHeight);
529 //rectangle2 represents each cell rectangle
530 Rectangle rectangle2 = new Rectangle(point.X, point.Y, this.m_cellWidth, this.m_cellHeight);
531 //rect stands for the time scale rectangle; width is 100px; Height is length of the hour on grid
532 Rectangle rect = new Rectangle(0, rectangle2.Y, this.m_col0Width, rectangle2.Height * num3);
533 //height is length of hour
534 int height = rect.Height;
535 //Min font height is 25 pixels (100/4)--see below where it's used
536 height = (height > (this.m_col0Width / 4)) ? (this.m_col0Width / 4) : height;
537
538 //if we are the top of the time scale (at hour:00) -- num5 is min
539 if (num5 == 0)
540 {
541 // Fill time scale triangle with Gray (remember, this is the whole hour!)
542 g.FillRectangle(Brushes.LightGray, rect);
543 // Draw Rectangle
544 g.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);
545 //Pad time with at least one zero to make it 2 digits
546 string str = string.Format("{0}", num6).PadLeft(2, '0');
547 //Font height using pixels. Min is 25 pixels
548 Font font = new Font("Arial", (float) height, FontStyle.Bold, GraphicsUnit.Pixel);
549 // rectangle3 is the left half of the time rectangle
550 Rectangle rectangle3 = new Rectangle(rect.X, rect.Y, rect.Width / 2, rect.Height);
551 // In this left half, draw the hours (m_sfHour is the stringformat:
552 // Horizontal Center and Right Justified to rectangle3
553 g.DrawString(str, font, Brushes.Black, rectangle3, this.m_sfHour);
554 // Increment hour
555 num6++;
556 font.Dispose();
557 }
558
559 // Pad minutes with zeros to be 2 digits long
560 string s = string.Format("{0}", num5);
561 s = ":" + s.PadLeft(2, '0');
562 // Rectangle starts at
563 // X: 2/3rds of width of Time Rectangle
564 // Y: Top of the current time slot cell
565 // Width: 1/3rd of the width of the Time Rectangle
566 // Height: Height of a time slot
567 Rectangle layoutRectangle = new Rectangle(rect.X + ((rect.Width * 2) / 3), rectangle2.Top, rect.Width / 3, rectangle2.Height);
568 // At in this rectangle, write the minutes. Horizontal Ctr and Right Justified to Rectangle
569 g.DrawString(s, this.m_fCell, Brushes.Black, layoutRectangle, this.m_sfRight);
570 // Draw Line from two points, just under the time we have just written
571 Point point2 = new Point(rect.X + ((rect.Width * 2) / 3), rectangle2.Bottom);
572 Point point3 = new Point(rect.Right, rectangle2.Bottom);
573 g.DrawLine(pen, point2, point3);
574 // Increment the minutes with the time scale
575 num5 += this.m_nTimeScale;
576 // If miniutes reaches 60, reset to zero
577 num5 = (num5 >= 60) ? 0 : num5;
578 // When we reach the bottom (num4 - 1 is # of rows) and we are not scrolling
579 if ((i == (num4 - 1)) && !this.m_bScroll)
580 {
581 // Fill the last cell with Gray (?)
582 g.TranslateTransform((float) -base.AutoScrollPosition.X, (float) -base.AutoScrollPosition.Y);
583 rect = new Rectangle(0, 0, this.m_col0Width, this.m_cellHeight);
584 g.FillRectangle(Brushes.LightGray, rect);
585 g.DrawRectangle(pen, rect);
586 g.TranslateTransform((float) base.AutoScrollPosition.X, (float) base.AutoScrollPosition.Y);
587 }
588 }
589
590 //This for loop draws the cells
591 //Start from the bottom (num4 is # of rows) and go down to the zeroth row (ie date row/resource row)
592 for (int j = num4; j > -1; j--)
593 {
594 // For each column - 1 (we start at 1, not zero-->We drew the first column anyways in the 1st loop)
595 for (int k = 1; k < nColumns; k++)
596 {
597 int num12 = 0; // X-axis position
598 if (k == 1) // If we are at the first column, start at 100px (default)
599 {
600 num12 = this.m_col0Width;
601 }
602 if (k > 1) //
603 {
604 num12 = this.m_col0Width + (this.m_cellWidth * (k - 1));
605 }
606 Point point4 = new Point(num12, j * this.m_cellHeight);
607 Rectangle r = new Rectangle(point4.X, point4.Y, this.m_cellWidth, this.m_cellHeight);
608 if (j != 0)
609 {
610 CGCell cellFromRowCol = null;
611 if (flag)
612 {
613 cellFromRowCol = new CGCell(r, j, k);
614 this.m_gridCells.AddCell(cellFromRowCol);
615 }
616 else
617 {
618 cellFromRowCol = this.m_gridCells.GetCellFromRowCol(j, k);
619 cellFromRowCol.CellRectangle = r;
620 }
621 if (this.m_sResourcesArray.Count > 0)
622 {
623 //IMP
624 //this is the place where we the selected cells are drawn in Light Light Blue.
625 //IMP
626 if (this.m_selectedRange.CellIsInRange(cellFromRowCol))
627 {
628 g.FillRectangle(Brushes.Aquamarine, r);
629 //g.FillRectangle(Brushes.AntiqueWhite, r);
630 }
631 else
632 {
633 g.FillRectangle(cellFromRowCol.AppointmentTypeColor, r);
634 }
635 g.DrawRectangle(pen, r.X, r.Y, r.Width, r.Height);
636 if (j == 1)
637 {
638 this.DrawAppointments(g, this.m_col0Width, this.m_cellWidth, this.m_cellHeight);
639 }
640 }
641 continue;
642 }
643 if (!this.m_bScroll)
644 {
645 g.TranslateTransform(0f, (float) -base.AutoScrollPosition.Y);
646 Rectangle rectangle6 = r;
647 g.FillRectangle(Brushes.LightBlue, rectangle6);
648 g.DrawRectangle(pen, rectangle6.X, rectangle6.Y, rectangle6.Width, rectangle6.Height);
649 string str3 = "";
650 if (this.m_sResourcesArray.Count > 1)
651 {
652 foreach (DictionaryEntry entry in this.m_ColumnInfoTable)
653 {
654 int num13 = (int) entry.Value;
655 num13++;
656 if (num13 == k)
657 {
658 str3 = entry.Key.ToString();
659 break;
660 }
661 }
662 }
663 else
664 {
665 DateTime dtStart = this.m_dtStart;
666 if (k > 1)
667 {
668 dtStart = dtStart.AddDays((double) (k - 1));
669 }
670 string format = "ddd, MMM d";
671 str3 = dtStart.ToString(format, DateTimeFormatInfo.InvariantInfo);
672 }
673 g.DrawString(str3, this.m_fCell, Brushes.Black, rectangle6, this.m_sf);
674 g.TranslateTransform(0f, (float) base.AutoScrollPosition.Y);
675 }
676 }
677 }
678 this.m_bScroll = false;
679 pen.Dispose();
680 }
681
682 public Rectangle GetAppointmentRect(CGAppointment a, int col0Width, int cellWidth, int cellHeight, out bool bRet)
683 {
684 DateTime startTime = a.StartTime;
685 DateTime endTime = a.EndTime;
686 string resource = a.Resource;
687 int originX = 0;
688 int originY = 0;
689 int recHeight = 0;
690 int recWidth = 0;
691 int columnToPutAppt = 0;
692 Rectangle rectangle = new Rectangle();
693 int startTotalMinutesoffset = (int) startTime.TimeOfDay.TotalMinutes;
694 int endTotalMinutesoffset = (int) endTime.TimeOfDay.TotalMinutes;
695
696 // To fix a bug with 1 day view: if the start time of appt is before Calendar Start Date, don't draw anything.
697 if (startTime < this.m_dtStart)
698 {
699 bRet = false;
700 return rectangle;
701 }
702
703 // if grid has more than one reource
704 if (this.m_sResourcesArray.Count > 1)
705 {
706 // get zero based index
707 columnToPutAppt = (int) this.m_ColumnInfoTable[resource];
708 // increment to 1 based index
709 columnToPutAppt++;
710 }
711 else
712 {
713 columnToPutAppt = (startTime - this.m_dtStart).Days + 1;
714 }
715 // this if should not get tripped; it did the same function as the new first if check.
716 //if (columnToPutAppt < 1)
717 //{
718 // bRet = false;
719 // return rectangle;
720 //}
721 originX = col0Width + (cellWidth * (columnToPutAppt - 1));
722 int num8 = startTotalMinutesoffset + this.m_nTimeScale;
723 int num9 = (endTotalMinutesoffset > 0) ? endTotalMinutesoffset : 0x5a0;
724 num9 -= startTotalMinutesoffset;
725 originY = (cellHeight * num8) / this.m_nTimeScale;
726 recHeight = (cellHeight * num9) / this.m_nTimeScale;
727 recWidth = cellWidth;
728 rectangle.X = originX;
729 rectangle.Y = originY;
730 rectangle.Width = recWidth;
731 rectangle.Height = recHeight;
732 bRet = true;
733 return rectangle;
734 }
735
736 public bool GetCellFromTime(DateTime dDate, ref int nRow, ref int nCol, bool bStartCell, string sResource)
737 {
738 int num = (dDate.Hour * 60) + dDate.Minute;
739 nRow = num / this.m_nTimeScale;
740 if (bStartCell)
741 {
742 nRow++;
743 }
744 if (this.m_sResourcesArray.Count > 1)
745 {
746 if (sResource == "")
747 {
748 sResource = this.m_sResourcesArray[0].ToString();
749 }
750 nCol = (int) this.m_ColumnInfoTable[sResource];
751 nCol++;
752 return true;
753 }
754 DateTime time = new DateTime(dDate.Year, dDate.Month, dDate.Day);
755 TimeSpan span = (TimeSpan) (time - this.StartDate);
756 int totalDays = 0;
757 totalDays = (int) span.TotalDays;
758 nCol = totalDays;
759 nCol++;
760 return true;
761 }
762
763 private string GetResourceFromColumn(int nCol)
764 {
765 if (this.m_sResourcesArray.Count == 1)
766 {
767 return this.m_sResourcesArray[0].ToString();
768 }
769 foreach (DictionaryEntry entry in this.m_ColumnInfoTable)
770 {
771 int num = (int) entry.Value;
772 num++;
773 if (num == nCol)
774 {
775 return entry.Key.ToString();
776 }
777 }
778 return "";
779 }
780
781 public bool GetSelectedTime(out DateTime dStart, out DateTime dEnd, out string sResource)
782 {
783 if (this.m_selectedRange.Cells.CellCount == 0)
784 {
785 dEnd = new DateTime();
786 dStart = dEnd;
787 sResource = "";
788 return false;
789 }
790 CGCell startCell = this.m_selectedRange.StartCell;
791 CGCell endCell = this.m_selectedRange.EndCell;
792 if (startCell.CellRow > endCell.CellRow)
793 {
794 CGCell cell3 = startCell;
795 startCell = endCell;
796 endCell = cell3;
797 }
798 dStart = this.GetTimeFromCell(startCell);
799 dEnd = this.GetTimeFromCell(endCell);
800 dEnd = dEnd.AddMinutes((double) this.m_nTimeScale);
801 sResource = this.GetResourceFromColumn(startCell.CellColumn);
802 return true;
803 }
804
805 public bool GetSelectedType(out int nAccessTypeID)
806 {
807 nAccessTypeID = 0;
808 if (this.m_selectedRange.Cells.CellCount == 0)
809 {
810 return false;
811 }
812 CGCell startCell = this.m_selectedRange.StartCell;
813 CGCell endCell = this.m_selectedRange.EndCell;
814 if (startCell.CellRow > endCell.CellRow)
815 {
816 CGCell cell3 = startCell;
817 startCell = endCell;
818 endCell = cell3;
819 }
820 DateTime timeFromCell = this.GetTimeFromCell(startCell);
821 DateTime time2 = this.GetTimeFromCell(endCell).AddMinutes((double) this.m_nTimeScale);
822 foreach (CGAvailability availability in this.m_pAvArray)
823 {
824 if (TimesOverlap(availability.StartTime, availability.EndTime, timeFromCell, time2))
825 {
826 nAccessTypeID = availability.AvailabilityType;
827 break;
828 }
829 }
830 return (nAccessTypeID > 0);
831 }
832
833 public DateTime GetTimeFromCell(CGCell cgCell)
834 {
835 int cellRow = cgCell.CellRow;
836 int cellColumn = cgCell.CellColumn;
837 DateTime dtStart = this.m_dtStart;
838 int num3 = (cellRow - 1) * this.m_nTimeScale;
839 int num4 = num3 / 60;
840 if (num4 > 0)
841 {
842 num3 = num3 % (num4 * 60);
843 }
844 dtStart = dtStart.AddHours((double) num4).AddMinutes((double) num3);
845 if (this.m_sResourcesArray.Count == 1)
846 {
847 dtStart = dtStart.AddDays((double) (cellColumn - 1));
848 }
849 return dtStart;
850 }
851
852 public bool GetTypeFromCell(CGCell cgCell, out int nAccessTypeID)
853 {
854 nAccessTypeID = 0;
855 CGCell cell = cgCell;
856 CGCell cell2 = cgCell;
857 if (cell.CellRow > cell2.CellRow)
858 {
859 CGCell cell3 = cell;
860 cell = cell2;
861 cell2 = cell3;
862 }
863 DateTime timeFromCell = this.GetTimeFromCell(cell);
864 DateTime time2 = this.GetTimeFromCell(cell2).AddMinutes((double) this.m_nTimeScale);
865 foreach (CGAvailability availability in this.m_pAvArray)
866 {
867 if (TimesOverlap(availability.StartTime, availability.EndTime, timeFromCell, time2))
868 {
869 nAccessTypeID = availability.AvailabilityType;
870 break;
871 }
872 }
873 return (nAccessTypeID > 0);
874 }
875
876 private bool HitTest(int X, int Y, ref int nRow, ref int nCol)
877 {
878 Y -= base.AutoScrollPosition.Y;
879 X -= base.AutoScrollPosition.X;
880 foreach (DictionaryEntry entry in this.m_gridCells)
881 {
882 CGCell cell = (CGCell) entry.Value;
883 if (cell.CellRectangle.Contains(X, Y))
884 {
885 nRow = cell.CellRow;
886 nCol = cell.CellColumn;
887 return true;
888 }
889 }
890 return false;
891 }
892
893 public void InitializeCalendarGrid()
894 {
895 this.AllowDrop = true;
896 }
897
898 private void InitializeComponent()
899 {
900 this.components = new System.ComponentModel.Container();
901 this.m_toolTip = new System.Windows.Forms.ToolTip(this.components);
902 this.SuspendLayout();
903 //
904 // CalendarGrid
905 //
906 this.AutoScroll = true;
907 this.AutoScrollMinSize = new System.Drawing.Size(600, 400);
908 this.BackColor = System.Drawing.SystemColors.Window;
909 this.Paint += new System.Windows.Forms.PaintEventHandler(this.CalendarGrid_Paint);
910 this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.CalendarGrid_MouseMove);
911 this.DragDrop += new System.Windows.Forms.DragEventHandler(this.CalendarGrid_DragDrop);
912 this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CalendarGrid_MouseDown);
913 this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.CalendarGrid_MouseUp);
914 this.DragEnter += new System.Windows.Forms.DragEventHandler(this.CalendarGrid_DragEnter);
915 this.ResumeLayout(false);
916
917 }
918
919 private static int MinSince80(DateTime d)
920 {
921 DateTime time = new DateTime(1980, 1, 1, 0, 0, 0);
922 TimeSpan span = (TimeSpan) (d - time);
923 return (int) span.TotalMinutes;
924 }
925
926 private void OnLButtonDown(int X, int Y, bool bStart)
927 {
928 this.m_bDragDropStart = false;
929 this.m_nSelectID = 0;
930 if (!this.m_bSelectingRange)
931 {
932 int y = Y - base.AutoScrollPosition.Y;
933 int x = X - base.AutoScrollPosition.X;
934 Point pt = new Point(x, y);
935 if (Control.ModifierKeys == Keys.Control)
936 {
937 this.m_bMouseDown = false;
938 foreach (CGAppointment appointment in this.m_Appointments.AppointmentTable.Values)
939 {
940 if (!appointment.GridRectangle.Contains(pt))
941 {
942 continue;
943 }
944 if (this.m_SelectedAppointments.AppointmentTable.ContainsKey(appointment.AppointmentKey))
945 {
946 this.m_SelectedAppointments.RemoveAppointment(appointment.AppointmentKey);
947 if (this.m_SelectedAppointments.AppointmentTable.Count == 0)
948 {
949 this.m_nSelectID = 0;
950 }
951 else
952 {
953 foreach (CGAppointment appointment2 in this.m_Appointments.AppointmentTable.Values)
954 {
955 this.m_nSelectID = appointment2.AppointmentKey;
956 }
957 }
958 }
959 else
960 {
961 this.m_SelectedAppointments.AddAppointment(appointment);
962 this.m_nSelectID = appointment.AppointmentKey;
963 }
964 appointment.Selected = !appointment.Selected;
965 break;
966 }
967 base.Invalidate();
968 return;
969 }
970 foreach (CGAppointment appointment3 in this.m_Appointments.AppointmentTable.Values)
971 {
972 if (!appointment3.GridRectangle.Contains(pt))
973 {
974 continue;
975 }
976 this.m_bMouseDown = false;
977 if (appointment3.Selected)
978 {
979 appointment3.Selected = false;
980 this.m_SelectedAppointments.ClearAllAppointments();
981 this.m_nSelectID = 0;
982 }
983 else
984 {
985 foreach (CGAppointment appointment4 in this.m_Appointments.AppointmentTable.Values)
986 {
987 appointment4.Selected = false;
988 }
989 this.m_SelectedAppointments.ClearAllAppointments();
990 this.m_SelectedAppointments.AddAppointment(appointment3);
991 appointment3.Selected = true;
992 this.m_nSelectID = appointment3.AppointmentKey;
993 this.m_bMouseDown = true;
994 this.m_bGridEnter = true;
995 }
996 base.Invalidate();
997 return;
998 }
999 }
1000 int nRow = -1;
1001 int nCol = -1;
1002 if (this.HitTest(X, Y, ref nRow, ref nCol))
1003 {
1004 CGCell cellFromRowCol = this.m_gridCells.GetCellFromRowCol(nRow, nCol);
1005 if (cellFromRowCol != null)
1006 {
1007 if (bStart)
1008 {
1009 this.m_currentCell = cellFromRowCol;
1010 this.m_selectedRange.StartCell = null;
1011 this.m_selectedRange.EndCell = null;
1012 this.m_selectedRange.CreateRange(this.m_gridCells, cellFromRowCol, cellFromRowCol);
1013 bStart = false;
1014 this.m_bMouseDown = true;
1015 this.m_bSelectingRange = true;
1016 }
1017 else if (cellFromRowCol != this.m_currentCell)
1018 {
1019 if (!this.m_selectedRange.Cells.CellHashTable.ContainsKey(cellFromRowCol.Key))
1020 {
1021 this.m_selectedRange.AppendCell(this.m_gridCells, cellFromRowCol);
1022 }
1023 else
1024 {
1025 bool bUp = cellFromRowCol.CellRow < this.m_currentCell.CellRow;
1026 this.m_selectedRange.SubtractCell(this.m_gridCells, cellFromRowCol, bUp);
1027 }
1028 this.m_currentCell = cellFromRowCol;
1029 }
1030 cellFromRowCol.IsSelected = true;
1031 base.Invalidate();
1032 }
1033 }
1034 }
1035
1036 public void OnUpdateArrays()
1037 {
1038 try
1039 {
1040 this.m_gridCells.ClearAllCells();
1041 this.SetColumnInfo();
1042 this.SetOverlapTable();
1043 Graphics g = base.CreateGraphics();
1044 this.BuildGridCellsArray(g);
1045 this.SetAppointmentTypes();
1046 }
1047 catch (Exception exception)
1048 {
1049 string message = exception.Message;
1050 }
1051 }
1052
1053 /// <summary>
1054 /// Draws Availabilities. Draws Some of the Empty cells (don't know where the rest go) with the Khaki color
1055 /// </summary>
1056 private void SetAppointmentTypes()
1057 {
1058 if (this.m_gridCells.CellCount != 0)
1059 {
1060 foreach (DictionaryEntry entry in this.m_gridCells.CellHashTable)
1061 {
1062 CGCell cell = (CGCell) entry.Value;
1063 cell.AppointmentTypeColor = (this.m_GridBackColor == "blue") ? Brushes.CornflowerBlue : Brushes.Khaki;
1064 }
1065 if ((this.m_pAvArray != null) && (this.m_pAvArray.Count != 0))
1066 {
1067 foreach (CGAvailability availability in this.m_pAvArray)
1068 {
1069 int nRow = 0;
1070 int nCol = 0;
1071 int num3 = 0;
1072 int num4 = 0;
1073 Brush brush = new SolidBrush(Color.FromArgb(availability.Red, availability.Green, availability.Blue));
1074 this.GetCellFromTime(availability.StartTime, ref nRow, ref nCol, true, availability.ResourceList);
1075 this.GetCellFromTime(availability.EndTime, ref num3, ref num4, false, availability.ResourceList);
1076 for (int i = nCol; i <= num4; i++)
1077 {
1078 for (int j = nRow; (i == num4) && (j <= num3); j++)
1079 {
1080 string str = "r" + j.ToString() + "c" + i.ToString();
1081 CGCell cell2 = (CGCell) this.m_gridCells.CellHashTable[str];
1082 if (cell2 != null)
1083 {
1084 cell2.AppointmentTypeColor = brush;
1085 }
1086 }
1087 }
1088 }
1089 }
1090 }
1091 }
1092
1093 private void SetColumnInfo()
1094 {
1095 this.m_ColumnInfoTable.Clear();
1096 for (int i = 0; i < this.m_sResourcesArray.Count; i++)
1097 {
1098 this.m_ColumnInfoTable.Add(this.m_sResourcesArray[i], i);
1099 }
1100 if (this.m_sResourcesArray.Count > 1)
1101 {
1102 this.m_nColumns = this.m_sResourcesArray.Count;
1103 }
1104 }
1105
1106 public void SetOverlapTable()
1107 {
1108 Hashtable hashtable = new Hashtable();
1109 int y = 0;
1110 int num2 = 0;
1111 int x = 0;
1112 foreach (CGAppointment appointment in this.m_Appointments.AppointmentTable.Values)
1113 {
1114 if (!appointment.WalkIn || this.m_bDrawWalkIns)
1115 {
1116 string resource = appointment.Resource;
1117 y = appointment.StartTime.Minute + (60 * appointment.StartTime.Hour);
1118 num2 = appointment.EndTime.Minute + (60 * appointment.EndTime.Hour);
1119 x = (this.m_sResourcesArray.Count > 1) ? (((int) this.m_ColumnInfoTable[resource]) + 1) : appointment.StartTime.DayOfYear;
1120 Rectangle rectangle = new Rectangle(x, y, 1, num2 - y);
1121 hashtable.Add(appointment.m_nKey, rectangle);
1122 }
1123 }
1124 this.m_ApptOverlapTable.Clear();
1125 foreach (int num4 in hashtable.Keys)
1126 {
1127 this.m_ApptOverlapTable.Add(num4, 0);
1128 }
1129 // Here it draws the Dates on Top
1130 if (this.m_ApptOverlapTable.Count != 0)
1131 {
1132 int num5 = (this.m_sResourcesArray.Count > 1) ? 1 : this.StartDate.DayOfYear;
1133 int num6 = (this.m_sResourcesArray.Count > 1) ? (this.m_sResourcesArray.Count + 1) : (this.Columns + this.StartDate.DayOfYear);
1134 for (int i = num5; i < num6; i++)
1135 {
1136 ArrayList list = new ArrayList();
1137 for (int j = 1; j < this.Rows; j++)
1138 {
1139 Rectangle rectangle2 = new Rectangle(i, j * this.m_nTimeScale, 1, this.m_nTimeScale);
1140 int num9 = -1;
1141 list.Clear();
1142 foreach (int num10 in hashtable.Keys)
1143 {
1144 Rectangle rect = (Rectangle) hashtable[num10];
1145 if (rectangle2.IntersectsWith(rect))
1146 {
1147 num9++;
1148 list.Add(num10);
1149 }
1150 }
1151 if (num9 > 0)
1152 {
1153 foreach (object obj2 in list)
1154 {
1155 int num11 = (int) obj2;
1156 if (((int) this.m_ApptOverlapTable[num11]) < num9)
1157 {
1158 this.m_ApptOverlapTable[num11] = num9;
1159 }
1160 }
1161 }
1162 }
1163 }
1164 }
1165 }
1166
1167 /// <summary>
1168 /// Handles scrolling when the mouse button is down
1169 /// </summary>
1170 /// <param name="o"></param>
1171 /// <param name="e"></param>
1172 private void tickEventHandler(object o, EventArgs e)
1173 {
1174 //if there are still WM_TIME messages in the Queue after the timer is dead, don't do anything.
1175 if (this.m_Timer == null) return;
1176
1177 Point point = new Point(base.AutoScrollPosition.X, base.AutoScrollPosition.Y);
1178 int x = point.X;
1179 int num = point.Y * -1;
1180 num = this.m_bScrollDown ? (num + 2) : (num - 2);
1181 point.Y = num;
1182 base.AutoScrollPosition = point;
1183 base.Invalidate();
1184 }
1185
1186 /// <summary>
1187 /// Do 2 time ranges overlap each other?
1188 /// </summary>
1189 /// <param name="dStart1">First Start Time</param>
1190 /// <param name="dEnd1">First End Time</param>
1191 /// <param name="dStart2">Second Start Time</param>
1192 /// <param name="dEnd2">Second End Time</param>
1193 /// <returns>True or False</returns>
1194 public static bool TimesOverlap(DateTime dStart1, DateTime dEnd1, DateTime dStart2, DateTime dEnd2)
1195 {
1196 long ticks = dEnd1.Ticks - dStart1.Ticks;
1197 TimeSpan ts = new TimeSpan(ticks);
1198 ticks = dEnd2.Ticks - dStart2.Ticks;
1199 new TimeSpan(ticks).Subtract(ts);
1200 Rectangle rect = new Rectangle();
1201 Rectangle rectangle2 = new Rectangle();
1202 rect.X = 0;
1203 rectangle2.X = 0;
1204 rect.Width = 1;
1205 rectangle2.Width = 1;
1206 rect.Y = MinSince80(dStart1);
1207 rect.Height = MinSince80(dEnd1) - rect.Y;
1208 rectangle2.Y = MinSince80(dStart2);
1209 rectangle2.Height = MinSince80(dEnd2) - rectangle2.Y;
1210 return rectangle2.IntersectsWith(rect);
1211 }
1212
1213 public void PositionGrid(int nHour)
1214 {
1215 //Position grid to nHour
1216 int nRow = 0, nCol = 0;
1217 DateTime dStart = DateTime.Today;
1218 dStart = dStart.AddHours(nHour);
1219 this.GetCellFromTime(dStart, ref nRow, ref nCol, false, "");
1220 int nHeight = this.CellHeight + 10;
1221 nHeight *= nRow;
1222 this.AutoScrollPosition = new Point(50, nHeight);
1223 this.Invalidate();
1224 }
1225
1226
1227 /// <summary>
1228 /// The purpose of this is to properly draw the date boxes at the top of the calendar grid.
1229 /// Otherwise, when scrolling, it gets garbled.
1230 /// </summary>
1231 /// <param name="msg">Handles three messages:
1232 /// WM_VSCROLL (0x115 - Vertical Scrolling)
1233 /// WM_HSCROLL (0x114 - Horizontal Scrolling)
1234 /// WM_MOUSEWHEEL (0x20a - Mouse Wheel Movement)
1235 /// </param>
1236 protected override void WndProc(ref Message msg)
1237 {
1238 try
1239 {
1240 if (msg.Msg == WM_VSCROLL || msg.Msg == WM_MOUSEWHEEL)
1241 {
1242 this.m_bScroll = true;
1243 base.Invalidate(false);
1244 this.m_bScroll = false;
1245 }
1246 if (msg.Msg == WM_HSCROLL)
1247 {
1248 base.Invalidate(false);
1249 }
1250 base.WndProc(ref msg);
1251 }
1252 catch (Exception exception)
1253 {
1254 MessageBox.Show("CalendarGrid::WndProc: " + exception.Message + "\nStack: " + exception.StackTrace);
1255 }
1256 }
1257
1258 public CGAppointments Appointments
1259 {
1260 get
1261 {
1262 return this.m_Appointments;
1263 }
1264 set
1265 {
1266 this.m_Appointments = value;
1267 }
1268 }
1269
1270 public string ApptDragSource
1271 {
1272 get
1273 {
1274 return this.m_sDragSource;
1275 }
1276 set
1277 {
1278 this.m_sDragSource = value;
1279 }
1280 }
1281
1282 public ArrayList AvailabilityArray
1283 {
1284 get
1285 {
1286 return this.m_pAvArray;
1287 }
1288 set
1289 {
1290 this.m_pAvArray = value;
1291 }
1292 }
1293
1294 public int CellHeight
1295 {
1296 get
1297 {
1298 return this.m_cellHeight;
1299 }
1300 }
1301
1302 public ToolTip CGToolTip
1303 {
1304 get
1305 {
1306 return this.m_toolTip;
1307 }
1308 }
1309
1310 public int Columns
1311 {
1312 get
1313 {
1314 return this.m_nColumns;
1315 }
1316 set
1317 {
1318 if ((value > 0) && (value < 11))
1319 {
1320 this.m_nColumns = value;
1321 this.m_gridCells.ClearAllCells();
1322 this.m_selectedRange.Cells.ClearAllCells();
1323 Graphics g = base.CreateGraphics();
1324 this.BuildGridCellsArray(g);
1325 this.SetAppointmentTypes();
1326 base.Invalidate();
1327 }
1328 }
1329 }
1330
1331 public bool DrawWalkIns
1332 {
1333 get
1334 {
1335 return this.m_bDrawWalkIns;
1336 }
1337 set
1338 {
1339 this.m_bDrawWalkIns = value;
1340 }
1341 }
1342
1343 public string GridBackColor
1344 {
1345 get
1346 {
1347 return this.m_GridBackColor;
1348 }
1349 set
1350 {
1351 this.m_GridBackColor = value;
1352 }
1353 }
1354
1355 public bool GridEnter
1356 {
1357 get
1358 {
1359 return this.m_bGridEnter;
1360 }
1361 set
1362 {
1363 this.m_bGridEnter = value;
1364 }
1365 }
1366
1367 public ArrayList Resources
1368 {
1369 get
1370 {
1371 return this.m_sResourcesArray;
1372 }
1373 set
1374 {
1375 this.m_sResourcesArray = value;
1376 }
1377 }
1378
1379 public int Rows
1380 {
1381 get
1382 {
1383 return (0x5a0 / this.m_nTimeScale);
1384 }
1385 }
1386
1387 public int SelectedAppointment
1388 {
1389 get
1390 {
1391 return this.m_nSelectID;
1392 }
1393 set
1394 {
1395 this.m_nSelectID = value;
1396 }
1397 }
1398
1399 public CGAppointments SelectedAppointments
1400 {
1401 get
1402 {
1403 return this.m_SelectedAppointments;
1404 }
1405 }
1406
1407 public CGRange SelectedRange
1408 {
1409 get
1410 {
1411 return this.m_selectedRange;
1412 }
1413 }
1414
1415 public DateTime StartDate
1416 {
1417 get
1418 {
1419 return this.m_dtStart;
1420 }
1421 set
1422 {
1423 this.m_dtStart = value;
1424 }
1425 }
1426
1427 public int TimeScale
1428 {
1429 get
1430 {
1431 return this.m_nTimeScale;
1432 }
1433 set
1434 {
1435 if ((((value == 5) || (value == 10)) || ((value == 15) || (value == 20))) || ((value == 30) || (value == 60)))
1436 {
1437 this.m_nTimeScale = value;
1438 this.m_gridCells.ClearAllCells();
1439 this.m_selectedRange.Cells.ClearAllCells();
1440 Graphics g = base.CreateGraphics();
1441 this.BuildGridCellsArray(g);
1442 this.SetAppointmentTypes();
1443 base.Invalidate();
1444 }
1445 }
1446 }
1447
1448 }
1449}
1450
Note: See TracBrowser for help on using the repository browser.