Changeset 1070 for Scheduling
- Timestamp:
- Jan 18, 2011, 9:15:22 AM (14 years ago)
- Location:
- Scheduling/trunk/cs/bsdx0200GUISourceCode
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs
r1065 r1070 113 113 { 114 114 this.m_dSelectedDate = value; 115 bool bRet = false;116 if (m_sResourcesArray.Count == 1)117 {118 bRet = this.WeekNeedsRefresh(1, m_dSelectedDate, out this.m_dStartDate, out this.m_dEndDate);119 }120 else121 {122 this.m_dStartDate = m_dSelectedDate;123 this.m_dEndDate = m_dSelectedDate;124 this.m_dEndDate = this.m_dEndDate.AddHours(23);125 this.m_dEndDate = this.m_dEndDate.AddMinutes(59);126 this.m_dEndDate = this.m_dEndDate.AddSeconds(59);127 }128 129 bRet = RefreshSchedule();130 115 } 131 116 } … … 303 288 } 304 289 305 p rivate void SetDate(DateTime dDate)306 { 307 308 if (m_ScheduleType == ScheduleType.Resource)309 310 bRet = this.WeekNeedsRefresh(2,dDate, out this.m_dStartDate, out this.m_dEndDate);311 312 313 314 this.m_dStartDate =dDate;315 this.m_dEndDate =dDate;316 317 318 319 290 public void RefreshDocument() 291 { 292 bool bRet = false; 293 if (m_sResourcesArray.Count == 1) 294 { 295 bRet = this.WeekNeedsRefresh(1, m_dSelectedDate, out this.m_dStartDate, out this.m_dEndDate); 296 } 297 else 298 { 299 this.m_dStartDate = m_dSelectedDate; 300 this.m_dEndDate = m_dSelectedDate; 301 this.m_dEndDate = this.m_dEndDate.AddHours(23); 302 this.m_dEndDate = this.m_dEndDate.AddMinutes(59); 303 this.m_dEndDate = this.m_dEndDate.AddSeconds(59); 304 } 320 305 321 306 bRet = RefreshSchedule(); 322 this.UpdateAllViews();323 }324 325 public void RefreshDocument()326 {327 bool bRet = RefreshSchedule();328 307 this.UpdateAllViews(); 329 308 } … … 356 335 CGView view = null; 357 336 //If this document already has a view, the use it 337 //SAM: Why do this again??? 358 338 Hashtable h = CGDocumentManager.Current.Views; 359 339 CGDocument d; … … 590 570 //TODO: Test that resource is not currently in list, that it IS a resource, etc 591 571 this.m_sResourcesArray.Add(sResource); 592 // UpdateAllViews: Redraws all the open views. But does not call server.593 this.UpdateAllViews();572 //SAM: removing: Remove UpdateAllViews: Redraws all the open views. But does not call server. 573 //this.UpdateAllViews(); 594 574 } 595 575 -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs
r1065 r1070 198 198 199 199 //Create the first empty document 200 //SAM: Good place for break point 200 201 CGDocument doc = new CGDocument(); 201 202 doc.DocManager = _current; … … 281 282 #region Methods & Events 282 283 283 284 private void StartSplash(object form)285 {286 ((DSplash)form).ShowDialog();287 }288 289 284 /// <summary> 290 285 /// See InitializeApp(bool) below … … 325 320 326 321 //Start new thread for the Splash screen. 327 Thread threadSplash = new Thread(new ParameterizedThreadStart( StartSplash));322 Thread threadSplash = new Thread(new ParameterizedThreadStart(frm => ((DSplash)frm).ShowDialog())); 328 323 threadSplash.IsBackground = true; //expendable thread -- exit even if still running. 329 324 threadSplash.Name = "Splash Thread"; -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs
r1069 r1070 651 651 this.tvSchedules.Sorted = true; 652 652 this.tvSchedules.TabIndex = 1; 653 this.tvSchedules.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvSchedules_BeforeSelect);654 653 this.tvSchedules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSchedules_AfterSelect); 655 654 this.tvSchedules.Click += new System.EventHandler(this.tvSchedules_Click); … … 820 819 this.calendarGrid1.TabIndex = 0; 821 820 this.calendarGrid1.TimeScale = 20; 822 this.calendarGrid1.CGAppointment Added += new CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded);823 this.calendarGrid1.CGAppointment Changed += new CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged);824 this.calendarGrid1.CGSelectionChanged += new CalendarGrid.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged);821 this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged); 822 this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded); 823 this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged); 825 824 this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick); 826 825 // … … 1494 1493 } 1495 1494 1496 1495 /// <summary> 1496 /// Opens a view of the Schedule a user requested to open at a specific date 1497 /// </summary> 1498 /// <param name="sSelectedTreeResourceArray">A set of resources to open (?pending more investigation)</param> 1499 /// <param name="dDate">Date at which to show the Grid</param> 1497 1500 private void OpenSelectedSchedule(ArrayList sSelectedTreeResourceArray, DateTime dDate) 1498 1501 { 1499 1502 //If resource already open, then navigate to its window 1500 //XXX: Why is this doc definition here? Should be under else scope1501 //XXX: Use Bananna peeling instead of if/else1502 CGDocument doc;1503 1503 CGView v =this.DocManager.GetViewByResource(sSelectedTreeResourceArray); 1504 1504 if (v != null) … … 1506 1506 v.Activate(); 1507 1507 v.dateTimePicker1.Value = dDate; 1508 return; 1509 } 1510 1511 //If this Document has no resources then use it (happens when the GUI has nothing open, typically after log-in) 1512 //Else, create a new document 1513 CGDocument doc; 1514 if (this.Document.m_sResourcesArray.Count == 0) 1515 { 1516 doc = this.Document; 1508 1517 } 1509 1518 else 1510 1519 { 1511 //If not already open, open it 1512 //If current document has a resource, then open a new window 1513 //with the selected resource. 1514 //Otherwise just use the current document. 1515 if (this.Document.m_sResourcesArray.Count > 0) 1516 { 1517 doc = new CGDocument(); 1518 doc.DocManager = this.DocManager; 1519 } 1520 else 1521 { 1522 doc = this.Document; 1523 } 1524 for (int j=0; j < sSelectedTreeResourceArray.Count; j++) 1525 { 1526 // Investigate this. This draws the grid when there is nothing to draw!!! 1527 doc.AddResource((string) sSelectedTreeResourceArray[j]); 1528 } 1529 1530 doc.DocName = this.m_sDocName; 1520 doc = new CGDocument(); 1521 doc.DocManager = this.DocManager; 1522 } 1523 1524 //Add resources to Document 1525 for (int j=0; j < sSelectedTreeResourceArray.Count; j++) 1526 { 1527 doc.AddResource((string) sSelectedTreeResourceArray[j]); 1528 } 1529 1530 doc.DocName = this.m_sDocName; 1531 1531 1532 1533 1534 1535 1532 try 1533 { 1534 doc.OnOpenDocument(); 1535 } 1536 1536 1537 catch (Exception ex) 1538 { 1539 MessageBox.Show("Unable to open " + m_sDocName + " schedule. " + ex.Message, "Clinical Scheduling"); 1540 this.m_DocManager.CloseAllViews(doc); 1541 return; 1542 } 1543 v =this.DocManager.GetViewByResource(sSelectedTreeResourceArray); 1544 v.dateTimePicker1.Value = dDate; 1545 1546 //Get preferred time scale from resource info 1547 //If more than one resource, get smallest time scale 1548 CalendarGrid cg = v.CGrid; 1549 DataTable dt = this.DocManager.GlobalDataSet.Tables["Resources"]; 1550 DataView dv = new DataView(dt, "", "RESOURCE_NAME ASC", DataViewRowState.OriginalRows); 1551 int nScale = 60; 1552 int nTest=0; 1553 string sResource; 1554 int nDataRow; 1555 DataRowView drv; 1556 for (int j=0; j < sSelectedTreeResourceArray.Count; j++) 1557 { 1558 sResource = (string) sSelectedTreeResourceArray[j]; 1559 nDataRow = dv.Find(sResource); 1560 Debug.Assert(nDataRow != -1); 1561 drv = dv[nDataRow]; 1562 if (drv["TIMESCALE"].ToString() == "") 1563 { 1564 nTest = 15; //15 minute default 1565 } 1566 else 1567 { 1568 nTest = (int) drv["TIMESCALE"]; 1569 } 1570 nScale = (nTest < nScale)?nTest : nScale ; 1571 } 1572 1573 cg.TimeScale = nScale; 1574 1575 cg.PositionGrid(7); 1576 1577 //Get the OverBook and ModifySchedule permissions from ResourceUser table 1578 //and populate the hashtables 1579 string sOverbook; 1580 string sModSchedule; 1581 string sModAppts; 1582 bool bOverbook; 1583 bool bModSchedule; 1584 bool bModAppts; 1585 v.m_htOverbook = new Hashtable(sSelectedTreeResourceArray.Count); 1586 v.m_htModifySchedule = new Hashtable(sSelectedTreeResourceArray.Count); 1587 v.m_htChangeAppts = new Hashtable(sSelectedTreeResourceArray.Count); 1588 dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"]; 1589 dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows); 1590 dv.RowFilter = "USERNAME = '" + this.DocManager.ConnectInfo.UserName + "'"; 1591 for (int j=0; j < dv.Count; j++) 1592 { 1593 drv = dv[j]; 1594 sResource = drv["RESOURCENAME"].ToString(); 1595 sOverbook = drv["OVERBOOK"].ToString(); 1596 bOverbook = (sOverbook == "YES")?true:false; 1597 sModSchedule = drv["MODIFY_SCHEDULE"].ToString(); 1598 bModSchedule = (sModSchedule == "YES")?true:false; 1599 sModAppts = drv["MODIFY_APPOINTMENTS"].ToString(); 1600 bModAppts = (sModAppts == "YES")?true:false; 1601 v.m_htOverbook[sResource] = bOverbook; 1602 v.m_htModifySchedule[sResource] = bModSchedule; 1603 v.m_htChangeAppts[sResource] = bModAppts; 1604 } 1605 1606 //For programmers and scheduling managers, set all permissions for all resources 1607 if (this.DocManager.ScheduleManager == true) 1608 { 1609 dt = this.DocManager.GlobalDataSet.Tables["Resources"]; 1610 foreach (DataRow dr in dt.Rows) 1611 { 1612 sResource = dr["RESOURCE_NAME"].ToString(); 1613 v.m_htOverbook[sResource] = true; 1614 v.m_htModifySchedule[sResource] = true; 1615 v.m_htChangeAppts[sResource] = true; 1616 } 1617 } 1618 1619 v.calendarGrid1.SetOverlapTable(); 1620 v.calendarGrid1.Refresh(); 1621 } 1537 catch (Exception ex) 1538 { 1539 MessageBox.Show("Unable to open " + m_sDocName + " schedule. " + ex.Message, "Clinical Scheduling"); 1540 this.m_DocManager.CloseAllViews(doc); 1541 return; 1542 } 1543 1544 //We are doing this--Again? 1545 v =this.DocManager.GetViewByResource(sSelectedTreeResourceArray); 1546 v.dateTimePicker1.Value = dDate; 1547 1548 //Get preferred time scale from resource info 1549 //If more than one resource, get smallest time scale 1550 CalendarGrid cg = v.CGrid; 1551 DataTable dt = this.DocManager.GlobalDataSet.Tables["Resources"]; 1552 DataView dv = new DataView(dt, "", "RESOURCE_NAME ASC", DataViewRowState.OriginalRows); 1553 int nScale = 60; 1554 int nTest=0; 1555 string sResource; 1556 int nDataRow; 1557 DataRowView drv; 1558 for (int j=0; j < sSelectedTreeResourceArray.Count; j++) 1559 { 1560 sResource = (string) sSelectedTreeResourceArray[j]; 1561 nDataRow = dv.Find(sResource); 1562 Debug.Assert(nDataRow != -1); 1563 drv = dv[nDataRow]; 1564 if (drv["TIMESCALE"].ToString() == "") 1565 { 1566 nTest = 15; //15 minute default 1567 } 1568 else 1569 { 1570 nTest = (int) drv["TIMESCALE"]; 1571 } 1572 nScale = (nTest < nScale)?nTest : nScale ; 1573 } 1574 1575 cg.TimeScale = nScale; 1576 1577 cg.PositionGrid(7); 1578 1579 //Get the OverBook and ModifySchedule permissions from ResourceUser table 1580 //and populate the hashtables 1581 string sOverbook; 1582 string sModSchedule; 1583 string sModAppts; 1584 bool bOverbook; 1585 bool bModSchedule; 1586 bool bModAppts; 1587 v.m_htOverbook = new Hashtable(sSelectedTreeResourceArray.Count); 1588 v.m_htModifySchedule = new Hashtable(sSelectedTreeResourceArray.Count); 1589 v.m_htChangeAppts = new Hashtable(sSelectedTreeResourceArray.Count); 1590 dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"]; 1591 dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows); 1592 dv.RowFilter = "USERNAME = '" + this.DocManager.ConnectInfo.UserName + "'"; 1593 for (int j=0; j < dv.Count; j++) 1594 { 1595 drv = dv[j]; 1596 sResource = drv["RESOURCENAME"].ToString(); 1597 sOverbook = drv["OVERBOOK"].ToString(); 1598 bOverbook = (sOverbook == "YES")?true:false; 1599 sModSchedule = drv["MODIFY_SCHEDULE"].ToString(); 1600 bModSchedule = (sModSchedule == "YES")?true:false; 1601 sModAppts = drv["MODIFY_APPOINTMENTS"].ToString(); 1602 bModAppts = (sModAppts == "YES")?true:false; 1603 v.m_htOverbook[sResource] = bOverbook; 1604 v.m_htModifySchedule[sResource] = bModSchedule; 1605 v.m_htChangeAppts[sResource] = bModAppts; 1606 } 1607 1608 //For programmers and scheduling managers, set all permissions for all resources 1609 if (this.DocManager.ScheduleManager == true) 1610 { 1611 dt = this.DocManager.GlobalDataSet.Tables["Resources"]; 1612 foreach (DataRow dr in dt.Rows) 1613 { 1614 sResource = dr["RESOURCE_NAME"].ToString(); 1615 v.m_htOverbook[sResource] = true; 1616 v.m_htModifySchedule[sResource] = true; 1617 v.m_htChangeAppts[sResource] = true; 1618 } 1619 } 1620 1621 v.calendarGrid1.SetOverlapTable(); 1622 v.calendarGrid1.Refresh(); 1622 1623 } 1623 1624 … … 2491 2492 } 2492 2493 2493 private void tvSchedules_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)2494 {2495 2496 }2497 2498 2494 private void tvSchedules_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) 2499 2495 { … … 3095 3091 void RequestRefreshGrid() 3096 3092 { 3097 DateTime dDate = dateTimePicker1.Value; 3098 dDate = dDate.Date; 3099 // This below is responsible for redrawing the grid when you change the date. 3093 DateTime dDate = dateTimePicker1.Value.Date; 3094 // Change Date on Document 3100 3095 this.Document.SelectedDate = dDate; 3096 3097 //Splash when loading and change Cursor 3098 this.Cursor = Cursors.WaitCursor; 3099 LoadSplash(); 3100 3101 this.Cursor = Cursors.Default; 3102 this.Document.RefreshDocument(); 3101 3103 3102 3104 if (this.Document.Resources.Count == 1) … … 3115 3117 this.StartDate = this.Document.SelectedDate; 3116 3118 } 3117 //Is this needed? 3119 3120 //Is this needed? -- Yes it is. There is a bug in the drawing code for the calendar 3121 //First time it draws, it draws appointments, but not availability slots 3122 //Second time it draws, it both appointments and availabilites 3123 //XXX: Need to investigate 3118 3124 this.Document.UpdateAllViews(); 3119 //Is this needed? 3120 this.calendarGrid1.Invalidate(); 3125 3126 StopSplash(); 3127 this.Cursor = Cursors.Default; 3128 } 3129 3130 LoadingSplash _loadingSplash; // Splash object a data point in class 3131 3132 /// <summary> 3133 /// Loads a splash that says "Loading" 3134 /// </summary> 3135 private void LoadSplash() 3136 { 3137 _loadingSplash = new LoadingSplash(); 3138 _loadingSplash.StartPosition = FormStartPosition.CenterScreen; //XXX: Don't like this, but will do for now. 3139 _loadingSplash.UseWaitCursor = true; // tell user we are working 3140 Thread threadSplash = new Thread(new ThreadStart(() => _loadingSplash.ShowDialog())); // lambda 3141 threadSplash.IsBackground = true; //expendable thread -- exit even if still running. 3142 threadSplash.Name = "Loading Thread"; 3143 threadSplash.Start(); 3144 } 3145 3146 private void StopSplash() 3147 { 3148 _loadingSplash.RemoteClose(); 3121 3149 } 3122 3150 -
Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj
r1065 r1070 67 67 <ConfigurationOverrideFile> 68 68 </ConfigurationOverrideFile> 69 <DefineConstants> TRACE;DEBUG</DefineConstants>69 <DefineConstants>DEBUG;TRACE</DefineConstants> 70 70 <DocumentationFile> 71 71 </DocumentationFile> … … 178 178 <Compile Include="CGAppointment.cs" /> 179 179 <Compile Include="CGAppointmentChangedArgs.cs" /> 180 <Compile Include="CGAppointmentChangedHandler.cs" />181 180 <Compile Include="CGAppointments.cs" /> 182 181 <Compile Include="CGAvailability.cs" /> … … 199 198 </Compile> 200 199 <Compile Include="CGSelectionChangedArgs.cs" /> 201 <Compile Include="CGSelectionChangedHandler.cs" />202 200 <Compile Include="CGView.cs"> 203 201 <SubType>Form</SubType> … … 296 294 <DependentUpon>DMassSlotDelete.cs</DependentUpon> 297 295 </Compile> 296 <Compile Include="LoadingSplash.cs"> 297 <SubType>Form</SubType> 298 </Compile> 299 <Compile Include="LoadingSplash.Designer.cs"> 300 <DependentUpon>LoadingSplash.cs</DependentUpon> 301 </Compile> 298 302 <Compile Include="Options.cs" /> 299 303 <Compile Include="Printing.cs" /> … … 402 406 <DependentUpon>DSplash.cs</DependentUpon> 403 407 <SubType>Designer</SubType> 408 </EmbeddedResource> 409 <EmbeddedResource Include="LoadingSplash.resx"> 410 <DependentUpon>LoadingSplash.cs</DependentUpon> 404 411 </EmbeddedResource> 405 412 <EmbeddedResource Include="UCPatientAppts.resx"> -
Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user
r1062 r1070 37 37 </RemoteDebugMachine> 38 38 <StartAction>Project</StartAction> 39 <StartArguments>/s=172.16.16.108 /p=9250 /a=abeer12 /v=abc,4321</StartArguments> 39 <StartArguments> 40 </StartArguments> 40 41 <StartPage> 41 42 </StartPage> … … 56 57 </RemoteDebugMachine> 57 58 <StartAction>Project</StartAction> 58 <StartArguments>/s=172.16.17.51 /p=9260 /a=shabiel12 /v=abc,123!</StartArguments> 59 <StartArguments> 60 </StartArguments> 59 61 <StartPage> 60 62 </StartPage>
Note:
See TracChangeset
for help on using the changeset viewer.