source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/IndianHealthService.BMXNet/RemoteSession.cs@ 1172

Last change on this file since 1172 was 1146, checked in by Sam Habiel, 14 years ago

Initial Import of BMX4

File size: 38.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Data;
5using IndianHealthService.BMXNet.Ado;
6using IndianHealthService.BMXNet.Services;
7using IndianHealthService.BMXNet.Model;
8
9namespace IndianHealthService.BMXNet
10{
11 /// <summary>
12 /// All server-side RPMS RPC calls are performed through this interface. Each instance of RemoteSession corresponds to a single job (e.g. Cache process) on RPMS. There is always one primary RemoteSession and potentially more when using RemoteSessionPool. When the primary RemoteSession is closed all secondary pooled sessions are also closed and the server broker connection is terminated.
13 /// </summary>
14 public interface RemoteSession
15 {
16 #region General Properties
17 /// <summary>
18 /// BMX Broker's host address name or IP Address
19 /// </summary>
20 String HostAddress { get; }
21
22 /// <summary>
23 /// Authenticated user associated with this remote session
24 /// </summary>
25 /// <example>
26 /// this.StatusLabel.Text="Logged in: "+ aRemoteSession.User.Name;
27 /// </example>
28 /// /// <remarks>
29 /// If there is a remoteSession user, it will be the same as the localSession User object
30 /// </remarks>
31 User User { get; }
32
33 /// <summary>
34 /// The active AppContext (OPTION) of this remote session.
35 /// </summary>
36 /// <remarks>
37 /// Normally the AppContext is set once, after logging into the BMX, with a
38 /// single AppContext for the current applications. The AppContext can also be set in every RPC call. If the AppContext
39 /// is the same as the currently set AppContext, the AppContext will not be re-set.
40 /// </remarks>
41 /// <example>
42 /// The VEN namespace is for PCC+ and the example below would be used at the beginning
43 /// of a PCC+ application.
44 /// <code>
45 /// aRemoteSession.AppContext = "VEN RPC";
46 /// </code>
47 /// </example>
48 String AppContext { get; set; }
49
50 #endregion
51
52 #region Remote Procedure Call Services
53
54 /// <summary>
55 /// Calls a remote procedure on the RPMS server and returns the result as a String.
56 /// </summary>
57 /// <remarks>
58 /// Presumes that the AppContext was set prior to the call.
59 /// </remarks>
60 /// <example>
61 /// <code>
62 /// ...
63 /// this.RemoteSession.AppContext="VEN RPC";
64 /// ...
65 /// String asqThreadholds= this.RemoteSession.TransmitRPC("VEN ASQ GET DATA", this.Context.Patient.Ien);
66 /// </code>
67 /// </example>
68 /// <param name="rpcCommand">The remote procedure call name </param>
69 /// <param name="rpcParameter">A carrot ^ delimited string of input parameters</param>
70 /// <returns>The result of the RPC call</returns>
71 String TransmitRPC(String rpcCommand, String rpcParameter);
72
73 /// <summary>
74 /// Calls a remote procedure on the RPMS server and returns the result as a String.
75 /// </summary>
76 /// <remarks>
77 /// Use this for usage patterns where the AppContext is changed often and should be explicity set
78 /// for each call and not implicitly through a prior invocation of this.RemoteSession.AppContext
79 /// </remarks>
80 /// <example>
81 /// <code>
82 /// ...
83 /// this.RemoteSession.AppContext=;
84 /// ...
85 /// String asqThreadholds= this.RemoteSession.TransmitRPC("VEN ASQ GET DATA", this.Context.Patient.Ien,"VEN RPC");
86 // </code>
87 /// </example>
88 /// <param name="rpcCommand">The remote procedure call name </param>
89 /// <param name="rpcParameter">A carrot ^ delimited string of input parameters</param>
90 /// <param name="aContext">The AppContext (OPTION) to be set prior to the call(</param>
91 /// <returns>The result of the RPC call</returns>
92 String TransmitRPC(String rpcCommand, String rpcParameter, String aContext);
93
94
95 /// <summary>
96 /// Calls a remote procedure on the RPMS server and returns the result as a String. If there are any exceptions a
97 /// colon delimited string in the format Exception:Message is returned.
98 /// </summary>
99 /// <remarks>
100 /// Presumes that the AppContext was set prior to the call.
101 /// </remarks>
102 /// <example>
103 /// <code>
104 /// ...
105 /// this.RemoteSession.AppContext="VEN RPC";
106 /// ...
107 /// String asqThreadholds= this.RemoteSession.SafelyTransmitRPC("VEN ASQ GET DATA", this.Context.Patient.Ien);
108 /// </code>
109 /// </example>
110 /// <param name="rpcCommand">The remote procedure call name </param>
111 /// <param name="rpcParameter">A carrot ^ delimited string of input parameters</param>
112 /// <returns>The result of the RPC call. If there are any exceptions a colon delimited string in the format Exception:Message is returned.</returns>
113 String SafelyTransmitRPC(String rpcCommand, String rpcParameter);
114
115
116 /// <summary>
117 /// Calls a remote procedure on the RPMS server and returns the result as a String. If there are any exceptions a
118 /// colon delimited string in the format Exception:Message is returned.
119 /// </summary>
120 /// <remarks>
121 /// Presumes that the AppContext was set prior to the call.
122 /// </remarks>
123 /// <example>
124 /// <code>
125 /// ...
126 /// this.RemoteSession.AppContext="VEN RPC";
127 /// ...
128 /// String asqThreadholds= this.RemoteSession.SafelyTransmitRPC("VEN ASQ GET DATA", this.Context.Patient.Ien);
129 /// </code>
130 /// </example>
131 /// <param name="rpcCommand">The remote procedure call name </param>
132 /// <param name="rpcParameter">A carrot ^ delimited string of input parameters</param>
133 /// <param name="aContext">The AppContext (OPTION) to be set prior to the call(</param>
134 /// <returns>The result of the RPC call. If there are any exceptions a colon delimited string in the format Exception:Message is returned.</returns>
135 String SafelyTransmitRPC(String rpcCommand, String rpcParameter, String context);
136
137 #endregion
138 // ADO Services
139
140 #region ADO.NET Table Services
141
142 /// <summary>
143 ///
144 /// <example>
145 ///
146 /// <code>
147 ///
148 /// this.Context.Visit.Create();
149 /// if (this.Context.Visit.IsStub)
150 /// {
151 /// if (!this.Context.Visit.Create())
152 /// {
153 /// return false;
154 /// }
155 /// }
156 /// this.RemoteSession.SaveChanges(this.ScoreTable);
157 /// </code>
158 /// </example>
159 /// </summary>
160 /// <param name="aDataTable"></param>
161 /// <returns></returns>
162 bool SaveChanges(DataTable aDataTable);
163
164
165 /// <summary>
166 /// Calling a Custom Remote Procedure call (RPC) registered in VA FileMan’s REMOTE PROCEDURE file that results in a DataTable. You must design your remote procedure’s M routine to build its result its data in the specific format described later in this document.
167 /// </summary>
168 /// <param name="aCommand">The co /// </param>
169 /// <remarks>
170 /// Normally the AppContext is set once, after logging into the BMX, with a
171 /// single AppContext for the current applications or specified in every RPC call.
172 /// </remarks>
173 /// <example>
174 /// The VEN namespace is for PCC+ and the example below would be used at the beginning
175 /// of a PCC+ application.
176 /// <code>
177 /// aRemoteSession.AppContext = "VEN RPC";
178 /// </code>
179 /// The M code for a simple remote procedure call (BMX PATIENT DEMO) with two parameters to return a list of patients. See the following example. Note the inclusion of an error trap in the routine; BMXNet RPC routines must contain a functional error trap.
180 /// <code>
181 /// Figure 5 2 shows the M code for a simple remote procedure call (BMX PATIENT DEMO) with two parameters to return a list of patients. See the following example. Note the inclusion of an error trap in the routine; BMXNet RPC routines must contain a functional error trap.
182 /// PDEMO(BMXY,BMXPAT,BMXCOUNT) ;EP
183 /// ;This simple RPC demonstrates how to format data
184 /// ;for the BMXNet ADO.NET data provider
185 /// ;
186 /// ;Returns a maximum of BMXCOUNT records from the
187 /// ;VA PATIENT file whose names begin with BMXPAT
188 /// ;
189 /// N BMXI,BMXD,BMXC,BMXNODE,BMXDOB
190 /// ;
191 /// ; BMXY is passed in by reference. Set it to
192 /// ;the value of the variable in which we will return our data:
193 /// S BMXY="^TMP(BMX,"_$J_")"
194 /// ;
195 /// ;The first subnode of the data global contains the column header information
196 /// ;in the form "txxxxxCOLUMN1NAME^txxxxxCOLUMN2NAME"_$C(30)
197 /// ;where t is the column data type:
198 /// ; T for text
199 /// ; I for integer
200 /// ; N for floating point number
201 /// ; D for date/time.
202 /// ;xxxxx is the length of the column in characters.
203 /// ;
204 /// S BMXI=0,BMXC=0
205 /// S ^ TMP(BMX,$J,BMXI)="T00030NAME^T00010SEX^D00020DOB"_$C(30)
206 /// ;
207 /// ;You MUST set an error trap:
208 /// S X="PDERR^BMXRPC6",@^%ZOSF("TRAP")
209 /// ;
210 /// ;Strip CR, LF, TAB from BMXCOUNT parameter
211 /// S BMXCOUNT=$TR(BMXCOUNT,$C(13),"")
212 /// S BMXCOUNT=$TR(BMXCOUNT,$C(10),"")
213 /// S BMXCOUNT=$TR(BMXCOUNT,$C(9),"")
214 /// ;
215 /// ;Iterate through the global and set the data nodes:
216 /// S:BMXPAT="" BMXPAT="A"
217 /// S BMXPAT=$O(^DPT("B",BMXPAT),-1)
218 /// S BMXD=0
219 /// F S BMXPAT=$O(^DPT("B",BMXPAT)) Q:BMXPAT="" S BMXD=$O(^DPT("B",BMXPAT,0)) I +BMXD S BMXC=BMXC+1 Q:(BMXCOUNT)BMXC BMXCOUNT) D
220 /// . Q:'$D(^DPT(BMXD,0))
221 /// . S BMXI=BMXI+1
222 /// . S BMXNODE=^DPT(BMXD,0)
223 /// . ;Convert the DOB from FM date to external form
224 /// . S Y=$P(BMXNODE,U,3)
225 /// . I +Y X ^DD("DD")
226 /// . S BMXDOB=Y
227 /// . ;The data node fields are in the same order as the column header, i.e. NAME^SEX^DOB
228 /// . ;and terminated with a $C(30)
229 /// . S ^ TMP(BMX,$J,BMXI)=$P(BMXNODE,U)_U_$P(BMXNODE,U,2)_U_BMXDOB_$C(30)
230 /// ;
231 /// ;After all the data nodes have been set, set the final node to $C(31) to indicate
232 /// ;the end of the recordset
233 /// S BMXI=BMXI+1
234 /// S ^ TMP(BMX,$J,BMXI)=$C(31)
235 /// Q
236 /// ;
237 /// PDERR ;Error trap for PDEMO
238 /// ;
239 /// S ^ TMP(BMX,$J,BMXI+1)=$C(31)
240 /// Q
241 /// </code>
242 /// Register as an RPC
243 /// <para>
244 /// NAME: BMX DEMO TAG: PDEMO
245 /// ROUTINE: BMXRPC6 RETURN VALUE TYPE: GLOBAL ARRAY
246 /// </para>
247 /// Call using a RemoteSession
248 /// <code>
249 /// DataTable demoTable=aRemoteSession.TableFromCommand("BMX DEMO^S^10");
250 /// </code>
251 /// </example>
252 /// <param name="aCommand">The name of the RPC </param>
253 /// <returns>The resulting DataTable</returns>
254 DataTable TableFromCommand(String aCommand);
255
256
257 /// <summary>
258 /// Calling a Custom Remote Procedure call (RPC) registered in VA FileMan’s REMOTE PROCEDURE file that results in a DataTable. You must design your remote procedure’s M routine to build its result its data in the specific format described later in this document.
259 /// </summary>
260 /// <param name="aCommand">The co /// </param>
261 /// <remarks>
262 /// Normally the AppContext is set once, after logging into the BMX, with a
263 /// single AppContext for the current applications or specified in every RPC call.
264 /// </remarks>
265 /// <example>
266 /// The VEN namespace is for PCC+ and the example below would be used at the beginning
267 /// of a PCC+ application.
268 /// <code>
269 /// aRemoteSession.AppContext = "VEN RPC";
270 /// </code>
271 /// The M code for a simple remote procedure call (BMX PATIENT DEMO) with two parameters to return a list of patients. See the following example. Note the inclusion of an error trap in the routine; BMXNet RPC routines must contain a functional error trap.
272 /// <code>
273 /// Figure 5 2 shows the M code for a simple remote procedure call (BMX PATIENT DEMO) with two parameters to return a list of patients. See the following example. Note the inclusion of an error trap in the routine; BMXNet RPC routines must contain a functional error trap.
274 /// PDEMO(BMXY,BMXPAT,BMXCOUNT) ;EP
275 /// ;This simple RPC demonstrates how to format data
276 /// ;for the BMXNet ADO.NET data provider
277 /// ;
278 /// ;Returns a maximum of BMXCOUNT records from the
279 /// ;VA PATIENT file whose names begin with BMXPAT
280 /// ;
281 /// N BMXI,BMXD,BMXC,BMXNODE,BMXDOB
282 /// ;
283 /// ; BMXY is passed in by reference. Set it to
284 /// ;the value of the variable in which we will return our data:
285 /// S BMXY="^TMP(BMX,"_$J_")"
286 /// ;
287 /// ;The first subnode of the data global contains the column header information
288 /// ;in the form "txxxxxCOLUMN1NAME^txxxxxCOLUMN2NAME"_$C(30)
289 /// ;where t is the column data type:
290 /// ; T for text
291 /// ; I for integer
292 /// ; N for floating point number
293 /// ; D for date/time.
294 /// ;xxxxx is the length of the column in characters.
295 /// ;
296 /// S BMXI=0,BMXC=0
297 /// S ^ TMP(BMX,$J,BMXI)="T00030NAME^T00010SEX^D00020DOB"_$C(30)
298 /// ;
299 /// ;You MUST set an error trap:
300 /// S X="PDERR^BMXRPC6",@^%ZOSF("TRAP")
301 /// ;
302 /// ;Strip CR, LF, TAB from BMXCOUNT parameter
303 /// S BMXCOUNT=$TR(BMXCOUNT,$C(13),"")
304 /// S BMXCOUNT=$TR(BMXCOUNT,$C(10),"")
305 /// S BMXCOUNT=$TR(BMXCOUNT,$C(9),"")
306 /// ;
307 /// ;Iterate through the global and set the data nodes:
308 /// S:BMXPAT="" BMXPAT="A"
309 /// S BMXPAT=$O(^DPT("B",BMXPAT),-1)
310 /// S BMXD=0
311 /// F S BMXPAT=$O(^DPT("B",BMXPAT)) Q:BMXPAT="" S BMXD=$O(^DPT("B",BMXPAT,0)) I +BMXD S BMXC=BMXC+1 Q:(BMXCOUNT)BMXC BMXCOUNT) D
312 /// . Q:'$D(^DPT(BMXD,0))
313 /// . S BMXI=BMXI+1
314 /// . S BMXNODE=^DPT(BMXD,0)
315 /// . ;Convert the DOB from FM date to external form
316 /// . S Y=$P(BMXNODE,U,3)
317 /// . I +Y X ^DD("DD")
318 /// . S BMXDOB=Y
319 /// . ;The data node fields are in the same order as the column header, i.e. NAME^SEX^DOB
320 /// . ;and terminated with a $C(30)
321 /// . S ^ TMP(BMX,$J,BMXI)=$P(BMXNODE,U)_U_$P(BMXNODE,U,2)_U_BMXDOB_$C(30)
322 /// ;
323 /// ;After all the data nodes have been set, set the final node to $C(31) to indicate
324 /// ;the end of the recordset
325 /// S BMXI=BMXI+1
326 /// S ^ TMP(BMX,$J,BMXI)=$C(31)
327 /// Q
328 /// ;
329 /// PDERR ;Error trap for PDEMO
330 /// ;
331 /// S ^ TMP(BMX,$J,BMXI+1)=$C(31)
332 /// Q
333 /// </code>
334 /// Register as an RPC
335 /// <para>
336 /// NAME: BMX DEMO TAG: PDEMO
337 /// ROUTINE: BMXRPC6 RETURN VALUE TYPE: GLOBAL ARRAY
338 /// </para>
339 /// Call using a RemoteSession
340 /// <code>
341 /// DataTable demoTable=aRemoteSession.TableFromCommand("BMX DEMO^S^10");
342 /// </code>
343 /// </example>
344 /// <param name="aCommand">The name of the RPC </param>
345 /// <param name="aContext">The AppContext to set prior to the call</param>
346 /// <returns>The resulting DataTable</returns>
347 DataTable TableFromCommand(String aCommand, String aContext);
348
349
350 /// <summary>
351 /// Calling a Custom Remote Procedure call (RPC) registered in VA FileMan’s REMOTE PROCEDURE file that results in a DataTable. You must design your remote procedure’s M routine to build its result its data in the specific format described later in this document.
352 /// </summary>
353 /// <param name="aCommand">The co /// </param>
354 /// <remarks>
355 /// Normally the AppContext is set once, after logging into the BMX, with a
356 /// single AppContext for the current applications or specified in every RPC call.
357 /// </remarks>
358 /// <example>
359 /// The VEN namespace is for PCC+ and the example below would be used at the beginning
360 /// of a PCC+ application.
361 /// <code>
362 /// aRemoteSession.AppContext = "VEN RPC";
363 /// </code>
364 /// The M code for a simple remote procedure call (BMX PATIENT DEMO) with two parameters to return a list of patients. See the following example. Note the inclusion of an error trap in the routine; BMXNet RPC routines must contain a functional error trap.
365 /// <code>
366 /// Figure 5 2 shows the M code for a simple remote procedure call (BMX PATIENT DEMO) with two parameters to return a list of patients. See the following example. Note the inclusion of an error trap in the routine; BMXNet RPC routines must contain a functional error trap.
367 /// PDEMO(BMXY,BMXPAT,BMXCOUNT) ;EP
368 /// ;This simple RPC demonstrates how to format data
369 /// ;for the BMXNet ADO.NET data provider
370 /// ;
371 /// ;Returns a maximum of BMXCOUNT records from the
372 /// ;VA PATIENT file whose names begin with BMXPAT
373 /// ;
374 /// N BMXI,BMXD,BMXC,BMXNODE,BMXDOB
375 /// ;
376 /// ; BMXY is passed in by reference. Set it to
377 /// ;the value of the variable in which we will return our data:
378 /// S BMXY="^TMP(BMX,"_$J_")"
379 /// ;
380 /// ;The first subnode of the data global contains the column header information
381 /// ;in the form "txxxxxCOLUMN1NAME^txxxxxCOLUMN2NAME"_$C(30)
382 /// ;where t is the column data type:
383 /// ; T for text
384 /// ; I for integer
385 /// ; N for floating point number
386 /// ; D for date/time.
387 /// ;xxxxx is the length of the column in characters.
388 /// ;
389 /// S BMXI=0,BMXC=0
390 /// S ^ TMP(BMX,$J,BMXI)="T00030NAME^T00010SEX^D00020DOB"_$C(30)
391 /// ;
392 /// ;You MUST set an error trap:
393 /// S X="PDERR^BMXRPC6",@^%ZOSF("TRAP")
394 /// ;
395 /// ;Strip CR, LF, TAB from BMXCOUNT parameter
396 /// S BMXCOUNT=$TR(BMXCOUNT,$C(13),"")
397 /// S BMXCOUNT=$TR(BMXCOUNT,$C(10),"")
398 /// S BMXCOUNT=$TR(BMXCOUNT,$C(9),"")
399 /// ;
400 /// ;Iterate through the global and set the data nodes:
401 /// S:BMXPAT="" BMXPAT="A"
402 /// S BMXPAT=$O(^DPT("B",BMXPAT),-1)
403 /// S BMXD=0
404 /// F S BMXPAT=$O(^DPT("B",BMXPAT)) Q:BMXPAT="" S BMXD=$O(^DPT("B",BMXPAT,0)) I +BMXD S BMXC=BMXC+1 Q:(BMXCOUNT)BMXC BMXCOUNT) D
405 /// . Q:'$D(^DPT(BMXD,0))
406 /// . S BMXI=BMXI+1
407 /// . S BMXNODE=^DPT(BMXD,0)
408 /// . ;Convert the DOB from FM date to external form
409 /// . S Y=$P(BMXNODE,U,3)
410 /// . I +Y X ^DD("DD")
411 /// . S BMXDOB=Y
412 /// . ;The data node fields are in the same order as the column header, i.e. NAME^SEX^DOB
413 /// . ;and terminated with a $C(30)
414 /// . S ^ TMP(BMX,$J,BMXI)=$P(BMXNODE,U)_U_$P(BMXNODE,U,2)_U_BMXDOB_$C(30)
415 /// ;
416 /// ;After all the data nodes have been set, set the final node to $C(31) to indicate
417 /// ;the end of the recordset
418 /// S BMXI=BMXI+1
419 /// S ^ TMP(BMX,$J,BMXI)=$C(31)
420 /// Q
421 /// ;
422 /// PDERR ;Error trap for PDEMO
423 /// ;
424 /// S ^ TMP(BMX,$J,BMXI+1)=$C(31)
425 /// Q
426 /// </code>
427 /// Register as an RPC
428 /// <para>
429 /// NAME: BMX DEMO TAG: PDEMO
430 /// ROUTINE: BMXRPC6 RETURN VALUE TYPE: GLOBAL ARRAY
431 /// </para>
432 /// Call using a RemoteSession
433 /// <code>
434 /// DataTable demoTable=aRemoteSession.TableFromCommand("BMX DEMO^S^10");
435 /// </code>
436 /// </example>
437 /// <param name="aCommand">The name of the RPC </param>
438 /// <param name="aDataSet">The DataSet to be populated with a resulting DataTable named aTableNAme</param>
439 /// <param name="aTableName">The name of the DataTable in the DataSet to populate or to create</param>
440 /// <returns>The resulting DataTable</returns>
441 DataTable TableFromCommand(String aCommand, DataSet aDataSet, String aTableName);
442
443
444 /// <summary>
445 /// Calling a Custom Remote Procedure call (RPC) registered in VA FileMan’s REMOTE PROCEDURE file that results in a DataTable. You must design your remote procedure’s M routine to build its result its data in the specific format described later in this document.
446 /// </summary>
447 /// <param name="aCommand">The co /// </param>
448 /// <remarks>
449 /// Normally the AppContext is set once, after logging into the BMX, with a
450 /// single AppContext for the current applications or specified in every RPC call.
451 /// </remarks>
452 /// <example>
453 /// The VEN namespace is for PCC+ and the example below would be used at the beginning
454 /// of a PCC+ application.
455 /// <code>
456 /// aRemoteSession.AppContext = "VEN RPC";
457 /// </code>
458 /// The M code for a simple remote procedure call (BMX PATIENT DEMO) with two parameters to return a list of patients. See the following example. Note the inclusion of an error trap in the routine; BMXNet RPC routines must contain a functional error trap.
459 /// <code>
460 /// Figure 5 2 shows the M code for a simple remote procedure call (BMX PATIENT DEMO) with two parameters to return a list of patients. See the following example. Note the inclusion of an error trap in the routine; BMXNet RPC routines must contain a functional error trap.
461 /// PDEMO(BMXY,BMXPAT,BMXCOUNT) ;EP
462 /// ;This simple RPC demonstrates how to format data
463 /// ;for the BMXNet ADO.NET data provider
464 /// ;
465 /// ;Returns a maximum of BMXCOUNT records from the
466 /// ;VA PATIENT file whose names begin with BMXPAT
467 /// ;
468 /// N BMXI,BMXD,BMXC,BMXNODE,BMXDOB
469 /// ;
470 /// ; BMXY is passed in by reference. Set it to
471 /// ;the value of the variable in which we will return our data:
472 /// S BMXY="^TMP(BMX,"_$J_")"
473 /// ;
474 /// ;The first subnode of the data global contains the column header information
475 /// ;in the form "txxxxxCOLUMN1NAME^txxxxxCOLUMN2NAME"_$C(30)
476 /// ;where t is the column data type:
477 /// ; T for text
478 /// ; I for integer
479 /// ; N for floating point number
480 /// ; D for date/time.
481 /// ;xxxxx is the length of the column in characters.
482 /// ;
483 /// S BMXI=0,BMXC=0
484 /// S ^ TMP(BMX,$J,BMXI)="T00030NAME^T00010SEX^D00020DOB"_$C(30)
485 /// ;
486 /// ;You MUST set an error trap:
487 /// S X="PDERR^BMXRPC6",@^%ZOSF("TRAP")
488 /// ;
489 /// ;Strip CR, LF, TAB from BMXCOUNT parameter
490 /// S BMXCOUNT=$TR(BMXCOUNT,$C(13),"")
491 /// S BMXCOUNT=$TR(BMXCOUNT,$C(10),"")
492 /// S BMXCOUNT=$TR(BMXCOUNT,$C(9),"")
493 /// ;
494 /// ;Iterate through the global and set the data nodes:
495 /// S:BMXPAT="" BMXPAT="A"
496 /// S BMXPAT=$O(^DPT("B",BMXPAT),-1)
497 /// S BMXD=0
498 /// F S BMXPAT=$O(^DPT("B",BMXPAT)) Q:BMXPAT="" S BMXD=$O(^DPT("B",BMXPAT,0)) I +BMXD S BMXC=BMXC+1 Q:(BMXCOUNT)BMXC BMXCOUNT) D
499 /// . Q:'$D(^DPT(BMXD,0))
500 /// . S BMXI=BMXI+1
501 /// . S BMXNODE=^DPT(BMXD,0)
502 /// . ;Convert the DOB from FM date to external form
503 /// . S Y=$P(BMXNODE,U,3)
504 /// . I +Y X ^DD("DD")
505 /// . S BMXDOB=Y
506 /// . ;The data node fields are in the same order as the column header, i.e. NAME^SEX^DOB
507 /// . ;and terminated with a $C(30)
508 /// . S ^ TMP(BMX,$J,BMXI)=$P(BMXNODE,U)_U_$P(BMXNODE,U,2)_U_BMXDOB_$C(30)
509 /// ;
510 /// ;After all the data nodes have been set, set the final node to $C(31) to indicate
511 /// ;the end of the recordset
512 /// S BMXI=BMXI+1
513 /// S ^ TMP(BMX,$J,BMXI)=$C(31)
514 /// Q
515 /// ;
516 /// PDERR ;Error trap for PDEMO
517 /// ;
518 /// S ^ TMP(BMX,$J,BMXI+1)=$C(31)
519 /// Q
520 /// </code>
521 /// Register as an RPC
522 /// <para>
523 /// NAME: BMX DEMO TAG: PDEMO
524 /// ROUTINE: BMXRPC6 RETURN VALUE TYPE: GLOBAL ARRAY
525 /// </para>
526 /// Call using a RemoteSession
527 /// <code>
528 /// DataTable demoTable=aRemoteSession.TableFromCommand("BMX DEMO^S^10");
529 /// </code>
530 /// </example>
531 /// <param name="aCommand">The name of the RPC </param>
532 /// <param name="aDataSet">The DataSet to be populated with a resulting DataTable named aTableNAme</param>
533 /// <param name="aTableName">The name of the DataTable in the DataSet to populate or to create</param>
534 /// <param name="aContext">The AppContext to set prior to the call</param>
535 /// <returns>The resulting DataTable</returns>
536 DataTable TableFromCommand(String aCommand, DataSet aDataSet, String aTableName, String aContext);
537
538
539
540 DataTable TableFromSQL(String anSqlStatement);
541 DataTable TableFromSQL(String anSqlStatement, String aContext);
542 DataTable TableFromSQL(String anSqlStatement, DataSet aDataSet, String aTableName);
543
544 /// <summary>
545 /// SELECT VA_PATIENT.NAME, VA_PATIENT.SSN, PATIENT.CURRENT_COMMUNITY FROM VA_PATIENT, PATIENT WHERE VA_PATIENT.BMXIEN =* INTERNAL[PATIENT.NAME] AND VA_PATIENT.NAME LIKE 'DEMO%' AND VA_PATIENT.AGE BETWEEN 15 AND 24 SHOWPLAN
546 /// </summary>
547 /// <param name="anSqlStatement"></param>
548 /// <param name="aDataSet"></param>
549 /// <param name="aTableName"></param>
550 /// <param name="aContext"></param>
551 /// <returns></returns>
552 DataTable TableFromSQL(String anSqlStatement, DataSet aDataSet, String aTableName, String aContext);
553
554 /// <summary>
555 /// TabletFromRpc is a double-dispatch method that is used by some developers. Developers create an RPC
556 /// call the returns a properly format BMX command (custom or BMX SS ADO) that is then transmitted back to RPMS to retrieve the Data Table.
557 /// </summary>
558 /// <param name="rpcCommand">The remote procedure call name </param>
559 /// <param name="rpcParameter">A carrot ^ delimited string of input parameters</param>
560 /// <returns>The resulting DataTable</returns>
561 DataTable TableFromRPC(String rpcCommand, String rpcParameter);
562
563 /// <summary>
564 /// TabletFromRpc is a double-dispatch method that is used by some developers. Developers create an RPC
565 /// call the returns a properly format BMX command (custom or BMX SS ADO) that is then transmitted back to RPMS to retrieve the Data Table.
566 /// </summary>
567 /// <param name="rpcCommand">The remote procedure call name </param>
568 /// <param name="rpcParameter">A carrot ^ delimited string of input parameters</param>
569 /// <param name="aContext">The AppContext to set prior to the call</param>
570 /// <returns>The resulting DataTable</returns>
571 DataTable TableFromRPC(String rpcCommand, String rpcParameter, String aContext);
572
573 /// <summary>
574 /// TabletFromRpc is a double-dispatch method that is used by some developers. Developers create an RPC
575 /// call the returns a properly format BMX command (custom or BMX SS ADO) that is then transmitted back to RPMS to retrieve the Data Table.
576 /// </summary>
577 /// <param name="rpcCommand">The remote procedure call name </param>
578 /// <param name="rpcParameter">A carrot ^ delimited string of input parameters</param>
579 /// <param name="aDataSet">The DataSet to be populated with a resulting DataTable named aTableNAme</param>
580 /// <param name="aTableName">The name of the DataTable in the DataSet to populate or to create</param>
581 /// <returns>The resulting DataTable</returns>
582 DataTable TableFromRPC(String rpcCommand, String rpcParameter, DataSet aDataSet, String aTableName);
583
584 /// <summary>
585 /// TabletFromRpc is a double-dispatch method that is used by some developers. Developers create an RPC
586 /// call the returns a properly format BMX command (custom or BMX SS ADO) that is then transmitted back to RPMS to retrieve the Data Table.
587 /// </summary>
588 /// <param name="rpcCommand">The remote procedure call name </param>
589 /// <param name="rpcParameter">A carrot ^ delimited string of input parameters</param>
590 /// <param name="aDataSet">The DataSet to be populated with a resulting DataTable named aTableNAme</param>
591 /// <param name="aTableName">The name of the DataTable in the DataSet to populate or to create</param>
592 /// <param name="aContext">The AppContext to set prior to the call</param>
593 /// <returns>The resulting DataTable</returns>
594 DataTable TableFromRPC(String rpcCommand, String rpcParameter, DataSet aDataSet, String aTableName, String context);
595
596
597 /// <summary>
598 /// Same as the corresponding TableFromCommand call except a DataTableFuture is returned. See <see cref="DataTableFuture "/> on how to use a 'Future
599 /// </summary>
600 /// <param name="aCommand">The name of the RPC </param>
601 /// <returns>A DataTableFuture</returns>
602 DataTableFuture AsyncTableFromCommand(String aCommand);
603
604 /// <summary>
605 /// Same as the corresponding TableFromCommand call except a DataTableFuture is returned. See <see cref="DataTableFuture "/> on how to use a 'Future
606 /// </summary>
607 /// <param name="aCommand">The name of the RPC </param>
608 /// <param name="aContext">The AppContext to set prior to the call</param>
609 /// <returns>A DataTableFuture</returns>
610 DataTableFuture AsyncTableFromCommand(String aCommand, String aContext);
611
612 /// <summary>
613 /// Same as the corresponding TableFromCommand call except a DataTableFuture is returned. See <see cref="DataTableFuture "/> on how to use a 'Future
614 /// </summary>
615 /// <param name="aCommand">The name of the RPC </param>
616 /// <param name="aDataSet">The DataSet to be populated with a resulting DataTable named aTableNAme</param>
617 /// <param name="aTableName">The name of the DataTable in the DataSet to populate or to create</param>
618 /// <returns>A DataTableFuture</returns>
619 DataTableFuture AsyncTableFromCommand(String aCommand, DataSet aDataSet, String aTableName);
620
621 /// <summary>
622 /// Same as the corresponding TableFromCommand call except a DataTableFuture is returned. See <see cref="DataTableFuture "/> on how to use a 'Future
623 /// </summary>
624 /// <param name="aCommand">The name of the RPC </param>
625 /// <param name="aDataSet">The DataSet to be populated with a resulting DataTable named aTableNAme</param>
626 /// <param name="aTableName">The name of the DataTable in the DataSet to populate or to create</param>
627 /// <param name="aContext">The AppContext to set prior to the call</param>
628 /// <returns>A DataTableFuture</returns>
629 DataTableFuture AsyncTableFromCommand(String aCommand, DataSet aDataSet, String aTableName, String aContext);
630
631 DataTableFuture AsyncTableFromSQL(String sql);
632 DataTableFuture AsyncTableFromSQL(String sql, String aContext);
633 DataTableFuture AsyncTableFromSQL(String sql, DataSet aDataSet, String aTableName);
634 DataTableFuture AsyncTableFromSQL(String sql, DataSet aDataSet, String aTableName, String aContext);
635
636 /// <summary>
637 /// Same as the corresponding TableFromRPC call except a DataTableFuture is returned. See <see cref="DataTableFuture "/> on how to use a 'Future
638 /// </summary>
639 /// <param name="rpcCommand">The remote procedure call name </param>
640 /// <param name="rpcParameter">A carrot ^ delimited string of input parameters</param>
641 /// <returns>A DataTableFuture</returns>
642 DataTableFuture AsyncTableFromRPC(String rpcCommand, String rpcParameter);
643
644 /// <summary>
645 /// Same as the corresponding TableFromRPC call except a DataTableFuture is returned. See <see cref="DataTableFuture "/> on how to use a 'Future
646 /// </summary>
647 /// <param name="rpcCommand"></param>
648 /// <param name="rpcParameter"></param>
649 /// <param name="aContext"></param>
650 /// <returns>A DataTableFuture</returns>
651 DataTableFuture AsyncTableFromRPC(String rpcCommand, String rpcParameter, String context);
652
653 /// <summary>
654 /// Same as the corresponding TableFromRPC call except a DataTableFuture is returned. See <see cref="DataTableFuture "/> on how to use a 'Future
655 /// </summary>
656 /// <param name="rpcCommand">The remote procedure call name </param>
657 /// <param name="rpcParameter">A carrot ^ delimited string of input parameters</param>
658 /// <param name="aDataSet">The DataSet to be populated with a resulting DataTable named aTableNAme</param>
659 /// <param name="aTableName">The name of the DataTable in the DataSet to populate or to create</param>
660 /// <returns>A DataTableFuture</returns>
661 DataTableFuture AsyncTableFromRPC(String rpcCommand, String rpcParameter, DataSet aDataSet, String aTableName);
662
663 /// <summary>
664 /// Same as the corresponding TableFromRPC call except a DataTableFuture is returned. See <see cref="DataTableFuture "/> on how to use a 'Future
665 /// </summary>
666 /// <param name="rpcCommand">The remote procedure call name </param>
667 /// <param name="rpcParameter">A carrot ^ delimited string of input parameters</param>
668 /// <param name="aDataSet">The DataSet to be populated with a resulting DataTable named aTableNAme</param>
669 /// <param name="aTableName">The name of the DataTable in the DataSet to populate or to create</param>
670 /// <param name="aContext">The AppContext to set prior to the call</param>
671 /// <returns>A DataTableFuture</returns>
672 DataTableFuture AsyncTableFromRPC(String rpcCommand, String rpcParameter, DataSet aDataSet, String aTableName, String aContext);
673
674 /// <summary>
675 /// Answer True if aString is a standard BMX ADO SS command that uses the BMX ADO SCHEMA files
676 /// </summary>
677 /// <remarks>
678 /// This is mostly used by the framework but exposed for potential use.
679 /// </remarks>
680 /// <param name="aString">The command to be examined</param>
681 /// <returns>True if it complied, otherwise false</returns>
682 bool IsBmxAdoCommand(String aString);
683 #endregion
684
685
686 #region Event Services
687
688 /// <summary>
689 /// Access the session's RemoteEventServices service provider to configure receiving
690 /// remote events and to source new events.
691 /// </summary>
692 RemoteEventService EventServices { get; }
693
694 #endregion
695
696
697 #region Debugging
698 /// <summary>
699 /// Job number of server-side Cache/MDB process. Very useful for debugging.
700 /// </summary>
701 String Job { get; }
702
703 /// <summary>
704 /// String describing RPC call and input parameters of last non-DataTable RPC call
705 /// </summary>
706 String DebugLastRpcSignature { get; }
707
708 /// <summary>
709 /// String value of last successful non-DataTable RPC call
710 /// </summary>
711 String RpcResult { get; }
712
713 /// <summary>
714 /// String value of last successful non-DataTable RPC call
715 /// </summary>
716 String DebugLastRpcResult { get; }
717
718 /// <summary>
719 /// Last DataTable retrieved by non-async calls
720 /// </summary>
721 DataTable DebugLastTableResult { get; }
722
723 Log Log { get; }
724
725 #endregion
726
727 #region Lifecycle
728
729 /// <summary>
730 /// The networking data receive timeout (in milliseconds). This value can be changed if the developer finds it neccessary
731 /// to extend the time after login.
732 /// </summary>
733 /// <remarks>
734 /// Only applicable for the WinFramework
735 /// </remarks>
736 int ReceiveTimeout { get; set; }
737
738 /// <summary>
739 /// The networking data send timeout (in milliseconds). This value can be changed if the developer finds it neccessary
740 /// to extend the time after login but normally the send timeout should be kept short unless network conditions are poor.
741 /// </summary>
742 /// <remarks>
743 /// Only applicable for the WinFramework
744 /// </remarks>
745 int SendTimeout { get; set; }
746
747 /// <summary>
748 /// The primary session has the unique in that it holds the authenication privileges for all sessions. If you close the primary session, then all will close.
749 /// </summary>
750 bool IsPrimary { get; }
751
752 /// <summary>
753 /// When done with session it should be closed. Once closed it is unusable.
754 /// </summary>
755 /// <remarks>Internally the session is a lightweight object and when using multiple sessions internal RPMS connections are pooled . Close sessions when finished</remarks>
756 /// <remarks>Closing the primary session closes all sessions and shuts down the RPMS connection</remarks>
757 void Close();
758 #endregion
759 }
760
761}
Note: See TracBrowser for help on using the repository browser.