[1146] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Text;
|
---|
| 4 | using CIA_CSS;
|
---|
| 5 | using CSS_User;
|
---|
| 6 | using System.Windows.Forms;
|
---|
| 7 | using IndianHealthService.BMXNet.Services;
|
---|
| 8 | using IndianHealthService.BMXNet.EHR.Model;
|
---|
| 9 |
|
---|
| 10 | namespace IndianHealthService.BMXNet.EHR
|
---|
| 11 | {
|
---|
| 12 | internal class BMXNetEhrBroker : BMXNetBroker, BMXNetSessionConnectionSource
|
---|
| 13 | {
|
---|
| 14 | public static BMXNetEhrBroker Open(ICSS_Session aCiaSession, ICSS_User aCiaUser, IndianHealthService.BMXNet.Model.User aUser)
|
---|
| 15 | {
|
---|
| 16 | CiaVisit.InitialzeAccessToCSSEncounter();
|
---|
| 17 |
|
---|
| 18 | BMXNetEhrBroker broker = new BMXNetEhrBroker();
|
---|
| 19 | if (broker.OpenOn(aCiaSession, aCiaUser,aUser))
|
---|
| 20 | {
|
---|
| 21 | return broker;
|
---|
| 22 | }
|
---|
| 23 | else
|
---|
| 24 | {
|
---|
| 25 | throw new BMXNetException("Unable to connection BMX to EHR session.");
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | private ICSS_Session _ciaSession = null;
|
---|
| 30 |
|
---|
| 31 | public ICSS_Session CiaSession
|
---|
| 32 | {
|
---|
| 33 | get { return _ciaSession; }
|
---|
| 34 | set { _ciaSession = value; }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | private ICSS_User _ciaUser = null;
|
---|
| 38 |
|
---|
| 39 | public ICSS_User CiaUser
|
---|
| 40 | {
|
---|
| 41 | get { return _ciaUser; }
|
---|
| 42 | set { _ciaUser = value; }
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 | internal bool OpenOn(ICSS_Session aCiaSession, ICSS_User aCiaUser, IndianHealthService.BMXNet.Model.User aUser)
|
---|
| 47 | {
|
---|
| 48 | this.CiaSession = aCiaSession;
|
---|
| 49 | this.CiaUser = aCiaUser;
|
---|
| 50 | this.User = aUser;
|
---|
| 51 | this.SessionPool = this.CreateRemoteSessionPool(this, 1);
|
---|
| 52 | this.PrimarySession = this.SessionPool.OpenSession(this.Log);
|
---|
| 53 | return this.PrimaryRemoteSession != null;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | private RemoteSessionPool _sessionPool = null;
|
---|
| 58 |
|
---|
| 59 | public RemoteSessionPool SessionPool
|
---|
| 60 | {
|
---|
| 61 | get { return _sessionPool; }
|
---|
| 62 | set { _sessionPool = value; }
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 | public override bool IsConnected
|
---|
| 68 | {
|
---|
| 69 | get { throw new NotImplementedException(); }
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | public override void Close()
|
---|
| 73 | {
|
---|
| 74 | //Do nothing. Can't close this broker
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | private RemoteSession _primarySession = null;
|
---|
| 78 |
|
---|
| 79 | internal RemoteSession PrimarySession
|
---|
| 80 | {
|
---|
| 81 | get { return _primarySession; }
|
---|
| 82 | set { _primarySession = value; }
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 |
|
---|
| 86 | public override RemoteSession PrimaryRemoteSession
|
---|
| 87 | {
|
---|
| 88 | get { return this.PrimarySession; }
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | public override RemoteSessionPool RemoteSessionPool
|
---|
| 92 | {
|
---|
| 93 | get { return this.SessionPool; }
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 |
|
---|
| 97 | BMXNetSessionConnection BMXNetSessionConnectionSource.OpenConnection()
|
---|
| 98 | {
|
---|
| 99 | return BMXNetEhrSessionConnection.OpenOn(this,this.CiaSession, this.CiaUser);
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 | void BMXNetSessionConnectionSource.CloseConnection(BMXNetSessionConnection aConnection)
|
---|
| 103 | {
|
---|
| 104 | //Do nothing. We don't close the primary connection
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | }
|
---|
| 109 | }
|
---|
| 110 |
|
---|