NotificationService.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Reflection;
  3. using System.ServiceModel;
  4. using System.Threading;
  5. using System.ServiceModel.Activation;
  6. using System.Collections.Generic;
  7. using System.IO;
  8. using System.Runtime.Serialization;
  9. using System.Runtime.Serialization.Formatters.Binary;
  10. using Aitex.Core.RT.Log;
  11. namespace Aitex.Core.Account
  12. {
  13. /// <summary>
  14. /// NotificationService class
  15. /// </summary>
  16. public sealed class NotificationService
  17. {
  18. /// 客户电脑名
  19. /// </summary>
  20. public static string ClientHostName
  21. {
  22. get
  23. {
  24. //return OperationContext.Current.IncomingMessageHeaders.GetHeader<string>("IdentityClientName", "ns");
  25. return null;
  26. }
  27. }
  28. /// <summary>
  29. /// 客户用户名
  30. /// </summary>
  31. public static string ClientUserName
  32. {
  33. get
  34. {
  35. if (OperationContext.Current == null || OperationContext.Current.IncomingMessageHeaders == null)
  36. return "";
  37. var res = OperationContext.Current.IncomingMessageHeaders.FindHeader("IdentityUserName", "ns");
  38. if (res == -1)
  39. return "";
  40. return OperationContext.Current.IncomingMessageHeaders.GetHeader<string>("IdentityUserName", "ns");
  41. }
  42. }
  43. /// <summary>
  44. /// 客户端程序唯一的Guid编号
  45. /// </summary>
  46. public static Guid ClientGuid
  47. {
  48. get
  49. {
  50. //try
  51. //{
  52. // var guidStr = OperationContext.Current.IncomingMessageHeaders.GetHeader<string>("ClientGuid", "ns");
  53. // return Guid.Parse(guidStr);
  54. //}
  55. //catch (Exception ex)
  56. //{
  57. // LOG.Write(ex);
  58. //}
  59. return Guid.Empty;
  60. }
  61. }
  62. }
  63. }