[815] | 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 | {
|
---|
[923] | 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);
|
---|
[967] | 61 | this.cmdCancel.TabIndex = 3;
|
---|
[923] | 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);
|
---|
[967] | 70 | this.cmdOK.TabIndex = 2;
|
---|
[923] | 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);
|
---|
[967] | 108 | this.lstDivision.TabIndex = 1;
|
---|
[923] | 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 | //
|
---|
[967] | 121 | this.AcceptButton = this.cmdOK;
|
---|
[923] | 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";
|
---|
[1063] | 132 | this.Load += new System.EventHandler(this.DSelectDivision_Load);
|
---|
[923] | 133 | this.pnlPageBottom.ResumeLayout(false);
|
---|
| 134 | this.pnlDescription.ResumeLayout(false);
|
---|
| 135 | this.grpDescriptionResourceGroup.ResumeLayout(false);
|
---|
| 136 | this.ResumeLayout(false);
|
---|
[815] | 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 |
|
---|
[923] | 170 | public void InitializePage(DataTable dtDivisions)
|
---|
[815] | 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 | {
|
---|
[923] | 185 | m_dtDivisions.DefaultView.Sort="DEFAULT ASC";
|
---|
| 186 | this.lstDivision.DataSource = m_dtDivisions.DefaultView;
|
---|
[815] | 187 | lstDivision.DisplayMember = "FACILITY_NAME";
|
---|
| 188 | lstDivision.ValueMember = "FACILITY_IEN";
|
---|
[923] | 189 | lstDivision.SelectedIndex = m_dtDivisions.DefaultView.Find(1);
|
---|
[815] | 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 | {
|
---|
[923] | 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 | }
|
---|
[815] | 228 | this.UpdateDialogData(false);
|
---|
| 229 | return;
|
---|
| 230 | }
|
---|
[923] | 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 |
|
---|
[1063] | 244 | private void DSelectDivision_Load(object sender, EventArgs e)
|
---|
| 245 | {
|
---|
| 246 | this.Activate();
|
---|
| 247 | }
|
---|
[923] | 248 |
|
---|
[1063] | 249 |
|
---|
[815] | 250 | }
|
---|
| 251 | }
|
---|