| 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.WinForm.Model
|
|---|
| 8 | {
|
|---|
| 9 | internal class WinUser : WinObject, User, IDisposable
|
|---|
| 10 | {
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 | public bool HasSecurityKey(String aString)
|
|---|
| 14 | {
|
|---|
| 15 | return "-1".Equals(this.RemoteSession.TransmitRPC("BMX SECURITY KEY", aString));
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | public List<string> RequestKeys()
|
|---|
| 19 | {
|
|---|
| 20 | try
|
|---|
| 21 | {
|
|---|
| 22 | List<String> keys = new List<string>();
|
|---|
| 23 |
|
|---|
| 24 | DataTable result = this.RemoteSession.TableFromCommand("BMXUserKeyRS^" + this.Ien);
|
|---|
| 25 |
|
|---|
| 26 | foreach (DataRow each in result.Rows)
|
|---|
| 27 | {
|
|---|
| 28 | String key = each["KEY"].ToString().Trim();
|
|---|
| 29 | if (key.Length > 0)
|
|---|
| 30 | {
|
|---|
| 31 | keys.Add(key);
|
|---|
| 32 | }
|
|---|
| 33 | }
|
|---|
| 34 | return keys;
|
|---|
| 35 |
|
|---|
| 36 | }
|
|---|
| 37 | catch (Exception problem)
|
|---|
| 38 | {
|
|---|
| 39 | throw new BMXNetException("User key listing unavailable.", problem);
|
|---|
| 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 | #region IDisposable Members
|
|---|
| 63 |
|
|---|
| 64 | public void Dispose()
|
|---|
| 65 | {
|
|---|
| 66 | throw new NotImplementedException();
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | #endregion
|
|---|
| 70 |
|
|---|
| 71 | public String Duz
|
|---|
| 72 | {
|
|---|
| 73 | get { return this.Ien; }
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 | private String _name;
|
|---|
| 78 |
|
|---|
| 79 | public String Name
|
|---|
| 80 | {
|
|---|
| 81 | get { return _name; }
|
|---|
| 82 | set { _name = value; }
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 | private Division _division = null;
|
|---|
| 87 |
|
|---|
| 88 | public Division Division
|
|---|
| 89 | {
|
|---|
| 90 | get { return _division; }
|
|---|
| 91 | set { _division = value; }
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 | }
|
|---|
| 97 | }
|
|---|