[1146] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Text;
|
---|
| 4 | using IndianHealthService.BMXNet.Model;
|
---|
| 5 | using System.Data;
|
---|
| 6 |
|
---|
| 7 | namespace IndianHealthService.BMXNet.EHR.Model
|
---|
| 8 | {
|
---|
| 9 | internal class CiaUser:CiaObject,User
|
---|
| 10 | {
|
---|
| 11 |
|
---|
| 12 | public bool HasSecurityKey(String aString)
|
---|
| 13 | {
|
---|
| 14 | return "-1".Equals(this.RemoteSession.TransmitRPC("BMX SECURITY KEY", aString));
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | public List<string> RequestKeys()
|
---|
| 18 | {
|
---|
| 19 | try
|
---|
| 20 | {
|
---|
| 21 | List<String> keys = new List<string>();
|
---|
| 22 |
|
---|
| 23 | DataTable result = this.RemoteSession.TableFromCommand("BMXUserKeyRS^" + this.Ien);
|
---|
| 24 |
|
---|
| 25 | foreach (DataRow each in result.Rows)
|
---|
| 26 | {
|
---|
| 27 | String key = each["KEY"].ToString().Trim();
|
---|
| 28 | if (key.Length > 0)
|
---|
| 29 | {
|
---|
| 30 | keys.Add(key.ToUpper());
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 | return keys;
|
---|
| 34 |
|
---|
| 35 | }
|
---|
| 36 | catch (Exception problem)
|
---|
| 37 | {
|
---|
| 38 | throw new BMXNetException("User key listing unavailable.", problem);
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 | public List<String> HasSecurityKeys(string[] keys)
|
---|
| 44 | {
|
---|
| 45 | List<String> missingKeys = new List<string>(keys);
|
---|
| 46 | List<String> keychain = this.RequestKeys();
|
---|
| 47 | foreach (string each in keychain)
|
---|
| 48 | {
|
---|
| 49 | if (missingKeys.Contains(each.ToUpper()))
|
---|
| 50 | {
|
---|
| 51 | missingKeys.Remove(each.ToUpper());
|
---|
| 52 | }
|
---|
| 53 | if (missingKeys.Count == 0)
|
---|
| 54 | {
|
---|
| 55 | break;
|
---|
| 56 | }
|
---|
| 57 | }
|
---|
| 58 | return missingKeys;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | public String Duz
|
---|
| 63 | {
|
---|
| 64 | get { return this.Ien; }
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | private String _name = null;
|
---|
| 68 |
|
---|
| 69 | public String Name
|
---|
| 70 | {
|
---|
| 71 | get { return _name; }
|
---|
| 72 | set { _name = value; }
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | private Division _division = null;
|
---|
| 76 |
|
---|
| 77 | internal Division FriendDivision
|
---|
| 78 | {
|
---|
| 79 | set { _division = value; }
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | public Division Division
|
---|
| 84 | {
|
---|
| 85 | get
|
---|
| 86 | {
|
---|
| 87 | return _division;
|
---|
| 88 | }
|
---|
| 89 | set
|
---|
| 90 | {
|
---|
| 91 | throw new NotSupportedException("Division can not be set in EHR via BMX.");
|
---|
| 92 | }
|
---|
| 93 | }
|
---|
| 94 |
|
---|
| 95 | }
|
---|
| 96 | }
|
---|