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

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

Changes in handling of Divisions. Now prompts if more than one division assigned to user.

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