source: Scheduling/branches/GUI1.2/DResourceGroupItem.cs@ 1045

Last change on this file since 1045 was 614, checked in by Sam Habiel, 15 years ago

Initial committ of scheduling package

File size: 6.0 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 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 {
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.AddRange(new System.Windows.Forms.Control[] {
73 this.cmdCancel,
74 this.cmdOK});
75 this.pnlPageBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
76 this.pnlPageBottom.Location = new System.Drawing.Point(0, 112);
77 this.pnlPageBottom.Name = "pnlPageBottom";
78 this.pnlPageBottom.Size = new System.Drawing.Size(456, 40);
79 this.pnlPageBottom.TabIndex = 5;
80 //
81 // cmdCancel
82 //
83 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
84 this.cmdCancel.Location = new System.Drawing.Point(376, 8);
85 this.cmdCancel.Name = "cmdCancel";
86 this.cmdCancel.Size = new System.Drawing.Size(56, 24);
87 this.cmdCancel.TabIndex = 2;
88 this.cmdCancel.Text = "Cancel";
89 //
90 // cmdOK
91 //
92 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
93 this.cmdOK.Location = new System.Drawing.Point(296, 8);
94 this.cmdOK.Name = "cmdOK";
95 this.cmdOK.Size = new System.Drawing.Size(64, 24);
96 this.cmdOK.TabIndex = 1;
97 this.cmdOK.Text = "OK";
98 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
99 //
100 // label1
101 //
102 this.label1.Location = new System.Drawing.Point(40, 40);
103 this.label1.Name = "label1";
104 this.label1.Size = new System.Drawing.Size(96, 16);
105 this.label1.TabIndex = 8;
106 this.label1.Text = "Select Resource:";
107 this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
108 //
109 // cboResource
110 //
111 this.cboResource.Location = new System.Drawing.Point(144, 40);
112 this.cboResource.Name = "cboResource";
113 this.cboResource.Size = new System.Drawing.Size(248, 21);
114 this.cboResource.TabIndex = 7;
115 this.cboResource.Text = "cboResource";
116 //
117 // DResourceGroupItem
118 //
119 this.AcceptButton = this.cmdOK;
120 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
121 this.CancelButton = this.cmdCancel;
122 this.ClientSize = new System.Drawing.Size(456, 152);
123 this.Controls.AddRange(new System.Windows.Forms.Control[] {
124 this.label1,
125 this.cboResource,
126 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);
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);
153
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.