source: Scheduling/branches/BMX4Support/DAccessGroupItem.cs@ 1301

Last change on this file since 1301 was 899, checked in by Sam Habiel, 14 years ago
  1. Make combo boxes in DManagement searchable (in MS Lingo AutoComplete).
  2. Make sure that all DManagement lists and combo boxes are sorted.
File size: 6.8 KB
Line 
1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Data;
7//using System.Data.OleDb;
8using IndianHealthService.BMXNet;
9using System.Diagnostics;
10
11namespace IndianHealthService.ClinicalScheduling
12{
13 /// <summary>
14 /// Summary description for DAccessGroupItem.
15 /// </summary>
16 public class DAccessGroupItem : System.Windows.Forms.Form
17 {
18 private System.Windows.Forms.Panel pnlPageBottom;
19 private System.Windows.Forms.Button cmdCancel;
20 private System.Windows.Forms.Button cmdOK;
21 private System.Windows.Forms.Label label1;
22 private System.Windows.Forms.ComboBox cboAccessType;
23 /// <summary>
24 /// Required designer variable.
25 /// </summary>
26 private System.ComponentModel.Container components = null;
27
28 public DAccessGroupItem()
29 {
30 //
31 // Required for Windows Form Designer support
32 //
33 InitializeComponent();
34
35 //
36 // TODO: Add any constructor code after InitializeComponent call
37 //
38 }
39
40 /// <summary>
41 /// Clean up any resources being used.
42 /// </summary>
43 protected override void Dispose( bool disposing )
44 {
45 if( disposing )
46 {
47 if(components != null)
48 {
49 components.Dispose();
50 }
51 }
52 base.Dispose( disposing );
53 }
54
55 #region Windows Form Designer generated code
56 /// <summary>
57 /// Required method for Designer support - do not modify
58 /// the contents of this method with the code editor.
59 /// </summary>
60 private void InitializeComponent()
61 {
62 this.pnlPageBottom = new System.Windows.Forms.Panel();
63 this.cmdCancel = new System.Windows.Forms.Button();
64 this.cmdOK = new System.Windows.Forms.Button();
65 this.label1 = new System.Windows.Forms.Label();
66 this.cboAccessType = new System.Windows.Forms.ComboBox();
67 this.pnlPageBottom.SuspendLayout();
68 this.SuspendLayout();
69 //
70 // pnlPageBottom
71 //
72 this.pnlPageBottom.Controls.Add(this.cmdCancel);
73 this.pnlPageBottom.Controls.Add(this.cmdOK);
74 this.pnlPageBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
75 this.pnlPageBottom.Location = new System.Drawing.Point(0, 112);
76 this.pnlPageBottom.Name = "pnlPageBottom";
77 this.pnlPageBottom.Size = new System.Drawing.Size(472, 40);
78 this.pnlPageBottom.TabIndex = 6;
79 //
80 // cmdCancel
81 //
82 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
83 this.cmdCancel.Location = new System.Drawing.Point(376, 8);
84 this.cmdCancel.Name = "cmdCancel";
85 this.cmdCancel.Size = new System.Drawing.Size(56, 24);
86 this.cmdCancel.TabIndex = 2;
87 this.cmdCancel.Text = "Cancel";
88 //
89 // cmdOK
90 //
91 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
92 this.cmdOK.Location = new System.Drawing.Point(296, 8);
93 this.cmdOK.Name = "cmdOK";
94 this.cmdOK.Size = new System.Drawing.Size(64, 24);
95 this.cmdOK.TabIndex = 1;
96 this.cmdOK.Text = "OK";
97 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
98 //
99 // label1
100 //
101 this.label1.Location = new System.Drawing.Point(24, 40);
102 this.label1.Name = "label1";
103 this.label1.Size = new System.Drawing.Size(120, 16);
104 this.label1.TabIndex = 10;
105 this.label1.Text = "Select Access Type:";
106 this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
107 //
108 // cboAccessType
109 //
110 this.cboAccessType.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
111 this.cboAccessType.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
112 this.cboAccessType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
113 this.cboAccessType.Location = new System.Drawing.Point(152, 40);
114 this.cboAccessType.Name = "cboAccessType";
115 this.cboAccessType.Size = new System.Drawing.Size(248, 21);
116 this.cboAccessType.TabIndex = 9;
117 //
118 // DAccessGroupItem
119 //
120 this.AcceptButton = this.cmdOK;
121 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
122 this.CancelButton = this.cmdCancel;
123 this.ClientSize = new System.Drawing.Size(472, 152);
124 this.Controls.Add(this.label1);
125 this.Controls.Add(this.cboAccessType);
126 this.Controls.Add(this.pnlPageBottom);
127 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
128 this.Name = "DAccessGroupItem";
129 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
130 this.Text = "DAccessGroupItem";
131 this.pnlPageBottom.ResumeLayout(false);
132 this.ResumeLayout(false);
133
134 }
135 #endregion
136
137 #region Fields
138 int m_nAccessTypeID;
139 string m_sAccessTypeName;
140 #endregion Fields
141
142
143 public void InitializePage(int nSelectedATID, DataSet dsGlobal)
144 {
145
146 //Datasource the ACCESS GROUP combo box
147 DataTable dtAccessType = dsGlobal.Tables["AccessTypes"];
148 DataView dvAccessType = new DataView(dtAccessType);
149 dvAccessType.Sort = "ACCESS_TYPE_NAME ASC";
150
151
152 cboAccessType.DataSource = dvAccessType;
153 cboAccessType.DisplayMember = "ACCESS_TYPE_NAME";
154 cboAccessType.ValueMember = "BMXIEN";
155
156 Debug.Assert(nSelectedATID == -1); //We're always in ADD mode
157
158 this.Text = "Add New Access Type to Group";
159 m_nAccessTypeID = 0;
160 m_sAccessTypeName = "";
161 UpdateDialogData(true);
162 }
163
164 /// <summary>
165 /// If b is true, moves member vars into control data
166 /// otherwise, moves control data into member vars
167 /// </summary>
168 /// <param name="b"></param>
169 private void UpdateDialogData(bool b)
170 {
171 if (b == true)
172 {
173 cboAccessType.SelectedValue = m_nAccessTypeID;
174 }
175 else
176 {
177 m_nAccessTypeID = Convert.ToInt16(cboAccessType.SelectedValue);
178 m_sAccessTypeName = cboAccessType.DisplayMember;
179 }
180 }
181
182 private void cmdOK_Click(object sender, System.EventArgs e)
183 {
184 UpdateDialogData(false);
185 }
186
187 #region Properties
188
189 /// <summary>
190 /// Contains the IEN of the AccessType in the BSDX_ACCESS_TYPE file
191 /// </summary>
192 public int AccessTypeID
193 {
194 get
195 {
196 return m_nAccessTypeID;
197 }
198 }
199
200 /// <summary>
201 /// Contains the name of the AccessType
202 /// </summary>
203 public string AccessTypeName
204 {
205 get
206 {
207 return m_sAccessTypeName;
208 }
209 }
210 #endregion Properties
211
212
213 }
214}
Note: See TracBrowser for help on using the repository browser.