Ignore:
Timestamp:
Mar 20, 2011, 3:22:11 AM (13 years ago)
Author:
Sam Habiel
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs

    r1097 r1106  
    617617            this.tvSchedules.Location = new System.Drawing.Point(0, 0);
    618618            this.tvSchedules.Name = "tvSchedules";
    619             this.tvSchedules.Size = new System.Drawing.Size(128, 358);
     619            this.tvSchedules.Size = new System.Drawing.Size(128, 393);
    620620            this.tvSchedules.Sorted = true;
    621621            this.tvSchedules.TabIndex = 1;
    622622            this.tvSchedules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSchedules_AfterSelect);
    623             this.tvSchedules.Click += new System.EventHandler(this.tvSchedules_Click);
     623            this.tvSchedules.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvSchedules_NodeMouseClick);
    624624            this.tvSchedules.DoubleClick += new System.EventHandler(this.tvSchedules_DoubleClick);
     625            this.tvSchedules.MouseEnter += new System.EventHandler(this.tvSchedules_MouseEnter);
    625626            //
    626627            // contextMenu1
     
    662663            this.panelRight.Controls.Add(this.panelClip);
    663664            this.panelRight.Dock = System.Windows.Forms.DockStyle.Right;
    664             this.panelRight.Location = new System.Drawing.Point(941, 0);
     665            this.panelRight.Location = new System.Drawing.Point(996, 0);
    665666            this.panelRight.Name = "panelRight";
    666             this.panelRight.Size = new System.Drawing.Size(128, 358);
     667            this.panelRight.Size = new System.Drawing.Size(128, 393);
    667668            this.panelRight.TabIndex = 3;
    668669            this.panelRight.Visible = false;
     
    730731            this.panelTop.Location = new System.Drawing.Point(128, 0);
    731732            this.panelTop.Name = "panelTop";
    732             this.panelTop.Size = new System.Drawing.Size(813, 24);
     733            this.panelTop.Size = new System.Drawing.Size(868, 24);
    733734            this.panelTop.TabIndex = 6;
    734735            //
     
    737738            this.dateTimePicker1.Dock = System.Windows.Forms.DockStyle.Right;
    738739            this.dateTimePicker1.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right;
    739             this.dateTimePicker1.Location = new System.Drawing.Point(607, 0);
     740            this.dateTimePicker1.Location = new System.Drawing.Point(662, 0);
    740741            this.dateTimePicker1.Name = "dateTimePicker1";
    741742            this.dateTimePicker1.Size = new System.Drawing.Size(206, 20);
     
    760761            this.panelCenter.Location = new System.Drawing.Point(136, 24);
    761762            this.panelCenter.Name = "panelCenter";
    762             this.panelCenter.Size = new System.Drawing.Size(802, 310);
     763            this.panelCenter.Size = new System.Drawing.Size(857, 345);
    763764            this.panelCenter.TabIndex = 7;
    764765            //
     
    846847            this.panelBottom.Controls.Add(this.statusBar1);
    847848            this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
    848             this.panelBottom.Location = new System.Drawing.Point(136, 334);
     849            this.panelBottom.Location = new System.Drawing.Point(136, 369);
    849850            this.panelBottom.Name = "panelBottom";
    850             this.panelBottom.Size = new System.Drawing.Size(802, 24);
     851            this.panelBottom.Size = new System.Drawing.Size(857, 24);
    851852            this.panelBottom.TabIndex = 8;
    852853            //
     
    856857            this.statusBar1.Location = new System.Drawing.Point(0, 0);
    857858            this.statusBar1.Name = "statusBar1";
    858             this.statusBar1.Size = new System.Drawing.Size(802, 24);
     859            this.statusBar1.Size = new System.Drawing.Size(857, 24);
    859860            this.statusBar1.SizingGrip = false;
    860861            this.statusBar1.TabIndex = 0;
     
    864865            this.splitter1.Location = new System.Drawing.Point(128, 24);
    865866            this.splitter1.Name = "splitter1";
    866             this.splitter1.Size = new System.Drawing.Size(8, 334);
     867            this.splitter1.Size = new System.Drawing.Size(8, 369);
    867868            this.splitter1.TabIndex = 9;
    868869            this.splitter1.TabStop = false;
     
    871872            //
    872873            this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
    873             this.splitter2.Location = new System.Drawing.Point(938, 24);
     874            this.splitter2.Location = new System.Drawing.Point(993, 24);
    874875            this.splitter2.Name = "splitter2";
    875             this.splitter2.Size = new System.Drawing.Size(3, 334);
     876            this.splitter2.Size = new System.Drawing.Size(3, 369);
    876877            this.splitter2.TabIndex = 10;
    877878            this.splitter2.TabStop = false;
     
    901902            this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources")));
    902903            this.calendarGrid1.SelectedAppointment = 0;
    903             this.calendarGrid1.Size = new System.Drawing.Size(802, 310);
     904            this.calendarGrid1.Size = new System.Drawing.Size(857, 345);
    904905            this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
    905906            this.calendarGrid1.TabIndex = 0;
     
    914915            //
    915916            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    916             this.ClientSize = new System.Drawing.Size(1069, 358);
     917            this.ClientSize = new System.Drawing.Size(1124, 393);
    917918            this.Controls.Add(this.panelCenter);
    918919            this.Controls.Add(this.panelBottom);
     
    946947                private CGDocumentManager       m_DocManager;
    947948                private int                                     m_nSlots;
    948                 bool                                            bSchedulesClicked = false;
    949949                private ArrayList                       m_alSelectedTreeResourceArray = new ArrayList();
    950950                private string                          m_sDocName;
     
    13601360                }
    13611361
    1362                 void UpdateStatusBar(DateTime dStart, DateTime dEnd, string sAccessType, string sAvailabilityMessage)
    1363                 {
    1364                         string sMsg =  dStart.ToShortTimeString() + " to " + dEnd.ToShortTimeString();
    1365                         if (m_nSlots > 0)
    1366                         {
    1367                                 sMsg = sMsg + ": " + m_nSlots.ToString() + " slot";
    1368                                 sMsg = sMsg + ((m_nSlots > 1)?"s " : " ");
    1369                                 sMsg = sMsg + "available";
    1370                                 if (sAccessType != "")
    1371                                 {
    1372                                         sMsg = sMsg + " for " + sAccessType;
    1373                                 }
    1374                                 sMsg = sMsg + ".";
    1375                                 if (sAvailabilityMessage != "")
    1376                                 {
    1377                                         sMsg = sMsg + "  Note: " + sAvailabilityMessage;
    1378                                 }
    1379                         }
     1362                void UpdateStatusBar(DateTime dStart, DateTime dEnd, CGAvailability av)
     1363                {
     1364            System.Text.StringBuilder sbMsg = new System.Text.StringBuilder(100);
     1365                    sbMsg.Append(dStart.ToShortTimeString() + " to " + dEnd.ToShortTimeString());
     1366                        if (av != null && m_nSlots > 0)
     1367                        {
     1368                sbMsg.Append(String.Format(" has {0} slot(s) available for {1}. ", m_nSlots.ToString(), av.AccessTypeName));
     1369            }
    13801370                        else
    13811371                        {
    1382                                 sMsg += ": No appointment slots available.";
    1383                         }
    1384 
    1385                         this.statusBar1.Text = sMsg;
     1372                                sbMsg.Append(": No appointment slots available. ");
     1373                        }
     1374
     1375            if (av != null)
     1376            {
     1377                sbMsg.Append(String.Format("Source Block: {0} to {1} with {2} slot(s) of type {3}",
     1378                    av.StartTime.ToShortTimeString(),
     1379                    av.EndTime.ToShortTimeString(),
     1380                    av.Slots.ToString(),
     1381                    av.AccessTypeName));
     1382
     1383                sbMsg.Append(". ");
     1384
     1385                if (av.Note.Trim().Length > 0) sbMsg.Append("Note: " + av.Note + ".");
     1386            }
     1387
     1388            this.statusBar1.Text = sbMsg.ToString();
    13861389                }
    13871390
     
    14751478                                v.Activate();
    14761479                                v.dateTimePicker1.Value = dDate;
     1480                v.RequestRefreshGrid();
    14771481                return;
    14781482                        }
     
    15071511            try
    15081512                        {
    1509                                 doc.OnOpenDocument();
     1513                                doc.OnOpenDocument(dDate);
    15101514                        }
    15111515                               
     
    16381642                        try
    16391643                        {
    1640                                 doc.OnOpenDocument();
     1644                                doc.OnOpenDocument(DateTime.Today);
    16411645                        }
    16421646                        catch (Exception ex)
     
    20462050                //SMH: Takes too long to do.
    20472051                                //this.Document.RefreshDocument();
    2048                                 string sAccessType = "";
    2049                                 string sAvailabilityMessage = "";
    2050                                 m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);
     2052                CGAvailability resultantAvail;
     2053
     2054                                m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, this.calendarGrid1.TimeScale, out resultantAvail);
    20512055
    20522056                                if (m_nSlots < 1)
     
    21552159                                }
    21562160                               
    2157                                 TimeSpan tsDuration = dEnd - dStart;
    2158                                 int nDuration = (int) tsDuration.TotalMinutes;
    2159                                 Debug.Assert(nDuration > 0);
    2160 
    2161 
    21622161                //Sam: takes too long. Remove this call; deal with the issue of concurrent appointments another way.
    21632162                //this.Document.RefreshDocument();
    2164                                 string sAccessType = "";
    2165                                 string sAvailabilityMessage = "";
    2166                                 m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);
     2163                CGAvailability resultantAvail;
     2164                m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, this.calendarGrid1.TimeScale, out resultantAvail);
    21672165
    21682166                                if (m_nSlots < 1)
     
    21922190                                dAppt.DocManager = this.m_DocManager;
    21932191                                string sNote = "";
    2194                                 dAppt.InitializePage(dPat.PatientIEN, dStart, nDuration, sResource, sNote);
     2192                dAppt.InitializePage(dPat.PatientIEN, dStart, dEnd, sResource, sNote, nAccessTypeID);
    21952193
    21962194                                if (dAppt.ShowDialog(this) == DialogResult.Cancel)
     
    21992197                                }
    22002198
    2201                 CGAppointment appt = new CGAppointment();
     2199                CGAppointment appt = dAppt.Appointment;
     2200                   
     2201                // old way of making an appointment
     2202                    /*new CGAppointment();
    22022203                                appt.PatientID = Convert.ToInt32(dPat.PatientIEN);
    22032204                                appt.PatientName = dPat.PatientName;
     
    22082209                                appt.HealthRecordNumber = dPat.HealthRecordNumber;
    22092210                                appt.AccessTypeID = nAccessTypeID;
     2211                    */
    22102212
    22112213                                //Call Document to add a new appointment. Document adds appointment to CGAppointments array.
    22122214                                this.Document.CreateAppointment(appt);
     2215
     2216                //Experimental now.
     2217                if (dAppt.PrintAppointmentSlip)
     2218                {
     2219                    System.Drawing.Printing.PrintDocument pd = new System.Drawing.Printing.PrintDocument();
     2220                    pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintAppointmentSlip(appt, e);
     2221                    pd.Print();
     2222                }
    22132223
    22142224                //Show the new set of appointments by calling UpdateArrays. Fetches Document's CGAppointments
     
    25052515                calendarGrid1.Focus();
    25062516        }
     2517
     2518        /// <summary>
     2519        /// If mouse enters the Tree Section, check if the grid is on the active form first before stealing the focus
     2520        /// </summary>
     2521        /// <param name="sender"></param>
     2522        /// <param name="e"></param>
     2523        private void tvSchedules_MouseEnter(object sender, EventArgs e)
     2524        {
     2525            if (GetActiveWindow() == this.Handle)
     2526                tvSchedules.Focus();
     2527        }
    25072528       
    25082529        private void CGView_Load(object sender, System.EventArgs e)
     
    25202541            //Show the Form
    25212542            this.Activate();
     2543
     2544            //Set focus on the calendar grid
     2545            this.calendarGrid1.Focus();
    25222546                }
    25232547
     
    25922616                }
    25932617
    2594                 private void tvSchedules_Click(object sender, System.EventArgs e)
    2595                 {
    2596                         bSchedulesClicked = true;
    2597                 }
     2618
    25982619
    25992620                private void tvSchedules_DoubleClick(object sender, System.EventArgs e)
     
    26362657        }
    26372658
     2659
    26382660                private void tvSchedules_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
    2639                 {
    2640                         if (bSchedulesClicked == false)
    2641                                 return;
    2642                         bSchedulesClicked = false;
    2643                        
     2661                {       
    26442662                        m_alSelectedTreeResourceArray = new ArrayList();
    26452663                        string sResource = e.Node.FullPath;
     
    26622680                }
    26632681
     2682        /// <summary>
     2683        /// Makes sure that the node gets selected no matter where we click.
     2684        /// Incidentally, Invokes AfterSelect event.
     2685        /// </summary>
     2686        /// <param name="sender"></param>
     2687        /// <param name="e"></param>
     2688        private void tvSchedules_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
     2689        {
     2690            e.Node.TreeView.SelectedNode = e.Node;
     2691        }
     2692
     2693        /// <summary>
     2694        /// Useless code now... Good place to test something.
     2695        /// </summary>
     2696        /// <param name="sender"></param>
     2697        /// <param name="e"></param>
    26642698                private void mnuTest1_Click(object sender, System.EventArgs e)
    26652699                {
     
    27182752                private void calendarGrid1_CGSelectionChanged(object sender, IndianHealthService.ClinicalScheduling.CGSelectionChangedArgs e)
    27192753                {
    2720                         string sAccessType = "";
    2721                         string sAvailabilityMessage = "";
    2722                         m_nSlots = m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage);
    2723                         UpdateStatusBar(e.StartTime, e.EndTime, sAccessType, sAvailabilityMessage);
     2754            CGAvailability resultantAvail;
     2755            m_nSlots = m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail);
     2756                        UpdateStatusBar(e.StartTime, e.EndTime, resultantAvail);
    27242757                }
    27252758
     
    27582791
    27592792                                //20040909 Cherokee Replaced this block with following
    2760                                 string sAccessType = "";
    2761                                 string sAvailabilityMessage = "";
    27622793                                //                              if (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) < 1)
    27632794                                //                              {
     
    27752806                                        bModSchedule =  (bool) this.m_htModifySchedule[e.Resource.ToString()];
    27762807                                }
    2777                                 bool bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0);
     2808                CGAvailability resultantAvail;
     2809                bool bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail) > 0);
    27782810                                if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) ))
    27792811                                {
     
    29662998                        try
    29672999                        {
    2968                                 string sAccessType = "";
    2969                                 string sAvailabilityMessage = "";
    29703000                                bool    bSlotsAvailable;
    29713001                                bool    bOverbook;
     
    29903020                                bOverbook = (bool) this.m_htOverbook[e.Resource.ToString()];
    29913021                                bModSchedule =  (bool) this.m_htModifySchedule[e.Resource.ToString()];
    2992                                 bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0);
     3022                CGAvailability resultantAvail;
     3023
     3024                bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail) > 0);
    29933025
    29943026                                if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) ))
     
    33393371        }
    33403372
     3373
     3374
     3375
     3376
    33413377       
    33423378
Note: See TracChangeset for help on using the changeset viewer.