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

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

Some debugging code to attach the program to the console to print messages.
Letters:

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