source: Scheduling/trunk/cs/bsdx0200GUISourceCode/DApptSearchcs.bak@ 1160

Last change on this file since 1160 was 614, checked in by Sam Habiel, 15 years ago

Initial committ of scheduling package

File size: 18.2 KB
Line 
1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Data;
7using System.Data.OleDb;
8
9namespace IndianHealthService.ClinicalScheduling
10{
11 /// <summary>
12 /// Summary description for DApptSearch.
13 /// </summary>
14 public class DApptSearch : System.Windows.Forms.Form
15 {
16 private System.Windows.Forms.Panel panel1;
17 private System.Windows.Forms.Button cmdCancel;
18 private System.Windows.Forms.Button cmdOK;
19 private System.Windows.Forms.Panel pnlDescription;
20 private System.Windows.Forms.GroupBox grpDescription;
21 private System.Windows.Forms.Label lblDescription;
22 private System.Windows.Forms.Label label1;
23 private System.Windows.Forms.CheckBox chkMon;
24 private System.Windows.Forms.CheckBox chkTue;
25 private System.Windows.Forms.CheckBox chkWed;
26 private System.Windows.Forms.CheckBox chkThu;
27 private System.Windows.Forms.CheckBox chkFri;
28 private System.Windows.Forms.GroupBox grpTimeOfDay;
29 private System.Windows.Forms.GroupBox grpDayOfWeek;
30 private System.Windows.Forms.CheckBox chkSat;
31 private System.Windows.Forms.CheckBox chkSun;
32 private System.Windows.Forms.RadioButton rdoAM;
33 private System.Windows.Forms.RadioButton rdoPM;
34 private System.Windows.Forms.RadioButton rdoBoth;
35 private System.Windows.Forms.Label label2;
36 private System.Windows.Forms.Label label3;
37 private System.Windows.Forms.CheckedListBox lstAccessTypes;
38 private System.Windows.Forms.ComboBox cboAccessTypeFilter;
39 private System.Windows.Forms.MonthCalendar calStartDate;
40 /// <summary>
41 /// Required designer variable.
42 /// </summary>
43 private System.ComponentModel.Container components = null;
44
45 public DApptSearch()
46 {
47 //
48 // Required for Windows Form Designer support
49 //
50 InitializeComponent();
51
52 //
53 // TODO: Add any constructor code after InitializeComponent call
54 //
55 }
56
57 #region Fields
58
59 private OleDbConnection m_RPMSConnection;
60 private CGDocumentManager m_DocManager;
61
62 private DataSet m_dsGlobal;
63 DataTable m_dtTypes;
64 DataView m_dvTypes;
65
66 DateTime m_dStart;
67 DateTime m_dEnd;
68 ArrayList m_alResources;
69 ArrayList m_alAccessTypes;
70 string m_sWeekDays;
71 string m_sAmpm;
72
73 #endregion Fields
74
75 public void LoadListBox(string sGroup)
76 {
77 if (sGroup == "ALL")
78 {
79 //Load the Access Type list box with ALL access types
80 m_dtTypes = m_dsGlobal.Tables["AccessTypes"];
81 m_dvTypes = new DataView(m_dtTypes);
82 lstAccessTypes.DataSource = m_dvTypes;
83 lstAccessTypes.DisplayMember = "ACCESS_TYPE_NAME";
84 lstAccessTypes.ValueMember = "BMXIEN";
85 }
86 else
87 {
88 //Load the Access Type list box with active access types belonging
89 //to group sGroup
90
91 //Build AccessGroup table containing *active* AccessTypes and their Groups
92 m_dtTypes = m_dsGlobal.Tables["AccessGroupType"];
93
94 //Create a view that is filterable on Access Group
95 m_dvTypes = new DataView(m_dtTypes);
96 m_dvTypes.RowFilter = "ACCESS_GROUP = '" + this.cboAccessTypeFilter.Text + "'";
97 lstAccessTypes.DataSource = m_dvTypes;
98 lstAccessTypes.DisplayMember = "ACCESS_TYPE";
99 lstAccessTypes.ValueMember = "ACCESS_TYPE_ID";
100 }
101 }
102
103 public void InitializePage(ArrayList alResources, CGDocumentManager docManager)
104 {
105
106 this.m_DocManager = docManager;
107 this.m_dsGlobal = m_DocManager.GlobalDataSet;
108 this.m_RPMSConnection = m_DocManager.ADOConnection;
109
110 LoadListBox("ALL");
111
112 m_dStart = DateTime.Today;
113 m_dEnd = new DateTime(9999);
114 this.m_alResources = alResources;
115 this.m_alAccessTypes = new ArrayList();
116 this.m_sAmpm="both";
117 this.m_sWeekDays = "";
118
119
120 //Load filter combo with list of access type groups
121 DataTable dtGroup = m_dsGlobal.Tables["AccessGroup"];
122 DataSet dsTemp = new DataSet("dsTemp");
123 dsTemp.Tables.Add(dtGroup.Copy());
124 DataTable dtTemp = dsTemp.Tables["AccessGroup"];
125 DataView dvGroup = new DataView(dtTemp);
126 DataRowView drv = dvGroup.AddNew();
127 drv["ACCESS_GROUP"]="<Show All Access Types>";
128 dvGroup.Sort = "ACCESS_GROUP ASC";
129 cboAccessTypeFilter.DataSource = dvGroup;
130 cboAccessTypeFilter.DisplayMember = "ACCESS_GROUP";
131 cboAccessTypeFilter.SelectedIndex = cboAccessTypeFilter.Items.Count - 1;
132
133 //TODO: Initialize member vars
134
135 this.UpdateDialogData(true);
136
137 }
138
139 /// <summary>
140 /// If b is true, moves member vars into control data
141 /// otherwise, moves control data into member vars
142 /// </summary>
143 /// <param name="b"></param>
144 private void UpdateDialogData(bool b)
145 {
146 if (b == true) //move member vars into controls
147 {
148
149// lblClinic.Text = m_pAppt.Resource;
150// lblEndTime.Text = m_pAppt.EndTime.ToShortDateString() + " " + m_pAppt.EndTime.ToShortTimeString();
151// lblStartTime.Text = m_pAppt.StartTime.ToShortDateString() + " " + m_pAppt.StartTime.ToShortTimeString();
152// txtNote.Text = m_pAppt.Note;
153// nudSlots.Value = m_pAppt.Slots;
154// if (m_pAppt.AccessTypeID != 0)
155// {
156// lstAccessTypes.SelectedValue = m_pAppt.AccessTypeID;
157// }
158 }
159 else //move control data into member vars
160 {
161
162 //Build AccessType list
163
164 this.m_alAccessTypes.Clear();
165 for (int j = 0; j < this.lstAccessTypes.CheckedItems.Count; j++)
166 {
167 m_alAccessTypes.Add(this.lstAccessTypes.Items[j].ToString());
168 }
169
170 //TODO: AM/PM
171 this.m_sAmpm = "both";
172
173 //TODO: Weekday
174 this.m_sWeekDays = "any";
175
176// m_pAppt.Note = txtNote.Text;
177// int nIndex = this.lstAccessTypes.SelectedIndex;
178// string sTemp = (string) this.lstAccessTypes.SelectedValue;
179// sTemp = (sTemp == "")?"-1":sTemp;
180// m_pAppt.AccessTypeID = Convert.ToInt16(sTemp);
181// m_pAppt.Slots = Convert.ToInt16(nudSlots.Value);
182 }
183 }
184
185
186 /// <summary>
187 /// Clean up any resources being used.
188 /// </summary>
189 protected override void Dispose( bool disposing )
190 {
191 if( disposing )
192 {
193 if(components != null)
194 {
195 components.Dispose();
196 }
197 }
198 base.Dispose( disposing );
199 }
200
201 #region Windows Form Designer generated code
202 /// <summary>
203 /// Required method for Designer support - do not modify
204 /// the contents of this method with the code editor.
205 /// </summary>
206 private void InitializeComponent()
207 {
208 this.panel1 = new System.Windows.Forms.Panel();
209 this.cmdCancel = new System.Windows.Forms.Button();
210 this.cmdOK = new System.Windows.Forms.Button();
211 this.pnlDescription = new System.Windows.Forms.Panel();
212 this.grpDescription = new System.Windows.Forms.GroupBox();
213 this.lblDescription = new System.Windows.Forms.Label();
214 this.calStartDate = new System.Windows.Forms.MonthCalendar();
215 this.label1 = new System.Windows.Forms.Label();
216 this.grpTimeOfDay = new System.Windows.Forms.GroupBox();
217 this.rdoBoth = new System.Windows.Forms.RadioButton();
218 this.rdoPM = new System.Windows.Forms.RadioButton();
219 this.rdoAM = new System.Windows.Forms.RadioButton();
220 this.grpDayOfWeek = new System.Windows.Forms.GroupBox();
221 this.chkSun = new System.Windows.Forms.CheckBox();
222 this.chkSat = new System.Windows.Forms.CheckBox();
223 this.chkFri = new System.Windows.Forms.CheckBox();
224 this.chkThu = new System.Windows.Forms.CheckBox();
225 this.chkWed = new System.Windows.Forms.CheckBox();
226 this.chkTue = new System.Windows.Forms.CheckBox();
227 this.chkMon = new System.Windows.Forms.CheckBox();
228 this.cboAccessTypeFilter = new System.Windows.Forms.ComboBox();
229 this.lstAccessTypes = new System.Windows.Forms.CheckedListBox();
230 this.label2 = new System.Windows.Forms.Label();
231 this.label3 = new System.Windows.Forms.Label();
232 this.panel1.SuspendLayout();
233 this.pnlDescription.SuspendLayout();
234 this.grpDescription.SuspendLayout();
235 this.grpTimeOfDay.SuspendLayout();
236 this.grpDayOfWeek.SuspendLayout();
237 this.SuspendLayout();
238 //
239 // panel1
240 //
241 this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] {
242 this.cmdCancel,
243 this.cmdOK});
244 this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
245 this.panel1.Location = new System.Drawing.Point(0, 440);
246 this.panel1.Name = "panel1";
247 this.panel1.Size = new System.Drawing.Size(488, 40);
248 this.panel1.TabIndex = 4;
249 //
250 // cmdCancel
251 //
252 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
253 this.cmdCancel.Location = new System.Drawing.Point(416, 8);
254 this.cmdCancel.Name = "cmdCancel";
255 this.cmdCancel.Size = new System.Drawing.Size(64, 24);
256 this.cmdCancel.TabIndex = 1;
257 this.cmdCancel.Text = "Cancel";
258 //
259 // cmdOK
260 //
261 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
262 this.cmdOK.Location = new System.Drawing.Point(336, 8);
263 this.cmdOK.Name = "cmdOK";
264 this.cmdOK.Size = new System.Drawing.Size(64, 24);
265 this.cmdOK.TabIndex = 0;
266 this.cmdOK.Text = "Search";
267 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
268 //
269 // pnlDescription
270 //
271 this.pnlDescription.Controls.AddRange(new System.Windows.Forms.Control[] {
272 this.grpDescription});
273 this.pnlDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
274 this.pnlDescription.Location = new System.Drawing.Point(0, 376);
275 this.pnlDescription.Name = "pnlDescription";
276 this.pnlDescription.Size = new System.Drawing.Size(488, 64);
277 this.pnlDescription.TabIndex = 47;
278 //
279 // grpDescription
280 //
281 this.grpDescription.Controls.AddRange(new System.Windows.Forms.Control[] {
282 this.lblDescription});
283 this.grpDescription.Dock = System.Windows.Forms.DockStyle.Fill;
284 this.grpDescription.Name = "grpDescription";
285 this.grpDescription.Size = new System.Drawing.Size(488, 64);
286 this.grpDescription.TabIndex = 0;
287 this.grpDescription.TabStop = false;
288 this.grpDescription.Text = "Description";
289 //
290 // lblDescription
291 //
292 this.lblDescription.Dock = System.Windows.Forms.DockStyle.Fill;
293 this.lblDescription.Location = new System.Drawing.Point(3, 16);
294 this.lblDescription.Name = "lblDescription";
295 this.lblDescription.Size = new System.Drawing.Size(482, 45);
296 this.lblDescription.TabIndex = 1;
297 this.lblDescription.Text = "Search for available appointment times using this panel. You may narrow your sea" +
298 "rch by selecting an access type or by selecting specific days of the week or tim" +
299 "es of day.";
300 //
301 // calStartDate
302 //
303 this.calStartDate.Location = new System.Drawing.Point(24, 32);
304 this.calStartDate.Name = "calStartDate";
305 this.calStartDate.TabIndex = 48;
306 //
307 // label1
308 //
309 this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
310 this.label1.Location = new System.Drawing.Point(16, 8);
311 this.label1.Name = "label1";
312 this.label1.Size = new System.Drawing.Size(208, 16);
313 this.label1.TabIndex = 49;
314 this.label1.Text = "Search for first availabiltiy after this date:";
315 //
316 // grpTimeOfDay
317 //
318 this.grpTimeOfDay.Controls.AddRange(new System.Windows.Forms.Control[] {
319 this.rdoBoth,
320 this.rdoPM,
321 this.rdoAM});
322 this.grpTimeOfDay.Location = new System.Drawing.Point(240, 16);
323 this.grpTimeOfDay.Name = "grpTimeOfDay";
324 this.grpTimeOfDay.Size = new System.Drawing.Size(240, 48);
325 this.grpTimeOfDay.TabIndex = 50;
326 this.grpTimeOfDay.TabStop = false;
327 this.grpTimeOfDay.Text = "Time of Day";
328 //
329 // rdoBoth
330 //
331 this.rdoBoth.Checked = true;
332 this.rdoBoth.Location = new System.Drawing.Point(176, 24);
333 this.rdoBoth.Name = "rdoBoth";
334 this.rdoBoth.Size = new System.Drawing.Size(48, 16);
335 this.rdoBoth.TabIndex = 2;
336 this.rdoBoth.TabStop = true;
337 this.rdoBoth.Text = "Both";
338 //
339 // rdoPM
340 //
341 this.rdoPM.Location = new System.Drawing.Point(96, 24);
342 this.rdoPM.Name = "rdoPM";
343 this.rdoPM.Size = new System.Drawing.Size(72, 16);
344 this.rdoPM.TabIndex = 1;
345 this.rdoPM.Text = "PM Only";
346 //
347 // rdoAM
348 //
349 this.rdoAM.Location = new System.Drawing.Point(16, 24);
350 this.rdoAM.Name = "rdoAM";
351 this.rdoAM.Size = new System.Drawing.Size(72, 16);
352 this.rdoAM.TabIndex = 0;
353 this.rdoAM.Text = "AM Only";
354 //
355 // grpDayOfWeek
356 //
357 this.grpDayOfWeek.Controls.AddRange(new System.Windows.Forms.Control[] {
358 this.chkSun,
359 this.chkSat,
360 this.chkFri,
361 this.chkThu,
362 this.chkWed,
363 this.chkTue,
364 this.chkMon});
365 this.grpDayOfWeek.Location = new System.Drawing.Point(240, 80);
366 this.grpDayOfWeek.Name = "grpDayOfWeek";
367 this.grpDayOfWeek.Size = new System.Drawing.Size(240, 104);
368 this.grpDayOfWeek.TabIndex = 51;
369 this.grpDayOfWeek.TabStop = false;
370 this.grpDayOfWeek.Text = "Day of the Week";
371 //
372 // chkSun
373 //
374 this.chkSun.Location = new System.Drawing.Point(176, 64);
375 this.chkSun.Name = "chkSun";
376 this.chkSun.Size = new System.Drawing.Size(48, 16);
377 this.chkSun.TabIndex = 6;
378 this.chkSun.Text = "Sun";
379 //
380 // chkSat
381 //
382 this.chkSat.Location = new System.Drawing.Point(128, 64);
383 this.chkSat.Name = "chkSat";
384 this.chkSat.Size = new System.Drawing.Size(48, 16);
385 this.chkSat.TabIndex = 5;
386 this.chkSat.Text = "Sat";
387 //
388 // chkFri
389 //
390 this.chkFri.Location = new System.Drawing.Point(72, 64);
391 this.chkFri.Name = "chkFri";
392 this.chkFri.Size = new System.Drawing.Size(48, 16);
393 this.chkFri.TabIndex = 4;
394 this.chkFri.Text = "Fri";
395 //
396 // chkThu
397 //
398 this.chkThu.Location = new System.Drawing.Point(16, 64);
399 this.chkThu.Name = "chkThu";
400 this.chkThu.Size = new System.Drawing.Size(48, 16);
401 this.chkThu.TabIndex = 3;
402 this.chkThu.Text = "Thu";
403 //
404 // chkWed
405 //
406 this.chkWed.Location = new System.Drawing.Point(128, 32);
407 this.chkWed.Name = "chkWed";
408 this.chkWed.Size = new System.Drawing.Size(48, 16);
409 this.chkWed.TabIndex = 2;
410 this.chkWed.Text = "Wed";
411 //
412 // chkTue
413 //
414 this.chkTue.Location = new System.Drawing.Point(72, 32);
415 this.chkTue.Name = "chkTue";
416 this.chkTue.Size = new System.Drawing.Size(48, 16);
417 this.chkTue.TabIndex = 1;
418 this.chkTue.Text = "Tue";
419 //
420 // chkMon
421 //
422 this.chkMon.Location = new System.Drawing.Point(16, 32);
423 this.chkMon.Name = "chkMon";
424 this.chkMon.Size = new System.Drawing.Size(48, 16);
425 this.chkMon.TabIndex = 0;
426 this.chkMon.Text = "Mon";
427 //
428 // cboAccessTypeFilter
429 //
430 this.cboAccessTypeFilter.Location = new System.Drawing.Point(72, 208);
431 this.cboAccessTypeFilter.Name = "cboAccessTypeFilter";
432 this.cboAccessTypeFilter.Size = new System.Drawing.Size(224, 21);
433 this.cboAccessTypeFilter.TabIndex = 52;
434 this.cboAccessTypeFilter.Text = "cboAccessTypeFilter";
435 this.cboAccessTypeFilter.SelectionChangeCommitted += new System.EventHandler(this.cboAccessTypeFilter_SelectionChangeCommitted);
436 //
437 // lstAccessTypes
438 //
439 this.lstAccessTypes.CheckOnClick = true;
440 this.lstAccessTypes.HorizontalScrollbar = true;
441 this.lstAccessTypes.Location = new System.Drawing.Point(72, 240);
442 this.lstAccessTypes.MultiColumn = true;
443 this.lstAccessTypes.Name = "lstAccessTypes";
444 this.lstAccessTypes.Size = new System.Drawing.Size(408, 124);
445 this.lstAccessTypes.TabIndex = 53;
446 //
447 // label2
448 //
449 this.label2.Location = new System.Drawing.Point(16, 208);
450 this.label2.Name = "label2";
451 this.label2.Size = new System.Drawing.Size(48, 32);
452 this.label2.TabIndex = 54;
453 this.label2.Text = "Access Group";
454 //
455 // label3
456 //
457 this.label3.Location = new System.Drawing.Point(16, 240);
458 this.label3.Name = "label3";
459 this.label3.Size = new System.Drawing.Size(56, 32);
460 this.label3.TabIndex = 55;
461 this.label3.Text = "Access Type";
462 //
463 // DApptSearch
464 //
465 this.AcceptButton = this.cmdOK;
466 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
467 this.CancelButton = this.cmdCancel;
468 this.ClientSize = new System.Drawing.Size(488, 480);
469 this.Controls.AddRange(new System.Windows.Forms.Control[] {
470 this.label3,
471 this.label2,
472 this.lstAccessTypes,
473 this.cboAccessTypeFilter,
474 this.grpDayOfWeek,
475 this.grpTimeOfDay,
476 this.label1,
477 this.calStartDate,
478 this.pnlDescription,
479 this.panel1});
480 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
481 this.Name = "DApptSearch";
482 this.Text = "DApptSearch";
483 this.panel1.ResumeLayout(false);
484 this.pnlDescription.ResumeLayout(false);
485 this.grpDescription.ResumeLayout(false);
486 this.grpTimeOfDay.ResumeLayout(false);
487 this.grpDayOfWeek.ResumeLayout(false);
488 this.ResumeLayout(false);
489
490 }
491 #endregion
492
493 private void cboAccessTypeFilter_SelectionChangeCommitted(object sender, System.EventArgs e)
494 {
495 //Load Access Types listbox & filter
496 string sGroup = cboAccessTypeFilter.Text;
497 if (sGroup == "<Show All Access Types>")
498 {
499 LoadListBox("ALL");
500 }
501 else
502 {
503 LoadListBox("SELECTED");
504 }
505 }
506
507 private void cmdOK_Click(object sender, System.EventArgs e)
508 {
509 //Get the control data into local vars
510 UpdateDialogData(false);
511
512 //Do the search
513 DataSet rsOut = new DataSet("AvailabilitySearch");
514 OleDbCommand cmd = m_RPMSConnection.CreateCommand();
515 System.Data.OleDb.OleDbDataAdapter da = new OleDbDataAdapter();
516 //Resource array, Begin date, Access type array, MTWTF , AM PM
517// string sSql = "BSDX SEARCH AVAILABILITY^" + m_nAccessGroupID.ToString() + "^" + nAccessTypeID.ToString();
518// cmd.CommandText = sSql;
519 da.SelectCommand = cmd;
520 da.Fill(rsOut, "AvailabilitySearch");
521
522 // if the result set count > 0 open the result dialog
523 // else display a "no availability found" messagebox and return
524
525 //if the return from the result dialog is cancel then return to the search dialog
526 //else close the search dialog with dialogresult.oi
527
528 }
529
530 }
531}
Note: See TracBrowser for help on using the repository browser.