UserDto.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using MediaBrowser.Model.Configuration;
  2. using System;
  3. using System.ComponentModel;
  4. using System.Diagnostics;
  5. using System.Runtime.Serialization;
  6. using MediaBrowser.Model.Extensions;
  7. namespace MediaBrowser.Model.Dto
  8. {
  9. /// <summary>
  10. /// Class UserDto
  11. /// </summary>
  12. [DebuggerDisplay("Name = {Name}, ID = {Id}, HasPassword = {HasPassword}")]
  13. public class UserDto : IHasPropertyChangedEvent, IItemDto
  14. {
  15. /// <summary>
  16. /// Gets or sets the name.
  17. /// </summary>
  18. /// <value>The name.</value>
  19. public string Name { get; set; }
  20. /// <summary>
  21. /// Gets or sets the id.
  22. /// </summary>
  23. /// <value>The id.</value>
  24. public string Id { get; set; }
  25. /// <summary>
  26. /// Gets or sets the primary image tag.
  27. /// </summary>
  28. /// <value>The primary image tag.</value>
  29. public string PrimaryImageTag { get; set; }
  30. /// <summary>
  31. /// Gets or sets a value indicating whether this instance has password.
  32. /// </summary>
  33. /// <value><c>true</c> if this instance has password; otherwise, <c>false</c>.</value>
  34. public bool HasPassword { get; set; }
  35. /// <summary>
  36. /// Gets or sets the last login date.
  37. /// </summary>
  38. /// <value>The last login date.</value>
  39. public DateTime? LastLoginDate { get; set; }
  40. /// <summary>
  41. /// Gets or sets the last activity date.
  42. /// </summary>
  43. /// <value>The last activity date.</value>
  44. public DateTime? LastActivityDate { get; set; }
  45. /// <summary>
  46. /// Gets or sets the configuration.
  47. /// </summary>
  48. /// <value>The configuration.</value>
  49. public UserConfiguration Configuration { get; set; }
  50. /// <summary>
  51. /// Gets or sets the primary image aspect ratio.
  52. /// </summary>
  53. /// <value>The primary image aspect ratio.</value>
  54. public double? PrimaryImageAspectRatio { get; set; }
  55. /// <summary>
  56. /// Gets or sets the original primary image aspect ratio.
  57. /// </summary>
  58. /// <value>The original primary image aspect ratio.</value>
  59. public double? OriginalPrimaryImageAspectRatio { get; set; }
  60. /// <summary>
  61. /// Gets a value indicating whether this instance has primary image.
  62. /// </summary>
  63. /// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>
  64. [IgnoreDataMember]
  65. public bool HasPrimaryImage
  66. {
  67. get { return PrimaryImageTag != null; }
  68. }
  69. /// <summary>
  70. /// Initializes a new instance of the <see cref="UserDto"/> class.
  71. /// </summary>
  72. public UserDto()
  73. {
  74. Configuration = new UserConfiguration();
  75. }
  76. /// <summary>
  77. /// Occurs when [property changed].
  78. /// </summary>
  79. public event PropertyChangedEventHandler PropertyChanged;
  80. public override string ToString()
  81. {
  82. return Name ?? base.ToString();
  83. }
  84. }
  85. }