source: Scheduling/branches/GUI1.2/DCopyAppts.cs@ 1377

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

Removed user-interface references to RPMS.

File size: 9.8 KB
Line 
1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Data;
7using IndianHealthService.BMXNet;
8using System.Threading;
9using System.Net;
10using System.Net.Sockets;
11using System.Diagnostics;
12
13namespace IndianHealthService.ClinicalScheduling
14{
15 /// <summary>
16 /// Summary description for DCopyAppts.
17 /// </summary>
18 public class DCopyAppts : System.Windows.Forms.Form
19 {
20 private System.Windows.Forms.Button cmdOK;
21 private System.Windows.Forms.Panel pnlOKCancel;
22 private System.Windows.Forms.Label lblSummary;
23 private System.Windows.Forms.Label lblProgress;
24 private System.ComponentModel.IContainer components;
25
26 #region Fields
27 private DateTime m_dtBegin;
28 private DateTime m_dtEnd;
29 private string m_HospLocationID;
30 private string m_HospLocationName;
31 private string m_ResourceID;
32 private string m_ResourceName;
33 private string m_sTask;
34 private CGDocumentManager m_DocManager;
35
36 private System.Windows.Forms.Timer timerPoll;
37 private System.Windows.Forms.Label label1;
38 private System.Windows.Forms.Label label2;
39
40 //protected delegate void UpdateDisplayDelegate(string sText);
41 //protected delegate void RegisterEventDelegate(string sPort, string sEvent);
42
43 #endregion Fields
44
45 public DCopyAppts()
46 {
47 InitializeComponent();
48 }
49
50 /// <summary>
51 /// Clean up any resources being used.
52 /// </summary>
53 protected override void Dispose( bool disposing )
54 {
55 if( disposing )
56 {
57 if(components != null)
58 {
59 components.Dispose();
60 }
61 }
62 base.Dispose( disposing );
63 }
64
65 #region Windows Form Designer generated code
66 /// <summary>
67 /// Required method for Designer support - do not modify
68 /// the contents of this method with the code editor.
69 /// </summary>
70 private void InitializeComponent()
71 {
72 this.components = new System.ComponentModel.Container();
73 this.pnlOKCancel = new System.Windows.Forms.Panel();
74 this.cmdOK = new System.Windows.Forms.Button();
75 this.lblSummary = new System.Windows.Forms.Label();
76 this.lblProgress = new System.Windows.Forms.Label();
77 this.timerPoll = new System.Windows.Forms.Timer(this.components);
78 this.label1 = new System.Windows.Forms.Label();
79 this.label2 = new System.Windows.Forms.Label();
80 this.pnlOKCancel.SuspendLayout();
81 this.SuspendLayout();
82 //
83 // pnlOKCancel
84 //
85 this.pnlOKCancel.Controls.Add(this.cmdOK);
86 this.pnlOKCancel.Dock = System.Windows.Forms.DockStyle.Bottom;
87 this.pnlOKCancel.Location = new System.Drawing.Point(0, 211);
88 this.pnlOKCancel.Name = "pnlOKCancel";
89 this.pnlOKCancel.Size = new System.Drawing.Size(376, 40);
90 this.pnlOKCancel.TabIndex = 4;
91 //
92 // cmdOK
93 //
94 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
95 this.cmdOK.Location = new System.Drawing.Point(208, 8);
96 this.cmdOK.Name = "cmdOK";
97 this.cmdOK.Size = new System.Drawing.Size(136, 24);
98 this.cmdOK.TabIndex = 0;
99 this.cmdOK.Text = "OK";
100 //
101 // lblSummary
102 //
103 this.lblSummary.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
104 this.lblSummary.Location = new System.Drawing.Point(32, 32);
105 this.lblSummary.Name = "lblSummary";
106 this.lblSummary.Size = new System.Drawing.Size(312, 64);
107 this.lblSummary.TabIndex = 48;
108 this.lblSummary.Text = "lblSummary";
109 //
110 // lblProgress
111 //
112 this.lblProgress.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
113 this.lblProgress.Location = new System.Drawing.Point(32, 128);
114 this.lblProgress.Name = "lblProgress";
115 this.lblProgress.Size = new System.Drawing.Size(312, 72);
116 this.lblProgress.TabIndex = 49;
117 this.lblProgress.Text = "lblProgress";
118 //
119 // timerPoll
120 //
121 this.timerPoll.Tick += new System.EventHandler(this.timerPoll_Tick);
122 //
123 // label1
124 //
125 this.label1.Location = new System.Drawing.Point(32, 112);
126 this.label1.Name = "label1";
127 this.label1.Size = new System.Drawing.Size(144, 16);
128 this.label1.TabIndex = 50;
129 this.label1.Text = "Status:";
130 //
131 // label2
132 //
133 this.label2.Location = new System.Drawing.Point(32, 16);
134 this.label2.Name = "label2";
135 this.label2.Size = new System.Drawing.Size(144, 16);
136 this.label2.TabIndex = 51;
137 this.label2.Text = "Job Summary:";
138 //
139 // DCopyAppts
140 //
141 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
142 this.ClientSize = new System.Drawing.Size(376, 251);
143 this.Controls.Add(this.label2);
144 this.Controls.Add(this.label1);
145 this.Controls.Add(this.lblProgress);
146 this.Controls.Add(this.lblSummary);
147 this.Controls.Add(this.pnlOKCancel);
148 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
149 this.MaximizeBox = false;
150 this.Name = "DCopyAppts";
151 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
152 this.Text = "Copy Appointments";
153 this.Load += new System.EventHandler(this.DCopyAppts_Load);
154 this.Closing += new System.ComponentModel.CancelEventHandler(this.DCopyAppts_Closing);
155 this.pnlOKCancel.ResumeLayout(false);
156 this.ResumeLayout(false);
157
158 }
159 #endregion
160
161 #region Methods and Handlers
162
163 public void InitializePage(DateTime StartDate, DateTime EndDate,
164 string HospLocationID, string HospLocationName,
165 string ResourceID, string ResourceName,
166 CGDocumentManager DocManager)
167 {
168 string sMsg = "Copying appointments from " + HospLocationName + " to " + ResourceName + ", ";
169 sMsg += "beginning with apppointments on " + StartDate.ToLongDateString();
170 sMsg += " and going through " + EndDate.ToLongDateString() + ".";
171 lblSummary.Text = sMsg;
172 m_dtBegin = StartDate;
173 m_dtEnd = EndDate;
174 m_HospLocationID = HospLocationID;
175 m_HospLocationName = HospLocationName;
176 m_ResourceID = ResourceID;
177 m_ResourceName = ResourceName;
178 m_DocManager = DocManager;
179 }
180
181 private void DCopyAppts_Load(object sender, System.EventArgs e)
182 {
183 try
184 {
185 //Start M copy job and get the ZTSK number
186 //this.timerPoll.Stop();
187 lblProgress.Text = "Starting Process... \r\n";
188
189 string sSql = "BSDX COPY APPOINTMENTS^" + m_ResourceID + "^" + m_HospLocationID + "^" + m_dtBegin.ToShortDateString() + "^" + m_dtEnd.ToShortDateString();
190 DataTable dt = m_DocManager.RPMSDataTable(sSql, "ApptCopy");
191 Debug.Assert(dt.Rows.Count == 1);
192
193
194 DataRow dr = dt.Rows[0];
195 m_sTask = "0";
196 Object oTask = dr["TASK_NUMBER"];
197 m_sTask = oTask.ToString();
198
199 Object oError = dr["ERRORID"];
200 string sError = oError.ToString();
201 if (sError != "OK")
202 {
203 //timerPoll.Stop();
204 lblProgress.Text = sError;
205 cmdOK.Enabled = true;
206 }
207 else
208 {
209 lblProgress.Text += "VistA Job queued as Task #" + m_sTask;
210 //this.timerPoll.Start();
211 cmdOK.Enabled = true;
212 }
213
214 }
215 catch (Exception Ex)
216 {
217 MessageBox.Show(Ex.Message);
218 }
219
220 }
221
222 private void cmdCancel_Click(object sender, System.EventArgs e)
223 {
224 try
225 {
226 //Check status and update progress control
227 string sSql = "BSDX COPY APPOINTMENT CANCEL^" + m_sTask;
228 DataTable dt = m_DocManager.RPMSDataTable(sSql, "ApptCopyCancel");
229 Debug.Assert(dt.Rows.Count == 1);
230 DataRow dr = dt.Rows[0];
231 Object oCount = dr["RECORD_COUNT"];
232 string sCount = oCount.ToString();
233
234 lblProgress.Text = "Cancelling job...";
235 }
236 catch (Exception Ex)
237 {
238 MessageBox.Show(Ex.Message);
239 }
240 }
241
242 private void DCopyAppts_Closing(object sender, System.ComponentModel.CancelEventArgs e)
243 {
244
245 }
246
247 private void timerPoll_Tick(object sender, System.EventArgs e)
248 {
249 try
250 {
251 return;
252 //Check status and update progress control
253 //string sSql = "BSDX COPY APPOINTMENT STATUS^" + m_sTask;
254 //DataTable dt = m_DocManager.RPMSDataTable(sSql, "ApptCopyStatus");
255 //Debug.Assert(dt.Rows.Count == 1);
256 //DataRow dr = dt.Rows[0];
257 //Object oCount = dr["RECORD_COUNT"];
258 //string sCount = oCount.ToString();
259 //Object oError = dr["ERRORID"];
260 //string sError = oError.ToString();
261 //if (sError != "OK")
262 //{
263 // timerPoll.Stop();
264 // lblProgress.Text = sError;
265 //}
266 //else if ((sCount.StartsWith("Finished"))||(sCount.StartsWith("Cancelled")))
267 //{
268 // timerPoll.Stop();
269 // lblProgress.Text = sCount;
270 // cmdOK.Enabled = true;
271 // cmdCancel.Enabled = false;
272 //}
273 //else
274 //{
275 // lblProgress.Text = "RPMS Job queued as Task #" + m_sTask + ". " + sCount; // + " records copied so far.";
276 //}
277 }
278 catch (Exception Ex)
279 {
280 MessageBox.Show(Ex.Message);
281 }
282 }
283
284 #endregion Methods and Handlers
285 }
286}
Note: See TracBrowser for help on using the repository browser.