source: Scheduling/trunk/cs/bsdx0200GUISourceCode/DAccessTemplate.cs@ 973

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

New Release v 1.3.1

Added a note in the DAccessTemplate to say that you have to select the right 5 or 7 day view based on what you originally saved.

File size: 13.5 KB
Line 
1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6
7namespace IndianHealthService.ClinicalScheduling
8{
9 /// <summary>
10 /// Summary description for DAccessTemplate.
11 /// </summary>
12 public class DAccessTemplate : System.Windows.Forms.Form
13 {
14 private System.Windows.Forms.Panel pnlPageBottom;
15 private System.Windows.Forms.Button cmdCancel;
16 private System.Windows.Forms.Button cmdOK;
17 private System.Windows.Forms.Panel pnlDescription;
18 private System.Windows.Forms.GroupBox grpDescriptionResourceGroup;
19 private System.Windows.Forms.Label lblDescriptionResourceGroup;
20 private System.Windows.Forms.Button cmdSelectTemplate;
21 private System.Windows.Forms.TextBox txtTemplate;
22 private System.Windows.Forms.DateTimePicker dtpStartDate;
23 private System.Windows.Forms.NumericUpDown udWeeksToApply;
24 private System.Windows.Forms.Label label1;
25 private System.Windows.Forms.Label label2;
26 /// <summary>
27 /// Required designer variable.
28 /// </summary>
29 private System.ComponentModel.Container components = null;
30
31
32 #region Methods
33
34 public void InitializePage()
35 {
36
37 UpdateDialogData(true);
38
39 }
40
41 /// <summary>
42 /// If b is true, moves member vars into control data
43 /// otherwise, moves control data into member vars
44 /// </summary>
45 /// <param name="b"></param>
46 private void UpdateDialogData(bool b)
47 {
48 if (b == true)
49 {
50 udWeeksToApply.Value = 1;
51 }
52 else
53 {
54 //
55 m_nWeeksToApply = (int) udWeeksToApply.Value;
56 m_dtStart = dtpStartDate.Value;
57 }
58 }
59
60 public DAccessTemplate()
61 {
62 InitializeComponent();
63 }
64
65 /// <summary>
66 /// Clean up any resources being used.
67 /// </summary>
68 protected override void Dispose( bool disposing )
69 {
70 if( disposing )
71 {
72 if(components != null)
73 {
74 components.Dispose();
75 }
76 }
77 base.Dispose( disposing );
78 }
79
80 private void cmdOK_Click(object sender, System.EventArgs e)
81 {
82 DateTime dtStart = dtpStartDate.Value;
83 if (dtStart < DateTime.Today)
84 {
85 MessageBox.Show("Please select a future day.");
86 m_bCancelOK = true;
87 return;
88 }
89
90 if (m_bSelectedFile == false)
91 {
92 MessageBox.Show("Please select a valid template file.");
93 m_bCancelOK = true;
94 return;
95 }
96
97 if ((this.udWeeksToApply.Value > 52)||(this.udWeeksToApply.Value < 1))
98 {
99 MessageBox.Show("For the number of weeks to apply the template, please select a number between 1 and 52.");
100 m_bCancelOK = true;
101 return;
102 }
103 m_bCancelOK = false;
104
105 //Send the values from the controls to the fields
106 this.UpdateDialogData(false);
107
108 }
109
110 private void cmdSelectTemplate_Click(object sender, System.EventArgs e)
111 {
112 //Open the file dialog and pick a file
113 m_bSelectedFile = false;
114 OpenFileDialog openFileDialog1 = new OpenFileDialog();
115 string sPath = "";
116 sPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
117
118 openFileDialog1.InitialDirectory = @"c:\" ;
119 openFileDialog1.InitialDirectory = sPath ;
120 openFileDialog1.Filter = "Schedule Template Files (*.bsdxa)|*.bsdxa|All files (*.*)|*.*" ;
121 openFileDialog1.FilterIndex = 0 ;
122 openFileDialog1.RestoreDirectory = true ;
123
124 if(openFileDialog1.ShowDialog() == DialogResult.OK)
125 {
126 m_bSelectedFile = true;
127 m_ofDialog = openFileDialog1;
128 this.txtTemplate.Text = openFileDialog1.FileName;
129
130 }
131 }
132
133
134 #endregion Methods
135
136 #region Fields
137 private OpenFileDialog m_ofDialog;
138 private DateTime m_dtStart;
139 private int m_nWeeksToApply;
140 private bool m_bCancelOK = false;
141 private bool m_bSelectedFile = false;
142
143 #endregion Fields
144
145 #region Windows Form Designer generated code
146 /// <summary>
147 /// Required method for Designer support - do not modify
148 /// the contents of this method with the code editor.
149 /// </summary>
150 private void InitializeComponent()
151 {
152 this.pnlPageBottom = new System.Windows.Forms.Panel();
153 this.cmdCancel = new System.Windows.Forms.Button();
154 this.cmdOK = new System.Windows.Forms.Button();
155 this.pnlDescription = new System.Windows.Forms.Panel();
156 this.grpDescriptionResourceGroup = new System.Windows.Forms.GroupBox();
157 this.lblDescriptionResourceGroup = new System.Windows.Forms.Label();
158 this.cmdSelectTemplate = new System.Windows.Forms.Button();
159 this.txtTemplate = new System.Windows.Forms.TextBox();
160 this.dtpStartDate = new System.Windows.Forms.DateTimePicker();
161 this.udWeeksToApply = new System.Windows.Forms.NumericUpDown();
162 this.label1 = new System.Windows.Forms.Label();
163 this.label2 = new System.Windows.Forms.Label();
164 this.pnlPageBottom.SuspendLayout();
165 this.pnlDescription.SuspendLayout();
166 this.grpDescriptionResourceGroup.SuspendLayout();
167 ((System.ComponentModel.ISupportInitialize)(this.udWeeksToApply)).BeginInit();
168 this.SuspendLayout();
169 //
170 // pnlPageBottom
171 //
172 this.pnlPageBottom.Controls.Add(this.cmdCancel);
173 this.pnlPageBottom.Controls.Add(this.cmdOK);
174 this.pnlPageBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
175 this.pnlPageBottom.Location = new System.Drawing.Point(0, 264);
176 this.pnlPageBottom.Name = "pnlPageBottom";
177 this.pnlPageBottom.Size = new System.Drawing.Size(440, 40);
178 this.pnlPageBottom.TabIndex = 7;
179 //
180 // cmdCancel
181 //
182 this.cmdCancel.CausesValidation = false;
183 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
184 this.cmdCancel.Location = new System.Drawing.Point(360, 8);
185 this.cmdCancel.Name = "cmdCancel";
186 this.cmdCancel.Size = new System.Drawing.Size(56, 24);
187 this.cmdCancel.TabIndex = 2;
188 this.cmdCancel.Text = "Cancel";
189 //
190 // cmdOK
191 //
192 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
193 this.cmdOK.Location = new System.Drawing.Point(280, 8);
194 this.cmdOK.Name = "cmdOK";
195 this.cmdOK.Size = new System.Drawing.Size(64, 24);
196 this.cmdOK.TabIndex = 1;
197 this.cmdOK.Text = "OK";
198 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
199 //
200 // pnlDescription
201 //
202 this.pnlDescription.Controls.Add(this.grpDescriptionResourceGroup);
203 this.pnlDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
204 this.pnlDescription.Location = new System.Drawing.Point(0, 184);
205 this.pnlDescription.Name = "pnlDescription";
206 this.pnlDescription.Size = new System.Drawing.Size(440, 80);
207 this.pnlDescription.TabIndex = 8;
208 //
209 // grpDescriptionResourceGroup
210 //
211 this.grpDescriptionResourceGroup.Controls.Add(this.lblDescriptionResourceGroup);
212 this.grpDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
213 this.grpDescriptionResourceGroup.Location = new System.Drawing.Point(0, 0);
214 this.grpDescriptionResourceGroup.Name = "grpDescriptionResourceGroup";
215 this.grpDescriptionResourceGroup.Size = new System.Drawing.Size(440, 80);
216 this.grpDescriptionResourceGroup.TabIndex = 1;
217 this.grpDescriptionResourceGroup.TabStop = false;
218 this.grpDescriptionResourceGroup.Text = "Description";
219 //
220 // lblDescriptionResourceGroup
221 //
222 this.lblDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
223 this.lblDescriptionResourceGroup.Location = new System.Drawing.Point(3, 16);
224 this.lblDescriptionResourceGroup.Name = "lblDescriptionResourceGroup";
225 this.lblDescriptionResourceGroup.Size = new System.Drawing.Size(434, 61);
226 this.lblDescriptionResourceGroup.TabIndex = 0;
227 this.lblDescriptionResourceGroup.Text = "Use this panel to define an access pattern for future clinic availability.\r\nMAKE " +
228 "SURE TO SELECT 5 or 7 day view first depending on which view you used to save th" +
229 "e selected Access Template.";
230 //
231 // cmdSelectTemplate
232 //
233 this.cmdSelectTemplate.Location = new System.Drawing.Point(24, 40);
234 this.cmdSelectTemplate.Name = "cmdSelectTemplate";
235 this.cmdSelectTemplate.Size = new System.Drawing.Size(136, 32);
236 this.cmdSelectTemplate.TabIndex = 9;
237 this.cmdSelectTemplate.Text = "Select Access Template";
238 this.cmdSelectTemplate.Click += new System.EventHandler(this.cmdSelectTemplate_Click);
239 //
240 // txtTemplate
241 //
242 this.txtTemplate.Location = new System.Drawing.Point(176, 32);
243 this.txtTemplate.Multiline = true;
244 this.txtTemplate.Name = "txtTemplate";
245 this.txtTemplate.ReadOnly = true;
246 this.txtTemplate.Size = new System.Drawing.Size(248, 48);
247 this.txtTemplate.TabIndex = 10;
248 //
249 // dtpStartDate
250 //
251 this.dtpStartDate.AllowDrop = true;
252 this.dtpStartDate.Checked = false;
253 this.dtpStartDate.Location = new System.Drawing.Point(176, 104);
254 this.dtpStartDate.Name = "dtpStartDate";
255 this.dtpStartDate.Size = new System.Drawing.Size(184, 20);
256 this.dtpStartDate.TabIndex = 11;
257 //
258 // udWeeksToApply
259 //
260 this.udWeeksToApply.Location = new System.Drawing.Point(176, 144);
261 this.udWeeksToApply.Maximum = new decimal(new int[] {
262 52,
263 0,
264 0,
265 0});
266 this.udWeeksToApply.Minimum = new decimal(new int[] {
267 1,
268 0,
269 0,
270 0});
271 this.udWeeksToApply.Name = "udWeeksToApply";
272 this.udWeeksToApply.Size = new System.Drawing.Size(96, 20);
273 this.udWeeksToApply.TabIndex = 12;
274 this.udWeeksToApply.Value = new decimal(new int[] {
275 1,
276 0,
277 0,
278 0});
279 //
280 // label1
281 //
282 this.label1.Location = new System.Drawing.Point(16, 104);
283 this.label1.Name = "label1";
284 this.label1.Size = new System.Drawing.Size(152, 16);
285 this.label1.TabIndex = 13;
286 this.label1.Text = "Starting Week:";
287 this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
288 //
289 // label2
290 //
291 this.label2.Location = new System.Drawing.Point(16, 144);
292 this.label2.Name = "label2";
293 this.label2.Size = new System.Drawing.Size(152, 16);
294 this.label2.TabIndex = 13;
295 this.label2.Text = "Number of Weeks to Apply:";
296 this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
297 //
298 // DAccessTemplate
299 //
300 this.AcceptButton = this.cmdOK;
301 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
302 this.CancelButton = this.cmdCancel;
303 this.ClientSize = new System.Drawing.Size(440, 304);
304 this.Controls.Add(this.label1);
305 this.Controls.Add(this.udWeeksToApply);
306 this.Controls.Add(this.dtpStartDate);
307 this.Controls.Add(this.txtTemplate);
308 this.Controls.Add(this.cmdSelectTemplate);
309 this.Controls.Add(this.pnlDescription);
310 this.Controls.Add(this.pnlPageBottom);
311 this.Controls.Add(this.label2);
312 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
313 this.Name = "DAccessTemplate";
314 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
315 this.Text = "Apply Access Template";
316 this.Closing += new System.ComponentModel.CancelEventHandler(this.DAccessTemplate_Closing);
317 this.pnlPageBottom.ResumeLayout(false);
318 this.pnlDescription.ResumeLayout(false);
319 this.grpDescriptionResourceGroup.ResumeLayout(false);
320 ((System.ComponentModel.ISupportInitialize)(this.udWeeksToApply)).EndInit();
321 this.ResumeLayout(false);
322 this.PerformLayout();
323
324 }
325 #endregion
326
327
328 private void DAccessTemplate_Closing(object sender, System.ComponentModel.CancelEventArgs e)
329 {
330 if (m_bCancelOK == true)
331 {
332 e.Cancel = true;
333 m_bCancelOK = false;
334 }
335 else
336 {
337 e.Cancel = false;
338 }
339 }
340
341
342 #region Properties
343
344
345 /// <summary>
346 /// Returns the open file dialog object
347 /// </summary>
348 public OpenFileDialog FileDialog
349 {
350 get
351 {
352 return m_ofDialog;
353 }
354 }
355
356 /// <summary>
357 /// Sets or returns the start date to apply the template
358 /// </summary>
359 public DateTime StartDate
360 {
361 get
362 {
363 return m_dtStart;
364 }
365 set
366 {
367 m_dtStart = value;
368 }
369 }
370
371 /// <summary>
372 /// Sets or returns the number of weeks to apply the template
373 /// </summary>
374 public int WeeksToApply
375 {
376 get
377 {
378 return m_nWeeksToApply;
379 }
380 set
381 {
382 m_nWeeksToApply = value;
383 }
384 }
385 #endregion Properties
386
387
388
389
390
391 }
392}
Note: See TracBrowser for help on using the repository browser.