GrantAccount.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace COSXML.Model.Tag
  5. {
  6. /// <summary>
  7. /// 授予者信息
  8. /// </summary>
  9. public sealed class GrantAccount
  10. {
  11. internal List<string> idList;
  12. public GrantAccount()
  13. {
  14. idList = new List<string>();
  15. }
  16. /// <summary>
  17. /// ownerUin,根账号
  18. /// subUin,子账号
  19. /// </summary>
  20. /// <param name="ownerUin"></param>
  21. /// <param name="subUin"></param>
  22. public void AddGrantAccount(string ownerUin, string subUin)
  23. {
  24. if (ownerUin != null && subUin != null)
  25. {
  26. idList.Add(String.Format("id=\"qcs::cam::uin/{0}:uin/{1}\"", ownerUin, subUin));
  27. }
  28. }
  29. public string GetGrantAccounts()
  30. {
  31. StringBuilder idBuilder = new StringBuilder();
  32. foreach (string id in idList)
  33. {
  34. idBuilder.Append(id).Append(",");
  35. }
  36. string idStr = idBuilder.ToString();
  37. int last = idStr.LastIndexOf(",");
  38. if (last > 0)
  39. {
  40. return idStr.Substring(0, last);
  41. }
  42. return null;
  43. }
  44. }
  45. }