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

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

New exe and dll
calendarGrid: Minor documentation updates.
CGAppointments: Object now supports Deep cloning
CGDocument:

  1. Major changes on how m_pAvArrays is handled. Now it is locked whenever it is updated or queried. Some refactoring to make sure there are no db calls during the locks so that the locks won't be expensive.
  2. Removed ClearResources, an unused method.
  3. Appointment aCopy walkin property is set to true if the appointment is a walkin. This makes sure that the grid draws it correctly between it is added to the appointment array and we fetch new data from the server.
  4. Create appointment is not responsible anymore for requesting updates from the server. All requests to update data must be done through CGView, as it is the only party interested in displaying accurate data on the grid. Just send the create appt event to the server.
  5. CheckInAppointment: Same thing. Now responsible for requesting updates from the server. Just send the checkin event to the server.

CGDocumentManager: Removed tracing. Done in BMX Library only now.
CGView:

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