| 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 | using System.Diagnostics; | 
|---|
| 8 |  | 
|---|
| 9 | namespace IndianHealthService.BMXNet.Tools.SchemaBuilder | 
|---|
| 10 | { | 
|---|
| 11 | /// <summary> | 
|---|
| 12 | /// Summary description for DSelectSchema. | 
|---|
| 13 | /// </summary> | 
|---|
| 14 | public class DSelectSchema : System.Windows.Forms.Form | 
|---|
| 15 | { | 
|---|
| 16 | private System.Windows.Forms.Panel pnlPageBottom; | 
|---|
| 17 | private System.Windows.Forms.Button cmdCancel; | 
|---|
| 18 | private System.Windows.Forms.Button cmdOK; | 
|---|
| 19 | private ListBox lstSchemas; | 
|---|
| 20 | private Panel pnlSchemas; | 
|---|
| 21 | private Label lblDescriptionResourceGroup; | 
|---|
| 22 | private System.ComponentModel.Container components = null; | 
|---|
| 23 |  | 
|---|
| 24 | #region Windows Form Designer generated code | 
|---|
| 25 | /// <summary> | 
|---|
| 26 | /// Required method for Designer support - do not modify | 
|---|
| 27 | /// the contents of this method with the code editor. | 
|---|
| 28 | /// </summary> | 
|---|
| 29 | private void InitializeComponent() | 
|---|
| 30 | { | 
|---|
| 31 | this.pnlPageBottom = new System.Windows.Forms.Panel(); | 
|---|
| 32 | this.cmdCancel = new System.Windows.Forms.Button(); | 
|---|
| 33 | this.cmdOK = new System.Windows.Forms.Button(); | 
|---|
| 34 | this.lstSchemas = new System.Windows.Forms.ListBox(); | 
|---|
| 35 | this.pnlSchemas = new System.Windows.Forms.Panel(); | 
|---|
| 36 | this.lblDescriptionResourceGroup = new System.Windows.Forms.Label(); | 
|---|
| 37 | this.pnlPageBottom.SuspendLayout(); | 
|---|
| 38 | this.pnlSchemas.SuspendLayout(); | 
|---|
| 39 | this.SuspendLayout(); | 
|---|
| 40 | // | 
|---|
| 41 | // pnlPageBottom | 
|---|
| 42 | // | 
|---|
| 43 | this.pnlPageBottom.Controls.Add(this.cmdCancel); | 
|---|
| 44 | this.pnlPageBottom.Controls.Add(this.cmdOK); | 
|---|
| 45 | this.pnlPageBottom.Location = new System.Drawing.Point(0, 209); | 
|---|
| 46 | this.pnlPageBottom.Name = "pnlPageBottom"; | 
|---|
| 47 | this.pnlPageBottom.Size = new System.Drawing.Size(416, 40); | 
|---|
| 48 | this.pnlPageBottom.TabIndex = 6; | 
|---|
| 49 | // | 
|---|
| 50 | // cmdCancel | 
|---|
| 51 | // | 
|---|
| 52 | this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; | 
|---|
| 53 | this.cmdCancel.Location = new System.Drawing.Point(326, 8); | 
|---|
| 54 | this.cmdCancel.Name = "cmdCancel"; | 
|---|
| 55 | this.cmdCancel.Size = new System.Drawing.Size(66, 24); | 
|---|
| 56 | this.cmdCancel.TabIndex = 2; | 
|---|
| 57 | this.cmdCancel.Text = "Cancel"; | 
|---|
| 58 | // | 
|---|
| 59 | // cmdOK | 
|---|
| 60 | // | 
|---|
| 61 | this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK; | 
|---|
| 62 | this.cmdOK.Location = new System.Drawing.Point(254, 8); | 
|---|
| 63 | this.cmdOK.Name = "cmdOK"; | 
|---|
| 64 | this.cmdOK.Size = new System.Drawing.Size(66, 24); | 
|---|
| 65 | this.cmdOK.TabIndex = 1; | 
|---|
| 66 | this.cmdOK.Text = "OK"; | 
|---|
| 67 | this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click); | 
|---|
| 68 | // | 
|---|
| 69 | // lstSchemas | 
|---|
| 70 | // | 
|---|
| 71 | this.lstSchemas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | 
|---|
| 72 | | System.Windows.Forms.AnchorStyles.Left) | 
|---|
| 73 | | System.Windows.Forms.AnchorStyles.Right))); | 
|---|
| 74 | this.lstSchemas.Location = new System.Drawing.Point(6, 24); | 
|---|
| 75 | this.lstSchemas.Name = "lstSchemas"; | 
|---|
| 76 | this.lstSchemas.Size = new System.Drawing.Size(407, 173); | 
|---|
| 77 | this.lstSchemas.TabIndex = 0; | 
|---|
| 78 | // | 
|---|
| 79 | // pnlSchemas | 
|---|
| 80 | // | 
|---|
| 81 | this.pnlSchemas.Controls.Add(this.lblDescriptionResourceGroup); | 
|---|
| 82 | this.pnlSchemas.Controls.Add(this.lstSchemas); | 
|---|
| 83 | this.pnlSchemas.Location = new System.Drawing.Point(0, 0); | 
|---|
| 84 | this.pnlSchemas.Name = "pnlSchemas"; | 
|---|
| 85 | this.pnlSchemas.Size = new System.Drawing.Size(416, 206); | 
|---|
| 86 | this.pnlSchemas.TabIndex = 8; | 
|---|
| 87 | // | 
|---|
| 88 | // lblDescriptionResourceGroup | 
|---|
| 89 | // | 
|---|
| 90 | this.lblDescriptionResourceGroup.AutoSize = true; | 
|---|
| 91 | this.lblDescriptionResourceGroup.Location = new System.Drawing.Point(3, 8); | 
|---|
| 92 | this.lblDescriptionResourceGroup.Name = "lblDescriptionResourceGroup"; | 
|---|
| 93 | this.lblDescriptionResourceGroup.Size = new System.Drawing.Size(130, 13); | 
|---|
| 94 | this.lblDescriptionResourceGroup.TabIndex = 4; | 
|---|
| 95 | this.lblDescriptionResourceGroup.Text = "Schemas Stored in RPMS"; | 
|---|
| 96 | // | 
|---|
| 97 | // DSelectSchema | 
|---|
| 98 | // | 
|---|
| 99 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | 
|---|
| 100 | this.ClientSize = new System.Drawing.Size(416, 249); | 
|---|
| 101 | this.ControlBox = false; | 
|---|
| 102 | this.Controls.Add(this.pnlSchemas); | 
|---|
| 103 | this.Controls.Add(this.pnlPageBottom); | 
|---|
| 104 | this.Name = "DSelectSchema"; | 
|---|
| 105 | this.Text = "Select Schema"; | 
|---|
| 106 | this.Load += new System.EventHandler(this.DSelectSchema_Load); | 
|---|
| 107 | this.pnlPageBottom.ResumeLayout(false); | 
|---|
| 108 | this.pnlSchemas.ResumeLayout(false); | 
|---|
| 109 | this.pnlSchemas.PerformLayout(); | 
|---|
| 110 | this.ResumeLayout(false); | 
|---|
| 111 |  | 
|---|
| 112 | } | 
|---|
| 113 | #endregion | 
|---|
| 114 |  | 
|---|
| 115 | #region Fields | 
|---|
| 116 |  | 
|---|
| 117 | private string          m_sSchemaName; | 
|---|
| 118 | private double          m_nSchemaIEN; | 
|---|
| 119 | private double          m_nFileNumber; | 
|---|
| 120 | private DataTable       m_dtSchemas; | 
|---|
| 121 |  | 
|---|
| 122 | #endregion Fields | 
|---|
| 123 |  | 
|---|
| 124 | #region Properties | 
|---|
| 125 | public double FileNumber | 
|---|
| 126 | { | 
|---|
| 127 | get | 
|---|
| 128 | { | 
|---|
| 129 | return m_nFileNumber; | 
|---|
| 130 | } | 
|---|
| 131 | set | 
|---|
| 132 | { | 
|---|
| 133 | m_nFileNumber = value; | 
|---|
| 134 | } | 
|---|
| 135 | } | 
|---|
| 136 |  | 
|---|
| 137 | public double SchemaIEN | 
|---|
| 138 | { | 
|---|
| 139 | get | 
|---|
| 140 | { | 
|---|
| 141 | return m_nSchemaIEN; | 
|---|
| 142 | } | 
|---|
| 143 | set | 
|---|
| 144 | { | 
|---|
| 145 | m_nSchemaIEN = value; | 
|---|
| 146 | } | 
|---|
| 147 | } | 
|---|
| 148 |  | 
|---|
| 149 | public string SchemaName | 
|---|
| 150 | { | 
|---|
| 151 | get | 
|---|
| 152 | { | 
|---|
| 153 | return m_sSchemaName; | 
|---|
| 154 | } | 
|---|
| 155 | set | 
|---|
| 156 | { | 
|---|
| 157 | m_sSchemaName = value; | 
|---|
| 158 | } | 
|---|
| 159 | } | 
|---|
| 160 | #endregion Properties | 
|---|
| 161 |  | 
|---|
| 162 | #region Methods | 
|---|
| 163 |  | 
|---|
| 164 | private RemoteSession _remoteSession = null; | 
|---|
| 165 |  | 
|---|
| 166 | public RemoteSession RemoteSession | 
|---|
| 167 | { | 
|---|
| 168 | get { return _remoteSession; } | 
|---|
| 169 | set { _remoteSession = value; } | 
|---|
| 170 | } | 
|---|
| 171 |  | 
|---|
| 172 |  | 
|---|
| 173 |  | 
|---|
| 174 | private void UpdateDialogData(bool b) | 
|---|
| 175 | { | 
|---|
| 176 | if (b == true) //Move data to dialog controls from member variables | 
|---|
| 177 | { | 
|---|
| 178 | } | 
|---|
| 179 | else //Move data to member variables from dialog controls | 
|---|
| 180 | { | 
|---|
| 181 | } | 
|---|
| 182 | } | 
|---|
| 183 |  | 
|---|
| 184 | private void cmdOK_Click(object sender, System.EventArgs e) | 
|---|
| 185 | { | 
|---|
| 186 | try | 
|---|
| 187 | { | 
|---|
| 188 | DataView dv = new DataView(m_dtSchemas); | 
|---|
| 189 | dv.Sort = "BMXIEN ASC"; | 
|---|
| 190 |  | 
|---|
| 191 | double nIen = (double) lstSchemas.SelectedValue; | 
|---|
| 192 | DataRowView[] drv = dv.FindRows(nIen); | 
|---|
| 193 |  | 
|---|
| 194 | Debug.Assert(drv.Length == 1); | 
|---|
| 195 |  | 
|---|
| 196 | DataRow dr = drv[0].Row; | 
|---|
| 197 |  | 
|---|
| 198 | m_nSchemaIEN = nIen; | 
|---|
| 199 | m_sSchemaName = dr["SCHEMA"].ToString(); | 
|---|
| 200 | m_nFileNumber = Convert.ToDouble(dr["FILE OR SUBFILE NUMBER"]); | 
|---|
| 201 | } | 
|---|
| 202 | catch(Exception ex) | 
|---|
| 203 | { | 
|---|
| 204 | MessageBox.Show(ex.Message, "BMX Schema Builder"); | 
|---|
| 205 |  | 
|---|
| 206 | } | 
|---|
| 207 | } | 
|---|
| 208 |  | 
|---|
| 209 | /// <summary> | 
|---|
| 210 | /// Clean up any resources being used. | 
|---|
| 211 | /// </summary> | 
|---|
| 212 | protected override void Dispose( bool disposing ) | 
|---|
| 213 | { | 
|---|
| 214 | if( disposing ) | 
|---|
| 215 | { | 
|---|
| 216 | if(components != null) | 
|---|
| 217 | { | 
|---|
| 218 | components.Dispose(); | 
|---|
| 219 | } | 
|---|
| 220 | } | 
|---|
| 221 | base.Dispose( disposing ); | 
|---|
| 222 | } | 
|---|
| 223 |  | 
|---|
| 224 | public DSelectSchema() | 
|---|
| 225 | { | 
|---|
| 226 | InitializeComponent(); | 
|---|
| 227 | } | 
|---|
| 228 | #endregion Methods | 
|---|
| 229 |  | 
|---|
| 230 | private void DSelectSchema_Load(object sender, EventArgs e) | 
|---|
| 231 | { | 
|---|
| 232 |  | 
|---|
| 233 | } | 
|---|
| 234 |  | 
|---|
| 235 | private void lblDescriptionResourceGroup_Click(object sender, EventArgs e) | 
|---|
| 236 | { | 
|---|
| 237 |  | 
|---|
| 238 | } | 
|---|
| 239 |  | 
|---|
| 240 |  | 
|---|
| 241 | internal void InitializePage(RemoteSession remoteSession) | 
|---|
| 242 | { | 
|---|
| 243 | this.RemoteSession = remoteSession; | 
|---|
| 244 | m_dtSchemas = this.RemoteSession.TableFromCommand("BMX ADO SS^SCHEMAS^^B~~~9999"); | 
|---|
| 245 | m_dtSchemas.TableName = "SCHEMAS"; | 
|---|
| 246 | lstSchemas.DisplayMember = "SCHEMA"; | 
|---|
| 247 | lstSchemas.ValueMember = "BMXIEN"; | 
|---|
| 248 | lstSchemas.DataSource = m_dtSchemas; | 
|---|
| 249 |  | 
|---|
| 250 | } | 
|---|
| 251 | } | 
|---|
| 252 | } | 
|---|