source: Scheduling/trunk/cs/bsdx0200GUISourceCode/DResourceGroup.cs@ 832

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

Initial committ of scheduling package

File size: 5.7 KB
RevLine 
[614]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 DResourceGroup.
15 /// </summary>
16 public class DResourceGroup : System.Windows.Forms.Form
17 {
18 private System.Windows.Forms.Panel pnlPageBottom;
19 private System.Windows.Forms.Button cmdCancel;
20 private System.Windows.Forms.Button cmdOK;
21 private System.Windows.Forms.Label label1;
22 private System.Windows.Forms.TextBox txtResourceGroupName;
23 /// <summary>
24 /// Required designer variable.
25 /// </summary>
26 private System.ComponentModel.Container components = null;
27
28 public DResourceGroup()
29 {
30 //
31 // Required for Windows Form Designer support
32 //
33 InitializeComponent();
34
35 //
36 // TODO: Add any constructor code after InitializeComponent call
37 //
38 m_sResourceGroupName = "";
39 }
40
41 /// <summary>
42 /// Clean up any resources being used.
43 /// </summary>
44 protected override void Dispose( bool disposing )
45 {
46 if( disposing )
47 {
48 if(components != null)
49 {
50 components.Dispose();
51 }
52 }
53 base.Dispose( disposing );
54 }
55
56 #region Windows Form Designer generated code
57 /// <summary>
58 /// Required method for Designer support - do not modify
59 /// the contents of this method with the code editor.
60 /// </summary>
61 private void InitializeComponent()
62 {
63 this.pnlPageBottom = new System.Windows.Forms.Panel();
64 this.cmdCancel = new System.Windows.Forms.Button();
65 this.cmdOK = new System.Windows.Forms.Button();
66 this.label1 = new System.Windows.Forms.Label();
67 this.txtResourceGroupName = new System.Windows.Forms.TextBox();
68 this.pnlPageBottom.SuspendLayout();
69 this.SuspendLayout();
70 //
71 // pnlPageBottom
72 //
73 this.pnlPageBottom.Controls.Add(this.cmdCancel);
74 this.pnlPageBottom.Controls.Add(this.cmdOK);
75 this.pnlPageBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
76 this.pnlPageBottom.Location = new System.Drawing.Point(0, 120);
77 this.pnlPageBottom.Name = "pnlPageBottom";
78 this.pnlPageBottom.Size = new System.Drawing.Size(472, 40);
79 this.pnlPageBottom.TabIndex = 6;
80 //
81 // cmdCancel
82 //
83 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
84 this.cmdCancel.Location = new System.Drawing.Point(376, 8);
85 this.cmdCancel.Name = "cmdCancel";
86 this.cmdCancel.Size = new System.Drawing.Size(56, 24);
87 this.cmdCancel.TabIndex = 2;
88 this.cmdCancel.Text = "Cancel";
89 //
90 // cmdOK
91 //
92 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
93 this.cmdOK.Enabled = false;
94 this.cmdOK.Location = new System.Drawing.Point(296, 8);
95 this.cmdOK.Name = "cmdOK";
96 this.cmdOK.Size = new System.Drawing.Size(64, 24);
97 this.cmdOK.TabIndex = 1;
98 this.cmdOK.Text = "OK";
99 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
100 //
101 // label1
102 //
103 this.label1.Location = new System.Drawing.Point(40, 48);
104 this.label1.Name = "label1";
105 this.label1.Size = new System.Drawing.Size(136, 16);
106 this.label1.TabIndex = 7;
107 this.label1.Text = "Resource Group Name:";
108 //
109 // txtResourceGroupName
110 //
111 this.txtResourceGroupName.Location = new System.Drawing.Point(176, 48);
112 this.txtResourceGroupName.Name = "txtResourceGroupName";
113 this.txtResourceGroupName.Size = new System.Drawing.Size(256, 20);
114 this.txtResourceGroupName.TabIndex = 0;
115 this.txtResourceGroupName.Text = "";
116 this.txtResourceGroupName.TextChanged += new System.EventHandler(this.txtResourceGroupName_TextChanged);
117 //
118 // DResourceGroup
119 //
120 this.AcceptButton = this.cmdOK;
121 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
122 this.CancelButton = this.cmdCancel;
123 this.ClientSize = new System.Drawing.Size(472, 160);
124 this.Controls.Add(this.txtResourceGroupName);
125 this.Controls.Add(this.label1);
126 this.Controls.Add(this.pnlPageBottom);
127 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
128 this.Name = "DResourceGroup";
129 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
130 this.Text = "Add Resource Group";
131 this.pnlPageBottom.ResumeLayout(false);
132 this.ResumeLayout(false);
133
134 }
135 #endregion
136
137 private string m_sResourceGroupName;
138
139 public void InitializePage(int nSelectedRGID, DataSet dsGlobal)
140 {
141
142 if (nSelectedRGID < 0) //then we're in ADD mode
143 {
144 this.Text = "Add New Resource Group";
145 this.cmdOK.Enabled = false;
146 }
147 else //we're in EDIT mode
148 {
149 this.Text = "Edit Resource Group";
150 }
151 UpdateDialogData(true);
152 }
153
154
155 /// <summary>
156 /// If b is true, moves member vars into control data
157 /// otherwise, moves control data into member vars
158 /// </summary>
159 /// <param name="b"></param>
160 private void UpdateDialogData(bool b)
161 {
162 if (b == true)
163 {
164 txtResourceGroupName.Text = m_sResourceGroupName;
165 }
166 else
167 {
168 m_sResourceGroupName = txtResourceGroupName.Text;
169 }
170 }
171
172 private void txtResourceGroupName_TextChanged(object sender, System.EventArgs e)
173 {
174 string sText = txtResourceGroupName.Text;
175 if ((sText.Length > 2) && (sText.Length < 30))
176 {
177 cmdOK.Enabled = true;
178 }
179 else
180 {
181 cmdOK.Enabled = false;
182 }
183 }
184
185 private void cmdOK_Click(object sender, System.EventArgs e)
186 {
187 UpdateDialogData(false);
188 }
189
190 /// <summary>
191 /// Gets the name of the resource group
192 /// </summary>
193 public String ResourceGroupName
194 {
195 get
196 {
197 return m_sResourceGroupName;
198 }
199 set
200 {
201 m_sResourceGroupName = value;
202 }
203 }
204
205 }
206}
Note: See TracBrowser for help on using the repository browser.