source: Scheduling/branches/BMX4Support/DAccessTemplate.cs@ 1452

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

UCPatientAppts: Fixes printing empty table bug reported by EHS.
DAccessTemplate: Various usability improvements.
CGDocumentManager: Fixed Delegate code so that it can operate asynchronously
CGAVView: Some temporary fixes (not totally usable): Added non-functional Delete Slots menu option; Added Background worker for saving acccess slots
In the future, Delete Slots will work; and will use ADO.net Updatable datatable for saving access slots.
calendarGrid: just some comments for now
AssemblyInfo: bumped version up to v1.4.2

File size: 13.4 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 //this.cmdSelectTemplate.Focus(); // Focus on first button on form
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 openFileDialog1.Filter = "Schedule Template Files (*.bsdxa)|*.bsdxa|All files (*.*)|*.*" ;
116 openFileDialog1.FilterIndex = 0 ;
117 openFileDialog1.RestoreDirectory = true ;
118
119 if(openFileDialog1.ShowDialog() == DialogResult.OK)
120 {
121 m_bSelectedFile = true;
122 m_ofDialog = openFileDialog1;
123 this.txtTemplate.Text = openFileDialog1.FileName;
124
125 }
126 }
127
128
129 #endregion Methods
130
131 #region Fields
132 private OpenFileDialog m_ofDialog;
133 private DateTime m_dtStart;
134 private int m_nWeeksToApply;
135 private bool m_bCancelOK = false;
136 private bool m_bSelectedFile = false;
137
138 #endregion Fields
139
140 #region Windows Form Designer generated code
141 /// <summary>
142 /// Required method for Designer support - do not modify
143 /// the contents of this method with the code editor.
144 /// </summary>
145 private void InitializeComponent()
146 {
147 this.pnlPageBottom = new System.Windows.Forms.Panel();
148 this.cmdCancel = new System.Windows.Forms.Button();
149 this.cmdOK = new System.Windows.Forms.Button();
150 this.pnlDescription = new System.Windows.Forms.Panel();
151 this.grpDescriptionResourceGroup = new System.Windows.Forms.GroupBox();
152 this.lblDescriptionResourceGroup = new System.Windows.Forms.Label();
153 this.cmdSelectTemplate = new System.Windows.Forms.Button();
154 this.txtTemplate = new System.Windows.Forms.TextBox();
155 this.dtpStartDate = new System.Windows.Forms.DateTimePicker();
156 this.udWeeksToApply = new System.Windows.Forms.NumericUpDown();
157 this.label1 = new System.Windows.Forms.Label();
158 this.label2 = new System.Windows.Forms.Label();
159 this.pnlPageBottom.SuspendLayout();
160 this.pnlDescription.SuspendLayout();
161 this.grpDescriptionResourceGroup.SuspendLayout();
162 ((System.ComponentModel.ISupportInitialize)(this.udWeeksToApply)).BeginInit();
163 this.SuspendLayout();
164 //
165 // pnlPageBottom
166 //
167 this.pnlPageBottom.Controls.Add(this.cmdCancel);
168 this.pnlPageBottom.Controls.Add(this.cmdOK);
169 this.pnlPageBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
170 this.pnlPageBottom.Location = new System.Drawing.Point(0, 264);
171 this.pnlPageBottom.Name = "pnlPageBottom";
172 this.pnlPageBottom.Size = new System.Drawing.Size(440, 40);
173 this.pnlPageBottom.TabIndex = 7;
174 //
175 // cmdCancel
176 //
177 this.cmdCancel.CausesValidation = false;
178 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
179 this.cmdCancel.Location = new System.Drawing.Point(360, 8);
180 this.cmdCancel.Name = "cmdCancel";
181 this.cmdCancel.Size = new System.Drawing.Size(56, 24);
182 this.cmdCancel.TabIndex = 5;
183 this.cmdCancel.Text = "Cancel";
184 //
185 // cmdOK
186 //
187 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
188 this.cmdOK.Location = new System.Drawing.Point(280, 8);
189 this.cmdOK.Name = "cmdOK";
190 this.cmdOK.Size = new System.Drawing.Size(64, 24);
191 this.cmdOK.TabIndex = 4;
192 this.cmdOK.Text = "OK";
193 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
194 //
195 // pnlDescription
196 //
197 this.pnlDescription.Controls.Add(this.grpDescriptionResourceGroup);
198 this.pnlDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
199 this.pnlDescription.Location = new System.Drawing.Point(0, 184);
200 this.pnlDescription.Name = "pnlDescription";
201 this.pnlDescription.Size = new System.Drawing.Size(440, 80);
202 this.pnlDescription.TabIndex = 8;
203 //
204 // grpDescriptionResourceGroup
205 //
206 this.grpDescriptionResourceGroup.Controls.Add(this.lblDescriptionResourceGroup);
207 this.grpDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
208 this.grpDescriptionResourceGroup.Location = new System.Drawing.Point(0, 0);
209 this.grpDescriptionResourceGroup.Name = "grpDescriptionResourceGroup";
210 this.grpDescriptionResourceGroup.Size = new System.Drawing.Size(440, 80);
211 this.grpDescriptionResourceGroup.TabIndex = 1;
212 this.grpDescriptionResourceGroup.TabStop = false;
213 this.grpDescriptionResourceGroup.Text = "Description";
214 //
215 // lblDescriptionResourceGroup
216 //
217 this.lblDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
218 this.lblDescriptionResourceGroup.Location = new System.Drawing.Point(3, 16);
219 this.lblDescriptionResourceGroup.Name = "lblDescriptionResourceGroup";
220 this.lblDescriptionResourceGroup.Size = new System.Drawing.Size(434, 61);
221 this.lblDescriptionResourceGroup.TabIndex = 0;
222 this.lblDescriptionResourceGroup.Text = "Use this panel to define an access pattern for future clinic availability.\r\nMAKE " +
223 "SURE TO SELECT 5 or 7 day view first depending on which view you used to save th" +
224 "e selected Access Template.";
225 //
226 // cmdSelectTemplate
227 //
228 this.cmdSelectTemplate.Location = new System.Drawing.Point(24, 40);
229 this.cmdSelectTemplate.Name = "cmdSelectTemplate";
230 this.cmdSelectTemplate.Size = new System.Drawing.Size(136, 32);
231 this.cmdSelectTemplate.TabIndex = 1;
232 this.cmdSelectTemplate.Text = "Select Access Template";
233 this.cmdSelectTemplate.Click += new System.EventHandler(this.cmdSelectTemplate_Click);
234 //
235 // txtTemplate
236 //
237 this.txtTemplate.Location = new System.Drawing.Point(176, 32);
238 this.txtTemplate.Multiline = true;
239 this.txtTemplate.Name = "txtTemplate";
240 this.txtTemplate.ReadOnly = true;
241 this.txtTemplate.Size = new System.Drawing.Size(248, 48);
242 this.txtTemplate.TabIndex = 10;
243 //
244 // dtpStartDate
245 //
246 this.dtpStartDate.AllowDrop = true;
247 this.dtpStartDate.Checked = false;
248 this.dtpStartDate.Location = new System.Drawing.Point(176, 104);
249 this.dtpStartDate.Name = "dtpStartDate";
250 this.dtpStartDate.Size = new System.Drawing.Size(184, 20);
251 this.dtpStartDate.TabIndex = 2;
252 //
253 // udWeeksToApply
254 //
255 this.udWeeksToApply.Location = new System.Drawing.Point(176, 144);
256 this.udWeeksToApply.Maximum = new decimal(new int[] {
257 52,
258 0,
259 0,
260 0});
261 this.udWeeksToApply.Minimum = new decimal(new int[] {
262 1,
263 0,
264 0,
265 0});
266 this.udWeeksToApply.Name = "udWeeksToApply";
267 this.udWeeksToApply.Size = new System.Drawing.Size(96, 20);
268 this.udWeeksToApply.TabIndex = 3;
269 this.udWeeksToApply.Value = new decimal(new int[] {
270 1,
271 0,
272 0,
273 0});
274 //
275 // label1
276 //
277 this.label1.Location = new System.Drawing.Point(16, 104);
278 this.label1.Name = "label1";
279 this.label1.Size = new System.Drawing.Size(152, 16);
280 this.label1.TabIndex = 13;
281 this.label1.Text = "Starting Week:";
282 this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
283 //
284 // label2
285 //
286 this.label2.Location = new System.Drawing.Point(16, 144);
287 this.label2.Name = "label2";
288 this.label2.Size = new System.Drawing.Size(152, 16);
289 this.label2.TabIndex = 13;
290 this.label2.Text = "Number of Weeks to Apply:";
291 this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
292 //
293 // DAccessTemplate
294 //
295 this.AcceptButton = this.cmdOK;
296 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
297 this.CancelButton = this.cmdCancel;
298 this.ClientSize = new System.Drawing.Size(440, 304);
299 this.Controls.Add(this.label1);
300 this.Controls.Add(this.udWeeksToApply);
301 this.Controls.Add(this.dtpStartDate);
302 this.Controls.Add(this.txtTemplate);
303 this.Controls.Add(this.cmdSelectTemplate);
304 this.Controls.Add(this.pnlDescription);
305 this.Controls.Add(this.pnlPageBottom);
306 this.Controls.Add(this.label2);
307 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
308 this.Name = "DAccessTemplate";
309 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
310 this.Text = "Apply Access Template";
311 this.Closing += new System.ComponentModel.CancelEventHandler(this.DAccessTemplate_Closing);
312 this.pnlPageBottom.ResumeLayout(false);
313 this.pnlDescription.ResumeLayout(false);
314 this.grpDescriptionResourceGroup.ResumeLayout(false);
315 ((System.ComponentModel.ISupportInitialize)(this.udWeeksToApply)).EndInit();
316 this.ResumeLayout(false);
317 this.PerformLayout();
318
319 }
320 #endregion
321
322
323 private void DAccessTemplate_Closing(object sender, System.ComponentModel.CancelEventArgs e)
324 {
325 if (m_bCancelOK == true)
326 {
327 e.Cancel = true;
328 m_bCancelOK = false;
329 }
330 else
331 {
332 e.Cancel = false;
333 }
334 }
335
336
337 #region Properties
338
339
340 /// <summary>
341 /// Returns the open file dialog object
342 /// </summary>
343 public OpenFileDialog FileDialog
344 {
345 get
346 {
347 return m_ofDialog;
348 }
349 }
350
351 /// <summary>
352 /// Sets or returns the start date to apply the template
353 /// </summary>
354 public DateTime StartDate
355 {
356 get
357 {
358 return m_dtStart;
359 }
360 set
361 {
362 m_dtStart = value;
363 }
364 }
365
366 /// <summary>
367 /// Sets or returns the number of weeks to apply the template
368 /// </summary>
369 public int WeeksToApply
370 {
371 get
372 {
373 return m_nWeeksToApply;
374 }
375 set
376 {
377 m_nWeeksToApply = value;
378 }
379 }
380 #endregion Properties
381
382
383
384
385
386 }
387}
Note: See TracBrowser for help on using the repository browser.