source: BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/cs/bmx_0200scr/BMX2/BMXNet/DSelectDivision.cs@ 1787

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

BMXNetConnectInfo:
Pass up BMXNetException instead of recreating it as a new generic Exception; for more accurate error catching.
W32Handle for class not acquired. Don't even know why we needed that.
DSelectDivision:
Load event now has this.Activate to bring the window to the front. Needed b/c of new splash screen in Sched GUI which will show up front unless this form is activated.
BMXNetLib:
Better handling of exception in OpenConnectionCommon (pass inner exception when creating BMXNetException.

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
8namespace 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.Load += new System.EventHandler(this.DSelectDivision_Load);
133 this.pnlPageBottom.ResumeLayout(false);
134 this.pnlDescription.ResumeLayout(false);
135 this.grpDescriptionResourceGroup.ResumeLayout(false);
136 this.ResumeLayout(false);
137
138 }
139 #endregion
140
141 #region Fields
142
143 private DataTable m_dtDivisions;
144 private string m_sDUZ2;
145 private string m_sDivisionName;
146
147 #endregion Fields
148
149 #region Properties
150
151 public string DivisionName
152 {
153 get
154 {
155 return this.m_sDivisionName;
156 }
157 }
158
159 public string DUZ2
160 {
161 get
162 {
163 return this.m_sDUZ2;
164 }
165 }
166 #endregion Properties
167
168 #region Methods
169
170 public void InitializePage(DataTable dtDivisions)
171 {
172 m_dtDivisions = dtDivisions;
173 UpdateDialogData(true);
174 }
175
176 /// <summary>
177 /// If b is true, moves member vars into control data
178 /// otherwise, moves control data into member vars
179 /// </summary>
180 /// <param name="b"></param>
181 private void UpdateDialogData(bool b)
182 {
183 if (b == true) //move member vars into controls
184 {
185 m_dtDivisions.DefaultView.Sort="DEFAULT ASC";
186 this.lstDivision.DataSource = m_dtDivisions.DefaultView;
187 lstDivision.DisplayMember = "FACILITY_NAME";
188 lstDivision.ValueMember = "FACILITY_IEN";
189 lstDivision.SelectedIndex = m_dtDivisions.DefaultView.Find(1);
190 }
191 else //move control data into member vars
192 {
193 this.m_sDUZ2 = lstDivision.SelectedValue.ToString();
194 this.m_sDivisionName = lstDivision.Text;
195 }
196 }
197
198 /// <summary>
199 /// Clean up any resources being used.
200 /// </summary>
201 protected override void Dispose( bool disposing )
202 {
203 if( disposing )
204 {
205 if(components != null)
206 {
207 components.Dispose();
208 }
209 }
210 base.Dispose( disposing );
211 }
212
213 public DSelectDivision()
214 {
215 InitializeComponent();
216 }
217
218 #endregion Methods
219
220 private void cmdOK_Click(object sender, System.EventArgs e)
221 {
222 if (lstDivision.SelectedIndex < 0) {
223 this.lblDescriptionResourceGroup.Text="Must select a division";
224 this.lblDescriptionResourceGroup.ForeColor = Color.Red;
225 this.DialogResult = DialogResult.None; //forestall acceptance.
226 return;
227 }
228 this.UpdateDialogData(false);
229 return;
230 }
231
232 private void lstDivision_DoubleClick(object sender, EventArgs e)
233 {
234 if (lstDivision.SelectedIndex < 0) {
235 this.lblDescriptionResourceGroup.Text = "Must select a division";
236 this.lblDescriptionResourceGroup.ForeColor = Color.Red;
237 return;
238 }
239 this.UpdateDialogData(false);
240 this.DialogResult = DialogResult.OK;
241 return;
242 }
243
244 private void DSelectDivision_Load(object sender, EventArgs e)
245 {
246 this.Activate();
247 }
248
249
250 }
251}
Note: See TracBrowser for help on using the repository browser.