Bumped version number to 1.5

DSplash: Changes intended to support Asynchronous invokation of Splash Screen.
CGDocumentManager: Extensive changes to increase speed and invoke Splash screen async.
This commit is contained in:
sam 2011-01-05 09:10:20 +00:00
parent 034801884f
commit eaad41e08e
8 changed files with 589 additions and 552 deletions

View File

@ -27,7 +27,7 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.4.2.*")]
[assembly: AssemblyVersion("1.5.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
@ -57,5 +57,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: AssemblyFileVersionAttribute("1.4.2.0")]
[assembly: AssemblyFileVersionAttribute("1.5.0.0")]
[assembly: ComVisibleAttribute(false)]

View File

@ -429,7 +429,6 @@ namespace IndianHealthService.ClinicalScheduling
{
m_DocManager.ConnectInfo.LoadConnectInfo();
}
System.IntPtr pHandle = m_DocManager.Handle;
m_pAvArray.Clear();

View File

@ -3,6 +3,7 @@ using System.Windows.Forms;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.Threading;
using IndianHealthService.BMXNet;
using Mono.Options;
using System.Runtime.InteropServices;
@ -10,85 +11,37 @@ using System.Runtime.InteropServices;
namespace IndianHealthService.ClinicalScheduling
{
/// <summary>
/// Summary description for DocumentManager.
/// Main Worker. Handles sub-forms.
/// </summary>
public class CGDocumentManager : System.Windows.Forms.Form
public class CGDocumentManager //: System.Windows.Forms.Form
{
#region Member Variables
private static CGDocumentManager _current;
private Hashtable _views = new Hashtable();
private Hashtable m_AVViews = new Hashtable();
private Hashtable _views = new Hashtable(); //Returns the list of currently opened documents
private Hashtable m_AVViews = new Hashtable(); // List of currently opened CGAVViews
private string m_sWindowText = "Clinical Scheduling"; //Default Window Text
private bool m_bSchedManager;
private bool m_bExitOK = true;
public string m_sHandle = "0";
private bool m_bSchedManager = false; // Do you have the XUPROGMODE or BSDXZMGR?
private bool m_bExitOK = true; // Okay to exit program? Used to control Re-logins. Default true.
public string m_sHandle = "0"; // Not Used
//Connection variables
//Connection variables (tied to command line parameters /a /v /s /p /e)
private string m_AccessCode="";
private string m_VerifyCode="";
private string m_Server="";
private int m_Port=0;
//Encoding string (empty by default)
private string m_Encoding="";
private string m_Encoding=""; //Encoding is "" by default;
//Data Access Layer
private DAL _dal = null;
//M Connection member variables
private DataSet m_dsGlobal = null;
private System.ComponentModel.IContainer components = null;
private BMXNetConnectInfo m_ConnectInfo = null;
private BMXNetConnectInfo.BMXNetEventDelegate CDocMgrEventDelegate;
private DataSet m_dsGlobal = null; // Holds all user data
private BMXNetConnectInfo m_ConnectInfo = null; // Connection to VISTA object
private BMXNetConnectInfo.BMXNetEventDelegate CDocMgrEventDelegate; // Delegate to respond to messages from VISTA. Responds to event: BMXNetConnectInfo.BMXNetEvent
#endregion
/// <summary>
/// Constructor. Sets up connector, and ties BMXNet Events to function here.
/// </summary>
public CGDocumentManager()
{
InitializeComponent();
m_bSchedManager = false;
}
#region BMXNet Event Handler
private void CDocMgrEventHandler(Object obj, BMXNet.BMXNetEventArgs e)
{
if (e.BMXEvent == "BSDX CALL WORKSTATIONS")
{
string sParam = "";
string sDelim="~";
sParam += this.m_ConnectInfo.UserName + sDelim;
sParam += this.m_sHandle + sDelim;
sParam += Application.ProductVersion + sDelim;
sParam += this._views.Count.ToString();
_current.m_ConnectInfo.RaiseEvent("BSDX WORKSTATION REPORT", sParam, true);
}
if (e.BMXEvent == "BSDX ADMIN MESSAGE")
{
string sMsg = e.BMXParam;
ShowAdminMsgDelegate samd = new ShowAdminMsgDelegate(ShowAdminMsg);
this.Invoke(samd, new object [] {sMsg});
}
if (e.BMXEvent == "BSDX ADMIN SHUTDOWN")
{
string sMsg = e.BMXParam;
CloseAllDelegate cad = new CloseAllDelegate(CloseAll);
this.Invoke(cad, new object [] {sMsg});
}
}
delegate void ShowAdminMsgDelegate(string sMsg);
private void ShowAdminMsg(string sMsg)
{
MessageBox.Show(sMsg, "Message from Scheduling Administrator", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
#endregion BMXNet Event Handler
#region Properties
/// <summary>
@ -138,13 +91,6 @@ namespace IndianHealthService.ClinicalScheduling
m_dsGlobal = value;
}
}
//public BMXNetConnection ADOConnection
//{
// get
// {
// return m_ADOConnection;
// }
//}
/// <summary>
/// Returns the single CGDocumentManager object
@ -157,6 +103,7 @@ namespace IndianHealthService.ClinicalScheduling
}
}
/// <summary>
/// Returns the list of currently opened documents
/// </summary>
@ -187,68 +134,166 @@ namespace IndianHealthService.ClinicalScheduling
#endregion
#region Methods & Events
/// <summary>
/// Clean up any resources being used.
/// Constructor. Does absolutely nothing at this point.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (m_ConnectInfo != null)
{
m_ConnectInfo.EventPollingEnabled = false;
m_ConnectInfo.UnSubscribeEvent("BSDX SCHEDULE");
m_ConnectInfo.UnSubscribeEvent("BSDX CALL WORKSTATIONS");
m_ConnectInfo.CloseConnection();
}
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
public CGDocumentManager()
{
}
private DSplash m_ds;
public void StartSplash()
#if DEBUG
//To write to the console
[DllImport("kernel32.dll")]
static extern bool AttachConsole(int dwProcessId);
private const int ATTACH_PARENT_PROCESS = -1;
#endif
/// <summary>
/// Main Entry Point
/// </summary>
/// <param name="args">We accept the following Arguments:
/// /s or -s = Server ip address or name
/// /p or -p = port number (must be numeric)
/// /a or -a = Access Code
/// /v or -v = Verify Code
/// /e or -e = Encoding (name of encoding as known to windows, such as windows-1256)
/// </param>
/// <remarks>
/// Encoding decision is complex. This is the order of priority:
/// - If the M DB runs in UTF-8, that's what we are going to use.
/// - If that's not so, /e sets the default encoding. If /e is a non-existent encoding, move forward.
/// - If /e is not supplied or is not recognized, the default encoding is the Windows default Encoding for the user.
/// </remarks>
[STAThread()]
static void Main(string[] args)
{
m_ds = new DSplash();
m_ds.ShowDialog();
#if DEBUG
// Print console messages to console if launched from console
// Note: Imported From kernel32.dll
AttachConsole(ATTACH_PARENT_PROCESS);
#endif
//Store a class instance of manager. Actual constructor does nothing.
_current = new CGDocumentManager();
//Get command line options; store in private variables
var opset = new OptionSet() {
{ "s=", s => _current.m_Server = s },
{ "p=", p => _current.m_Port = int.Parse(p) },
{ "a=", a => _current.m_AccessCode = a },
{ "v=", v => _current.m_VerifyCode = v },
{ "e=", e => _current.m_Encoding = e}
};
opset.Parse(args);
_current.InitializeApp();
//Create the first empty document
CGDocument doc = new CGDocument();
doc.DocManager = _current;
doc.OnNewDocument();
Application.DoEvents();
//Run the application
Application.Run();
}
#region BMXNet Event Handler
private void CDocMgrEventHandler(Object obj, BMXNet.BMXNetEventArgs e)
{
if (e.BMXEvent == "BSDX CALL WORKSTATIONS")
{
string sParam = "";
string sDelim="~";
sParam += this.m_ConnectInfo.UserName + sDelim;
sParam += this.m_sHandle + sDelim;
sParam += Application.ProductVersion + sDelim;
sParam += this._views.Count.ToString();
_current.m_ConnectInfo.RaiseEvent("BSDX WORKSTATION REPORT", sParam, true);
}
if (e.BMXEvent == "BSDX ADMIN MESSAGE")
{
string sMsg = e.BMXParam;
ShowAdminMsgDelegate samd = new ShowAdminMsgDelegate(ShowAdminMsg);
//this.Invoke(samd, new object [] {sMsg});
samd.Invoke(sMsg);
}
if (e.BMXEvent == "BSDX ADMIN SHUTDOWN")
{
string sMsg = e.BMXParam;
CloseAllDelegate cad = new CloseAllDelegate(CloseAll);
//this.Invoke(cad, new object [] {sMsg});
cad.Invoke(sMsg);
}
}
delegate void ShowAdminMsgDelegate(string sMsg);
private void ShowAdminMsg(string sMsg)
{
MessageBox.Show(sMsg, "Message from Scheduling Administrator", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
#endregion BMXNet Event Handler
#region Methods & Events
private void StartSplash(object form)
{
((DSplash)form).ShowDialog();
}
/// <summary>
/// See InitializeApp(bool) below
/// </summary>
private void InitializeApp()
{
InitializeApp(false);
}
/// <summary>
/// Does a million things:
/// 1. Starts Connection and displays log-in dialogs
/// 2. Starts Splash screen
/// 3. Loads data tables
/// </summary>
/// <param name="bReLogin">Is the User logging in again from a currently running instance?
/// If so, display a dialog to collect access and verify codes.</param>
private void InitializeApp(bool bReLogin)
{
//Set M connection info
m_ConnectInfo = new BMXNetConnectInfo(m_Encoding); // Encoding is "" unless passed in command line
_dal = new DAL(m_ConnectInfo); // Data access layer
//m_ConnectInfo.bmxNetLib.StartLog(); //This line turns on logging of messages
//Create a delegate to process events raised by BMX.
CDocMgrEventDelegate = new BMXNetConnectInfo.BMXNetEventDelegate(CDocMgrEventHandler);
//Tie delegate to Events generated by BMX.
m_ConnectInfo.BMXNetEvent += CDocMgrEventDelegate;
//Disable polling (But does this really work???? I don't see how it gets disabled)
m_ConnectInfo.EventPollingEnabled = false;
try
{
//Set M connection info
//Show a splash screen while initializing
m_ds = new DSplash();
m_ds.Show(this);
m_ds.SetStatus("Loading Configuration Settings...");
m_ds.Refresh();
this.Activate();
DSplash m_ds = new DSplash();
DSplash.dSetStatus setStatusDelegate = new DSplash.dSetStatus(m_ds.SetStatus);
DSplash.dAny closeSplashDelegate = new DSplash.dAny(m_ds.RemoteClose);
DSplash.dAny hideSplashDelegate = new DSplash.dAny(m_ds.RemoteHide);
Thread threadSplash = new Thread(new ParameterizedThreadStart(StartSplash));
threadSplash.IsBackground = true; //expendable -- exit even if still running.
threadSplash.Start(m_ds);
//m_ds.SetStatus("Loading Configuration Settings...");
//m_ds.Refresh();
//this.Activate();
// smh--not used System.Configuration.ConfigurationManager.GetSection("appSettings");
m_ds.SetStatus("Connecting to VistA Server...");
m_ds.Refresh();
setStatusDelegate("Connecting to VISTA");
//m_ds.Refresh();
bool bRetry = true;
//Try to connect using supplied values for Server and Port
@ -257,6 +302,8 @@ namespace IndianHealthService.ClinicalScheduling
//we can connect at all by doing a simple connection and disconnect.
//TODO: Make this more robust by sending a TCPConnect message and seeing if you get a response.
//m_ds.Refresh();
if (m_Server != "" && m_Port != 0)
{
System.Net.Sockets.TcpClient tcpClient = new System.Net.Sockets.TcpClient();
@ -270,6 +317,7 @@ namespace IndianHealthService.ClinicalScheduling
throw ex;
}
}
do
{
// login crap
@ -302,7 +350,7 @@ namespace IndianHealthService.ClinicalScheduling
}
catch (Exception ex)
{
m_ds.Close();
//m_ds.Close();
if (MessageBox.Show("Unable to connect to VistA. " + ex.Message, "Clinical Scheduling", MessageBoxButtons.RetryCancel) == DialogResult.Retry)
{
bRetry = true;
@ -310,6 +358,7 @@ namespace IndianHealthService.ClinicalScheduling
}
else
{
closeSplashDelegate();
bRetry = false;
throw ex;
}
@ -320,8 +369,8 @@ namespace IndianHealthService.ClinicalScheduling
_current.m_dsGlobal = new DataSet("GlobalDataSet");
//Version info
m_ds.SetStatus("Getting Version Info...");
m_ds.Refresh();
//m_ds.Activate();
setStatusDelegate("Getting Version Info from Server...");
DataTable ver = _dal.GetVersion("BSDX");
ver.TableName = "VersionInfo";
@ -356,6 +405,8 @@ namespace IndianHealthService.ClinicalScheduling
//Change encoding
setStatusDelegate("Setting encoding...");
if (m_Encoding == String.Empty)
{
string utf8_server_support = m_ConnectInfo.bmxNetLib.TransmitRPC("BMX UTF-8", "");
@ -363,24 +414,160 @@ namespace IndianHealthService.ClinicalScheduling
m_ConnectInfo.bmxNetLib.Encoder = System.Text.UTF8Encoding.UTF8;
}
//Set application context
m_ds.SetStatus("Setting Application Context to BSDXRPC...");
m_ds.Refresh();
setStatusDelegate("Setting Application Context to BSDXRPC...");
m_ConnectInfo.AppContext = "BSDXRPC";
//Load global recordsets
m_ds.SetStatus("Loading VistA data tables...");
m_ds.Refresh();
if (_current.LoadGlobalRecordsets() == false)
{
MessageBox.Show("Unable to create VistA recordsets"); //TODO Improve this message
m_ds.Close();
return;
}
string statusConst = "Loading VistA data tables...";
setStatusDelegate(statusConst);
string sCommandText;
setStatusDelegate(statusConst + " Schedule User");
//Schedule User Info
DataTable dtUser = _dal.GetUserInfo(m_ConnectInfo.DUZ);
dtUser.TableName = "SchedulingUser";
m_dsGlobal.Tables.Add(dtUser);
Debug.Assert(dtUser.Rows.Count == 1);
// Only one row and one column named "MANAGER". Set local var m_bSchedManager to true if Manager.
DataRow rUser = dtUser.Rows[0];
Object oUser = rUser["MANAGER"];
string sUser = oUser.ToString();
m_bSchedManager = (sUser == "YES") ? true : false;
setStatusDelegate(statusConst + " Access Types");
//Get Access Types
DataTable dtAccessTypes = _dal.GetAccessTypes();
dtAccessTypes.TableName = "AccessTypes";
m_dsGlobal.Tables.Add(dtAccessTypes);
setStatusDelegate(statusConst + " Access Groups");
//AccessGroups
LoadAccessGroupsTable();
//Build Primary Key for AccessGroup table
DataTable dtGroups = m_dsGlobal.Tables["AccessGroup"];
DataColumn dcKey = dtGroups.Columns["ACCESS_GROUP"];
DataColumn[] dcKeys = new DataColumn[1];
dcKeys[0] = dcKey;
dtGroups.PrimaryKey = dcKeys;
setStatusDelegate(statusConst + " Access Group Types");
//AccessGroupType
LoadAccessGroupTypesTable();
//Build Primary Key for AccessGroupType table
DataTable dtAGTypes = m_dsGlobal.Tables["AccessGroupType"];
DataColumn dcGTKey = dtAGTypes.Columns["ACCESS_GROUP_TYPEID"];
DataColumn[] dcGTKeys = new DataColumn[1];
dcGTKeys[0] = dcGTKey;
dtAGTypes.PrimaryKey = dcGTKeys;
//Build Data Relationship between AccessGroupType and AccessTypes tables
DataRelation dr = new DataRelation("AccessGroupType", //Relation Name
m_dsGlobal.Tables["AccessGroup"].Columns["BMXIEN"], //Parent
m_dsGlobal.Tables["AccessGroupType"].Columns["ACCESS_GROUP_ID"]); //Child
m_dsGlobal.Relations.Add(dr);
setStatusDelegate(statusConst + " Resource Groups By User");
//ResourceGroup Table (Resource Groups by User)
LoadResourceGroupTable();
setStatusDelegate(statusConst + " Resources By User");
//Resources by user
LoadBSDXResourcesTable();
//Build Primary Key for Resources table
DataColumn[] dc = new DataColumn[1];
dc[0] = m_dsGlobal.Tables["Resources"].Columns["RESOURCEID"];
m_dsGlobal.Tables["Resources"].PrimaryKey = dc;
setStatusDelegate(statusConst + " Group Resources");
//GroupResources table
LoadGroupResourcesTable();
//Build Primary Key for ResourceGroup table
dc = new DataColumn[1];
dc[0] = m_dsGlobal.Tables["ResourceGroup"].Columns["RESOURCE_GROUP"];
m_dsGlobal.Tables["ResourceGroup"].PrimaryKey = dc;
//Build Data Relationships between ResourceGroup and GroupResources tables
dr = new DataRelation("GroupResource", //Relation Name
m_dsGlobal.Tables["ResourceGroup"].Columns["RESOURCE_GROUP"], //Parent
m_dsGlobal.Tables["GroupResources"].Columns["RESOURCE_GROUP"]); //Child
CGSchedLib.OutputArray(m_dsGlobal.Tables["GroupResources"], "GroupResources");
m_dsGlobal.Relations.Add(dr);
setStatusDelegate(statusConst + " Clinics");
//HospitalLocation table
//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";
ConnectInfo.RPMSDataTable(sCommandText, "HospitalLocation", m_dsGlobal);
Debug.Write("LoadGlobalRecordsets -- HospitalLocation loaded\n");
//Build Primary Key for HospitalLocation table
dc = new DataColumn[1];
DataTable dtTemp = m_dsGlobal.Tables["HospitalLocation"];
dc[0] = dtTemp.Columns["HOSPITAL_LOCATION_ID"];
m_dsGlobal.Tables["HospitalLocation"].PrimaryKey = dc;
//Build Data Relationships between Resources and HospitalLocation tables
dr = new DataRelation("HospitalLocationResource", //Relation Name
m_dsGlobal.Tables["HospitalLocation"].Columns["HOSPITAL_LOCATION_ID"], //Parent
m_dsGlobal.Tables["Resources"].Columns["HOSPITAL_LOCATION_ID"], false); //Child
m_dsGlobal.Relations.Add(dr);
setStatusDelegate(statusConst + " Schedule User");
//Build ScheduleUser table
this.LoadScheduleUserTable();
//Build Primary Key for ScheduleUser table
dc = new DataColumn[1];
dtTemp = m_dsGlobal.Tables["ScheduleUser"];
dc[0] = dtTemp.Columns["USERID"];
m_dsGlobal.Tables["ScheduleUser"].PrimaryKey = dc;
setStatusDelegate(statusConst + " Resource User");
//Build ResourceUser table
this.LoadResourceUserTable();
//Build Primary Key for ResourceUser table
dc = new DataColumn[1];
dtTemp = m_dsGlobal.Tables["ResourceUser"];
dc[0] = dtTemp.Columns["RESOURCEUSER_ID"];
m_dsGlobal.Tables["ResourceUser"].PrimaryKey = dc;
//Create relation between BSDX Resource and BSDX Resource User tables
dr = new DataRelation("ResourceUser", //Relation Name
m_dsGlobal.Tables["Resources"].Columns["RESOURCEID"], //Parent
m_dsGlobal.Tables["ResourceUser"].Columns["RESOURCEID"]); //Child
m_dsGlobal.Relations.Add(dr);
setStatusDelegate(statusConst + " Providers");
//Build active provider table
sCommandText = "SELECT BMXIEN, NAME FROM NEW_PERSON WHERE INACTIVE_DATE = '' AND BMXIEN > 1";
ConnectInfo.RPMSDataTable(sCommandText, "Provider", m_dsGlobal);
Debug.Write("LoadGlobalRecordsets -- Provider loaded\n");
setStatusDelegate(statusConst + " Clinic Stops");
//Build the CLINIC_STOP table
// sCommandText = "SELECT BMXIEN, CODE, NAME FROM CLINIC_STOP"; //SMH
sCommandText = "SELECT BMXIEN, AMIS_REPORTING_STOP_CODE, NAME FROM CLINIC_STOP";
ConnectInfo.RPMSDataTable(sCommandText, "ClinicStop", m_dsGlobal);
Debug.Write("LoadGlobalRecordsets -- ClinicStop loaded\n");
setStatusDelegate(statusConst + " Holiday");
//Build the HOLIDAY table
sCommandText = "SELECT NAME, DATE FROM HOLIDAY WHERE DATE > '" + DateTime.Today.ToShortDateString() + "'";
ConnectInfo.RPMSDataTable(sCommandText, "HOLIDAY", m_dsGlobal);
Debug.Write("LoadingGlobalRecordsets -- Holidays loaded\n");
//Save the xml schema
//m_dsGlobal.WriteXmlSchema(@"..\..\csSchema20060526.xsd");
//----------------------------------------------
//smh -- why get handles?
System.IntPtr pHandle = this.Handle;
System.IntPtr pConnHandle = this.ConnectInfo.Handle;
this.m_sHandle = pHandle.ToString();
_current.m_ConnectInfo.ReceiveTimeout = 30000; //30-second timeout
@ -396,72 +583,11 @@ namespace IndianHealthService.ClinicalScheduling
_current.m_ConnectInfo.EventPollingEnabled = true;
_current.m_ConnectInfo.AutoFire = 12; //AutoFire every 12*5 seconds
m_ds.Close();
}
catch (Exception ex)
{
m_ds.Close();
Debug.Write(ex.Message);
MessageBox.Show(ex.Message + ex.StackTrace, "Clinical Scheduling Error -- Closing Application");
throw ex;
}
//Close Splash Screen
closeSplashDelegate();
}
//To write to the console
[DllImport("kernel32.dll")]
static extern bool AttachConsole(int dwProcessId);
private const int ATTACH_PARENT_PROCESS = -1;
[STAThread()]
static void Main(string[] args)
{
#if DEBUG
// Print console messages to console if launched from console
// Note: Imported From kernel32.dll
AttachConsole(ATTACH_PARENT_PROCESS);
#endif
try
{
//Store the current manager
_current = new CGDocumentManager();
//Get command line options; store in private variables
var opset = new OptionSet () {
{ "s=", s => _current.m_Server = s },
{ "p=", p => _current.m_Port = int.Parse(p) },
{ "a=", a => _current.m_AccessCode = a },
{ "v=", v => _current.m_VerifyCode = v },
{ "e=", e => _current.m_Encoding = e}
};
opset.Parse(args);
try
{
_current.InitializeApp();
}
catch (Exception ex)
{
Debug.Write(ex.Message);
return;
}
//Create the first empty document
CGDocument doc = new CGDocument();
doc.DocManager = _current;
doc.OnNewDocument();
Application.DoEvents();
//Run the application
Application.Run();
}
catch (Exception ex)
{
Debug.Write(ex.Message);
MessageBox.Show(ex.Message + ex.StackTrace, "CGDocumentManager.Main(): Clinical Scheduling Error -- Closing Application");
return;
}
}
public void LoadAccessGroupsTable()
@ -528,171 +654,17 @@ namespace IndianHealthService.ClinicalScheduling
public void LoadResourceUserTable(bool bAllUsers)
{
string sCommandText = "SELECT BMXIEN RESOURCEUSER_ID, RESOURCENAME, INTERNAL[RESOURCENAME] RESOURCEID, OVERBOOK, MODIFY_SCHEDULE, MODIFY_APPOINTMENTS, USERNAME, INTERNAL[USERNAME] USERID FROM BSDX_RESOURCE_USER"; // WHERE INTERNAL[INSTITUTION]=" + m_ConnectInfo.DUZ2;
string sCommandText = @"SELECT BMXIEN RESOURCEUSER_ID, RESOURCENAME, INTERNAL[RESOURCENAME] RESOURCEID, OVERBOOK, MODIFY_SCHEDULE, MODIFY_APPOINTMENTS, USERNAME, INTERNAL[USERNAME] USERID FROM BSDX_RESOURCE_USER"; // WHERE INTERNAL[INSTITUTION]=" + m_ConnectInfo.DUZ2;
if (!bAllUsers)
{
sCommandText += String.Format(" WHERE INTERNAL[USERNAME] = {0}", m_ConnectInfo.DUZ);
}
ConnectInfo.RPMSDataTable(sCommandText, "ResourceUser", m_dsGlobal);
Debug.Write("LoadGlobalRecordsets -- ResourceUser loaded\n");
}
private bool LoadGlobalRecordsets()
{
string sCommandText;
//Schedule User Info
DataTable dtUser = _dal.GetUserInfo(m_ConnectInfo.DUZ);
dtUser.TableName = "SchedulingUser";
m_dsGlobal.Tables.Add(dtUser);
Debug.Assert(dtUser.Rows.Count == 1);
// Only one row and one column named "MANAGER". Set local var m_bSchedManager to true if Manager.
DataRow rUser = dtUser.Rows[0];
Object oUser = rUser["MANAGER"];
string sUser = oUser.ToString();
m_bSchedManager = (sUser == "YES")?true:false;
//Get Access Types
DataTable dtAccessTypes = _dal.GetAccessTypes();
dtAccessTypes.TableName = "AccessTypes";
m_dsGlobal.Tables.Add(dtAccessTypes);
//AccessGroups
LoadAccessGroupsTable();
//Build Primary Key for AccessGroup table
DataTable dtGroups = m_dsGlobal.Tables["AccessGroup"];
DataColumn dcKey = dtGroups.Columns["ACCESS_GROUP"];
DataColumn[] dcKeys = new DataColumn[1];
dcKeys[0] = dcKey;
dtGroups.PrimaryKey = dcKeys;
//AccessGroupType
LoadAccessGroupTypesTable();
//Build Primary Key for AccessGroupType table
DataTable dtAGTypes = m_dsGlobal.Tables["AccessGroupType"];
DataColumn dcGTKey = dtAGTypes.Columns["ACCESS_GROUP_TYPEID"];
DataColumn[] dcGTKeys = new DataColumn[1];
dcGTKeys[0] = dcGTKey;
dtAGTypes.PrimaryKey = dcGTKeys;
//Build Data Relationship between AccessGroupType and AccessTypes tables
DataRelation dr = new DataRelation("AccessGroupType", //Relation Name
m_dsGlobal.Tables["AccessGroup"].Columns["BMXIEN"], //Parent
m_dsGlobal.Tables["AccessGroupType"].Columns["ACCESS_GROUP_ID"]); //Child
m_dsGlobal.Relations.Add(dr);
//ResourceGroup Table (Resource Groups by User)
LoadResourceGroupTable();
//Resources by user
LoadBSDXResourcesTable();
//Build Primary Key for Resources table
DataColumn[] dc = new DataColumn[1];
dc[0] = m_dsGlobal.Tables["Resources"].Columns["RESOURCEID"];
m_dsGlobal.Tables["Resources"].PrimaryKey = dc;
//GroupResources table
LoadGroupResourcesTable();
//Build Primary Key for ResourceGroup table
dc = new DataColumn[1];
dc[0] = m_dsGlobal.Tables["ResourceGroup"].Columns["RESOURCE_GROUP"];
m_dsGlobal.Tables["ResourceGroup"].PrimaryKey = dc;
//Build Data Relationships between ResourceGroup and GroupResources tables
dr = new DataRelation("GroupResource", //Relation Name
m_dsGlobal.Tables["ResourceGroup"].Columns["RESOURCE_GROUP"], //Parent
m_dsGlobal.Tables["GroupResources"].Columns["RESOURCE_GROUP"]); //Child
CGSchedLib.OutputArray(m_dsGlobal.Tables["GroupResources"], "GroupResources");
m_dsGlobal.Relations.Add(dr);
//HospitalLocation table
//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";
ConnectInfo.RPMSDataTable(sCommandText, "HospitalLocation", m_dsGlobal);
Debug.Write("LoadGlobalRecordsets -- HospitalLocation loaded\n");
//Build Primary Key for HospitalLocation table
dc = new DataColumn[1];
DataTable dtTemp = m_dsGlobal.Tables["HospitalLocation"];
dc[0] = dtTemp.Columns["HOSPITAL_LOCATION_ID"];
m_dsGlobal.Tables["HospitalLocation"].PrimaryKey = dc;
//smh
//LoadClinicSetupTable();
//smh
//Build Primary Key for ClinicSetupParameters table
/*dc = new DataColumn[1];
dtTemp = m_dsGlobal.Tables["ClinicSetupParameters"];
dc[0] = dtTemp.Columns["HOSPITAL_LOCATION_ID"];
m_dsGlobal.Tables["ClinicSetupParameters"].PrimaryKey = dc;
//Build Data Relationships between ClinicSetupParameters and HospitalLocation tables
dr = new DataRelation("HospitalLocationClinic", //Relation Name
m_dsGlobal.Tables["HospitalLocation"].Columns["HOSPITAL_LOCATION_ID"], //Parent
m_dsGlobal.Tables["ClinicSetupParameters"].Columns["HOSPITAL_LOCATION_ID"], false); //Child
m_dsGlobal.Relations.Add(dr);*/
/*SMH
dtTemp.Columns.Add("PROVIDER", System.Type.GetType("System.String"), "Parent.DEFAULT_PROVIDER");
dtTemp.Columns.Add("CLINIC_STOP", System.Type.GetType("System.String"), "Parent.STOP_CODE_NUMBER");
dtTemp.Columns.Add("INACTIVATE_DATE", System.Type.GetType("System.String"), "Parent.INACTIVATE_DATE");
dtTemp.Columns.Add("REACTIVATE_DATE", System.Type.GetType("System.String"), "Parent.REACTIVATE_DATE");
*/
//Build Data Relationships between Resources and HospitalLocation tables
dr = new DataRelation("HospitalLocationResource", //Relation Name
m_dsGlobal.Tables["HospitalLocation"].Columns["HOSPITAL_LOCATION_ID"], //Parent
m_dsGlobal.Tables["Resources"].Columns["HOSPITAL_LOCATION_ID"], false); //Child
m_dsGlobal.Relations.Add(dr);
//Build ScheduleUser table
this.LoadScheduleUserTable();
//Build Primary Key for ScheduleUser table
dc = new DataColumn[1];
dtTemp = m_dsGlobal.Tables["ScheduleUser"];
dc[0] = dtTemp.Columns["USERID"];
m_dsGlobal.Tables["ScheduleUser"].PrimaryKey = dc;
//Build ResourceUser table
this.LoadResourceUserTable();
//Build Primary Key for ResourceUser table
dc = new DataColumn[1];
dtTemp = m_dsGlobal.Tables["ResourceUser"];
dc[0] = dtTemp.Columns["RESOURCEUSER_ID"];
m_dsGlobal.Tables["ResourceUser"].PrimaryKey = dc;
//Create relation between BSDX Resource and BSDX Resource User tables
dr = new DataRelation("ResourceUser", //Relation Name
m_dsGlobal.Tables["Resources"].Columns["RESOURCEID"], //Parent
m_dsGlobal.Tables["ResourceUser"].Columns["RESOURCEID"]); //Child
m_dsGlobal.Relations.Add(dr);
//Build active provider table
sCommandText = "SELECT BMXIEN, NAME FROM NEW_PERSON WHERE INACTIVE_DATE = '' AND BMXIEN > 1";
ConnectInfo.RPMSDataTable(sCommandText, "Provider", m_dsGlobal);
Debug.Write("LoadGlobalRecordsets -- Provider loaded\n");
//Build the CLINIC_STOP table
// sCommandText = "SELECT BMXIEN, CODE, NAME FROM CLINIC_STOP"; //SMH
sCommandText = "SELECT BMXIEN, AMIS_REPORTING_STOP_CODE, NAME FROM CLINIC_STOP";
ConnectInfo.RPMSDataTable(sCommandText, "ClinicStop", m_dsGlobal);
Debug.Write("LoadGlobalRecordsets -- ClinicStop loaded\n");
//Build the HOLIDAY table
sCommandText = "SELECT NAME, DATE FROM HOLIDAY WHERE DATE > '" + DateTime.Today.ToShortDateString() + "'";
ConnectInfo.RPMSDataTable(sCommandText, "HOLIDAY", m_dsGlobal);
Debug.Write("LoadingGlobalRecordsets -- Holidays loaded\n");
//Save the xml schema
//m_dsGlobal.WriteXmlSchema(@"..\..\csSchema20060526.xsd");
return true;
}
public void RegisterDocumentView(CGDocument doc, CGView view)
{
@ -791,6 +763,11 @@ namespace IndianHealthService.ClinicalScheduling
return null;
}
/// <summary>
/// Removes view and Handles Disconnection from Database if no views are left.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ViewClosed(object sender, EventArgs e)
{
//Remove the sender from our document list
@ -995,7 +972,7 @@ namespace IndianHealthService.ClinicalScheduling
m_bExitOK = false;
CloseAll();
m_bExitOK = true;
_current.m_ConnectInfo = new BMXNet.BMXNetConnectInfo();
//_current.m_ConnectInfo = new BMXNet.BMXNetConnectInfo();//smh redundant
this.InitializeApp(true);
//Create a new document
CGDocument doc = new CGDocument();
@ -1067,7 +1044,8 @@ namespace IndianHealthService.ClinicalScheduling
{
//System.IntPtr pHandle = this.Handle;
RPMSDataTableDelegate rdtd = new RPMSDataTableDelegate(ConnectInfo.RPMSDataTable);
dtOut = (DataTable) this.Invoke(rdtd, new object[] {sSQL, sTableName});
//dtOut = (DataTable) this.Invoke(rdtd, new object[] {sSQL, sTableName});
dtOut = rdtd.Invoke(sSQL, sTableName);
}
catch (Exception ex)

View File

@ -191,9 +191,7 @@
<Compile Include="CGDocument.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="CGDocumentManager.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CGDocumentManager.cs" />
<Compile Include="CGRange.cs" />
<Compile Include="CGResource.cs" />
<Compile Include="CGSchedLib.cs">

View File

@ -36,7 +36,7 @@
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>/s=172.16.16.51 /p=9250 /a=s.habiel /v=catdog.55</StartArguments>
<StartArguments>/s=10.161.20.25 /p=9280 /a=s.habiel /v=catdog.55</StartArguments>
<StartPage>
</StartPage>
<StartProgram>C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\IEExec.exe</StartProgram>

View File

@ -12,9 +12,10 @@ namespace IndianHealthService.ClinicalScheduling
public class DSplash : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
//private System.Windows.Forms.Label lblVersion;
private System.Windows.Forms.LinkLabel lnkMail;
private System.Windows.Forms.Label lblStatus;
private Label lblVersion;
private Label label2;
/// <summary>
/// Required designer variable.
/// </summary>
@ -54,19 +55,22 @@ namespace IndianHealthService.ClinicalScheduling
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DSplash));
this.label1 = new System.Windows.Forms.Label();
this.lnkMail = new System.Windows.Forms.LinkLabel();
this.lblStatus = new System.Windows.Forms.Label();
this.lblVersion = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(24, 32);
this.label1.Location = new System.Drawing.Point(12, 67);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(448, 40);
this.label1.Size = new System.Drawing.Size(464, 40);
this.label1.TabIndex = 0;
this.label1.Text = "VistA Clinical Scheduling";
this.label1.Text = "Clinical Scheduling";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lnkMail
@ -79,55 +83,90 @@ namespace IndianHealthService.ClinicalScheduling
// lblStatus
//
this.lblStatus.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lblStatus.Location = new System.Drawing.Point(88, 160);
this.lblStatus.Location = new System.Drawing.Point(80, 159);
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(328, 16);
this.lblStatus.TabIndex = 3;
this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblVersion
//
this.lblVersion.AutoSize = true;
this.lblVersion.Location = new System.Drawing.Point(210, 117);
this.lblVersion.Name = "lblVersion";
this.lblVersion.Size = new System.Drawing.Size(52, 13);
this.lblVersion.TabIndex = 5;
this.lblVersion.Text = "lblVersion";
this.lblVersion.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Book Antiqua", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(180, 21);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(130, 46);
this.label2.TabIndex = 6;
this.label2.Text = "VISTA";
//
// DSplash
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
this.ClientSize = new System.Drawing.Size(488, 252);
this.ControlBox = false;
this.Controls.Add(this.label2);
this.Controls.Add(this.lblVersion);
this.Controls.Add(this.lblStatus);
this.Controls.Add(this.lnkMail);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "DSplash";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Clinical Scheduling";
this.Load += new System.EventHandler(this.DSplash_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public delegate void dSetStatus(string sStatus);
public delegate void dAny();
public void SetStatus(string sStatus)
{
this.Status = sStatus;
if (this.InvokeRequired == true)
{
dSetStatus d = new dSetStatus(SetStatus);
this.Invoke(d, new object[] { sStatus });
return;
}
System.Diagnostics.Debug.Assert(this.InvokeRequired == false);
this.lblStatus.Text = sStatus;
this.Refresh();
}
private void DSplash_Load(object sender, System.EventArgs e)
{
//this.lblVersion.Text = "Version " + Application.ProductVersion;
this.lblVersion.Text = "Version " + Application.ProductVersion;
}
#region Properties
/// <summary>
/// Gets or sets the value of the Status displayed on the splash screen
/// </summary>
public String Status
public void RemoteClose()
{
get
dAny d = new dAny(this.Close);
this.Invoke(d);
}
public void RemoteHide()
{
return lblStatus.Text;
}
set
{
lblStatus.Text = value;
dAny d = new dAny(this.Hide);
this.Invoke(d);
}
}
#endregion Properties
}
}

View File

@ -117,4 +117,27 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAIAICAQAAAAAADoAgAAJgAAABAQEAAAAAAAKAEAAA4DAAAoAAAAIAAAAEAAAAABAAQAAAAAAIAC
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAMDAwACAgIAAAAD/AAD/
AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIh3iI
iId4iAAAAAAAAAAACId4iIiHeIAiIiIggAAAAAAAAAAAAAgCqqqqoggAAAAAAAAAAACAKqqqqiAIAAiH
eId4iIiIAqqqqqIAAIAIh3iHeIiIgCqqqqogAACAAAAAAAAACAKqqqqiAAAAgAAAAAAAAIAqqqqqIAAA
AIAAAAAAAAgCqqqqogAAAAgAAAAAAAAAIiIiIiAAAACAAAAA////8AAAAAAAAAAIAAAAAP////8Aqqqq
IAAAgAAAAAD/iIj/gCqqqqIACAAAAAAA/4iI/4gCqqqqIIAAAAAAAP//////8AAAAAgAAAAAAAD/////
//+IiIiPAAAAAAAA/4iI/4iI/4iI/wAAAAAAAP+IiP+IiP+IiP8AAAAAAAD/////////////AAAAAAAA
/////////////wAAAAAAAP+IiP+IiP+IiP8AAAAAAAD/iIj/iIj/iIj/AAAAAAAA/////////////wAA
AAAAAP////////////8AAAAAAERERERERERERERERAAAAABEREREREREREREREQAAAAARERERERERERE
REREAAAAAERERERERERERERERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////
///4AAAP+AAAB///gAP//wADgAAAAYAAAAH/+AAB//AAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8AA
AD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/////////
//8oAAAAEAAAACAAAAABAAQAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAA
AACAAIAAgIAAAMDAwACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAHh4iHgA
CAAAAAAAACIiAAh4eIgCqqIIAAAAACqqIAAAAAACqqIAAAAP/wAAAAAAAA+IgKqiAAAAD//4AADwAAAP
iPiPiPAAAA//////8AAAD4j4j4jwAAAP//////AAAERERERERAAAREREREREAAAAAAAAAAAA//8AAMAD
AAD/gQAAgAAAAP4AAADAAQAAwAMAAMADAADAAwAAwAMAAMADAADAAwAAwAMAAMADAADAAwAA//8AAA==
</value>
</data>
</root>