source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/BMX41000/IHS BMX Framework/IndianHealthService.BMXNet.TestBench/PatientVisitPicker.cs@ 1482

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

Initial Import of BMX4

File size: 4.8 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Text;
7using System.Windows.Forms;
8using IndianHealthService.BMXNet.Model;
9using IndianHealthService.BMXNet.WinForm;
10
11
12namespace IndianHealthService.BMXNet.TestBench
13{
14 public partial class PatientVisitPicker : Form
15 {
16 public PatientVisitPicker()
17 {
18 InitializeComponent();
19 }
20
21 private DesktopSession _desktopSession = null;
22
23 public DesktopSession DesktopSession
24 {
25 get { return _desktopSession; }
26 set { _desktopSession = value; }
27 }
28
29
30 private Context _context;
31
32 public Context Context
33 {
34 get { return _context; }
35 set { _context = value; }
36 }
37
38 private Patient _selectedPatient = null;
39
40 public Patient SelectedPatient
41 {
42 get { return _selectedPatient; }
43 set { _selectedPatient = value; }
44 }
45
46 private void findByChartButton_Click(object sender, EventArgs e)
47 {
48 this.SelectedPatient = this.DesktopSession.FindPatientFromChart(this.patientEntry.Text.Trim(),false);
49 this.UpdatePatientInfo();
50 }
51
52 public bool HasSelectedPatient
53 {
54
55 get { return this.SelectedPatient != null; }
56 }
57
58 private void findByIenButton_Click(object sender, EventArgs e)
59 {
60 this.CreateTestVisit();
61 }
62
63 private void CreateTestVisit()
64 {
65 if (this.HasSelectedPatient)
66 {
67 // MessageBox.Show(this.Rpc.TransmitRPC("VEN WCM TEST VISIT", this.SelectedPatient..Text + ";1", "VEN RPC"));
68 }
69 }
70
71 private void newVisitButton_Click(object sender, EventArgs e)
72 {
73
74 }
75
76 private DesktopFramework _broker = null;
77
78 public DesktopFramework Framework
79 {
80 get { return _broker; }
81 set { _broker = value; }
82 }
83
84
85 private void okButton_Click(object sender, EventArgs e)
86 {
87 this.Framework.ChangePatient(this.SelectedPatient,false);
88 this.Framework.ChangeVisit(this.SelectedVisit, false);
89 this.DialogResult = DialogResult.OK;
90 this.Close();
91 }
92
93 public Visit SelectedVisit
94 {
95 get
96 {
97 return (this.visitListView.SelectedItems.Count > 0)
98 ? this.visitListView.SelectedItems[0].Tag as Visit : null;
99 }
100 }
101
102 private void cancelButton_Click(object sender, EventArgs e)
103 {
104 this.DialogResult = DialogResult.Cancel;
105 this.Close();
106 }
107
108 private void PatientVisitPicker_Load(object sender, EventArgs e)
109 {
110
111 this.SelectedPatient = this.Context.Patient;
112 this.UpdatePatientInfo();
113 }
114
115 public void UpdatePatientInfo()
116 {
117 this.patientLabel.Text = this.HasSelectedPatient ? this.SelectedPatient.PatientName : "[No patient found]";
118 List<Visit> visits = new List<Visit>();
119 if (this.HasSelectedPatient)
120 {
121 visits = this.DesktopSession.VisitsFor(this.SelectedPatient);
122 }
123
124 this.visitListView.BeginUpdate();
125 this.visitListView.Columns.Clear();
126 this.visitListView.Items.Clear();
127 this.visitListView.Columns.Add("Date", 100);
128 this.visitListView.Columns.Add("Clinic", 100);
129 this.visitListView.Columns.Add("Provider", 150);
130 foreach (Visit each in visits)
131 {
132 ListViewItem item = new ListViewItem(each.DateTime.ToShortDateString());
133 item.SubItems.Add(each.LocationName);
134 item.SubItems.Add(each.ProviderName);
135 item.Tag = each;
136 item.Selected = each.Ien == (this.Context.HasVisit ? this.Context.Visit.Ien : "");
137 this.visitListView.Items.Add(item);
138 }
139 this.visitListView.EndUpdate();
140 }
141
142 private void patientEntry_KeyUp(object sender, KeyEventArgs e)
143 {
144 if (e.KeyCode == Keys.Return)
145 {
146 this.findByChartButton_Click(null, null);
147 e.Handled = true;
148 }
149 }
150
151 private void visitListView_DoubleClick(object sender, EventArgs e)
152 {
153 this.okButton_Click(null, null);
154 }
155
156 private void noVisitButton_Click(object sender, EventArgs e)
157 {
158 this.visitListView.SelectedItems.Clear();
159 }
160
161
162
163 }
164}
165
166
Note: See TracBrowser for help on using the repository browser.