source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/BMX41000/IHS BMX Framework/IndianHealthService.BMXNet.EHR/CiaPatientContext.cs@ 1492

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

Initial Import of BMX4

File size: 2.4 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4using IndianHealthService.Model;
5
6namespace IndianHealthService.BMXNet.CIA
7{
8 internal class CiaPatientContext : CiaObject, PatientContext
9 {
10
11 internal static CiaPatientContext CreateFrom(CiaSession aSession, IEhrEvents eventSource)
12 {
13 CiaPatientContext answer = new CiaPatientContext();
14
15 answer.Session = aSession;
16 answer.HookEvents(eventSource);
17
18 return answer;
19 }
20
21 private CiaSession _session=null;
22
23 internal CiaSession Session
24 {
25 get { return _session; }
26 set { _session = value; }
27 }
28
29
30 #region PatientContext Members
31
32 public event EventHandler<ContextChangedArgs> Changed;
33
34 public event EventHandler<ContextChangingArgs> Changing;
35
36 internal void HookEvents(IEhrEvents eventSource)
37 {
38 eventSource.ContextChanged += new EventHandler<ContextChangedArgs>(aComponent_ContextChanged);
39 eventSource.ContextChanging += new EventHandler<ContextChangingArgs>(aComponent_ContextChanging);
40 }
41
42 private void aComponent_ContextChanging(object sender, ContextChangingArgs e)
43 {
44 if (this.Changing != null)
45 this.Changing.Invoke(sender, e);
46 }
47
48 void aComponent_ContextChanged(object sender, ContextChangedArgs e)
49 {
50 if (e.IsPatientChange)
51 {
52 this.Patient = CiaPatient.FindCurrent(this.Session);
53 }
54
55 if (e.IsVisitChange)
56 {
57 this.Encounter= CiaEncounter.FindCurrent(this.Session);
58 }
59
60
61 if (this.Changed != null)
62 this.Changed.Invoke(sender, e); ;
63 }
64
65 Patient _patient = null;
66
67 public Patient Patient
68 {
69 get { return _patient; }
70 set { _patient = value; }
71 }
72
73 private Encounter _encounter = null;
74
75 public Encounter Encounter
76 {
77 get { return _encounter; }
78 set { _encounter = value; }
79 }
80
81
82 public bool HasPatient
83 {
84 get { return this.Patient != null; }
85 }
86
87 public bool HasEncounter
88 {
89 get { return this.Encounter != null; }
90 }
91
92 #endregion
93 }
94}
Note: See TracBrowser for help on using the repository browser.