source: Scheduling/trunk/cs/bsdx0200GUISourceCode/DSelectLetterClinics.cs@ 668

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

Initial committ of scheduling package

File size: 11.6 KB
RevLine 
[614]1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Data;
7
8namespace IndianHealthService.ClinicalScheduling
9{
10 /// <summary>
11 /// Summary description for DSelectLetterClinics.
12 /// </summary>
13 public class DSelectLetterClinics : System.Windows.Forms.Form
14 {
15 private System.Windows.Forms.Button cmdCancel;
16 private System.Windows.Forms.Button cmdOK;
17 private System.Windows.Forms.Panel pnlOkCancel;
18 private System.Windows.Forms.Panel pnlDescription;
19 private System.Windows.Forms.GroupBox grpDescription;
20 private System.Windows.Forms.Label lblDescription;
21 private System.Windows.Forms.CheckedListBox lstResource;
22 private System.Windows.Forms.ComboBox cboResourceGroup;
23 private System.Windows.Forms.Label label1;
24 private System.Windows.Forms.Label label2;
25 private System.Windows.Forms.Label label4;
26 private System.Windows.Forms.Label label5;
27 private System.Windows.Forms.DateTimePicker dtBegin;
28 private System.Windows.Forms.DateTimePicker dtEnd;
29 private System.Windows.Forms.Label lblRange;
30 private System.Windows.Forms.CheckBox chkSelectAll;
31 private System.ComponentModel.Container components = null;
32
33 public DSelectLetterClinics()
34 {
35 InitializeComponent();
36 }
37
38 /// <summary>
39 /// Clean up any resources being used.
40 /// </summary>
41 protected override void Dispose( bool disposing )
42 {
43 if( disposing )
44 {
45 if(components != null)
46 {
47 components.Dispose();
48 }
49 }
50 base.Dispose( disposing );
51 }
52
53 #region Windows Form Designer generated code
54 /// <summary>
55 /// Required method for Designer support - do not modify
56 /// the contents of this method with the code editor.
57 /// </summary>
58 private void InitializeComponent()
59 {
60 this.pnlOkCancel = new System.Windows.Forms.Panel();
61 this.cmdCancel = new System.Windows.Forms.Button();
62 this.cmdOK = new System.Windows.Forms.Button();
63 this.pnlDescription = new System.Windows.Forms.Panel();
64 this.grpDescription = new System.Windows.Forms.GroupBox();
65 this.lblDescription = new System.Windows.Forms.Label();
66 this.lstResource = new System.Windows.Forms.CheckedListBox();
67 this.cboResourceGroup = new System.Windows.Forms.ComboBox();
68 this.label1 = new System.Windows.Forms.Label();
69 this.label2 = new System.Windows.Forms.Label();
70 this.dtBegin = new System.Windows.Forms.DateTimePicker();
71 this.dtEnd = new System.Windows.Forms.DateTimePicker();
72 this.lblRange = new System.Windows.Forms.Label();
73 this.label4 = new System.Windows.Forms.Label();
74 this.label5 = new System.Windows.Forms.Label();
75 this.chkSelectAll = new System.Windows.Forms.CheckBox();
76 this.pnlOkCancel.SuspendLayout();
77 this.pnlDescription.SuspendLayout();
78 this.grpDescription.SuspendLayout();
79 this.SuspendLayout();
80 //
81 // pnlOkCancel
82 //
83 this.pnlOkCancel.Controls.Add(this.cmdCancel);
84 this.pnlOkCancel.Controls.Add(this.cmdOK);
85 this.pnlOkCancel.Dock = System.Windows.Forms.DockStyle.Bottom;
86 this.pnlOkCancel.Location = new System.Drawing.Point(0, 430);
87 this.pnlOkCancel.Name = "pnlOkCancel";
88 this.pnlOkCancel.Size = new System.Drawing.Size(512, 40);
89 this.pnlOkCancel.TabIndex = 4;
90 //
91 // cmdCancel
92 //
93 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
94 this.cmdCancel.Location = new System.Drawing.Point(416, 8);
95 this.cmdCancel.Name = "cmdCancel";
96 this.cmdCancel.Size = new System.Drawing.Size(64, 24);
97 this.cmdCancel.TabIndex = 1;
98 this.cmdCancel.Text = "Cancel";
99 //
100 // cmdOK
101 //
102 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
103 this.cmdOK.Location = new System.Drawing.Point(336, 8);
104 this.cmdOK.Name = "cmdOK";
105 this.cmdOK.Size = new System.Drawing.Size(64, 24);
106 this.cmdOK.TabIndex = 0;
107 this.cmdOK.Text = "OK";
108 //
109 // pnlDescription
110 //
111 this.pnlDescription.Controls.Add(this.grpDescription);
112 this.pnlDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
113 this.pnlDescription.Location = new System.Drawing.Point(0, 350);
114 this.pnlDescription.Name = "pnlDescription";
115 this.pnlDescription.Size = new System.Drawing.Size(512, 80);
116 this.pnlDescription.TabIndex = 47;
117 //
118 // grpDescription
119 //
120 this.grpDescription.Controls.Add(this.lblDescription);
121 this.grpDescription.Dock = System.Windows.Forms.DockStyle.Fill;
122 this.grpDescription.Location = new System.Drawing.Point(0, 0);
123 this.grpDescription.Name = "grpDescription";
124 this.grpDescription.Size = new System.Drawing.Size(512, 80);
125 this.grpDescription.TabIndex = 0;
126 this.grpDescription.TabStop = false;
127 this.grpDescription.Text = "Description";
128 //
129 // lblDescription
130 //
131 this.lblDescription.Dock = System.Windows.Forms.DockStyle.Fill;
132 this.lblDescription.Location = new System.Drawing.Point(3, 16);
133 this.lblDescription.Name = "lblDescription";
134 this.lblDescription.Size = new System.Drawing.Size(506, 61);
135 this.lblDescription.TabIndex = 1;
136 this.lblDescription.Text = "Use this panel to select resources and to specify the time period for patient rem" +
137 "inder letters. Check each resource (clinic) for which to print letters. Letter" +
138 "s will be printed for appointments between the beginning and ending dates, inclu" +
139 "sive.";
140 //
141 // lstResource
142 //
143 this.lstResource.HorizontalScrollbar = true;
144 this.lstResource.Location = new System.Drawing.Point(24, 96);
145 this.lstResource.MultiColumn = true;
146 this.lstResource.Name = "lstResource";
147 this.lstResource.Size = new System.Drawing.Size(448, 124);
148 this.lstResource.TabIndex = 48;
149 //
150 // cboResourceGroup
151 //
152 this.cboResourceGroup.Location = new System.Drawing.Point(24, 40);
153 this.cboResourceGroup.Name = "cboResourceGroup";
154 this.cboResourceGroup.Size = new System.Drawing.Size(448, 21);
155 this.cboResourceGroup.TabIndex = 49;
156 this.cboResourceGroup.SelectedIndexChanged += new System.EventHandler(this.cboResourceGroup_SelectedIndexChanged);
157 //
158 // label1
159 //
160 this.label1.Location = new System.Drawing.Point(24, 16);
161 this.label1.Name = "label1";
162 this.label1.Size = new System.Drawing.Size(208, 16);
163 this.label1.TabIndex = 50;
164 this.label1.Text = "Resource Group:";
165 //
166 // label2
167 //
168 this.label2.Location = new System.Drawing.Point(24, 72);
169 this.label2.Name = "label2";
170 this.label2.Size = new System.Drawing.Size(72, 16);
171 this.label2.TabIndex = 51;
172 this.label2.Text = "Resource:";
173 //
174 // dtBegin
175 //
176 this.dtBegin.Location = new System.Drawing.Point(24, 312);
177 this.dtBegin.Name = "dtBegin";
178 this.dtBegin.TabIndex = 52;
179 //
180 // dtEnd
181 //
182 this.dtEnd.Location = new System.Drawing.Point(280, 312);
183 this.dtEnd.Name = "dtEnd";
184 this.dtEnd.Size = new System.Drawing.Size(192, 20);
185 this.dtEnd.TabIndex = 52;
186 //
187 // lblRange
188 //
189 this.lblRange.Location = new System.Drawing.Point(24, 272);
190 this.lblRange.Name = "lblRange";
191 this.lblRange.Size = new System.Drawing.Size(192, 16);
192 this.lblRange.TabIndex = 53;
193 this.lblRange.Text = "Date range for appointment letters:";
194 //
195 // label4
196 //
197 this.label4.Location = new System.Drawing.Point(24, 296);
198 this.label4.Name = "label4";
199 this.label4.Size = new System.Drawing.Size(152, 16);
200 this.label4.TabIndex = 54;
201 this.label4.Text = "Beginning Date:";
202 //
203 // label5
204 //
205 this.label5.Location = new System.Drawing.Point(280, 296);
206 this.label5.Name = "label5";
207 this.label5.Size = new System.Drawing.Size(152, 16);
208 this.label5.TabIndex = 54;
209 this.label5.Text = "Ending Date:";
210 //
211 // chkSelectAll
212 //
213 this.chkSelectAll.Location = new System.Drawing.Point(32, 232);
214 this.chkSelectAll.Name = "chkSelectAll";
215 this.chkSelectAll.Size = new System.Drawing.Size(168, 24);
216 this.chkSelectAll.TabIndex = 55;
217 this.chkSelectAll.Text = "Select All Resources";
218 this.chkSelectAll.CheckedChanged += new System.EventHandler(this.chkSelectAll_CheckedChanged);
219 //
220 // DSelectLetterClinics
221 //
222 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
223 this.ClientSize = new System.Drawing.Size(512, 470);
224 this.Controls.Add(this.chkSelectAll);
225 this.Controls.Add(this.label4);
226 this.Controls.Add(this.lblRange);
227 this.Controls.Add(this.dtBegin);
228 this.Controls.Add(this.label2);
229 this.Controls.Add(this.label1);
230 this.Controls.Add(this.cboResourceGroup);
231 this.Controls.Add(this.lstResource);
232 this.Controls.Add(this.pnlDescription);
233 this.Controls.Add(this.pnlOkCancel);
234 this.Controls.Add(this.dtEnd);
235 this.Controls.Add(this.label5);
236 this.Name = "DSelectLetterClinics";
237 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
238 this.Text = "Print Apppointment Letters";
239 this.pnlOkCancel.ResumeLayout(false);
240 this.pnlDescription.ResumeLayout(false);
241 this.grpDescription.ResumeLayout(false);
242 this.ResumeLayout(false);
243
244 }
245 #endregion
246
247 #region Methods
248
249 public void SetupForReports()
250 {
251 lblRange.Text = "Date Range for Appointment List:";
252 lblDescription.Text = "Use this panel to select resources and to specify the time period for appointment lists. Check each resource (clinic) for which to print lists. Lists will be printed for appointments between the beginning and ending dates, inclusive.";
253 this.Text = "Print Clinic Schedules";
254 }
255
256 public void InitializePage(DataSet dsGlobal, string sWindowText)
257 {
258 try
259 {
260 m_bInitialized = false;
261 this.Text = sWindowText;
262 m_dtResources = dsGlobal.Tables["GroupResources"];
263 m_dvResources = new DataView(m_dtResources);
264 m_dvResources.Sort = "RESOURCE_NAME ASC";
265 lstResource.DataSource = m_dvResources;
266 lstResource.DisplayMember = "RESOURCE_NAME";
267 lstResource.ValueMember = "RESOURCEID";
268
269 m_dtGroups = dsGlobal.Tables["ResourceGroup"];
270 m_dvGroups = new DataView(m_dtGroups);
271 m_dvGroups.Sort = "RESOURCE_GROUP ASC";
272 cboResourceGroup.DataSource = m_dvGroups;
273 cboResourceGroup.DisplayMember = "RESOURCE_GROUP";
274 cboResourceGroup.ValueMember = "RESOURCE_GROUPID";
275
276 m_dvResources.RowFilter = "RESOURCE_GROUPID = " + cboResourceGroup.SelectedValue;
277 m_bInitialized = true;
278 return;
279 }
280 catch(Exception ex)
281 {
282 throw ex;
283 }
284
285 }
286
287 private void cboResourceGroup_SelectedIndexChanged(object sender, System.EventArgs e)
288 {
289 if (m_bInitialized == true)
290 m_dvResources.RowFilter = "RESOURCE_GROUPID = " + cboResourceGroup.SelectedValue;
291 chkSelectAll.Checked = false;
292 }
293
294 private void chkSelectAll_CheckedChanged(object sender, System.EventArgs e)
295 {
296 for(int i=0; i < lstResource.Items.Count; i++)
297 {
298 lstResource.SetItemChecked(i, chkSelectAll.Checked);
299 }
300 }
301
302 #endregion Methods
303
304 #region Fields
305 private DataTable m_dtGroups;
306 private DataView m_dvGroups;
307 private DataTable m_dtResources;
308 private DataView m_dvResources;
309 private bool m_bInitialized;
310
311 #endregion Fields
312
313 #region Properties
314
315 /// <summary>
316 /// Returns the |-delimited string of selected resource id's
317 /// </summary>
318 public string SelectedClinics
319 {
320 get
321 {
322 string sRet = "";
323 foreach(DataRowView s in this.lstResource.CheckedItems)
324 {
325 sRet = sRet + s["RESOURCEID"].ToString() + "|";
326 }
327 return sRet;
328 }
329 }
330
331 public DateTime BeginDate
332 {
333 get
334 {
335 return dtBegin.Value;
336 }
337 }
338
339 public DateTime EndDate
340 {
341 get
342 {
343 return dtEnd.Value;
344 }
345 }
346 #endregion Properties
347
348
349 }
350}
Note: See TracBrowser for help on using the repository browser.