Changeset 1512 for Scheduling/trunk


Ignore:
Timestamp:
Aug 9, 2012, 4:05:09 PM (12 years ago)
Author:
Sam Habiel
Message:

lstClip_DragDrop is modified to create a copy of the appointment to put in the clipboard rather than having the original appointment reference there. What happened was that when the appointment was dropped into the grid, it changed the original appointment object (it's the same CLR object!), when the original appointment object should not have been modified in the first place. I.e., we really just wanted a copy of the original appointment all along in the clipboard, not the original appointment itself.
Fixes bug EHS#0000255.

File:
1 edited

Legend:

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

    r1511 r1512  
    255255            this.lblResource = new System.Windows.Forms.Label();
    256256            this.panelCenter = new System.Windows.Forms.Panel();
    257             this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid();
    258257            this.ctxCalendarGrid = new System.Windows.Forms.ContextMenu();
    259258            this.ctxCalGridAdd = new System.Windows.Forms.MenuItem();
     
    275274            this.splitter1 = new System.Windows.Forms.Splitter();
    276275            this.splitter2 = new System.Windows.Forms.Splitter();
     276            this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid();
    277277            this.panelRight.SuspendLayout();
    278278            this.panelClip.SuspendLayout();
     
    716716            this.tvSchedules.Location = new System.Drawing.Point(0, 0);
    717717            this.tvSchedules.Name = "tvSchedules";
    718             this.tvSchedules.Size = new System.Drawing.Size(128, 389);
     718            this.tvSchedules.Size = new System.Drawing.Size(128, 347);
    719719            this.tvSchedules.Sorted = true;
    720720            this.tvSchedules.TabIndex = 1;
     
    785785            this.panelRight.Location = new System.Drawing.Point(996, 0);
    786786            this.panelRight.Name = "panelRight";
    787             this.panelRight.Size = new System.Drawing.Size(128, 389);
     787            this.panelRight.Size = new System.Drawing.Size(128, 347);
    788788            this.panelRight.TabIndex = 3;
    789789            this.panelRight.Visible = false;
     
    881881            this.panelCenter.Location = new System.Drawing.Point(136, 24);
    882882            this.panelCenter.Name = "panelCenter";
    883             this.panelCenter.Size = new System.Drawing.Size(857, 341);
     883            this.panelCenter.Size = new System.Drawing.Size(857, 299);
    884884            this.panelCenter.TabIndex = 7;
    885885            //
     
    988988            this.panelBottom.Controls.Add(this.statusBar1);
    989989            this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
    990             this.panelBottom.Location = new System.Drawing.Point(136, 365);
     990            this.panelBottom.Location = new System.Drawing.Point(136, 323);
    991991            this.panelBottom.Name = "panelBottom";
    992992            this.panelBottom.Size = new System.Drawing.Size(857, 24);
     
    10061006            this.splitter1.Location = new System.Drawing.Point(128, 24);
    10071007            this.splitter1.Name = "splitter1";
    1008             this.splitter1.Size = new System.Drawing.Size(8, 365);
     1008            this.splitter1.Size = new System.Drawing.Size(8, 323);
    10091009            this.splitter1.TabIndex = 9;
    10101010            this.splitter1.TabStop = false;
     
    10151015            this.splitter2.Location = new System.Drawing.Point(993, 24);
    10161016            this.splitter2.Name = "splitter2";
    1017             this.splitter2.Size = new System.Drawing.Size(3, 365);
     1017            this.splitter2.Size = new System.Drawing.Size(3, 323);
    10181018            this.splitter2.TabIndex = 10;
    10191019            this.splitter2.TabStop = false;
     
    10381038            this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources")));
    10391039            this.calendarGrid1.SelectedAppointment = 0;
    1040             this.calendarGrid1.Size = new System.Drawing.Size(857, 341);
     1040            this.calendarGrid1.Size = new System.Drawing.Size(857, 299);
    10411041            this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
    10421042            this.calendarGrid1.TabIndex = 0;
     
    10511051            //
    10521052            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    1053             this.ClientSize = new System.Drawing.Size(1124, 389);
     1053            this.ClientSize = new System.Drawing.Size(1124, 347);
    10541054            this.Controls.Add(this.panelCenter);
    10551055            this.Controls.Add(this.panelBottom);
     
    34553455                        {
    34563456                                CGAppointment a = (CGAppointment) e.Data.GetData(typeof(CGAppointment));
    3457                                 if (m_ClipList.AppointmentTable.Contains((int) a.AppointmentKey))
    3458                                 {
    3459                                         return;
    3460                                 }
    34613457
    34623458                if (a.RadiologyExamIEN.HasValue)
     
    34663462                }
    34673463
    3468                                 m_ClipList.AddAppointment(a);
    3469                                 lstClip.Items.Add(a);
     3464                // SMH: We copy the appointment so that when we change it later we don't inadvertently
     3465                // change the original appointment which may be shared by the grid.
     3466                //TODO: This is very messy. We need a true constructor.
     3467                CGAppointment apptcopy = new CGAppointment();
     3468                apptcopy.Patient = a.Patient;
     3469                apptcopy.PatientID = a.PatientID;
     3470                apptcopy.PatientName = a.PatientName;
     3471                apptcopy.StartTime = a.StartTime;
     3472                apptcopy.EndTime = a.EndTime;
     3473                apptcopy.Resource = String.Empty;
     3474                apptcopy.HealthRecordNumber = a.HealthRecordNumber;
     3475                // Using a different key to prevent addition of the same patient twice rather than the ApptID.
     3476                apptcopy.AppointmentKey = a.PatientID; // this is the key of the array list m_ClipList
     3477
     3478                //If patient is already here, bye! No need to add him/her/it again.
     3479                if (m_ClipList.AppointmentTable.Contains((int)apptcopy.AppointmentKey))
     3480                {
     3481                    return;
     3482                }
     3483
     3484                //SMH: Why are there two lists? Should have one. Oh well.
     3485                //m_ClipList is used elsewhere. And it seems that they get out of sync sometimes. Agh!
     3486                                m_ClipList.AddAppointment(apptcopy);
     3487                                lstClip.Items.Add(apptcopy);
    34703488                        }
    34713489                        catch(Exception ex)
Note: See TracChangeset for help on using the changeset viewer.