CGAVDocument: Don't Update Grid. Leave that to CGAVView.

CGAVView: When updating grid, make a copy of appointments, and use the copy, so there won't be clashes when updating appointments in the background.
CGDocument: Minor Changes in AppointmentNoShow; New method AppointmentUndoCheckIn
CGDocumentManager: Resequenced load order b/c UserPreferences now talks to DB.
DAL: New Methods to save autoprint preferences; new delegate to enable some async stuff
DCheckIn & DAppointPage: _myCodeIsFiringIstheCheckBoxChangedEvent added to protect against firing event when setting checkbox in the code.
DPatientLetter: No changes.
UserPreferences: Now gets and saves user preferences from DB.
This commit is contained in:
sam 2011-03-29 09:38:18 +00:00
parent 5860f06e6a
commit 0e73482b11
14 changed files with 163 additions and 51 deletions

View File

@ -251,7 +251,7 @@ namespace IndianHealthService.ClinicalScheduling
}
Debug.Write("CreateAvailabilityAuto -- new AV block created\n");
UpdateAllViews();
//UpdateAllViews();
aCopy.AppointmentKey = nApptID;
return nApptID;

View File

@ -883,6 +883,7 @@ namespace IndianHealthService.ClinicalScheduling
{
//TODO: Create these components
this.calendarGrid1.Resources = this.m_Document.Resources;
this.calendarGrid1.Appointments = (CGAppointments)this.m_Document.m_AVBlocks.Clone();
this.calendarGrid1.OnUpdateArrays();
this.lblResource.Text = this.m_Document.DocName;
@ -1041,12 +1042,9 @@ namespace IndianHealthService.ClinicalScheduling
/*
* Display dialog to collect:
* - Number of weeks to apply template
* - Starting week Monday
* - Starting week (application starts on Culture WeekStartDay of selected week)
* - Template path & filename
*
* for each week,
* Delete all availability during that week
* apply the template
*
*/
DAccessTemplate dlg = new DAccessTemplate();
@ -1505,7 +1503,7 @@ namespace IndianHealthService.ClinicalScheduling
this.Document.WeekNeedsRefresh(1, dtStart, out newStartDate, out newEndDate);
dtStart = newStartDate;
int nWeeksToApply = dlg.WeeksToApply;
DateTime dtEnd = dtStart.AddDays(6); // or 7?
DateTime dtEnd = dtStart.AddDays(6); // or 7? smh:: not 7 for sure.
string sResourceID = this.m_Document.ResourceID.ToString();

View File

@ -1245,14 +1245,14 @@ namespace IndianHealthService.ClinicalScheduling
}
public string AppointmentNoShow(int nApptID, bool bNoShow)
public string AppointmentNoShow(CGAppointment a, bool bNoShow)
{
/*
* BSDX NOSHOW RPC Returns 1 in ERRORID if successfully sets NOSHOW flag in BSDX APPOINTMENT and, if applicable, File 2
*Otherwise, returns negative numbers for failure and errormessage in ERRORTXT
*
*/
int nApptID = a.AppointmentKey;
string sTest = bNoShow.ToString();
string sNoShow = (bNoShow == true) ? "1" : "0";
string sSql = "BSDX NOSHOW^" + nApptID.ToString();
@ -1269,11 +1269,32 @@ namespace IndianHealthService.ClinicalScheduling
return r["ERRORTEXT"].ToString();
}
bool bRet = RefreshSchedule();
//All okay over here... then set appointment noshow or not no show...
a.NoShow = bNoShow ? true : false;
//bool bRet = RefreshSchedule();
return sErrorID;
}
public bool AppointmentUndoCheckin(CGAppointment a, out string msg)
{
msg = "";
//zero good, anything else bad
DataTable dt = CGDocumentManager.Current.DAL.RemoveCheckIn(a.AppointmentKey);
if (dt.Rows[0][0].ToString() == "0")
{
a.CheckInTime = DateTime.MinValue; // remove check-in time.
return true;
}
else
{
msg = dt.Rows[0][0].ToString();
return false;
}
}
#endregion Methods
}//End class

View File

@ -353,8 +353,8 @@ namespace IndianHealthService.ClinicalScheduling
threadSplash.Name = "Splash Thread";
threadSplash.Start(m_ds); // pass form as parameter.
//There are 19 steps to load the application. That's max for the progress bar.
setMaxProgressDelegate(19);
//There are 21 steps to load the application. That's max for the progress bar.
setMaxProgressDelegate(21);
// smh--not used: System.Configuration.ConfigurationManager.GetSection("appSettings");
@ -471,8 +471,7 @@ namespace IndianHealthService.ClinicalScheduling
this.m_PrintingObject = Creator.PrintFactory();
}
//User Preferences Object
_current.UserPreferences = new UserPreferences();
//User Interface Culture (m_CultureName is set from the command line flag /culture)
try { Thread.CurrentThread.CurrentUICulture = new CultureInfo(m_CultureName); } // if "", invariant culture
@ -536,6 +535,12 @@ namespace IndianHealthService.ClinicalScheduling
setStatusDelegate("Setting Application Context to BSDXRPC...");
m_ConnectInfo.AppContext = "BSDXRPC";
//User Preferences Object
setProgressDelegate(4); //next number is 6 b/c two calls
setStatusDelegate("Getting User Preferences from the Server...");
_current.UserPreferences = new UserPreferences(); // Does the calling to do that...
//Load global recordsets
string statusConst = "Loading VistA data tables...";
setStatusDelegate(statusConst);
@ -544,7 +549,7 @@ namespace IndianHealthService.ClinicalScheduling
//Schedule User Info
// Table #4
setProgressDelegate(4);
setProgressDelegate(6);
setStatusDelegate(statusConst + " Schedule User");
DataTable dtUser = _dal.GetUserInfo(m_ConnectInfo.DUZ);
dtUser.TableName = "SchedulingUser";
@ -559,7 +564,7 @@ namespace IndianHealthService.ClinicalScheduling
//Get Access Types
// Table #5
setProgressDelegate(5);
setProgressDelegate(7);
setStatusDelegate(statusConst + " Access Types");
DataTable dtAccessTypes = _dal.GetAccessTypes();
dtAccessTypes.TableName = "AccessTypes";
@ -567,7 +572,7 @@ namespace IndianHealthService.ClinicalScheduling
//Get Access Groups
// Table #6
setProgressDelegate(6);
setProgressDelegate(8);
setStatusDelegate(statusConst + " Access Groups");
LoadAccessGroupsTable();
@ -582,7 +587,7 @@ namespace IndianHealthService.ClinicalScheduling
//Optimization Note: Can eliminate Access type and Access Group Table
// But they are heavily referenced throughout the code.
// Table #7
setProgressDelegate(7);
setProgressDelegate(9);
setStatusDelegate(statusConst + " Access Group Types");
LoadAccessGroupTypesTable();
@ -602,14 +607,14 @@ namespace IndianHealthService.ClinicalScheduling
//ResourceGroup Table (Resource Groups by User)
// Table #8
// What shows up on the tree. The groups the user has access to.
setProgressDelegate(8);
setProgressDelegate(10);
setStatusDelegate(statusConst + " Resource Groups By User");
LoadResourceGroupTable();
//Resources by user
// Table #9
// Individual Resources
setProgressDelegate(9);
setProgressDelegate(11);
setStatusDelegate(statusConst + " Resources By User");
LoadBSDXResourcesTable();
@ -621,7 +626,7 @@ namespace IndianHealthService.ClinicalScheduling
//GroupResources table
// Table #10
// Resource Groups and Indivdual Resources together
setProgressDelegate(10);
setProgressDelegate(12);
setStatusDelegate(statusConst + " Group Resources");
LoadGroupResourcesTable();
@ -639,7 +644,7 @@ namespace IndianHealthService.ClinicalScheduling
//HospitalLocation table
//Table #11
setProgressDelegate(11);
setProgressDelegate(13);
setStatusDelegate(statusConst + " Clinics");
//cmd.CommandText = "SELECT BMXIEN 'HOSPITAL_LOCATION_ID', NAME 'HOSPITAL_LOCATION', DEFAULT_PROVIDER, STOP_CODE_NUMBER, INACTIVATE_DATE, REACTIVATE_DATE FROM HOSPITAL_LOCATION";
sCommandText = "BSDX HOSPITAL LOCATION";
@ -660,7 +665,7 @@ namespace IndianHealthService.ClinicalScheduling
//Build ScheduleUser table
//Table #12
setProgressDelegate(12);
setProgressDelegate(14);
setStatusDelegate(statusConst + " Schedule User");
this.LoadScheduleUserTable();
@ -673,7 +678,7 @@ namespace IndianHealthService.ClinicalScheduling
//Build ResourceUser table
//Table #13
//Acess to Resources by [this] User
setProgressDelegate(13);
setProgressDelegate(15);
setStatusDelegate(statusConst + " Resource User");
this.LoadResourceUserTable();
@ -692,7 +697,7 @@ namespace IndianHealthService.ClinicalScheduling
//Build active provider table
//Table #14
//TODO: Lazy load the provider table; no need to load in advance.
setProgressDelegate(14);
setProgressDelegate(16);
setStatusDelegate(statusConst + " Providers");
sCommandText = "SELECT BMXIEN, NAME FROM NEW_PERSON WHERE INACTIVE_DATE = '' AND BMXIEN > 1";
ConnectInfo.RPMSDataTable(sCommandText, "Provider", m_dsGlobal);
@ -700,7 +705,7 @@ namespace IndianHealthService.ClinicalScheduling
//Build the HOLIDAY table
//Table #15
setProgressDelegate(15);
setProgressDelegate(17);
setStatusDelegate(statusConst + " Holiday");
sCommandText = "SELECT NAME, DATE FROM HOLIDAY WHERE INTERNAL[DATE] > '" + FMDateTime.Create(DateTime.Today).DateOnly.FMDateString + "'";
ConnectInfo.RPMSDataTable(sCommandText, "HOLIDAY", m_dsGlobal);
@ -720,16 +725,16 @@ namespace IndianHealthService.ClinicalScheduling
// Event Subsriptions
setStatusDelegate("Subscribing to Server Events");
//Table #16
setProgressDelegate(16);
setProgressDelegate(18);
_current.m_ConnectInfo.SubscribeEvent("BSDX SCHEDULE");
//Table #17
setProgressDelegate(17);
setProgressDelegate(19);
_current.m_ConnectInfo.SubscribeEvent("BSDX CALL WORKSTATIONS");
//Table #18
setProgressDelegate(18);
setProgressDelegate(20);
_current.m_ConnectInfo.SubscribeEvent("BSDX ADMIN MESSAGE");
//Table #19
setProgressDelegate(19);
setProgressDelegate(21);
_current.m_ConnectInfo.SubscribeEvent("BSDX ADMIN SHUTDOWN");
_current.m_ConnectInfo.EventPollingInterval = 5000; //in milliseconds

View File

@ -36,7 +36,7 @@
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>/s=172.16.16.108 /p=9250 /a=BASMA.ALDWAIRI /v=SELEN.123 /culture="ar-JO"</StartArguments>
<StartArguments>/s=172.16.16.108 /p=9250 /a=BASMA.ALDWAIRI /v=SELEN.123 /culture=ar-JO</StartArguments>
<StartPage>
</StartPage>
<StartProgram>C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\IEExec.exe</StartProgram>

View File

@ -16,6 +16,7 @@ namespace IndianHealthService.ClinicalScheduling
private BMXNetConnectInfo _thisConnection; // set in constructor
delegate DataTable RPMSDataTableDelegate(string CommandString, string TableName); // for use in calling (Sync and Async)
delegate string TransmitRPCAsync(string RPCName, string Params); //same idea
/// <summary>
/// Constructor
@ -172,6 +173,64 @@ namespace IndianHealthService.ClinicalScheduling
return RPMSDataTable(cmd, "Cancelled");
}
/// <summary>
/// Remove the check-in for the appointment
/// </summary>
/// <param name="ApptID">Appointment IEN/Key</param>
/// <returns>Table with 1 columns: ERRORID. ErrorID of "0" is okay;
/// any other (negative numbers plus text) is bad</returns>
public DataTable RemoveCheckIn(int ApptID)
{
string cmd = string.Format("BSDX REMOVE CHECK-IN^{0}", ApptID);
return RPMSDataTable(cmd, "");
}
/// <summary>
/// Save User Preference in DB For Printing Routing Slip
/// Uses Parameter BSDX AUTO PRINT RS
/// </summary>
/// <remarks>
/// Notice Code-Fu for Async Save...
/// </remarks>
public bool AutoPrintRoutingSlip
{
get
{
string val = _thisConnection.bmxNetLib.TransmitRPC("BSDX GET PARAM", "BSDX AUTO PRINT RS"); //1 = true; 0 = false; "" = not set
return val == "1" ? true : false;
}
set
{
TransmitRPCAsync _asyncTransmitter = new TransmitRPCAsync(_thisConnection.bmxNetLib.TransmitRPC);
// 0 = success; anything else is wrong. Not being tested here as its success is not critical to application use.
_asyncTransmitter.BeginInvoke("BSDX SET PARAM", String.Format("{0}^{1}", "BSDX AUTO PRINT RS", value ? "1" : "0"), null, null);
}
}
/// <summary>
/// Save User Preference in DB For Printing Routing Slip
/// Uses Parameter BSDX AUTO PRINT AS
/// </summary>
/// <remarks>
/// Notice Code-Fu for Async Save...
/// </remarks>
public bool AutoPrintAppointmentSlip
{
get
{
string val = _thisConnection.bmxNetLib.TransmitRPC("BSDX GET PARAM", "BSDX AUTO PRINT AS"); //1 = true; 0 = false; "" = not set
return val == "1" ? true : false;
}
set
{
TransmitRPCAsync _asyncTransmitter = new TransmitRPCAsync(_thisConnection.bmxNetLib.TransmitRPC);
// 0 = success; anything else is wrong. Not being tested here as its success is not critical to application use.
_asyncTransmitter.BeginInvoke("BSDX SET PARAM", String.Format("{0}^{1}", "BSDX AUTO PRINT AS", value ? "1" : "0"), null, null);
}
}
/// <summary>
/// Workhorse
/// </summary>

View File

@ -670,6 +670,7 @@ namespace IndianHealthService.ClinicalScheduling
private string m_sEmail;
private string m_sCountry;
private int m_iAccessTypeID;
private bool _myCodeIsFiringIstheCheckBoxChangedEvent;
#endregion //fields
@ -718,7 +719,9 @@ namespace IndianHealthService.ClinicalScheduling
UC.Dock = DockStyle.Fill;
groupBox4.Controls.Add(UC);
_myCodeIsFiringIstheCheckBoxChangedEvent = true;
chkPrint.Checked = CGDocumentManager.Current.UserPreferences.PrintAppointmentSlipAutomacially;
_myCodeIsFiringIstheCheckBoxChangedEvent = false;
}
catch(Exception e)
{
@ -861,13 +864,14 @@ namespace IndianHealthService.ClinicalScheduling
#endregion //Properties
/// <summary>
/// Save Print Slip preference in UserPreferences object. For now, it always starts false since
/// it isn't saved in the DB; but that will change in the future.
/// Save Print Slip preference in UserPreferences object.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void chkPrint_CheckedChanged(object sender, EventArgs e)
{
if (_myCodeIsFiringIstheCheckBoxChangedEvent) return;
CGDocumentManager.Current.UserPreferences.PrintAppointmentSlipAutomacially = chkPrint.Checked;
}

View File

@ -24,6 +24,8 @@ namespace IndianHealthService.ClinicalScheduling
// Required for Windows Form Designer support
//
InitializeComponent();
}
@ -59,6 +61,7 @@ namespace IndianHealthService.ClinicalScheduling
public bool m_bPrintRouteSlip;
private List<Provider> _providers;
private ToolTip toolTip1;
private bool _myCodeIsFiringIstheCheckBoxChangedEvent; // To prevent the event from firing when I set the control from code
#endregion Fields
@ -232,8 +235,9 @@ namespace IndianHealthService.ClinicalScheduling
m_dCheckIn = DateTime.Now;
}
//Print Routing Slip based on user preferences.
_myCodeIsFiringIstheCheckBoxChangedEvent = true;
chkRoutingSlip.Checked = CGDocumentManager.Current.UserPreferences.PrintRoutingSlipAutomatically;
_myCodeIsFiringIstheCheckBoxChangedEvent = false;
UpdateDialogData(true);
}
@ -474,6 +478,8 @@ namespace IndianHealthService.ClinicalScheduling
/// <param name="e"></param>
private void chkRoutingSlip_CheckedChanged(object sender, EventArgs e)
{
if (_myCodeIsFiringIstheCheckBoxChangedEvent) return;
CGDocumentManager.Current.UserPreferences.PrintRoutingSlipAutomatically = chkRoutingSlip.Checked;
}

View File

@ -67,7 +67,7 @@ namespace IndianHealthService.ClinicalScheduling
// DPatientLetter
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(648, 398);
this.ClientSize = new System.Drawing.Size(748, 443);
this.Name = "DPatientLetter";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Patient Letter";
@ -403,5 +403,6 @@ namespace IndianHealthService.ClinicalScheduling
// If we reach this point, we need to reset the counter (ticket #15 on https://trac.opensourcevista.net/ticket/15)
_currentApptPrinting = 0;
}
}
}

View File

@ -112,21 +112,21 @@
<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="printAppts.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>116, 17</value>
<metadata name="printAppts.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>122, 17</value>
</metadata>
<metadata name="printReminderLetters.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>218, 17</value>
<metadata name="printReminderLetters.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>231, 17</value>
</metadata>
<metadata name="printCancelLetters.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>374, 17</value>
<metadata name="printCancelLetters.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>397, 17</value>
</metadata>
<metadata name="printRebookLetters.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>515, 17</value>
<metadata name="printRebookLetters.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>547, 17</value>
</metadata>
</root>

View File

@ -6,17 +6,35 @@ using System.Text;
namespace IndianHealthService.ClinicalScheduling
{
/// <summary>
/// Designed to keep user preferences. Very basic for now.
/// Designed to keep user preferences. Gets settings from DB in constructor; Writes them back when changed.
/// </summary>
public class UserPreferences
{
bool _printAppointmentSlipAutomacially;
bool _printRoutingSlipAutomatically;
public UserPreferences()
{
PrintAppointmentSlipAutomacially = false;
PrintRoutingSlipAutomatically = false;
_printAppointmentSlipAutomacially = CGDocumentManager.Current.DAL.AutoPrintAppointmentSlip;
_printRoutingSlipAutomatically = CGDocumentManager.Current.DAL.AutoPrintRoutingSlip;
}
public bool PrintAppointmentSlipAutomacially { get; set; }
public bool PrintRoutingSlipAutomatically { get; set; }
public bool PrintAppointmentSlipAutomacially {
get { return _printAppointmentSlipAutomacially; }
set
{
CGDocumentManager.Current.DAL.AutoPrintAppointmentSlip = _printAppointmentSlipAutomacially = value;
}
}
public bool PrintRoutingSlipAutomatically
{
get { return _printRoutingSlipAutomatically; }
set
{
CGDocumentManager.Current.DAL.AutoPrintRoutingSlip = _printRoutingSlipAutomatically = value;
}
}
}
}