1 | using System;
|
---|
2 | using System.Drawing;
|
---|
3 | using System.Collections;
|
---|
4 | using System.ComponentModel;
|
---|
5 | using System.Windows.Forms;
|
---|
6 | using System.Data;
|
---|
7 | using IndianHealthService.BMXNet;
|
---|
8 | using System.Diagnostics;
|
---|
9 |
|
---|
10 | namespace IndianHealthService.ClinicalScheduling
|
---|
11 | {
|
---|
12 | /// <summary>
|
---|
13 | /// Summary description for DResourceUser.
|
---|
14 | /// </summary>
|
---|
15 | public class DResourceUser : System.Windows.Forms.Form
|
---|
16 | {
|
---|
17 | private System.Windows.Forms.Label label1;
|
---|
18 | private System.Windows.Forms.Panel pnlPageBottom;
|
---|
19 | private System.Windows.Forms.Panel pnlDescription;
|
---|
20 | private System.Windows.Forms.GroupBox grpDescriptionResourceGroup;
|
---|
21 | private System.Windows.Forms.Label lblDescriptionResourceGroup;
|
---|
22 | private System.Windows.Forms.Button cmdOK;
|
---|
23 | private System.Windows.Forms.ComboBox cboScheduleUser;
|
---|
24 | private System.Windows.Forms.CheckBox chkModifySchedule;
|
---|
25 | private System.Windows.Forms.CheckBox chkOverbook;
|
---|
26 | private System.Windows.Forms.Button cmdCancel;
|
---|
27 | private System.Windows.Forms.CheckBox chkAppointments;
|
---|
28 | /// <summary>
|
---|
29 | /// Required designer variable.
|
---|
30 | /// </summary>
|
---|
31 | private System.ComponentModel.Container components = null;
|
---|
32 |
|
---|
33 | public DResourceUser()
|
---|
34 | {
|
---|
35 | //
|
---|
36 | // Required for Windows Form Designer support
|
---|
37 | //
|
---|
38 | InitializeComponent();
|
---|
39 |
|
---|
40 | //
|
---|
41 | // TODO: Add any constructor code after InitializeComponent call
|
---|
42 | //
|
---|
43 | }
|
---|
44 |
|
---|
45 | /// <summary>
|
---|
46 | /// Clean up any resources being used.
|
---|
47 | /// </summary>
|
---|
48 | protected override void Dispose( bool disposing )
|
---|
49 | {
|
---|
50 | if( disposing )
|
---|
51 | {
|
---|
52 | if(components != null)
|
---|
53 | {
|
---|
54 | components.Dispose();
|
---|
55 | }
|
---|
56 | }
|
---|
57 | base.Dispose( disposing );
|
---|
58 | }
|
---|
59 |
|
---|
60 | #region Windows Form Designer generated code
|
---|
61 | /// <summary>
|
---|
62 | /// Required method for Designer support - do not modify
|
---|
63 | /// the contents of this method with the code editor.
|
---|
64 | /// </summary>
|
---|
65 | private void InitializeComponent()
|
---|
66 | {
|
---|
67 | this.cboScheduleUser = new System.Windows.Forms.ComboBox();
|
---|
68 | this.label1 = new System.Windows.Forms.Label();
|
---|
69 | this.pnlPageBottom = new System.Windows.Forms.Panel();
|
---|
70 | this.cmdCancel = new System.Windows.Forms.Button();
|
---|
71 | this.cmdOK = new System.Windows.Forms.Button();
|
---|
72 | this.pnlDescription = new System.Windows.Forms.Panel();
|
---|
73 | this.grpDescriptionResourceGroup = new System.Windows.Forms.GroupBox();
|
---|
74 | this.lblDescriptionResourceGroup = new System.Windows.Forms.Label();
|
---|
75 | this.chkModifySchedule = new System.Windows.Forms.CheckBox();
|
---|
76 | this.chkOverbook = new System.Windows.Forms.CheckBox();
|
---|
77 | this.chkAppointments = new System.Windows.Forms.CheckBox();
|
---|
78 | this.pnlPageBottom.SuspendLayout();
|
---|
79 | this.pnlDescription.SuspendLayout();
|
---|
80 | this.grpDescriptionResourceGroup.SuspendLayout();
|
---|
81 | this.SuspendLayout();
|
---|
82 | //
|
---|
83 | // cboScheduleUser
|
---|
84 | //
|
---|
85 | this.cboScheduleUser.Location = new System.Drawing.Point(144, 32);
|
---|
86 | this.cboScheduleUser.Name = "cboScheduleUser";
|
---|
87 | this.cboScheduleUser.Size = new System.Drawing.Size(248, 21);
|
---|
88 | this.cboScheduleUser.TabIndex = 0;
|
---|
89 | this.cboScheduleUser.Text = "cboScheduleUser";
|
---|
90 | this.cboScheduleUser.SelectedIndexChanged += new System.EventHandler(this.cboScheduleUser_SelectedIndexChanged);
|
---|
91 | //
|
---|
92 | // label1
|
---|
93 | //
|
---|
94 | this.label1.Location = new System.Drawing.Point(16, 32);
|
---|
95 | this.label1.Name = "label1";
|
---|
96 | this.label1.Size = new System.Drawing.Size(120, 16);
|
---|
97 | this.label1.TabIndex = 1;
|
---|
98 | this.label1.Text = "Select Resource User:";
|
---|
99 | this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
---|
100 | //
|
---|
101 | // pnlPageBottom
|
---|
102 | //
|
---|
103 | this.pnlPageBottom.Controls.Add(this.cmdCancel);
|
---|
104 | this.pnlPageBottom.Controls.Add(this.cmdOK);
|
---|
105 | this.pnlPageBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
|
---|
106 | this.pnlPageBottom.Location = new System.Drawing.Point(0, 254);
|
---|
107 | this.pnlPageBottom.Name = "pnlPageBottom";
|
---|
108 | this.pnlPageBottom.Size = new System.Drawing.Size(448, 40);
|
---|
109 | this.pnlPageBottom.TabIndex = 4;
|
---|
110 | //
|
---|
111 | // cmdCancel
|
---|
112 | //
|
---|
113 | this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
---|
114 | this.cmdCancel.Location = new System.Drawing.Point(376, 8);
|
---|
115 | this.cmdCancel.Name = "cmdCancel";
|
---|
116 | this.cmdCancel.Size = new System.Drawing.Size(56, 24);
|
---|
117 | this.cmdCancel.TabIndex = 2;
|
---|
118 | this.cmdCancel.Text = "Cancel";
|
---|
119 | //
|
---|
120 | // cmdOK
|
---|
121 | //
|
---|
122 | this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
---|
123 | this.cmdOK.Location = new System.Drawing.Point(296, 8);
|
---|
124 | this.cmdOK.Name = "cmdOK";
|
---|
125 | this.cmdOK.Size = new System.Drawing.Size(64, 24);
|
---|
126 | this.cmdOK.TabIndex = 1;
|
---|
127 | this.cmdOK.Text = "OK";
|
---|
128 | this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
|
---|
129 | //
|
---|
130 | // pnlDescription
|
---|
131 | //
|
---|
132 | this.pnlDescription.Controls.Add(this.grpDescriptionResourceGroup);
|
---|
133 | this.pnlDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
|
---|
134 | this.pnlDescription.Location = new System.Drawing.Point(0, 182);
|
---|
135 | this.pnlDescription.Name = "pnlDescription";
|
---|
136 | this.pnlDescription.Size = new System.Drawing.Size(448, 72);
|
---|
137 | this.pnlDescription.TabIndex = 5;
|
---|
138 | //
|
---|
139 | // grpDescriptionResourceGroup
|
---|
140 | //
|
---|
141 | this.grpDescriptionResourceGroup.Controls.Add(this.lblDescriptionResourceGroup);
|
---|
142 | this.grpDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
|
---|
143 | this.grpDescriptionResourceGroup.Location = new System.Drawing.Point(0, 0);
|
---|
144 | this.grpDescriptionResourceGroup.Name = "grpDescriptionResourceGroup";
|
---|
145 | this.grpDescriptionResourceGroup.Size = new System.Drawing.Size(448, 72);
|
---|
146 | this.grpDescriptionResourceGroup.TabIndex = 1;
|
---|
147 | this.grpDescriptionResourceGroup.TabStop = false;
|
---|
148 | this.grpDescriptionResourceGroup.Text = "Description";
|
---|
149 | //
|
---|
150 | // lblDescriptionResourceGroup
|
---|
151 | //
|
---|
152 | this.lblDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
|
---|
153 | this.lblDescriptionResourceGroup.Location = new System.Drawing.Point(3, 16);
|
---|
154 | this.lblDescriptionResourceGroup.Name = "lblDescriptionResourceGroup";
|
---|
155 | this.lblDescriptionResourceGroup.Size = new System.Drawing.Size(442, 53);
|
---|
156 | this.lblDescriptionResourceGroup.TabIndex = 0;
|
---|
157 | this.lblDescriptionResourceGroup.Text = "Use this panel to assign user access to Resources. Only users who have the BSDXZ" +
|
---|
158 | "MENU key in VistA will appear in the selection list. If Modify Schedule is check" +
|
---|
159 | "ed, then the user will be able to add and edit the resource\'s availability.";
|
---|
160 | //
|
---|
161 | // chkModifySchedule
|
---|
162 | //
|
---|
163 | this.chkModifySchedule.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
|
---|
164 | this.chkModifySchedule.Location = new System.Drawing.Point(96, 136);
|
---|
165 | this.chkModifySchedule.Name = "chkModifySchedule";
|
---|
166 | this.chkModifySchedule.Size = new System.Drawing.Size(152, 16);
|
---|
167 | this.chkModifySchedule.TabIndex = 7;
|
---|
168 | this.chkModifySchedule.Text = "Modify Clinic Availability:";
|
---|
169 | this.chkModifySchedule.CheckedChanged += new System.EventHandler(this.chkModifySchedule_CheckedChanged);
|
---|
170 | //
|
---|
171 | // chkOverbook
|
---|
172 | //
|
---|
173 | this.chkOverbook.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
|
---|
174 | this.chkOverbook.Location = new System.Drawing.Point(160, 104);
|
---|
175 | this.chkOverbook.Name = "chkOverbook";
|
---|
176 | this.chkOverbook.Size = new System.Drawing.Size(88, 16);
|
---|
177 | this.chkOverbook.TabIndex = 8;
|
---|
178 | this.chkOverbook.Text = "Overbook:";
|
---|
179 | this.chkOverbook.CheckedChanged += new System.EventHandler(this.chkOverbook_CheckedChanged);
|
---|
180 | //
|
---|
181 | // chkAppointments
|
---|
182 | //
|
---|
183 | this.chkAppointments.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
|
---|
184 | this.chkAppointments.Location = new System.Drawing.Point(40, 72);
|
---|
185 | this.chkAppointments.Name = "chkAppointments";
|
---|
186 | this.chkAppointments.Size = new System.Drawing.Size(208, 16);
|
---|
187 | this.chkAppointments.TabIndex = 9;
|
---|
188 | this.chkAppointments.Text = "Add, Edit and Delete appointments:";
|
---|
189 | this.chkAppointments.CheckedChanged += new System.EventHandler(this.chkAppointments_CheckedChanged);
|
---|
190 | //
|
---|
191 | // DResourceUser
|
---|
192 | //
|
---|
193 | this.AcceptButton = this.cmdOK;
|
---|
194 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
---|
195 | this.CancelButton = this.cmdCancel;
|
---|
196 | this.ClientSize = new System.Drawing.Size(448, 294);
|
---|
197 | this.Controls.Add(this.chkAppointments);
|
---|
198 | this.Controls.Add(this.chkOverbook);
|
---|
199 | this.Controls.Add(this.chkModifySchedule);
|
---|
200 | this.Controls.Add(this.pnlDescription);
|
---|
201 | this.Controls.Add(this.pnlPageBottom);
|
---|
202 | this.Controls.Add(this.label1);
|
---|
203 | this.Controls.Add(this.cboScheduleUser);
|
---|
204 | this.Name = "DResourceUser";
|
---|
205 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
---|
206 | this.Text = "DResourceUser";
|
---|
207 | this.pnlPageBottom.ResumeLayout(false);
|
---|
208 | this.pnlDescription.ResumeLayout(false);
|
---|
209 | this.grpDescriptionResourceGroup.ResumeLayout(false);
|
---|
210 | this.ResumeLayout(false);
|
---|
211 |
|
---|
212 | }
|
---|
213 | #endregion
|
---|
214 |
|
---|
215 | #region Fields
|
---|
216 |
|
---|
217 | private DataTable m_dtResourceUser;
|
---|
218 | private int m_nUserID;
|
---|
219 | private bool m_bModifySchedule;
|
---|
220 | private bool m_bOverbook;
|
---|
221 | private bool m_bAppointments;
|
---|
222 |
|
---|
223 | #endregion Fields
|
---|
224 |
|
---|
225 | #region Properties
|
---|
226 |
|
---|
227 | /// <summary>
|
---|
228 | /// The ID of the Resource User in the NEW PERSON file.
|
---|
229 | /// </summary>
|
---|
230 | public int UserID
|
---|
231 | {
|
---|
232 | get
|
---|
233 | {
|
---|
234 | return m_nUserID;
|
---|
235 | }
|
---|
236 | }
|
---|
237 |
|
---|
238 | /// <summary>
|
---|
239 | /// True if the user is allowed to modify the resource's scheduled availability
|
---|
240 | /// </summary>
|
---|
241 | public bool ModifySchedule
|
---|
242 | {
|
---|
243 | get
|
---|
244 | {
|
---|
245 | return m_bModifySchedule;
|
---|
246 | }
|
---|
247 | }
|
---|
248 |
|
---|
249 | /// <summary>
|
---|
250 | /// True if the user is allowed to overbook beyond the resource's scheduled availability
|
---|
251 | /// </summary>
|
---|
252 | public bool Overbook
|
---|
253 | {
|
---|
254 | get
|
---|
255 | {
|
---|
256 | return m_bOverbook;
|
---|
257 | }
|
---|
258 | }
|
---|
259 |
|
---|
260 | /// <summary>
|
---|
261 | /// True if the user is allowed to create, edit and delete appointments
|
---|
262 | /// </summary>
|
---|
263 | public bool Appoinmtments
|
---|
264 | {
|
---|
265 | get
|
---|
266 | {
|
---|
267 | return m_bAppointments;
|
---|
268 | }
|
---|
269 | }
|
---|
270 | #endregion Properties
|
---|
271 |
|
---|
272 |
|
---|
273 | public void InitializePage(int nSelectedRUID, DataSet dsGlobal)
|
---|
274 | {
|
---|
275 |
|
---|
276 | m_dtResourceUser = dsGlobal.Tables["ResourceUser"];
|
---|
277 |
|
---|
278 | //Datasource the SCHEDULE USER combo box
|
---|
279 | DataTable dtSchedUser = dsGlobal.Tables["ScheduleUser"];
|
---|
280 | DataView dvSchedUser = new DataView(dtSchedUser);
|
---|
281 | dvSchedUser.Sort = "USERNAME ASC";
|
---|
282 |
|
---|
283 |
|
---|
284 | cboScheduleUser.DataSource = dvSchedUser;
|
---|
285 | cboScheduleUser.DisplayMember = "USERNAME";
|
---|
286 | cboScheduleUser.ValueMember = "USERID";
|
---|
287 |
|
---|
288 | if (nSelectedRUID < 0) //then we're in ADD mode
|
---|
289 | {
|
---|
290 | this.Text = "Add New Resource User";
|
---|
291 | m_nUserID = 0;
|
---|
292 | m_bModifySchedule = false;
|
---|
293 | m_bOverbook = false;
|
---|
294 | m_bAppointments = false;
|
---|
295 | this.cmdOK.Enabled = false;
|
---|
296 | }
|
---|
297 | else //we're in EDIT mode
|
---|
298 | {
|
---|
299 | this.Text = "Edit Scheduling Resource";
|
---|
300 | this.cboScheduleUser.Enabled = false;
|
---|
301 | DataRow dr = m_dtResourceUser.Rows.Find(nSelectedRUID);
|
---|
302 | m_nUserID = Convert.ToInt16(dr["USERID"]);//CHANGED FROM USERID1
|
---|
303 | string sOverbook = dr["OVERBOOK"].ToString();
|
---|
304 | m_bOverbook = (sOverbook == "YES")?true:false;
|
---|
305 | string sModify = dr["MODIFY_SCHEDULE"].ToString();
|
---|
306 | m_bModifySchedule = (sModify == "YES")?true:false;
|
---|
307 | string sAppts = dr["MODIFY_APPOINTMENTS"].ToString();
|
---|
308 | m_bAppointments = (sAppts == "YES")?true:false;
|
---|
309 |
|
---|
310 | }
|
---|
311 | UpdateDialogData(true);
|
---|
312 | }
|
---|
313 |
|
---|
314 | /// <summary>
|
---|
315 | /// If b is true, moves member vars into control data
|
---|
316 | /// otherwise, moves control data into member vars
|
---|
317 | /// </summary>
|
---|
318 | /// <param name="b"></param>
|
---|
319 | private void UpdateDialogData(bool b)
|
---|
320 | {
|
---|
321 | if (b == true)
|
---|
322 | {
|
---|
323 | this.chkOverbook.Checked = m_bOverbook;
|
---|
324 | this.chkModifySchedule.Checked = m_bModifySchedule;
|
---|
325 | this.cboScheduleUser.SelectedValue = m_nUserID;
|
---|
326 | this.chkAppointments.Checked = m_bAppointments;
|
---|
327 | }
|
---|
328 | else
|
---|
329 | {
|
---|
330 | m_bOverbook = this.chkOverbook.Checked;
|
---|
331 | m_bModifySchedule = this.chkModifySchedule.Checked;
|
---|
332 | m_bAppointments = this.chkAppointments.Checked;
|
---|
333 | m_nUserID = Convert.ToInt16(this.cboScheduleUser.SelectedValue);
|
---|
334 | }
|
---|
335 | }
|
---|
336 |
|
---|
337 | private void cmdOK_Click(object sender, System.EventArgs e)
|
---|
338 | {
|
---|
339 | this.UpdateDialogData(false);
|
---|
340 | }
|
---|
341 |
|
---|
342 | private void cboScheduleUser_SelectedIndexChanged(object sender, System.EventArgs e)
|
---|
343 | {
|
---|
344 | this.cmdOK.Enabled = true;
|
---|
345 | }
|
---|
346 |
|
---|
347 | private void chkModifySchedule_CheckedChanged(object sender, System.EventArgs e)
|
---|
348 | {
|
---|
349 | if (chkModifySchedule.Checked == true)
|
---|
350 | {
|
---|
351 | this.chkAppointments.Checked = true;
|
---|
352 | this.chkOverbook.Checked = true;
|
---|
353 | }
|
---|
354 | }
|
---|
355 |
|
---|
356 | private void chkOverbook_CheckedChanged(object sender, System.EventArgs e)
|
---|
357 | {
|
---|
358 | if (chkOverbook.Checked == true)
|
---|
359 | {
|
---|
360 | chkAppointments.Checked = true;
|
---|
361 | }
|
---|
362 | if (chkOverbook.Checked == false)
|
---|
363 | {
|
---|
364 | chkModifySchedule.Checked = false;
|
---|
365 | }
|
---|
366 | }
|
---|
367 |
|
---|
368 | private void chkAppointments_CheckedChanged(object sender, System.EventArgs e)
|
---|
369 | {
|
---|
370 | if (chkAppointments.Checked == false)
|
---|
371 | {
|
---|
372 | chkOverbook.Checked = false;
|
---|
373 | chkModifySchedule.Checked = false;
|
---|
374 | }
|
---|
375 | }
|
---|
376 |
|
---|
377 | }
|
---|
378 | }
|
---|