source: Scheduling/trunk/cs/bsdx0200GUISourceCode/DResourceGroupItem.cs@ 1240

Last change on this file since 1240 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
RevLine 
[614]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 DResourceGroup.
15 /// </summary>
16 public class DResourceGroupItem : 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 cboResource;
23 /// <summary>
24 /// Required designer variable.
25 /// </summary>
26 private System.ComponentModel.Container components = null;
27
28 public DResourceGroupItem()
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 {
[899]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.cboResource = 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(456, 40);
78 this.pnlPageBottom.TabIndex = 5;
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(40, 40);
102 this.label1.Name = "label1";
103 this.label1.Size = new System.Drawing.Size(96, 16);
104 this.label1.TabIndex = 8;
105 this.label1.Text = "Select Resource:";
106 this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
107 //
108 // cboResource
109 //
110 this.cboResource.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
111 this.cboResource.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
112 this.cboResource.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
113 this.cboResource.Location = new System.Drawing.Point(144, 40);
114 this.cboResource.Name = "cboResource";
115 this.cboResource.Size = new System.Drawing.Size(248, 21);
116 this.cboResource.TabIndex = 7;
117 //
118 // DResourceGroupItem
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(456, 152);
124 this.Controls.Add(this.label1);
125 this.Controls.Add(this.cboResource);
126 this.Controls.Add(this.pnlPageBottom);
127 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
128 this.Name = "DResourceGroupItem";
129 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
130 this.Text = "DResourceGroupItem";
131 this.pnlPageBottom.ResumeLayout(false);
132 this.ResumeLayout(false);
[614]133
134 }
135 #endregion
136
137 #region Fields
138 int m_nResourceID;
139 string m_sResourceName;
140// DataSet m_dtResource;
141
142 #endregion Fields
143
144
145 public void InitializePage(int nSelectedRID, DataSet dsGlobal)
146 {
147
148// m_dtResource = dsGlobal.Tables["Resources"];
149
150 //Datasource the RESOURCE combo box
151 DataTable dtResource = dsGlobal.Tables["Resources"];
152 DataView dvResource = new DataView(dtResource);
[899]153 dvResource.Sort = "RESOURCE_NAME ASC";
[614]154
155 cboResource.DataSource = dvResource;
156 cboResource.DisplayMember = "RESOURCE_NAME";
157 cboResource.ValueMember = "RESOURCEID";
158
159 if (nSelectedRID < 0) //then we're in ADD mode
160 {
161 this.Text = "Add New Resource to Group";
162 m_nResourceID = 0;
163 m_sResourceName = "";
164// this.cmdOK.Enabled = false;
165 }
166 UpdateDialogData(true);
167 }
168
169 /// <summary>
170 /// If b is true, moves member vars into control data
171 /// otherwise, moves control data into member vars
172 /// </summary>
173 /// <param name="b"></param>
174 private void UpdateDialogData(bool b)
175 {
176 if (b == true)
177 {
178 cboResource.SelectedValue = m_nResourceID;
179 }
180 else
181 {
182 m_nResourceID = Convert.ToInt16(cboResource.SelectedValue);
183 }
184 }
185
186 private void cmdOK_Click(object sender, System.EventArgs e)
187 {
188 UpdateDialogData(false);
189 }
190
191
192 #region Properties
193
194
195 /// <summary>
196 /// Contains the IEN of the Resource in the BSDX_RESOURCE file
197 /// </summary>
198 public int ResourceID
199 {
200 get
201 {
202 return m_nResourceID;
203 }
204 }
205
206 /// <summary>
207 /// Contains the name of the Resource
208 /// </summary>
209 public string ResourceName
210 {
211 get
212 {
213 return m_sResourceName;
214 }
215 }
216 #endregion Properties
217
218 }
219}
Note: See TracBrowser for help on using the repository browser.