1 | using System;
|
---|
2 | using System.Drawing;
|
---|
3 | using System.Collections;
|
---|
4 | using System.ComponentModel;
|
---|
5 | using System.Windows.Forms;
|
---|
6 | using System.Data;
|
---|
7 |
|
---|
8 | namespace IndianHealthService.BMXNet
|
---|
9 | {
|
---|
10 | /// <summary>
|
---|
11 | /// Summary description for DSelectDivision.
|
---|
12 | /// </summary>
|
---|
13 | public partial class DSelectDivision : System.Windows.Forms.Form
|
---|
14 | {
|
---|
15 | private System.Windows.Forms.Panel pnlPageBottom;
|
---|
16 | private System.Windows.Forms.Button cmdCancel;
|
---|
17 | private System.Windows.Forms.Button cmdOK;
|
---|
18 | private System.Windows.Forms.Panel pnlDescription;
|
---|
19 | private System.Windows.Forms.GroupBox grpDescriptionResourceGroup;
|
---|
20 | private System.Windows.Forms.Label lblDescriptionResourceGroup;
|
---|
21 | private System.Windows.Forms.ListBox lstDivision;
|
---|
22 | private System.Windows.Forms.Label label1;
|
---|
23 | private System.ComponentModel.Container components = null;
|
---|
24 |
|
---|
25 | #region Windows Form Designer generated code
|
---|
26 | /// <summary>
|
---|
27 | /// Required method for Designer support - do not modify
|
---|
28 | /// the contents of this method with the code editor.
|
---|
29 | /// </summary>
|
---|
30 | private void InitializeComponent()
|
---|
31 | {
|
---|
32 | this.pnlPageBottom = new System.Windows.Forms.Panel();
|
---|
33 | this.cmdCancel = new System.Windows.Forms.Button();
|
---|
34 | this.cmdOK = new System.Windows.Forms.Button();
|
---|
35 | this.pnlDescription = new System.Windows.Forms.Panel();
|
---|
36 | this.grpDescriptionResourceGroup = new System.Windows.Forms.GroupBox();
|
---|
37 | this.lblDescriptionResourceGroup = new System.Windows.Forms.Label();
|
---|
38 | this.lstDivision = new System.Windows.Forms.ListBox();
|
---|
39 | this.label1 = new System.Windows.Forms.Label();
|
---|
40 | this.pnlPageBottom.SuspendLayout();
|
---|
41 | this.pnlDescription.SuspendLayout();
|
---|
42 | this.grpDescriptionResourceGroup.SuspendLayout();
|
---|
43 | this.SuspendLayout();
|
---|
44 | //
|
---|
45 | // pnlPageBottom
|
---|
46 | //
|
---|
47 | this.pnlPageBottom.Controls.Add(this.cmdCancel);
|
---|
48 | this.pnlPageBottom.Controls.Add(this.cmdOK);
|
---|
49 | this.pnlPageBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
|
---|
50 | this.pnlPageBottom.Location = new System.Drawing.Point(0, 262);
|
---|
51 | this.pnlPageBottom.Name = "pnlPageBottom";
|
---|
52 | this.pnlPageBottom.Size = new System.Drawing.Size(456, 40);
|
---|
53 | this.pnlPageBottom.TabIndex = 7;
|
---|
54 | //
|
---|
55 | // cmdCancel
|
---|
56 | //
|
---|
57 | this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
---|
58 | this.cmdCancel.Location = new System.Drawing.Point(376, 8);
|
---|
59 | this.cmdCancel.Name = "cmdCancel";
|
---|
60 | this.cmdCancel.Size = new System.Drawing.Size(56, 24);
|
---|
61 | this.cmdCancel.TabIndex = 3;
|
---|
62 | this.cmdCancel.Text = "Cancel";
|
---|
63 | //
|
---|
64 | // cmdOK
|
---|
65 | //
|
---|
66 | this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
---|
67 | this.cmdOK.Location = new System.Drawing.Point(296, 8);
|
---|
68 | this.cmdOK.Name = "cmdOK";
|
---|
69 | this.cmdOK.Size = new System.Drawing.Size(64, 24);
|
---|
70 | this.cmdOK.TabIndex = 2;
|
---|
71 | this.cmdOK.Text = "OK";
|
---|
72 | this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
|
---|
73 | //
|
---|
74 | // pnlDescription
|
---|
75 | //
|
---|
76 | this.pnlDescription.Controls.Add(this.grpDescriptionResourceGroup);
|
---|
77 | this.pnlDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
|
---|
78 | this.pnlDescription.Location = new System.Drawing.Point(0, 190);
|
---|
79 | this.pnlDescription.Name = "pnlDescription";
|
---|
80 | this.pnlDescription.Size = new System.Drawing.Size(456, 72);
|
---|
81 | this.pnlDescription.TabIndex = 8;
|
---|
82 | //
|
---|
83 | // grpDescriptionResourceGroup
|
---|
84 | //
|
---|
85 | this.grpDescriptionResourceGroup.Controls.Add(this.lblDescriptionResourceGroup);
|
---|
86 | this.grpDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
|
---|
87 | this.grpDescriptionResourceGroup.Location = new System.Drawing.Point(0, 0);
|
---|
88 | this.grpDescriptionResourceGroup.Name = "grpDescriptionResourceGroup";
|
---|
89 | this.grpDescriptionResourceGroup.Size = new System.Drawing.Size(456, 72);
|
---|
90 | this.grpDescriptionResourceGroup.TabIndex = 1;
|
---|
91 | this.grpDescriptionResourceGroup.TabStop = false;
|
---|
92 | this.grpDescriptionResourceGroup.Text = "Description";
|
---|
93 | //
|
---|
94 | // lblDescriptionResourceGroup
|
---|
95 | //
|
---|
96 | this.lblDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
|
---|
97 | this.lblDescriptionResourceGroup.Location = new System.Drawing.Point(3, 16);
|
---|
98 | this.lblDescriptionResourceGroup.Name = "lblDescriptionResourceGroup";
|
---|
99 | this.lblDescriptionResourceGroup.Size = new System.Drawing.Size(450, 53);
|
---|
100 | this.lblDescriptionResourceGroup.TabIndex = 0;
|
---|
101 | this.lblDescriptionResourceGroup.Text = "Use this panel to select the Division.";
|
---|
102 | //
|
---|
103 | // lstDivision
|
---|
104 | //
|
---|
105 | this.lstDivision.Location = new System.Drawing.Point(40, 48);
|
---|
106 | this.lstDivision.Name = "lstDivision";
|
---|
107 | this.lstDivision.Size = new System.Drawing.Size(384, 121);
|
---|
108 | this.lstDivision.TabIndex = 1;
|
---|
109 | this.lstDivision.DoubleClick += new System.EventHandler(this.lstDivision_DoubleClick);
|
---|
110 | //
|
---|
111 | // label1
|
---|
112 | //
|
---|
113 | this.label1.Location = new System.Drawing.Point(40, 24);
|
---|
114 | this.label1.Name = "label1";
|
---|
115 | this.label1.Size = new System.Drawing.Size(240, 16);
|
---|
116 | this.label1.TabIndex = 10;
|
---|
117 | this.label1.Text = "Select Division:";
|
---|
118 | //
|
---|
119 | // DSelectDivision
|
---|
120 | //
|
---|
121 | this.AcceptButton = this.cmdOK;
|
---|
122 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
---|
123 | this.ClientSize = new System.Drawing.Size(456, 302);
|
---|
124 | this.Controls.Add(this.label1);
|
---|
125 | this.Controls.Add(this.lstDivision);
|
---|
126 | this.Controls.Add(this.pnlDescription);
|
---|
127 | this.Controls.Add(this.pnlPageBottom);
|
---|
128 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
---|
129 | this.Name = "DSelectDivision";
|
---|
130 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
---|
131 | this.Text = "Select Division";
|
---|
132 | this.pnlPageBottom.ResumeLayout(false);
|
---|
133 | this.pnlDescription.ResumeLayout(false);
|
---|
134 | this.grpDescriptionResourceGroup.ResumeLayout(false);
|
---|
135 | this.ResumeLayout(false);
|
---|
136 |
|
---|
137 | }
|
---|
138 | #endregion
|
---|
139 |
|
---|
140 | #region Fields
|
---|
141 |
|
---|
142 | private DataTable m_dtDivisions;
|
---|
143 | private string m_sDUZ2;
|
---|
144 | private string m_sDivisionName;
|
---|
145 |
|
---|
146 | #endregion Fields
|
---|
147 |
|
---|
148 | #region Properties
|
---|
149 |
|
---|
150 | public string DivisionName
|
---|
151 | {
|
---|
152 | get
|
---|
153 | {
|
---|
154 | return this.m_sDivisionName;
|
---|
155 | }
|
---|
156 | }
|
---|
157 |
|
---|
158 | public string DUZ2
|
---|
159 | {
|
---|
160 | get
|
---|
161 | {
|
---|
162 | return this.m_sDUZ2;
|
---|
163 | }
|
---|
164 | }
|
---|
165 | #endregion Properties
|
---|
166 |
|
---|
167 | #region Methods
|
---|
168 |
|
---|
169 | public void InitializePage(DataTable dtDivisions)
|
---|
170 | {
|
---|
171 | m_dtDivisions = dtDivisions;
|
---|
172 | UpdateDialogData(true);
|
---|
173 | }
|
---|
174 |
|
---|
175 | /// <summary>
|
---|
176 | /// If b is true, moves member vars into control data
|
---|
177 | /// otherwise, moves control data into member vars
|
---|
178 | /// </summary>
|
---|
179 | /// <param name="b"></param>
|
---|
180 | private void UpdateDialogData(bool b)
|
---|
181 | {
|
---|
182 | if (b == true) //move member vars into controls
|
---|
183 | {
|
---|
184 | m_dtDivisions.DefaultView.Sort="DEFAULT ASC";
|
---|
185 | this.lstDivision.DataSource = m_dtDivisions.DefaultView;
|
---|
186 | lstDivision.DisplayMember = "FACILITY_NAME";
|
---|
187 | lstDivision.ValueMember = "FACILITY_IEN";
|
---|
188 | lstDivision.SelectedIndex = m_dtDivisions.DefaultView.Find(1);
|
---|
189 | }
|
---|
190 | else //move control data into member vars
|
---|
191 | {
|
---|
192 | this.m_sDUZ2 = lstDivision.SelectedValue.ToString();
|
---|
193 | this.m_sDivisionName = lstDivision.Text;
|
---|
194 | }
|
---|
195 | }
|
---|
196 |
|
---|
197 | /// <summary>
|
---|
198 | /// Clean up any resources being used.
|
---|
199 | /// </summary>
|
---|
200 | protected override void Dispose( bool disposing )
|
---|
201 | {
|
---|
202 | if( disposing )
|
---|
203 | {
|
---|
204 | if(components != null)
|
---|
205 | {
|
---|
206 | components.Dispose();
|
---|
207 | }
|
---|
208 | }
|
---|
209 | base.Dispose( disposing );
|
---|
210 | }
|
---|
211 |
|
---|
212 | public DSelectDivision()
|
---|
213 | {
|
---|
214 | InitializeComponent();
|
---|
215 | }
|
---|
216 |
|
---|
217 | #endregion Methods
|
---|
218 |
|
---|
219 | private void cmdOK_Click(object sender, System.EventArgs e)
|
---|
220 | {
|
---|
221 | if (lstDivision.SelectedIndex < 0) {
|
---|
222 | this.lblDescriptionResourceGroup.Text="Must select a division";
|
---|
223 | this.lblDescriptionResourceGroup.ForeColor = Color.Red;
|
---|
224 | this.DialogResult = DialogResult.None; //forestall acceptance.
|
---|
225 | return;
|
---|
226 | }
|
---|
227 | this.UpdateDialogData(false);
|
---|
228 | return;
|
---|
229 | }
|
---|
230 |
|
---|
231 | private void lstDivision_DoubleClick(object sender, EventArgs e)
|
---|
232 | {
|
---|
233 | if (lstDivision.SelectedIndex < 0) {
|
---|
234 | this.lblDescriptionResourceGroup.Text = "Must select a division";
|
---|
235 | this.lblDescriptionResourceGroup.ForeColor = Color.Red;
|
---|
236 | return;
|
---|
237 | }
|
---|
238 | this.UpdateDialogData(false);
|
---|
239 | this.DialogResult = DialogResult.OK;
|
---|
240 | return;
|
---|
241 | }
|
---|
242 |
|
---|
243 |
|
---|
244 | }
|
---|
245 | }
|
---|