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.
This commit is contained in:
sam 2011-03-20 07:22:11 +00:00
parent 5a07602950
commit dfefa179b2
14 changed files with 406 additions and 169 deletions

View File

@ -302,6 +302,8 @@
this.m_bWalkIn = value;
}
}
public Patient Patient { get; set; }
}
}

View File

@ -7,6 +7,7 @@ using System.Drawing;
using System.Windows.Forms;
using IndianHealthService.BMXNet;
using System.Linq;
using System.Collections.Generic;
namespace IndianHealthService.ClinicalScheduling
{
@ -320,16 +321,14 @@ namespace IndianHealthService.ClinicalScheduling
this.UpdateAllViews();
}
public void OnOpenDocument()
public void OnOpenDocument(DateTime dDate)
{
try
{
//Create new Document
m_ScheduleType = (m_sResourcesArray.Count == 1) ? ScheduleType.Resource : ScheduleType.Clinic;
bool bRet = false;
//Set initial From and To dates based on current day
DateTime dDate = DateTime.Today;
if (m_ScheduleType == ScheduleType.Resource)
{
bRet = this.WeekNeedsRefresh(1, dDate, out this.m_dStartDate, out this.m_dEndDate);
@ -395,26 +394,9 @@ namespace IndianHealthService.ClinicalScheduling
/// <returns>Success or Failure. Should be always Success.</returns>
private bool RefreshSchedule()
{
try
{
bool bRet = this.RefreshAvailabilitySchedule();
if (bRet == false)
{
return bRet;
}
bRet = this.RefreshDaysSchedule();
return bRet;
}
catch (ApplicationException aex)
{
Debug.Write("CGDocument.RefreshSchedule Application Error: " + aex.Message + "\n");
return false;
}
catch (Exception ex)
{
MessageBox.Show("CGDocument.RefreshSchedule error: " + ex.Message + "\n");
return false;
}
this.RefreshAvailabilitySchedule();
this.RefreshDaysSchedule();
return true;
}
private bool RefreshAvailabilitySchedule()
@ -636,15 +618,16 @@ namespace IndianHealthService.ClinicalScheduling
/// <param name="sAccessType">Out: Name of Access Type</param>
/// <param name="sAvailabilityMessage">Out: Access Note</param>
/// <returns>Number of slots</returns>
public int SlotsAvailable(DateTime dSelStart, DateTime dSelEnd, string sResource, out string sAccessType, out string sAvailabilityMessage)
public int SlotsAvailable(DateTime dSelStart, DateTime dSelEnd, string sResource, int viewTimeScale, out CGAvailability resultantAV)
{
sAccessType = ""; //default out value
sAvailabilityMessage = ""; //default out value
resultantAV = null;
double slotsAvailable = 0; //defalut return value
double effectiveSlotsAvailable = 0; //Slots available based on the time scale.
//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.
@ -659,30 +642,85 @@ namespace IndianHealthService.ClinicalScheduling
lock (this.m_pAvArray)
{
//This foreach loop looks for an availability that overlaps where the user clicked.
//There can only be one, as availabilites cannot overlap each other (enforced at the DB level)
//Availabilites cannot overlap each other (enforced at the DB level)
//If selection hits multiple blocks, get the block with the most slots (reflected by the sorting here)
CGAvailability[] pAVs = (from pAV in this.m_pAvArray.Cast<CGAvailability>()
where (sResource == pAV.ResourceList && CalendarGrid.TimesOverlap(dSelStart, dSelEnd, pAV.StartTime, pAV.EndTime))
orderby pAV.Slots descending
select pAV)
.ToArray<CGAvailability>();
List<CGAvailability> lstAV = (from avail in this.m_pAvArray.Cast<CGAvailability>()
where (sResource == avail.ResourceList && CalendarGrid.TimesOverlap(dSelStart, dSelEnd, avail.StartTime, avail.EndTime))
select avail).ToList();
if ((pAVs.Length) == 0) return 0;
//if we don't have any availabilities, then return with zero slots.
if (lstAV.Count == 0) return 0;
CGAvailability pAV;
slotsAvailable = pAVs[0].Slots;
sAccessType = pAVs[0].AccessTypeName;
sAvailabilityMessage = pAVs[0].Note;
//if there is just one, that's it.
if (lstAV.Count == 1) pAV = lstAV.First();
//otherwise...
else
{
//if availabilities are contigous to each other, need to join them together.
//First, are they the same?
string firsttype = lstAV.First().AccessTypeName;
bool bAllSameType = lstAV.All(av => av.AccessTypeName == firsttype);
//Second are they ALL contigous?
DateTime lastEndTime = DateTime.Today; //bogus value to please compiler who wants it assigned.
int index = 0;
bool bContigous = lstAV.OrderBy(av => av.StartTime)
.All(av =>
{
index++;
if (index == 1)
{
lastEndTime = av.EndTime;
return true;
}
if (av.StartTime == lastEndTime)
{
lastEndTime = av.EndTime;
return true;
}
return false;
});
if (bContigous && bAllSameType)
{
var enumAVOrdered = lstAV.OrderBy(av => av.StartTime);
pAV = new CGAvailability
{
StartTime = enumAVOrdered.First().StartTime,
EndTime = enumAVOrdered.Last().EndTime,
Slots = enumAVOrdered.Sum(av => av.Slots),
AccessTypeName = enumAVOrdered.First().AccessTypeName,
Note = enumAVOrdered.First().Note
};
}
else
{
pAV = lstAV.OrderByDescending(av => av.Slots).First();
}
}
resultantAV = pAV; // out var
slotsAvailable = pAV.Slots;
//Subtract total slots current appointments take up.
slotsAvailable -= (from appt in this.Appointments.AppointmentTable.Values.Cast<CGAppointment>()
//If the resource is the same and the user selection overlaps, then...
where (sResource == appt.Resource && CalendarGrid.TimesOverlap(pAVs[0].StartTime, pAVs[0].EndTime, appt.StartTime, appt.EndTime))
where (sResource == appt.Resource && CalendarGrid.TimesOverlap(pAV.StartTime, pAV.EndTime, appt.StartTime, appt.EndTime))
// if appt starttime is before avail start time, only count against the avail starting from the availability start time
let startTimeToCountAgainstBlock = appt.StartTime < pAVs[0].StartTime ? pAVs[0].StartTime : appt.StartTime
let startTimeToCountAgainstBlock = appt.StartTime < pAV.StartTime ? pAV.StartTime : appt.StartTime
// if appt endtime is after the avail ends, only count against the avail up to where the avail ends
let endTimeToCountAgainstBlock = appt.EndTime > pAVs[0].EndTime ? pAVs[0].EndTime : appt.EndTime
let endTimeToCountAgainstBlock = appt.EndTime > pAV.EndTime ? pAV.EndTime : appt.EndTime
// theoretical minutes per slot for the availability
let minPerSlot = (pAVs[0].EndTime - pAVs[0].StartTime).TotalMinutes / pAVs[0].Slots
let minPerSlot = (pAV.EndTime - pAV.StartTime).TotalMinutes / pAV.Slots
// how many minutes does this appointment take away from the slot
let minPerAppt = (endTimeToCountAgainstBlock - startTimeToCountAgainstBlock).TotalMinutes
// how many slots the appointment takes up using this availability's scale
@ -690,9 +728,17 @@ namespace IndianHealthService.ClinicalScheduling
select slotsConsumed)
// add up SlotsConsumed to substract from slotsAvailable
.Sum();
}
return (int)slotsAvailable;
//theoretical minutes per slot for the availability
double minPerSlot2 = (pAV.EndTime - pAV.StartTime).TotalMinutes / pAV.Slots;
//Convert it to the view's time scale.
effectiveSlotsAvailable = (minPerSlot2 / viewTimeScale) * slotsAvailable;
}
//round it down.
return (int)effectiveSlotsAvailable;
/* OLD ALGOTHRIM 2

View File

@ -409,7 +409,14 @@ namespace IndianHealthService.ClinicalScheduling
if (MessageBox.Show("Unable to connect to VistA. " + ex.Message, "Clinical Scheduling", MessageBoxButtons.RetryCancel) == DialogResult.Retry)
{
bRetry = true;
_current.m_ConnectInfo.ChangeServerInfo();
//I hate this, but this is how the library is designed. It throws an error if the user cancels. XXX: Won't fix library until BMX 4.0 port.
try { _current.m_ConnectInfo.ChangeServerInfo(); }
catch (Exception)
{
closeSplashDelegate();
bRetry = false;
return false; //tell main that it's a no go.
}
}
else
{

View File

@ -616,12 +616,13 @@ 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, 358);
this.tvSchedules.Size = new System.Drawing.Size(128, 393);
this.tvSchedules.Sorted = true;
this.tvSchedules.TabIndex = 1;
this.tvSchedules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSchedules_AfterSelect);
this.tvSchedules.Click += new System.EventHandler(this.tvSchedules_Click);
this.tvSchedules.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvSchedules_NodeMouseClick);
this.tvSchedules.DoubleClick += new System.EventHandler(this.tvSchedules_DoubleClick);
this.tvSchedules.MouseEnter += new System.EventHandler(this.tvSchedules_MouseEnter);
//
// contextMenu1
//
@ -661,9 +662,9 @@ namespace IndianHealthService.ClinicalScheduling
//
this.panelRight.Controls.Add(this.panelClip);
this.panelRight.Dock = System.Windows.Forms.DockStyle.Right;
this.panelRight.Location = new System.Drawing.Point(941, 0);
this.panelRight.Location = new System.Drawing.Point(996, 0);
this.panelRight.Name = "panelRight";
this.panelRight.Size = new System.Drawing.Size(128, 358);
this.panelRight.Size = new System.Drawing.Size(128, 393);
this.panelRight.TabIndex = 3;
this.panelRight.Visible = false;
//
@ -729,14 +730,14 @@ namespace IndianHealthService.ClinicalScheduling
this.panelTop.Dock = System.Windows.Forms.DockStyle.Top;
this.panelTop.Location = new System.Drawing.Point(128, 0);
this.panelTop.Name = "panelTop";
this.panelTop.Size = new System.Drawing.Size(813, 24);
this.panelTop.Size = new System.Drawing.Size(868, 24);
this.panelTop.TabIndex = 6;
//
// dateTimePicker1
//
this.dateTimePicker1.Dock = System.Windows.Forms.DockStyle.Right;
this.dateTimePicker1.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right;
this.dateTimePicker1.Location = new System.Drawing.Point(607, 0);
this.dateTimePicker1.Location = new System.Drawing.Point(662, 0);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(206, 20);
this.dateTimePicker1.TabIndex = 1;
@ -759,7 +760,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, 310);
this.panelCenter.Size = new System.Drawing.Size(857, 345);
this.panelCenter.TabIndex = 7;
//
// ctxCalendarGrid
@ -845,9 +846,9 @@ 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, 334);
this.panelBottom.Location = new System.Drawing.Point(136, 369);
this.panelBottom.Name = "panelBottom";
this.panelBottom.Size = new System.Drawing.Size(802, 24);
this.panelBottom.Size = new System.Drawing.Size(857, 24);
this.panelBottom.TabIndex = 8;
//
// statusBar1
@ -855,7 +856,7 @@ namespace IndianHealthService.ClinicalScheduling
this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill;
this.statusBar1.Location = new System.Drawing.Point(0, 0);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Size = new System.Drawing.Size(802, 24);
this.statusBar1.Size = new System.Drawing.Size(857, 24);
this.statusBar1.SizingGrip = false;
this.statusBar1.TabIndex = 0;
//
@ -863,16 +864,16 @@ namespace IndianHealthService.ClinicalScheduling
//
this.splitter1.Location = new System.Drawing.Point(128, 24);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(8, 334);
this.splitter1.Size = new System.Drawing.Size(8, 369);
this.splitter1.TabIndex = 9;
this.splitter1.TabStop = false;
//
// splitter2
//
this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
this.splitter2.Location = new System.Drawing.Point(938, 24);
this.splitter2.Location = new System.Drawing.Point(993, 24);
this.splitter2.Name = "splitter2";
this.splitter2.Size = new System.Drawing.Size(3, 334);
this.splitter2.Size = new System.Drawing.Size(3, 369);
this.splitter2.TabIndex = 10;
this.splitter2.TabStop = false;
//
@ -900,7 +901,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, 310);
this.calendarGrid1.Size = new System.Drawing.Size(857, 345);
this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
this.calendarGrid1.TabIndex = 0;
this.calendarGrid1.TimeScale = 20;
@ -913,7 +914,7 @@ namespace IndianHealthService.ClinicalScheduling
// CGView
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(1069, 358);
this.ClientSize = new System.Drawing.Size(1124, 393);
this.Controls.Add(this.panelCenter);
this.Controls.Add(this.panelBottom);
this.Controls.Add(this.splitter2);
@ -945,7 +946,6 @@ namespace IndianHealthService.ClinicalScheduling
private CGDocument m_Document;
private CGDocumentManager m_DocManager;
private int m_nSlots;
bool bSchedulesClicked = false;
private ArrayList m_alSelectedTreeResourceArray = new ArrayList();
private string m_sDocName;
private CGAppointments m_ClipList;
@ -1359,30 +1359,33 @@ namespace IndianHealthService.ClinicalScheduling
base.Dispose( disposing );
}
void UpdateStatusBar(DateTime dStart, DateTime dEnd, string sAccessType, string sAvailabilityMessage)
void UpdateStatusBar(DateTime dStart, DateTime dEnd, CGAvailability av)
{
string sMsg = dStart.ToShortTimeString() + " to " + dEnd.ToShortTimeString();
if (m_nSlots > 0)
System.Text.StringBuilder sbMsg = new System.Text.StringBuilder(100);
sbMsg.Append(dStart.ToShortTimeString() + " to " + dEnd.ToShortTimeString());
if (av != null && m_nSlots > 0)
{
sMsg = sMsg + ": " + m_nSlots.ToString() + " slot";
sMsg = sMsg + ((m_nSlots > 1)?"s " : " ");
sMsg = sMsg + "available";
if (sAccessType != "")
{
sMsg = sMsg + " for " + sAccessType;
}
sMsg = sMsg + ".";
if (sAvailabilityMessage != "")
{
sMsg = sMsg + " Note: " + sAvailabilityMessage;
}
}
sbMsg.Append(String.Format(" has {0} slot(s) available for {1}. ", m_nSlots.ToString(), av.AccessTypeName));
}
else
{
sMsg += ": No appointment slots available.";
sbMsg.Append(": No appointment slots available. ");
}
this.statusBar1.Text = sMsg;
if (av != null)
{
sbMsg.Append(String.Format("Source Block: {0} to {1} with {2} slot(s) of type {3}",
av.StartTime.ToShortTimeString(),
av.EndTime.ToShortTimeString(),
av.Slots.ToString(),
av.AccessTypeName));
sbMsg.Append(". ");
if (av.Note.Trim().Length > 0) sbMsg.Append("Note: " + av.Note + ".");
}
this.statusBar1.Text = sbMsg.ToString();
}
private void EditScheduleAvailability()
@ -1474,6 +1477,7 @@ namespace IndianHealthService.ClinicalScheduling
{
v.Activate();
v.dateTimePicker1.Value = dDate;
v.RequestRefreshGrid();
return;
}
@ -1506,7 +1510,7 @@ namespace IndianHealthService.ClinicalScheduling
try
{
doc.OnOpenDocument();
doc.OnOpenDocument(dDate);
}
catch (Exception ex)
@ -1637,7 +1641,7 @@ namespace IndianHealthService.ClinicalScheduling
doc.DocManager = this.DocManager;
try
{
doc.OnOpenDocument();
doc.OnOpenDocument(DateTime.Today);
}
catch (Exception ex)
{
@ -2045,9 +2049,9 @@ namespace IndianHealthService.ClinicalScheduling
*/
//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);
CGAvailability resultantAvail;
m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, this.calendarGrid1.TimeScale, out resultantAvail);
if (m_nSlots < 1)
{
@ -2154,16 +2158,10 @@ namespace IndianHealthService.ClinicalScheduling
return;
}
TimeSpan tsDuration = dEnd - dStart;
int nDuration = (int) tsDuration.TotalMinutes;
Debug.Assert(nDuration > 0);
//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);
CGAvailability resultantAvail;
m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, this.calendarGrid1.TimeScale, out resultantAvail);
if (m_nSlots < 1)
{
@ -2191,14 +2189,17 @@ namespace IndianHealthService.ClinicalScheduling
DAppointPage dAppt = new DAppointPage();
dAppt.DocManager = this.m_DocManager;
string sNote = "";
dAppt.InitializePage(dPat.PatientIEN, dStart, nDuration, sResource, sNote);
dAppt.InitializePage(dPat.PatientIEN, dStart, dEnd, sResource, sNote, nAccessTypeID);
if (dAppt.ShowDialog(this) == DialogResult.Cancel)
{
return;
}
CGAppointment appt = new CGAppointment();
CGAppointment appt = dAppt.Appointment;
// old way of making an appointment
/*new CGAppointment();
appt.PatientID = Convert.ToInt32(dPat.PatientIEN);
appt.PatientName = dPat.PatientName;
appt.StartTime = dStart;
@ -2207,10 +2208,19 @@ namespace IndianHealthService.ClinicalScheduling
appt.Note = dAppt.Note;
appt.HealthRecordNumber = dPat.HealthRecordNumber;
appt.AccessTypeID = nAccessTypeID;
*/
//Call Document to add a new appointment. Document adds appointment to CGAppointments array.
this.Document.CreateAppointment(appt);
//Experimental now.
if (dAppt.PrintAppointmentSlip)
{
System.Drawing.Printing.PrintDocument pd = new System.Drawing.Printing.PrintDocument();
pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintAppointmentSlip(appt, e);
pd.Print();
}
//Show the new set of appointments by calling UpdateArrays. Fetches Document's CGAppointments
this.UpdateArrays();
@ -2504,6 +2514,17 @@ namespace IndianHealthService.ClinicalScheduling
if (GetActiveWindow() == this.Handle)
calendarGrid1.Focus();
}
/// <summary>
/// If mouse enters the Tree Section, check if the grid is on the active form first before stealing the focus
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tvSchedules_MouseEnter(object sender, EventArgs e)
{
if (GetActiveWindow() == this.Handle)
tvSchedules.Focus();
}
private void CGView_Load(object sender, System.EventArgs e)
{
@ -2519,6 +2540,9 @@ namespace IndianHealthService.ClinicalScheduling
//Show the Form
this.Activate();
//Set focus on the calendar grid
this.calendarGrid1.Focus();
}
private void mnuOpenSchedule_Click(object sender, System.EventArgs e)
@ -2591,10 +2615,7 @@ namespace IndianHealthService.ClinicalScheduling
this.mnuViewScheduleTree.Checked = !(this.mnuViewScheduleTree.Checked);
}
private void tvSchedules_Click(object sender, System.EventArgs e)
{
bSchedulesClicked = true;
}
private void tvSchedules_DoubleClick(object sender, System.EventArgs e)
{
@ -2635,12 +2656,9 @@ namespace IndianHealthService.ClinicalScheduling
}
private void tvSchedules_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
if (bSchedulesClicked == false)
return;
bSchedulesClicked = false;
{
m_alSelectedTreeResourceArray = new ArrayList();
string sResource = e.Node.FullPath;
string[] ss = sResource.Split((char) 92);
@ -2661,6 +2679,22 @@ namespace IndianHealthService.ClinicalScheduling
}
/// <summary>
/// Makes sure that the node gets selected no matter where we click.
/// Incidentally, Invokes AfterSelect event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tvSchedules_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
e.Node.TreeView.SelectedNode = e.Node;
}
/// <summary>
/// Useless code now... Good place to test something.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mnuTest1_Click(object sender, System.EventArgs e)
{
ReaderWriterLock m_rwl = this.DocManager.ConnectInfo.bmxNetLib.BMXRWL;
@ -2717,10 +2751,9 @@ namespace IndianHealthService.ClinicalScheduling
private void calendarGrid1_CGSelectionChanged(object sender, IndianHealthService.ClinicalScheduling.CGSelectionChangedArgs e)
{
string sAccessType = "";
string sAvailabilityMessage = "";
m_nSlots = m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage);
UpdateStatusBar(e.StartTime, e.EndTime, sAccessType, sAvailabilityMessage);
CGAvailability resultantAvail;
m_nSlots = m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail);
UpdateStatusBar(e.StartTime, e.EndTime, resultantAvail);
}
/// <summary>
@ -2757,8 +2790,6 @@ namespace IndianHealthService.ClinicalScheduling
return;
//20040909 Cherokee Replaced this block with following
string sAccessType = "";
string sAvailabilityMessage = "";
// if (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) < 1)
// {
// MessageBox.Show("There are no appointment slots available for the selected time.");
@ -2774,7 +2805,8 @@ namespace IndianHealthService.ClinicalScheduling
{
bModSchedule = (bool) this.m_htModifySchedule[e.Resource.ToString()];
}
bool bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0);
CGAvailability resultantAvail;
bool bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail) > 0);
if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) ))
{
MessageBox.Show("There are no appointment slots available for the selected time.");
@ -2965,8 +2997,6 @@ namespace IndianHealthService.ClinicalScheduling
{
try
{
string sAccessType = "";
string sAvailabilityMessage = "";
bool bSlotsAvailable;
bool bOverbook;
bool bModSchedule;
@ -2989,7 +3019,9 @@ namespace IndianHealthService.ClinicalScheduling
bOverbook = (bool) this.m_htOverbook[e.Resource.ToString()];
bModSchedule = (bool) this.m_htModifySchedule[e.Resource.ToString()];
bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0);
CGAvailability resultantAvail;
bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail) > 0);
if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) ))
{
@ -3338,6 +3370,10 @@ namespace IndianHealthService.ClinicalScheduling
_loadingSplash.RemoteClose();
}

View File

@ -23,7 +23,7 @@
private bool m_bDragDropStart;
private bool m_bDrawWalkIns = true;
private bool m_bGridEnter;
private bool m_bInitialUpdate;
//private bool m_bInitialUpdate;
private bool m_bMouseDown;
private bool m_bScroll;
private bool m_bScrollDown;
@ -48,11 +48,13 @@
private StringFormat m_sfHour;
private StringFormat m_sfRight;
private ArrayList m_sResourcesArray;
private Timer m_Timer; // Timeer used in Drag and Drop Operations
private Timer m_Timer; // Timer used in Drag and Drop Operations
private ToolTip m_toolTip;
private const int WM_HSCROLL = 0x114; // Horizontal Scrolling Windows Message
private const int WM_VSCROLL = 0x115; // Vertical Scrolling Windows Message
private const int WM_MOUSEWHEEL = 0x20a; // Windows Mouse Scrolling Message
private System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
public delegate void CGAppointmentChangedHandler(object sender, CGAppointmentChangedArgs e);
public event CGAppointmentChangedHandler CGAppointmentChanged;
@ -89,7 +91,7 @@
this.m_sfRight.Alignment = StringAlignment.Far;
this.m_sfHour.LineAlignment = StringAlignment.Center;
this.m_sfHour.Alignment = StringAlignment.Far;
this.m_bInitialUpdate = false;
// this.m_bInitialUpdate = false;
}
private Rectangle AdjustRectForOverlap()
@ -112,6 +114,7 @@
if (this.m_Timer != null)
{
this.m_Timer.Stop();
this.m_Timer.Tick -= new EventHandler(this.tickEventHandler);
this.m_Timer.Dispose();
this.m_Timer = null;
}
@ -231,6 +234,7 @@
private void CalendarGrid_MouseDown(object sender, MouseEventArgs e)
{
//watch.Restart();
if (e.Button == MouseButtons.Left)
{
foreach (DictionaryEntry entry in this.m_gridCells.CellHashTable)
@ -246,15 +250,25 @@
private void CalendarGrid_MouseMove(object Sender, MouseEventArgs e)
{
//test
//System.Diagnostics.Debug.Write(watch.ElapsedMilliseconds + "\n");
//test
//if the left mouse button is down and we are moving the mouse...
if (this.m_bMouseDown)
{
//if Y axis is outside the top or bottom
if ((e.Y >= base.ClientRectangle.Bottom) || (e.Y <= base.ClientRectangle.Top))
{
//start auto scrolling. m_bScrollDown decides whether we scroll up or down.
this.m_bScrollDown = e.Y >= base.ClientRectangle.Bottom;
AutoDragStart();
}
//if Y axis within client rectagle, stop dragging (whether you started or not)
if ((e.Y < base.ClientRectangle.Bottom) && (e.Y > base.ClientRectangle.Top))
{
bool bAutoDrag = this.m_bAutoDrag;
AutoDragStop();
}
if (this.m_bSelectingRange)
{
@ -277,6 +291,9 @@
}
else
{
//test
AutoDragStop(); //is this needed?
//test
int y = e.Y - base.AutoScrollPosition.Y;
int x = e.X - base.AutoScrollPosition.X;
Point pt = new Point(x, y);
@ -347,12 +364,14 @@
if (e.Graphics != null)
{
this.DrawGrid(e.Graphics);
/*
if (!this.m_bInitialUpdate)
{
this.SetAppointmentTypes();
base.Invalidate();
this.m_bInitialUpdate = true;
}
*/
}
}
@ -601,9 +620,13 @@
}
if (this.m_sResourcesArray.Count > 0)
{
//IMP
//this is the place where we the selected cells are drawn in Light Light Blue.
//IMP
if (this.m_selectedRange.CellIsInRange(cellFromRowCol))
{
g.FillRectangle(Brushes.Aquamarine, r);
//g.FillRectangle(Brushes.AntiqueWhite, r);
}
else
{
@ -1141,12 +1164,20 @@
}
}
/// <summary>
/// Handles scrolling when the mouse button is down
/// </summary>
/// <param name="o"></param>
/// <param name="e"></param>
private void tickEventHandler(object o, EventArgs e)
{
//if there are still WM_TIME messages in the Queue after the timer is dead, don't do anything.
if (this.m_Timer == null) return;
Point point = new Point(base.AutoScrollPosition.X, base.AutoScrollPosition.Y);
int x = point.X;
int num = point.Y * -1;
num = this.m_bScrollDown ? (num + 5) : (num - 5);
num = this.m_bScrollDown ? (num + 2) : (num - 2);
point.Y = num;
base.AutoScrollPosition = point;
base.Invalidate();

View File

@ -301,6 +301,7 @@
<DependentUpon>LoadingSplash.cs</DependentUpon>
</Compile>
<Compile Include="Options.cs" />
<Compile Include="Patient.cs" />
<Compile Include="Printing.cs" />
<Compile Include="UCPatientAppts.cs">
<SubType>UserControl</SubType>

View File

@ -10,12 +10,12 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.Build.0 = Release|Any CPU
{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Release|Any CPU.Build.0 = Release|Any CPU
{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.Build.0 = Release|Any CPU
{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection

View File

@ -111,7 +111,38 @@ namespace IndianHealthService.ClinicalScheduling
apptPrinting++;
}
}
/// <summary>
/// Prints a single appointment slip to give to the patient
/// </summary>
/// <param name="appt">The Appointment to print</param>
/// <param name="e">PrintPageEventArgs from PrintDocument Print handler</param>
public virtual void PrintAppointmentSlip(CGAppointment appt, PrintPageEventArgs e)
{
Rectangle printArea = e.MarginBounds;
Graphics g = e.Graphics;
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center; //for title
Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title
Font fBody = new Font(FontFamily.GenericSerif, 12);
string s = "Appointment Reminder Slip";
g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
// move down
int titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height;
printArea.Y += titleHeight;
printArea.Height -= titleHeight;
// draw underline
g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
printArea.Y += 15;
printArea.Height -= 15;
}
/// <summary>
/// Print Letter to be given or mailed to the patient
/// </summary>

View File

@ -62,6 +62,7 @@ namespace IndianHealthService.ClinicalScheduling
private TextBox txtPhoneCell;
private Label label7;
private TextBox txtCountry;
private CheckBox chkPrint;
private IContainer components;
public DAppointPage()
@ -124,6 +125,7 @@ namespace IndianHealthService.ClinicalScheduling
this.patientApptsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.dsPatientApptDisplay2BindingSource = new System.Windows.Forms.BindingSource(this.components);
this.dsPatientApptDisplay2 = new IndianHealthService.ClinicalScheduling.dsPatientApptDisplay2();
this.chkPrint = new System.Windows.Forms.CheckBox();
this.tabControl1.SuspendLayout();
this.tabAppointment.SuspendLayout();
this.groupBox3.SuspendLayout();
@ -531,6 +533,7 @@ namespace IndianHealthService.ClinicalScheduling
//
// panel1
//
this.panel1.Controls.Add(this.chkPrint);
this.panel1.Controls.Add(this.cmdCancel);
this.panel1.Controls.Add(this.cmdOK);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
@ -573,6 +576,16 @@ namespace IndianHealthService.ClinicalScheduling
this.dsPatientApptDisplay2.DataSetName = "dsPatientApptDisplay2";
this.dsPatientApptDisplay2.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// chkPrint
//
this.chkPrint.AutoSize = true;
this.chkPrint.Location = new System.Drawing.Point(13, 14);
this.chkPrint.Name = "chkPrint";
this.chkPrint.Size = new System.Drawing.Size(144, 17);
this.chkPrint.TabIndex = 2;
this.chkPrint.Text = "Print Appointment Letter";
this.chkPrint.UseVisualStyleBackColor = true;
//
// DAppointPage
//
this.AcceptButton = this.cmdOK;
@ -595,6 +608,7 @@ namespace IndianHealthService.ClinicalScheduling
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.patientApptsBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dsPatientApptDisplay2BindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dsPatientApptDisplay2)).EndInit();
@ -610,7 +624,7 @@ namespace IndianHealthService.ClinicalScheduling
private string m_sPatientName;
private string m_sPatientHRN;
private string m_sPatientIEN;
private string m_sPatientDOB;
private DateTime m_dPatientDOB;
private string m_sPatientPID;
private string m_sCity;
@ -622,12 +636,14 @@ namespace IndianHealthService.ClinicalScheduling
private string m_sNote;
private DateTime m_dStartTime;
private DateTime m_dEndTime;
private int m_nDuration;
private string m_sClinic;
private string m_sPhoneCell;
private string m_sEmail;
private string m_sCountry;
private int m_iAccessTypeID;
#endregion //fields
@ -635,13 +651,15 @@ namespace IndianHealthService.ClinicalScheduling
public void InitializePage(CGAppointment a)
{
InitializePage(a.PatientID.ToString(), a.StartTime, a.Duration, "", a.Note);
InitializePage(a.PatientID.ToString(), a.StartTime, a.EndTime, "", a.Note, a.AccessTypeID);
}
public void InitializePage(string sPatientIEN, DateTime dStart, int nDuration, string sClinic, string sNote)
public void InitializePage(string sPatientIEN, DateTime dStart, DateTime dEnd, string sClinic, string sNote, int iAccessTypeID)
{
m_dStartTime = dStart;
m_nDuration = nDuration;
m_dEndTime = dEnd;
m_nDuration = (int)(dEnd - dStart).TotalMinutes;
m_iAccessTypeID = iAccessTypeID;
m_sClinic = sClinic;
m_sPatientIEN = sPatientIEN;
m_sNote = sNote;
@ -658,8 +676,7 @@ namespace IndianHealthService.ClinicalScheduling
this.m_sPatientHRN = r["HRN"].ToString();
this.m_sPatientIEN = r["IEN"].ToString();
this.m_sPatientPID = r["PID"].ToString();
DateTime dDob =(DateTime) r["DOB"]; //what if it's null?
this.m_sPatientDOB = dDob.ToShortDateString();
this.m_dPatientDOB = (DateTime) r["DOB"];
this.m_sStreet = r["STREET"].ToString();
this.m_sCity = r["CITY"].ToString();
this.m_sPhoneOffice = r["OFCPHONE"].ToString();
@ -694,7 +711,7 @@ namespace IndianHealthService.ClinicalScheduling
lblStartTime.Text = m_dStartTime.ToShortDateString() + " " + m_dStartTime.ToShortTimeString();
txtCity.Text = this.m_sCity;
txtDOB.Text = this.m_sPatientDOB;
txtDOB.Text = this.m_dPatientDOB.ToShortDateString();
txtHRN.Text = this.m_sPatientHRN;
txtNote.Text = this.m_sNote;
txtPatientName.Text = m_sPatientName;
@ -766,6 +783,50 @@ namespace IndianHealthService.ClinicalScheduling
}
}
public bool PrintAppointmentSlip
{
get { return chkPrint.Checked; }
}
public CGAppointment Appointment
{
get
{
Patient pt = new Patient
{
DFN = Int32.Parse(m_sPatientIEN),
Name = m_sPatientName,
DOB = m_dPatientDOB,
ID = m_sPatientPID,
HRN = m_sPatientHRN,
Appointments = null, //for now
Street = m_sStreet,
City = m_sCity,
State = m_sState,
Zip = m_sZip,
Country = m_sCountry,
Email = m_sEmail,
HomePhone = m_sPhoneHome,
WorkPHone = m_sPhoneOffice,
CellPhone = m_sPhoneCell
};
CGAppointment appt = new CGAppointment()
{
PatientID = Convert.ToInt32(m_sPatientIEN),
PatientName = m_sPatientName,
StartTime = m_dStartTime,
EndTime = m_dEndTime,
Resource = m_sClinic,
Note = m_sNote,
HealthRecordNumber = m_sPatientHRN,
AccessTypeID = m_iAccessTypeID,
Patient = pt
};
return appt;
}
}
#endregion //Properties

View File

@ -112,18 +112,18 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="patientApptsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="patientApptsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>412, 17</value>
</metadata>
<metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>179, 17</value>
</metadata>
<metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -52,6 +52,7 @@ namespace IndianHealthService.ClinicalScheduling
private DateTimePicker dtStart;
private ColumnHeader colDOW;
private ColumnHeader colID;
private Label lblMessage;
private System.ComponentModel.IContainer components;
@ -311,6 +312,7 @@ namespace IndianHealthService.ClinicalScheduling
this.colResource = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colSlots = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colAccessType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lblMessage = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.pnlDescription.SuspendLayout();
this.grpDescription.SuspendLayout();
@ -322,6 +324,7 @@ namespace IndianHealthService.ClinicalScheduling
//
// panel1
//
this.panel1.Controls.Add(this.lblMessage);
this.panel1.Controls.Add(this.cmdSearch);
this.panel1.Controls.Add(this.cmdCancel);
this.panel1.Controls.Add(this.btnAccept);
@ -333,7 +336,7 @@ namespace IndianHealthService.ClinicalScheduling
//
// cmdSearch
//
this.cmdSearch.Location = new System.Drawing.Point(536, 8);
this.cmdSearch.Location = new System.Drawing.Point(33, 6);
this.cmdSearch.Name = "cmdSearch";
this.cmdSearch.Size = new System.Drawing.Size(72, 24);
this.cmdSearch.TabIndex = 2;
@ -343,7 +346,7 @@ namespace IndianHealthService.ClinicalScheduling
// cmdCancel
//
this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cmdCancel.Location = new System.Drawing.Point(616, 8);
this.cmdCancel.Location = new System.Drawing.Point(828, 8);
this.cmdCancel.Name = "cmdCancel";
this.cmdCancel.Size = new System.Drawing.Size(64, 24);
this.cmdCancel.TabIndex = 1;
@ -352,7 +355,7 @@ namespace IndianHealthService.ClinicalScheduling
// btnAccept
//
this.btnAccept.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnAccept.Location = new System.Drawing.Point(128, 8);
this.btnAccept.Location = new System.Drawing.Point(135, 8);
this.btnAccept.Name = "btnAccept";
this.btnAccept.Size = new System.Drawing.Size(176, 24);
this.btnAccept.TabIndex = 0;
@ -435,6 +438,7 @@ namespace IndianHealthService.ClinicalScheduling
this.dtEnd.Name = "dtEnd";
this.dtEnd.Size = new System.Drawing.Size(200, 20);
this.dtEnd.TabIndex = 65;
this.dtEnd.ValueChanged += new System.EventHandler(this.dtEnd_ValueChanged);
//
// dtStart
//
@ -442,6 +446,7 @@ namespace IndianHealthService.ClinicalScheduling
this.dtStart.Name = "dtStart";
this.dtStart.Size = new System.Drawing.Size(200, 20);
this.dtStart.TabIndex = 64;
this.dtStart.ValueChanged += new System.EventHandler(this.dtStart_ValueChanged);
//
// label3
//
@ -671,6 +676,16 @@ namespace IndianHealthService.ClinicalScheduling
this.colAccessType.Text = "Access Type";
this.colAccessType.Width = 101;
//
// lblMessage
//
this.lblMessage.AutoSize = true;
this.lblMessage.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblMessage.ForeColor = System.Drawing.Color.Red;
this.lblMessage.Location = new System.Drawing.Point(337, 16);
this.lblMessage.Name = "lblMessage";
this.lblMessage.Size = new System.Drawing.Size(0, 16);
this.lblMessage.TabIndex = 3;
//
// DApptSearch
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
@ -684,6 +699,7 @@ namespace IndianHealthService.ClinicalScheduling
this.Name = "DApptSearch";
this.Text = "Find Clinic Availability";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.pnlDescription.ResumeLayout(false);
this.grpDescription.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
@ -702,7 +718,8 @@ namespace IndianHealthService.ClinicalScheduling
{
//Tell user we are processing
this.Cursor = Cursors.WaitCursor;
this.lblMessage.Text = String.Empty;
//Get the control data into local vars
UpdateDialogData(false);
//Resource array, Begin date, Access type array, MTWTF , AM PM
@ -878,8 +895,8 @@ namespace IndianHealthService.ClinicalScheduling
lstResults.BeginUpdate(); //tell listview to suspend drawing for now
lstResults.Items.Clear(); //empty it from old data
//if (items.Length == 0) lstResults.Items.Add(new ListViewItem(new string[] { "", "", "", "" , "", "No Slots found", "", "" })); // no results
if (items.Length > 0) lstResults.Items.AddRange(items); // add new data
else this.lblMessage.Text = "No available Appointment Slots Found!";
lstResults.EndUpdate(); // ok done adding items, draw now.
//--End Update Listview
@ -903,44 +920,28 @@ namespace IndianHealthService.ClinicalScheduling
}
private void grdResult_DoubleClick(object sender, System.EventArgs e)
{
/*
if (lstResults.DataSource == null)
return;
DataGridViewCell dgCell;
dgCell = this.grdResult.CurrentCell;
this.m_sSelectedResource = grdResult.SelectedRows[0].Cells[2].ToString();
this.m_sSelectedDate = (DateTime)grdResult.SelectedRows[0].Cells[0].Value;
this.DialogResult = DialogResult.OK;
this.Close();
*/
}
private void grdResult_CurrentCellChanged(object sender, System.EventArgs e)
{
/*
DataGridViewCell dgCell;
dgCell = this.grdResult.CurrentCell;
*/
}
/// <summary>
/// BAAAAAAAAAAAAAAAAAD. Use a shared method instead.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lstResults_DoubleClick(object sender, EventArgs e)
{
btnAccept_Click(sender, e);
ProcessChoice(sender, e);
}
private void btnAccept_Click(object sender, EventArgs e)
{
ProcessChoice(sender, e);
}
/// <summary>
/// Shared method to process a user's choice
/// </summary>
/// <param name="s">sender</param>
/// <param name="e">EventArgs</param>
private void ProcessChoice(object s, EventArgs e)
{
if (lstResults.SelectedIndices.Count == 0)
{
this.DialogResult = DialogResult.None;
lblMessage.Text = "No Appointment Slot selected!";
return;
}
@ -951,10 +952,29 @@ namespace IndianHealthService.ClinicalScheduling
this.DialogResult = DialogResult.OK;
}
/// <summary>
/// Adjust start date based on end date.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dtStart_ValueChanged(object sender, EventArgs e)
{
if (dtEnd.Value < dtStart.Value) dtEnd.Value = dtStart.Value;
}
/// <summary>
/// Adjust end date based on start date.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dtEnd_ValueChanged(object sender, EventArgs e)
{
if (dtStart.Value > dtEnd.Value) dtStart.Value = dtEnd.Value;
}
#endregion Event Handlers
#region Properties
/// <summary>
/// Gets the Availability Selected by the User in which to put an appointment
@ -965,5 +985,7 @@ namespace IndianHealthService.ClinicalScheduling
}
#endregion Properties
}
}