CGView: Refactor PositionGrid into CalendarGrid.

This commit is contained in:
sam 2011-01-17 14:25:48 +00:00
parent b2d2f1beca
commit 0c195fe52e
1 changed files with 10 additions and 23 deletions

View File

@ -12,7 +12,7 @@ using IndianHealthService.BMXNet;
namespace IndianHealthService.ClinicalScheduling namespace IndianHealthService.ClinicalScheduling
{ {
/// <summary> /// <summary>
/// Summary description for CGView. /// Main Form: Shows Tree of Clinics and Calendar Grid
/// </summary> /// </summary>
public class CGView : System.Windows.Forms.Form public class CGView : System.Windows.Forms.Form
{ {
@ -819,9 +819,9 @@ namespace IndianHealthService.ClinicalScheduling
this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0); this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
this.calendarGrid1.TabIndex = 0; this.calendarGrid1.TabIndex = 0;
this.calendarGrid1.TimeScale = 20; this.calendarGrid1.TimeScale = 20;
this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded); this.calendarGrid1.CGAppointmentAdded += new CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded);
this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged); this.calendarGrid1.CGAppointmentChanged += new CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged);
this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged); this.calendarGrid1.CGSelectionChanged += new CalendarGrid.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged);
this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick); this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick);
// //
// ctxCalendarGrid // ctxCalendarGrid
@ -1482,7 +1482,7 @@ namespace IndianHealthService.ClinicalScheduling
cg.TimeScale = nScale; cg.TimeScale = nScale;
//Position grid to 0700 //Position grid to 0700
PositionGrid(cg, 7); cg.PositionGrid(7);
} }
} }
catch (Exception ex) catch (Exception ex)
@ -1572,7 +1572,7 @@ namespace IndianHealthService.ClinicalScheduling
cg.TimeScale = nScale; cg.TimeScale = nScale;
PositionGrid(cg, 7); cg.PositionGrid(7);
//Get the OverBook and ModifySchedule permissions from ResourceUser table //Get the OverBook and ModifySchedule permissions from ResourceUser table
//and populate the hashtables //and populate the hashtables
@ -1621,19 +1621,6 @@ namespace IndianHealthService.ClinicalScheduling
} }
} }
private void PositionGrid(CalendarGrid cg, int nHour)
{
//Position grid to nHour
int nRow = 0, nCol = 0;
DateTime dStart = DateTime.Today;
dStart = dStart.AddHours(nHour);
cg.GetCellFromTime(dStart, ref nRow, ref nCol, false, "");
int nHeight = cg.CellHeight + 10;
nHeight *= nRow;
cg.AutoScrollPosition = new Point(50, nHeight);
cg.Invalidate();
}
private void LoadTree() private void LoadTree()
{ {
//Navigate from ResourceGroup table to Resources table //Navigate from ResourceGroup table to Resources table
@ -2428,28 +2415,28 @@ namespace IndianHealthService.ClinicalScheduling
{ {
CalendarGrid cg = this.calendarGrid1; CalendarGrid cg = this.calendarGrid1;
cg.TimeScale = 10; cg.TimeScale = 10;
PositionGrid(cg, 7); cg.PositionGrid(7);
} }
private void mnu15Minute_Click(object sender, System.EventArgs e) private void mnu15Minute_Click(object sender, System.EventArgs e)
{ {
CalendarGrid cg = this.calendarGrid1; CalendarGrid cg = this.calendarGrid1;
cg.TimeScale = 15; cg.TimeScale = 15;
PositionGrid(cg, 7); cg.PositionGrid(7);
} }
private void mnu20Minute_Click(object sender, System.EventArgs e) private void mnu20Minute_Click(object sender, System.EventArgs e)
{ {
CalendarGrid cg = this.calendarGrid1; CalendarGrid cg = this.calendarGrid1;
cg.TimeScale = 20; cg.TimeScale = 20;
PositionGrid(cg, 7); cg.PositionGrid(7);
} }
private void mnu30Minute_Click(object sender, System.EventArgs e) private void mnu30Minute_Click(object sender, System.EventArgs e)
{ {
CalendarGrid cg = this.calendarGrid1; CalendarGrid cg = this.calendarGrid1;
cg.TimeScale = 30; cg.TimeScale = 30;
PositionGrid(cg, 7); cg.PositionGrid(7);
} }
private void mnuViewScheduleTree_Click(object sender, System.EventArgs e) private void mnuViewScheduleTree_Click(object sender, System.EventArgs e)