source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/BMX41000/IHS BMX Framework/IndianHealthService.BMXNet.Example.CrossComponent.EHR/UserInfoComponent.EHR.cs@ 1505

Last change on this file since 1505 was 1146, checked in by Sam Habiel, 14 years ago

Initial Import of BMX4

File size: 6.6 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Drawing;
5using System.Data;
6using System.Text;
7using System.Windows.Forms;
8using IndianHealthService.BMXNet.EHR;
9using CIA_CSS;
10using System.Runtime.InteropServices;
11using IndianHealthService.BMXNet.Model;
12using IndianHealthService.BMXNet.EHR.Model;
13using IndianHealthService.BMXNet.EHR.Services;
14
15namespace IndianHealthService.BMXNet.Example.CrossComponent.EHR
16{
17 /// <summary>
18 /// //////////////////////////////////Copy from colon after classname to end of file
19 /// </summary>
20 public partial class UserInfoComponent : CSS_Patient.ICSS_PatientEvents, CSS_Encounter.ICSS_EncounterEvents, CIA_CSS.ICSS_SessionEvents, IEhrEvents, IEhrComponent
21 {
22
23 #region Copy Region into partial EHR file plus include interfaces noted above
24
25 protected override void Dispose(bool disposing)
26 {
27 this.TeardownFramework();
28
29 if (disposing && (components != null))
30 {
31 components.Dispose();
32 }
33 base.Dispose(disposing);
34 }
35
36 public LocalSession LocalSession
37 {
38 get { return this.Framework.LocalSession; }
39 }
40
41 public Context Context
42 {
43 get { return this.LocalSession.Context; }
44 }
45
46 public RemoteSession RemoteSession
47 {
48 get { return this.Framework.RemoteSession; }
49 }
50
51 private String _helpString = "";
52
53 [ComVisible(true)]
54 public String HelpString
55 {
56 get { return _helpString; }
57 set { _helpString = value; }
58 }
59
60 private String _helpContext = "";
61
62 [ComVisible(true)]
63 public String HelpContext
64 {
65 get { return _helpContext; }
66 set { _helpContext = value; }
67 }
68
69 private String _helpFile = "";
70
71 [ComVisible(true)]
72 public String HelpFile
73 {
74 get { return _helpFile; }
75 set { _helpFile = value; }
76 }
77
78 public virtual void AttachToEhr(object aConsumer)
79 {
80 this.SetupFramework();
81 this.Framework.AttachTo(aConsumer);
82
83 if (this.HelpFile.Length == 0)
84 {
85 this.HelpFileAssemblyName(aConsumer.GetType());
86 }
87 }
88
89 private EhrFramework _framework = null;
90
91 public EhrFramework Framework
92 {
93 get { return _framework; }
94 set { _framework = value; }
95 }
96
97 protected void SetupFramework()
98 {
99 this.Framework = EhrFramework.On(new CIA_CSS.CSS_ServerClass().Session, (IEhrEvents)this, (CIA_CSS.ICSS_SessionEvents)this);
100 }
101
102 protected void TeardownFramework()
103 {
104 if (this.Framework != null)
105 {
106 this.Framework.Close();
107 }
108 }
109
110 public event EventHandler<ContextChangedArgs> ContextChanged;
111 public event EventHandler<ContextChangingArgs> ContextChanging;
112
113 void CSS_Encounter.ICSS_EncounterEvents.Canceled()
114 {
115 }
116
117 void CSS_Encounter.ICSS_EncounterEvents.Committed()
118 {
119 try
120 {
121 if (this.ContextChanged != null)
122 {
123 ContextChangedArgs args = new ContextChangedArgs();
124 args.IsVisitChange = true;
125 args.AfterContext = this.Context;
126 this.ContextChanged.Invoke(this, args);
127 }
128 }
129 catch
130 {
131 }
132 }
133
134 string CSS_Encounter.ICSS_EncounterEvents.Pending(bool Silent)
135 {
136 try
137 {
138 if (this.ContextChanging == null)
139 {
140 return "";
141 }
142 else
143 {
144 ContextChangingArgs args = new ContextChangingArgs();
145 args.BeforeContext = this.Context;
146 args.IsVisitChange = true;
147 args.Cancel = false;
148 this.ContextChanging.Invoke(this, args);
149
150 return args.Cancel ? "Cancel" : "";
151 }
152 }
153 catch
154 {
155 return "";
156 }
157 }
158
159 void CSS_Patient.ICSS_PatientEvents.Canceled()
160 {
161 }
162
163 void CSS_Patient.ICSS_PatientEvents.Committed()
164 {
165 try
166 {
167 if (this.ContextChanged != null)
168 {
169 ContextChangedArgs args = new ContextChangedArgs();
170 args.IsPatientChange = true;
171 args.AfterContext = this.Context;
172 this.ContextChanged.Invoke(this, args);
173 }
174 }
175 catch
176 {
177 }
178 }
179
180 string CSS_Patient.ICSS_PatientEvents.Pending(bool Silent)
181 {
182 try
183 {
184 if (this.ContextChanging == null)
185 {
186 return "";
187 }
188 else
189 {
190 ContextChangingArgs args = new ContextChangingArgs();
191 args.BeforeContext = this.Context;
192 args.IsPatientChange = true;
193 args.Cancel = false;
194 this.ContextChanging.Invoke(this, args);
195
196 return args.Cancel ? "Cancel" : "";
197 }
198 }
199 catch
200 {
201 return "";
202 }
203 }
204
205 protected virtual void UnhandledException(Exception aProblem)
206 {
207 MessageBox.Show(aProblem.Message + " \n\n\n" + aProblem.StackTrace, "Exception");
208 }
209
210 protected void HelpFileAssemblyName(Type aType)
211 {
212 this.HelpFile = aType.Assembly.GetName().Name + ".chm";
213 }
214
215
216 public void EventCallback(string anEvent, string aStub)
217 {
218 this.Framework.IncomingEventCallback(anEvent, aStub);
219 }
220
221 public void RPCCallback(int Handle, string Data)
222 {
223 }
224
225 public void RPCCallbackError(int Handle, int ErrorCode, string ErrorText)
226 {
227 }
228
229 #endregion
230
231 }
232
233
234 //Copy this interface too
235 public interface IEhrComponent : IDisposable
236 {
237 String HelpFile { get; }
238 String HelpContext { get; }
239 String HelpString { get; }
240
241 }
242
243}
244
Note: See TracBrowser for help on using the repository browser.