| 1 | using System;
|
|---|
| 2 | using System.Collections.Generic;
|
|---|
| 3 | using System.Text;
|
|---|
| 4 | using CIA_CSS;
|
|---|
| 5 | using CSS_User;
|
|---|
| 6 |
|
|---|
| 7 | namespace IndianHealthService.BMXNet.EHR
|
|---|
| 8 | {
|
|---|
| 9 | internal class BMXNetEhrSessionConnection : BMXNetSessionConnection
|
|---|
| 10 | {
|
|---|
| 11 |
|
|---|
| 12 | public override int SendTimeout
|
|---|
| 13 | {
|
|---|
| 14 | get { return 60000; }
|
|---|
| 15 | set { }
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | public override int ReceiveTimeout
|
|---|
| 19 | {
|
|---|
| 20 | get { return 60000; }
|
|---|
| 21 | set { }
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | public override Encoding ConnectionEncoding
|
|---|
| 25 | {
|
|---|
| 26 | get
|
|---|
| 27 | {
|
|---|
| 28 | return System.Text.Encoding.Default;
|
|---|
| 29 | }
|
|---|
| 30 | set
|
|---|
| 31 | {
|
|---|
| 32 | ConnectionEncoding = value;
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | public BMXNetEhrSessionConnection(BMXNetBroker aBroker):base(aBroker)
|
|---|
| 38 | {
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 | public override void Close()
|
|---|
| 43 | {
|
|---|
| 44 | //Don't close the EHR's internal broker
|
|---|
| 45 | this.CiaSession = null;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | public override bool IsConnected
|
|---|
| 49 | {
|
|---|
| 50 | get { return this.CiaSession != null; }
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | public override string GetLoginFacility(string aDuz)
|
|---|
| 54 | {
|
|---|
| 55 | return this.TransmitRPC("BMXGetFac", aDuz);
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | public static BMXNetEhrSessionConnection OpenOn(BMXNetBroker aBroker,ICSS_Session aCssSession, ICSS_User aCiaUser)
|
|---|
| 59 | {
|
|---|
| 60 | BMXNetEhrSessionConnection answer = new BMXNetEhrSessionConnection(aBroker);
|
|---|
| 61 | answer.CiaSession= aCssSession;
|
|---|
| 62 | answer.CiaUser=aCiaUser;
|
|---|
| 63 | return answer;
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | private ICSS_User _ciaUser;
|
|---|
| 67 |
|
|---|
| 68 | public ICSS_User CiaUser
|
|---|
| 69 | {
|
|---|
| 70 | get { return _ciaUser; }
|
|---|
| 71 | set
|
|---|
| 72 | {
|
|---|
| 73 | _ciaUser = value;
|
|---|
| 74 | if (value != null)
|
|---|
| 75 | {
|
|---|
| 76 | this.UserName = value.Name;
|
|---|
| 77 | this.DUZ = value.Handle.ToString();
|
|---|
| 78 | }
|
|---|
| 79 | }
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | private ICSS_Session _ciaSession;
|
|---|
| 83 |
|
|---|
| 84 | public ICSS_Session CiaSession
|
|---|
| 85 | {
|
|---|
| 86 | get { return _ciaSession; }
|
|---|
| 87 | set { _ciaSession = value;}
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | protected override string SendReceiveString(string sendString, string multi)
|
|---|
| 91 | {
|
|---|
| 92 | return this.DecodeReceiveString(
|
|---|
| 93 | this.CiaSession.CallRPCText(
|
|---|
| 94 | "BMXRPC^BMX CIA",
|
|---|
| 95 | this.EncodeSendString(sendString, this.EncodeSendString(this.EncryptionProvider.Encrypt(this.AppContext==null ? "" : this.AppContext),multi)))).Trim();
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 | }
|
|---|
| 100 | }
|
|---|