source: Scheduling/branches/GUI1.2/DAccessType.cs@ 1154

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

Initial committ of scheduling package

File size: 9.2 KB
Line 
1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Data;
7//using System.Data.OleDb;
8using IndianHealthService.BMXNet;
9using System.Diagnostics;
10
11namespace IndianHealthService.ClinicalScheduling
12{
13 /// <summary>
14 /// Summary description for DAccessType.
15 /// </summary>
16 public class DAccessType : System.Windows.Forms.Form
17 {
18 private System.Windows.Forms.Panel panel1;
19 private System.Windows.Forms.Button cmdCancel;
20 private System.Windows.Forms.Button cmdOK;
21 private System.Windows.Forms.Button cmdSelectColor;
22 private System.Windows.Forms.TextBox txtColor;
23 private System.Windows.Forms.CheckBox chkInactivate;
24 /// <summary>
25 /// Required designer variable.
26 /// </summary>
27 private System.ComponentModel.Container components = null;
28
29 private DataTable m_dtTypes;
30 private string m_sAccessIEN;
31 private string m_sAccessName;
32 private string m_sColor;
33 private int m_nRed;
34 private int m_nGreen;
35 private int m_nBlue;
36 private bool m_bInactive;
37 private System.Windows.Forms.TextBox txtAccessType;
38 private System.Windows.Forms.Label label1;
39
40 public DAccessType()
41 {
42 //
43 // Required for Windows Form Designer support
44 //
45 InitializeComponent();
46
47 //
48 // TODO: Add any constructor code after InitializeComponent call
49 //
50 }
51
52 /// <summary>
53 /// Clean up any resources being used.
54 /// </summary>
55 protected override void Dispose( bool disposing )
56 {
57 if( disposing )
58 {
59 if(components != null)
60 {
61 components.Dispose();
62 }
63 }
64 base.Dispose( disposing );
65 }
66
67 #region Windows Form Designer generated code
68 /// <summary>
69 /// Required method for Designer support - do not modify
70 /// the contents of this method with the code editor.
71 /// </summary>
72 private void InitializeComponent()
73 {
74 this.panel1 = new System.Windows.Forms.Panel();
75 this.cmdCancel = new System.Windows.Forms.Button();
76 this.cmdOK = new System.Windows.Forms.Button();
77 this.cmdSelectColor = new System.Windows.Forms.Button();
78 this.txtColor = new System.Windows.Forms.TextBox();
79 this.chkInactivate = new System.Windows.Forms.CheckBox();
80 this.txtAccessType = new System.Windows.Forms.TextBox();
81 this.label1 = new System.Windows.Forms.Label();
82 this.panel1.SuspendLayout();
83 this.SuspendLayout();
84 //
85 // panel1
86 //
87 this.panel1.Controls.Add(this.cmdCancel);
88 this.panel1.Controls.Add(this.cmdOK);
89 this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
90 this.panel1.Location = new System.Drawing.Point(0, 144);
91 this.panel1.Name = "panel1";
92 this.panel1.Size = new System.Drawing.Size(370, 40);
93 this.panel1.TabIndex = 99;
94 //
95 // cmdCancel
96 //
97 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
98 this.cmdCancel.Location = new System.Drawing.Point(288, 8);
99 this.cmdCancel.Name = "cmdCancel";
100 this.cmdCancel.Size = new System.Drawing.Size(64, 24);
101 this.cmdCancel.TabIndex = 4;
102 this.cmdCancel.Text = "Cancel";
103 this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click);
104 //
105 // cmdOK
106 //
107 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
108 this.cmdOK.Location = new System.Drawing.Point(208, 8);
109 this.cmdOK.Name = "cmdOK";
110 this.cmdOK.Size = new System.Drawing.Size(64, 24);
111 this.cmdOK.TabIndex = 3;
112 this.cmdOK.Text = "OK";
113 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
114 //
115 // cmdSelectColor
116 //
117 this.cmdSelectColor.Location = new System.Drawing.Point(8, 48);
118 this.cmdSelectColor.Name = "cmdSelectColor";
119 this.cmdSelectColor.Size = new System.Drawing.Size(96, 32);
120 this.cmdSelectColor.TabIndex = 1;
121 this.cmdSelectColor.Text = "Select Display Color";
122 this.cmdSelectColor.Click += new System.EventHandler(this.cmdSelectColor_Click);
123 //
124 // txtColor
125 //
126 this.txtColor.BackColor = System.Drawing.SystemColors.Menu;
127 this.txtColor.BorderStyle = System.Windows.Forms.BorderStyle.None;
128 this.txtColor.ForeColor = System.Drawing.SystemColors.Window;
129 this.txtColor.Location = new System.Drawing.Point(128, 48);
130 this.txtColor.Multiline = true;
131 this.txtColor.Name = "txtColor";
132 this.txtColor.ReadOnly = true;
133 this.txtColor.Size = new System.Drawing.Size(144, 32);
134 this.txtColor.TabIndex = 31;
135 this.txtColor.TabStop = false;
136 this.txtColor.Text = "";
137 //
138 // chkInactivate
139 //
140 this.chkInactivate.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
141 this.chkInactivate.Location = new System.Drawing.Point(56, 96);
142 this.chkInactivate.Name = "chkInactivate";
143 this.chkInactivate.Size = new System.Drawing.Size(88, 16);
144 this.chkInactivate.TabIndex = 2;
145 this.chkInactivate.Text = "Inactive:";
146 //
147 // txtAccessType
148 //
149 this.txtAccessType.Location = new System.Drawing.Point(128, 16);
150 this.txtAccessType.Name = "txtAccessType";
151 this.txtAccessType.Size = new System.Drawing.Size(144, 20);
152 this.txtAccessType.TabIndex = 0;
153 this.txtAccessType.Text = "";
154 //
155 // label1
156 //
157 this.label1.Location = new System.Drawing.Point(8, 16);
158 this.label1.Name = "label1";
159 this.label1.Size = new System.Drawing.Size(112, 16);
160 this.label1.TabIndex = 36;
161 this.label1.Text = "Access Type Name:";
162 this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
163 //
164 // DAccessType
165 //
166 this.AcceptButton = this.cmdOK;
167 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
168 this.CancelButton = this.cmdCancel;
169 this.ClientSize = new System.Drawing.Size(370, 184);
170 this.Controls.Add(this.label1);
171 this.Controls.Add(this.txtAccessType);
172 this.Controls.Add(this.chkInactivate);
173 this.Controls.Add(this.txtColor);
174 this.Controls.Add(this.cmdSelectColor);
175 this.Controls.Add(this.panel1);
176 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
177 this.Name = "DAccessType";
178 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
179 this.Text = "Manage Access Types";
180 this.panel1.ResumeLayout(false);
181 this.ResumeLayout(false);
182
183 }
184 #endregion
185
186 private void cmdSelectColor_Click(object sender, System.EventArgs e)
187 {
188 ColorDialog MyDialog = new ColorDialog();
189 // Keeps the user from selecting a custom color.
190 MyDialog.AllowFullOpen = true ;
191 // Allows the user to get help. (The default is false.)
192 MyDialog.ShowHelp = true ;
193 // Sets the initial color select to the current text color,
194 // so that if the user cancels out, the original color is restored.
195 MyDialog.Color = txtColor.BackColor ;
196 MyDialog.ShowDialog();
197 txtColor.BackColor = MyDialog.Color;
198
199 }
200
201 public void InitializePage(int nRow, DataSet dsGlobal)
202 {
203
204 m_dtTypes = dsGlobal.Tables["AccessTypes"];
205
206 if (nRow < 0) //then we're in ADD mode
207 {
208 m_sAccessIEN = "";
209 m_sAccessName = "";
210 m_sColor = "Gray";
211 Color c = Color.FromKnownColor(KnownColor.AppWorkspace);
212 m_nRed = c.R;
213 m_nBlue = c.B;
214 m_nGreen = c.G;
215 m_bInactive = false;
216
217 }
218 else //we're in EDIT mode
219 {
220 string sTemp;
221 DataRow dr = m_dtTypes.Rows[nRow];
222 m_sAccessIEN = dr["BMXIEN"].ToString();
223 m_sAccessName = dr["ACCESS_TYPE_NAME"].ToString();
224 m_sColor = dr["DISPLAY_COLOR"].ToString();
225 sTemp = dr["RED"].ToString();
226 sTemp = (sTemp == "")?"0":sTemp;
227 m_nRed = Convert.ToInt16(sTemp);
228 sTemp = dr["GREEN"].ToString();
229 sTemp = (sTemp == "")?"0":sTemp;
230 m_nGreen = Convert.ToInt16(sTemp);
231 sTemp = dr["BLUE"].ToString();
232 sTemp = (sTemp == "")?"0":sTemp;
233 m_nBlue = Convert.ToInt16(sTemp);
234 string sInactive = dr["INACTIVE"].ToString();
235 m_bInactive = (sInactive == "YES")?true:false;
236 }
237 UpdateDialogData(true);
238
239 }
240
241 /// <summary>
242 /// If b is true, moves member vars into control data
243 /// otherwise, moves control data into member vars
244 /// </summary>
245 /// <param name="b"></param>
246 private void UpdateDialogData(bool b)
247 {
248 if (b == true)
249 {
250 txtAccessType.Text = m_sAccessName;
251 this.chkInactivate.Checked = m_bInactive;
252 this.txtColor.BackColor = Color.FromArgb(m_nRed, m_nGreen, m_nBlue);
253 }
254 else
255 {
256 m_sAccessName = txtAccessType.Text;
257 m_bInactive = this.chkInactivate.Checked;
258 m_nRed = this.txtColor.BackColor.R;
259 m_nGreen = this.txtColor.BackColor.G;
260 m_nBlue = this.txtColor.BackColor.B;
261 }
262 }
263
264 private void cmdOK_Click(object sender, System.EventArgs e)
265 {
266 this.UpdateDialogData(false);
267 }
268
269 private void cmdCancel_Click(object sender, System.EventArgs e)
270 {
271
272 }
273
274 public string AccessIEN
275 {
276 get
277 {
278 return m_sAccessIEN;
279 }
280 }
281
282 public string AccessTypeName
283 {
284 get
285 {
286 return m_sAccessName;
287 }
288 }
289
290 public string DisplayColor
291 {
292 get
293 {
294 return m_sColor;
295 }
296 }
297
298 public bool Inactive
299 {
300 get
301 {
302 return m_bInactive;
303 }
304 }
305
306 public int Red
307 {
308 get
309 {
310 return m_nRed;
311 }
312 }
313
314 public int Green
315 {
316 get
317 {
318 return m_nGreen;
319 }
320 }
321
322 public int Blue
323 {
324 get
325 {
326 return m_nBlue;
327 }
328 }
329
330 }
331}
Note: See TracBrowser for help on using the repository browser.