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.
This commit is contained in:
parent
53308c9a60
commit
8e5d5f8665
|
@ -60,7 +60,6 @@
|
|||
public object Clone()
|
||||
{
|
||||
CGAppointments newappts = new CGAppointments();
|
||||
//appts.apptList = (Hashtable)apptList.Clone();
|
||||
foreach (DictionaryEntry d in this.apptList)
|
||||
{
|
||||
newappts.apptList.Add(d.Key, d.Value);
|
||||
|
|
|
@ -271,9 +271,12 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
|
||||
//sam: This is a test that duplicates RefreshDocument, but without the UpdateAllViews,
|
||||
// as that has to be done synchornously.
|
||||
//XXXXXX: Needs to be refactored obviously, but now for testing.
|
||||
//XXX: Needs to be refactored obviously, but now for testing.
|
||||
//XXX: Tested extensively enough. Less refactoring now. 2011-01-26
|
||||
public void RefreshDocumentAsync()
|
||||
{
|
||||
Debug.WriteLine("IN REFERSH DOCUMENT ASYNC\n\n");
|
||||
|
||||
bool bRet = false;
|
||||
if (m_sResourcesArray.Count == 0)
|
||||
return;
|
||||
|
@ -423,8 +426,6 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
m_DocManager.ConnectInfo.LoadConnectInfo();
|
||||
}
|
||||
|
||||
m_pAvArray.Clear();
|
||||
|
||||
ArrayList saryApptTypes = new ArrayList();
|
||||
int nApptTypeID = 0;
|
||||
|
||||
|
@ -463,59 +464,67 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
string sResourceList;
|
||||
string sAccessRuleList;
|
||||
|
||||
|
||||
foreach (DataRow rTemp in rAvailabilitySchedule.Rows)
|
||||
//smh: moved clear availabilities down here.
|
||||
//smh: Temporary solution to make sure that people don't touch the availability table at the same time!!!
|
||||
//NOTE: This lock makes sure that availabilities aren't queried for slots when the array is an intermediate
|
||||
//state. The other place that has this lock is SlotsAvailable function.
|
||||
lock (this.m_pAvArray)
|
||||
{
|
||||
//get StartTime, EndTime and Slots
|
||||
dStart = (DateTime)rTemp["START_TIME"];
|
||||
dEnd = (DateTime)rTemp["END_TIME"];
|
||||
m_pAvArray.Clear();
|
||||
|
||||
//TODO: Fix this slots datatype problem
|
||||
string sSlots = rTemp["SLOTS"].ToString();
|
||||
nSlots = Convert.ToInt16(sSlots);
|
||||
|
||||
sResourceList = rTemp["RESOURCE"].ToString();
|
||||
sAccessRuleList = rTemp["ACCESS_TYPE"].ToString();
|
||||
|
||||
string sNote = rTemp["NOTE"].ToString();
|
||||
|
||||
if ((nSlots < -1000) || (sAccessRuleList == ""))
|
||||
foreach (DataRow rTemp in rAvailabilitySchedule.Rows)
|
||||
{
|
||||
nApptTypeID = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (DataRow rType in rTypeSchedule.Rows)
|
||||
//get StartTime, EndTime and Slots
|
||||
dStart = (DateTime)rTemp["START_TIME"];
|
||||
dEnd = (DateTime)rTemp["END_TIME"];
|
||||
|
||||
//TODO: Fix this slots datatype problem
|
||||
string sSlots = rTemp["SLOTS"].ToString();
|
||||
nSlots = Convert.ToInt16(sSlots);
|
||||
|
||||
sResourceList = rTemp["RESOURCE"].ToString();
|
||||
sAccessRuleList = rTemp["ACCESS_TYPE"].ToString();
|
||||
|
||||
string sNote = rTemp["NOTE"].ToString();
|
||||
|
||||
if ((nSlots < -1000) || (sAccessRuleList == ""))
|
||||
{
|
||||
|
||||
dTypeStart = (DateTime)rType["StartTime"];
|
||||
dTypeEnd = (DateTime)rType["EndTime"];
|
||||
//if start & end times overlap, then
|
||||
string sTypeResource = rType["ResourceName"].ToString();
|
||||
if ((dTypeStart.DayOfYear == dStart.DayOfYear) && (sResourceList == sTypeResource))
|
||||
nApptTypeID = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (DataRow rType in rTypeSchedule.Rows)
|
||||
{
|
||||
crRectA.Y = GetTotalMinutes(dStart);
|
||||
crRectA.Height = GetTotalMinutes(dEnd) - crRectA.Top;
|
||||
crRectB.Y = GetTotalMinutes(dTypeStart);
|
||||
crRectB.Height = GetTotalMinutes(dTypeEnd) - crRectB.Top;
|
||||
bIsect = crRectA.IntersectsWith(crRectB);
|
||||
if (bIsect == true)
|
||||
|
||||
dTypeStart = (DateTime)rType["StartTime"];
|
||||
dTypeEnd = (DateTime)rType["EndTime"];
|
||||
//if start & end times overlap, then
|
||||
string sTypeResource = rType["ResourceName"].ToString();
|
||||
if ((dTypeStart.DayOfYear == dStart.DayOfYear) && (sResourceList == sTypeResource))
|
||||
{
|
||||
//TODO: This code:
|
||||
// nApptTypeID = (int) rType["AppointmentTypeID"];
|
||||
//Causes this exception:
|
||||
//Unhandled Exception: System.InvalidCastException: Specified cast is not valid.
|
||||
string sTemp = rType["AppointmentTypeID"].ToString();
|
||||
nApptTypeID = Convert.ToInt16(sTemp);
|
||||
break;
|
||||
crRectA.Y = GetTotalMinutes(dStart);
|
||||
crRectA.Height = GetTotalMinutes(dEnd) - crRectA.Top;
|
||||
crRectB.Y = GetTotalMinutes(dTypeStart);
|
||||
crRectB.Height = GetTotalMinutes(dTypeEnd) - crRectB.Top;
|
||||
bIsect = crRectA.IntersectsWith(crRectB);
|
||||
if (bIsect == true)
|
||||
{
|
||||
//TODO: This code:
|
||||
// nApptTypeID = (int) rType["AppointmentTypeID"];
|
||||
//Causes this exception:
|
||||
//Unhandled Exception: System.InvalidCastException: Specified cast is not valid.
|
||||
string sTemp = rType["AppointmentTypeID"].ToString();
|
||||
nApptTypeID = Convert.ToInt16(sTemp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}//end foreach datarow rType
|
||||
}
|
||||
}//end foreach datarow rType
|
||||
}
|
||||
|
||||
AddAvailability(dStart, dEnd, nApptTypeID, nSlots, false, sResourceList, sAccessRuleList, sNote);
|
||||
}//end foreach datarow rTemp
|
||||
|
||||
AddAvailability(dStart, dEnd, nApptTypeID, nSlots, false, sResourceList, sAccessRuleList, sNote);
|
||||
}//end foreach datarow rTemp
|
||||
}//end lock
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -530,6 +539,18 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
return ((dDate.Hour * 60) + dDate.Minute);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds Availability to Availability Array held by document
|
||||
/// </summary>
|
||||
/// <param name="StartTime">Self-Explan</param>
|
||||
/// <param name="EndTime">Self-Explan</param>
|
||||
/// <param name="nType"></param>
|
||||
/// <param name="nSlots"></param>
|
||||
/// <param name="UpdateView"></param>
|
||||
/// <param name="sResourceList"></param>
|
||||
/// <param name="sAccessRuleList"></param>
|
||||
/// <param name="sNote"></param>
|
||||
/// <returns></returns>
|
||||
public int AddAvailability(DateTime StartTime, DateTime EndTime, int nType, int nSlots, bool UpdateView, string sResourceList, string sAccessRuleList, string sNote)
|
||||
{
|
||||
//adds it to the object array
|
||||
|
@ -578,13 +599,6 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
{
|
||||
//TODO: Test that resource is not currently in list, that it IS a resource, etc
|
||||
this.m_sResourcesArray.Add(sResource);
|
||||
//SAM: removing: Remove UpdateAllViews: Redraws all the open views. But does not call server.
|
||||
//this.UpdateAllViews();
|
||||
}
|
||||
|
||||
public void ClearResources()
|
||||
{
|
||||
this.m_sResourcesArray.Clear();
|
||||
}
|
||||
|
||||
public int SlotsAvailable(DateTime dSelStart, DateTime dSelEnd, string sResource, out string sAccessType, out string sAvailabilityMessage)
|
||||
|
@ -603,39 +617,53 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
crRectB.Y = GetTotalMinutes(dSelStart);
|
||||
crRectB.Height = GetTotalMinutes(dSelEnd) - crRectB.Y;
|
||||
|
||||
// //loop thru m_pAvArray
|
||||
// //Compare the start time and end time of eachblock
|
||||
while (i < m_pAvArray.Count)
|
||||
{
|
||||
pAv = (CGAvailability)m_pAvArray[i];
|
||||
dStart = pAv.StartTime;
|
||||
dEnd = pAv.EndTime;
|
||||
if ((sResource == pAv.ResourceList) &&
|
||||
((dSelStart.Date == dStart.Date) || (dSelStart.Date == dEnd.Date)))
|
||||
{
|
||||
crRectA.Y = (dStart.Date < dSelStart.Date) ? 0 : GetTotalMinutes(dStart);
|
||||
crRectA.Height = (dEnd.Date > dSelEnd.Date) ? 1440 : GetTotalMinutes(dEnd);
|
||||
crRectA.Height = crRectA.Height - crRectA.Y;
|
||||
bIsect = crRectA.IntersectsWith(crRectB);
|
||||
if (bIsect != false)
|
||||
{
|
||||
nSlots = pAv.Slots;
|
||||
if (nSlots < 1)
|
||||
{
|
||||
nAvailableSlots = 0;
|
||||
break;
|
||||
}
|
||||
if (nSlots < nAvailableSlots)
|
||||
{
|
||||
nAvailableSlots = nSlots;
|
||||
sAccessType = pAv.AccessTypeName;
|
||||
sAvailabilityMessage = pAv.Note;
|
||||
//NOTE: What's this lock? This lock makes sure that nobody is editing the availability array
|
||||
//when we are looking at it. Since the availability array could potentially be updated on
|
||||
//a different thread, we are can be potentially left stuck with an empty array.
|
||||
//
|
||||
//The other place that uses this lock is the RefershAvailabilitySchedule method
|
||||
//
|
||||
//This is a temporary fix until I figure out how to divorce the availbilities here from those drawn
|
||||
//on the calendar. Appointments are cloned b/c they are in an object that supports that; and b/c I
|
||||
//don't need to suddenly query them at runtime like I do with Availabilities.
|
||||
|
||||
lock (this.m_pAvArray)
|
||||
{
|
||||
//loop thru m_pAvArray
|
||||
//Compare the start time and end time of eachblock
|
||||
while (i < m_pAvArray.Count)
|
||||
{
|
||||
pAv = (CGAvailability)m_pAvArray[i];
|
||||
dStart = pAv.StartTime;
|
||||
dEnd = pAv.EndTime;
|
||||
if ((sResource == pAv.ResourceList) &&
|
||||
((dSelStart.Date == dStart.Date) || (dSelStart.Date == dEnd.Date)))
|
||||
{
|
||||
crRectA.Y = (dStart.Date < dSelStart.Date) ? 0 : GetTotalMinutes(dStart);
|
||||
crRectA.Height = (dEnd.Date > dSelEnd.Date) ? 1440 : GetTotalMinutes(dEnd);
|
||||
crRectA.Height = crRectA.Height - crRectA.Y;
|
||||
bIsect = crRectA.IntersectsWith(crRectB);
|
||||
if (bIsect != false)
|
||||
{
|
||||
nSlots = pAv.Slots;
|
||||
if (nSlots < 1)
|
||||
{
|
||||
nAvailableSlots = 0;
|
||||
break;
|
||||
}
|
||||
if (nSlots < nAvailableSlots)
|
||||
{
|
||||
nAvailableSlots = nSlots;
|
||||
sAccessType = pAv.AccessTypeName;
|
||||
sAvailabilityMessage = pAv.Note;
|
||||
|
||||
}
|
||||
}//end if
|
||||
}//end if
|
||||
i++;
|
||||
}//end while
|
||||
}//end lock
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (nAvailableSlots == 999)
|
||||
{
|
||||
nAvailableSlots = 0;
|
||||
|
@ -758,6 +786,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
aCopy.PatientName = rApptInfo.PatientName;
|
||||
aCopy.HealthRecordNumber = rApptInfo.HealthRecordNumber;
|
||||
aCopy.AccessTypeID = rApptInfo.AccessTypeID;
|
||||
aCopy.WalkIn = bWalkin ? true : false;
|
||||
|
||||
string sSql = "BSDX ADD NEW APPOINTMENT^" + sStart + "^" + sEnd + "^" + sPatID + "^" + sResource + "^" + sLen + "^" + sNote + "^" + sApptID;
|
||||
System.Data.DataTable dtAppt = m_DocManager.RPMSDataTable(sSql, "NewAppointment");
|
||||
|
@ -772,10 +801,14 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
throw new Exception(sErrorID);
|
||||
aCopy.AppointmentKey = nApptID;
|
||||
this.m_appointments.AddAppointment(aCopy);
|
||||
|
||||
|
||||
//Have make appointment from CGView responsible for requesting an update for the avialability.
|
||||
//bool bRet = RefreshAvailabilitySchedule();
|
||||
|
||||
bool bRet = RefreshAvailabilitySchedule();
|
||||
|
||||
UpdateAllViews();
|
||||
//Sam: don't think this is needed as it is called from CGView.
|
||||
//Make CGView responsible for all drawing.
|
||||
//UpdateAllViews();
|
||||
|
||||
return nApptID;
|
||||
}
|
||||
|
@ -821,11 +854,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
DataRow r = dtAppt.Rows[0];
|
||||
string sErrorID = r["ERRORID"].ToString();
|
||||
|
||||
if (this.m_appointments.AppointmentTable.ContainsKey(nApptID))
|
||||
{
|
||||
bool bRet = RefreshSchedule();
|
||||
UpdateAllViews();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public string DeleteAppointment(int nApptID)
|
||||
|
|
|
@ -1181,9 +1181,6 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
string sErrorMessage = "";
|
||||
DataTable dtOut;
|
||||
|
||||
#if TRACE
|
||||
DateTime sendTime = DateTime.Now;
|
||||
#endif
|
||||
try
|
||||
{
|
||||
//System.IntPtr pHandle = this.Handle;
|
||||
|
@ -1198,12 +1195,6 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
throw ex;
|
||||
}
|
||||
|
||||
#if TRACE
|
||||
DateTime receiveTime = DateTime.Now;
|
||||
TimeSpan executionTime = receiveTime - sendTime;
|
||||
Debug.Write("CGDocumentManager::RPMSDataTable Execution Time: " + executionTime.Milliseconds + " ms.\n");
|
||||
#endif
|
||||
|
||||
return dtOut;
|
||||
|
||||
}
|
||||
|
|
|
@ -616,7 +616,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
this.tvSchedules.HotTracking = true;
|
||||
this.tvSchedules.Location = new System.Drawing.Point(0, 0);
|
||||
this.tvSchedules.Name = "tvSchedules";
|
||||
this.tvSchedules.Size = new System.Drawing.Size(128, 332);
|
||||
this.tvSchedules.Size = new System.Drawing.Size(128, 290);
|
||||
this.tvSchedules.Sorted = true;
|
||||
this.tvSchedules.TabIndex = 1;
|
||||
this.tvSchedules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSchedules_AfterSelect);
|
||||
|
@ -663,7 +663,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
this.panelRight.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.panelRight.Location = new System.Drawing.Point(941, 0);
|
||||
this.panelRight.Name = "panelRight";
|
||||
this.panelRight.Size = new System.Drawing.Size(128, 332);
|
||||
this.panelRight.Size = new System.Drawing.Size(128, 290);
|
||||
this.panelRight.TabIndex = 3;
|
||||
this.panelRight.Visible = false;
|
||||
//
|
||||
|
@ -761,7 +761,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
this.panelCenter.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelCenter.Location = new System.Drawing.Point(136, 24);
|
||||
this.panelCenter.Name = "panelCenter";
|
||||
this.panelCenter.Size = new System.Drawing.Size(802, 284);
|
||||
this.panelCenter.Size = new System.Drawing.Size(802, 242);
|
||||
this.panelCenter.TabIndex = 7;
|
||||
//
|
||||
// ctxCalendarGrid
|
||||
|
@ -847,7 +847,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
//
|
||||
this.panelBottom.Controls.Add(this.statusBar1);
|
||||
this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panelBottom.Location = new System.Drawing.Point(136, 308);
|
||||
this.panelBottom.Location = new System.Drawing.Point(136, 266);
|
||||
this.panelBottom.Name = "panelBottom";
|
||||
this.panelBottom.Size = new System.Drawing.Size(802, 24);
|
||||
this.panelBottom.TabIndex = 8;
|
||||
|
@ -865,7 +865,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
//
|
||||
this.splitter1.Location = new System.Drawing.Point(128, 24);
|
||||
this.splitter1.Name = "splitter1";
|
||||
this.splitter1.Size = new System.Drawing.Size(8, 308);
|
||||
this.splitter1.Size = new System.Drawing.Size(8, 266);
|
||||
this.splitter1.TabIndex = 9;
|
||||
this.splitter1.TabStop = false;
|
||||
//
|
||||
|
@ -874,7 +874,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.splitter2.Location = new System.Drawing.Point(938, 24);
|
||||
this.splitter2.Name = "splitter2";
|
||||
this.splitter2.Size = new System.Drawing.Size(3, 308);
|
||||
this.splitter2.Size = new System.Drawing.Size(3, 266);
|
||||
this.splitter2.TabIndex = 10;
|
||||
this.splitter2.TabStop = false;
|
||||
//
|
||||
|
@ -902,7 +902,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
this.calendarGrid1.Name = "calendarGrid1";
|
||||
this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources")));
|
||||
this.calendarGrid1.SelectedAppointment = 0;
|
||||
this.calendarGrid1.Size = new System.Drawing.Size(802, 284);
|
||||
this.calendarGrid1.Size = new System.Drawing.Size(802, 242);
|
||||
this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
|
||||
this.calendarGrid1.TabIndex = 0;
|
||||
this.calendarGrid1.TimeScale = 20;
|
||||
|
@ -915,7 +915,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
// CGView
|
||||
//
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.ClientSize = new System.Drawing.Size(1069, 332);
|
||||
this.ClientSize = new System.Drawing.Size(1069, 290);
|
||||
this.Controls.Add(this.panelCenter);
|
||||
this.Controls.Add(this.panelBottom);
|
||||
this.Controls.Add(this.splitter2);
|
||||
|
@ -1922,8 +1922,9 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
int nApptID = this.calendarGrid1.SelectedAppointment;
|
||||
Debug.Assert(nApptID != 0);
|
||||
|
||||
CGAppointment a = (CGAppointment) this.Appointments.AppointmentTable[nApptID];
|
||||
|
||||
//smh
|
||||
//CGAppointment a = (CGAppointment) this.Appointments.AppointmentTable[nApptID];
|
||||
CGAppointment a = (CGAppointment)this.Document.Appointments.AppointmentTable[nApptID];
|
||||
try
|
||||
{
|
||||
bool bAlreadyCheckedIn = false;
|
||||
|
@ -1979,12 +1980,18 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
|
||||
DateTime dtCheckIn = dlgCheckin.CheckInTime;
|
||||
|
||||
this.Document.CheckInAppointment(nApptID, dtCheckIn);
|
||||
//Save to Database
|
||||
this.Document.CheckInAppointment(nApptID, dtCheckIn);
|
||||
|
||||
//Tell appointment that it is checked in--smh cancel that!
|
||||
//a.CheckInTime = DateTime.Now;
|
||||
|
||||
//smh new code
|
||||
if (dlgCheckin.PrintRouteSlip)
|
||||
this.printRoutingSlip.Print();
|
||||
// end new code
|
||||
|
||||
//redraw grid (would this work???)
|
||||
this.calendarGrid1.Invalidate();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -2033,7 +2040,8 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
/*
|
||||
* 8-10-05 Added overbook prompt for walkin
|
||||
*/
|
||||
this.Document.RefreshDocument();
|
||||
//SMH: Takes too long to do.
|
||||
//this.Document.RefreshDocument();
|
||||
string sAccessType = "";
|
||||
string sAvailabilityMessage = "";
|
||||
m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);
|
||||
|
@ -2066,32 +2074,47 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
appt.Resource = sResource;
|
||||
appt.HealthRecordNumber = dPat.HealthRecordNumber;
|
||||
|
||||
this.Document.RefreshDocument();
|
||||
//smh: Takes too long
|
||||
//this.Document.RefreshDocument();
|
||||
|
||||
//Call Document to add a walkin appointment
|
||||
int nApptID = this.Document.CreateAppointment(appt, true);
|
||||
|
||||
//Now check them in.
|
||||
calendarGrid1.SelectedAppointment = nApptID;
|
||||
|
||||
AppointmentCheckIn();
|
||||
|
||||
try
|
||||
{
|
||||
RaiseRPMSEvent("BSDX SCHEDULE" , m_Document.DocName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Write(ex.Message);
|
||||
}
|
||||
|
||||
//Show the new set of appointments by calling UpdateArrays. Fetches Document's CGAppointments
|
||||
this.UpdateArrays();
|
||||
|
||||
//Get the appointments and availabilities, async, from Server. Callback updates this thread's controls.
|
||||
OnUpdateScheduleDelegate ousd = new OnUpdateScheduleDelegate(OnUpdateSchedule);
|
||||
ousd.BeginInvoke(OnUpdateScheduleCallback, null);
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Unable to add walk-in appointment " + ex.Message, "Clinical Scheduling");
|
||||
return;
|
||||
string msg;
|
||||
if (BMXNetLib.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error.
|
||||
msg = BMXNetLib.Piece(ex.Message, "~", 4);
|
||||
else
|
||||
msg = ex.Message;
|
||||
|
||||
MessageBox.Show("VISTA says: \r\n" + msg, "Unable to Make Walk-in Appointment");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
RaiseRPMSEvent("BSDX SCHEDULE", m_Document.DocName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Write(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void AppointmentAddNew()
|
||||
|
@ -2132,7 +2155,9 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
int nDuration = (int) tsDuration.TotalMinutes;
|
||||
Debug.Assert(nDuration > 0);
|
||||
|
||||
this.Document.RefreshDocument();
|
||||
|
||||
//Sam: takes too long. Remove this call; deal with the issue of concurrent appointments another way.
|
||||
//this.Document.RefreshDocument();
|
||||
string sAccessType = "";
|
||||
string sAvailabilityMessage = "";
|
||||
m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);
|
||||
|
@ -2179,17 +2204,28 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
appt.HealthRecordNumber = dPat.HealthRecordNumber;
|
||||
appt.AccessTypeID = nAccessTypeID;
|
||||
|
||||
//Call Document to add a new appointment
|
||||
//Call Document to add a new appointment. Document adds appointment to CGAppointments array.
|
||||
this.Document.CreateAppointment(appt);
|
||||
this.Document.RefreshDocument();
|
||||
|
||||
//Show the new set of appointments by calling UpdateArrays. Fetches Document's CGAppointments
|
||||
this.UpdateArrays();
|
||||
|
||||
//Get the appointments and availabilities, async, from Server. Callback updates this thread's controls.
|
||||
OnUpdateScheduleDelegate ousd = new OnUpdateScheduleDelegate(OnUpdateSchedule);
|
||||
ousd.BeginInvoke(OnUpdateScheduleCallback, null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Unable to add new appointment " + ex.Message, "Clinical Scheduling");
|
||||
return;
|
||||
{
|
||||
string msg;
|
||||
if (BMXNetLib.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error.
|
||||
msg = BMXNetLib.Piece(ex.Message, "~", 4);
|
||||
else
|
||||
msg = ex.Message;
|
||||
|
||||
MessageBox.Show("VISTA says: \r\n" + msg, "Unable to Make Appointment");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
RaiseRPMSEvent("BSDX SCHEDULE" , m_Document.DocName);
|
||||
|
@ -2319,12 +2355,18 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
// Make sure that we are called synchronously
|
||||
Debug.Assert(this.InvokeRequired == false,"CGView.UpdateArrays InvokeRequired");
|
||||
// This is where you set how the grid will look
|
||||
|
||||
//Create Deep copy of Availability Array
|
||||
ArrayList availArrayCopy = new ArrayList();
|
||||
foreach (CGAvailability av in this.m_Document.AvailabilityArray)
|
||||
availArrayCopy.Add(av);
|
||||
|
||||
try
|
||||
{
|
||||
//Tell the grid about Avails, Appts, and Resources.
|
||||
this.calendarGrid1.AvailabilityArray = this.m_Document.AvailabilityArray;
|
||||
this.calendarGrid1.AvailabilityArray = availArrayCopy;
|
||||
//Appts are cloned b/c if we tie into the class directly, we shoot off errors when we manipulate it.
|
||||
this.calendarGrid1.Appointments = (CGAppointments)this.m_Document.Appointments.Clone(); //smh new line again
|
||||
this.calendarGrid1.Appointments = (CGAppointments)this.m_Document.Appointments.Clone();
|
||||
this.calendarGrid1.Resources = this.m_Document.Resources;
|
||||
//Redraw the calendar grid
|
||||
this.calendarGrid1.OnUpdateArrays(); // this draws the Calendar
|
||||
|
@ -3134,19 +3176,33 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update Selection of date if user does not pick a date/time
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void dateTimePicker1_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Document.SelectedDate != dateTimePicker1.Value.Date)
|
||||
RequestRefreshGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle Selection of Date via mouse from datetimepicker dropdown
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void dateTimePicker1_CloseUp(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Document.SelectedDate != dateTimePicker1.Value.Date)
|
||||
RequestRefreshGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle Enter and Escape key on dateTimePicker
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void dateTimePicker1_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
//if enter key is pressed:
|
||||
|
|
|
@ -1027,6 +1027,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws Availabilities. Draws Some of the Empty cells (don't know where the rest go) with the Khaki color
|
||||
/// </summary>
|
||||
private void SetAppointmentTypes()
|
||||
{
|
||||
if (this.m_gridCells.CellCount != 0)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue