PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/mojoPortal.Business/ContentMeta.cs

#
C# | 187 lines | 135 code | 17 blank | 35 comment | 0 complexity | 827bd394a94be9fcd6d238f7be1ecbf7 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause, CPL-1.0, CC-BY-SA-3.0, GPL-2.0
  1. // Author: Joe Audette
  2. // Created: 2009-12-02
  3. // Last Modified: 2009-12-02
  4. //
  5. // The use and distribution terms for this software are covered by the
  6. // Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
  7. // which can be found in the file CPL.TXT at the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by
  9. // the terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. using System;
  13. using System.Collections;
  14. using System.Collections.Generic;
  15. using System.Data;
  16. using mojoPortal.Data;
  17. namespace mojoPortal.Business
  18. {
  19. public class ContentMeta
  20. {
  21. public ContentMeta()
  22. { }
  23. #region Private Properties
  24. private Guid guid = Guid.Empty;
  25. private Guid siteGuid = Guid.Empty;
  26. private Guid moduleGuid = Guid.Empty;
  27. private Guid contentGuid = Guid.Empty;
  28. private string name = string.Empty;
  29. private string scheme = string.Empty;
  30. private string langCode = string.Empty;
  31. private string dir = string.Empty;
  32. private string metaContent = string.Empty;
  33. private int sortRank = 0;
  34. private DateTime createdUtc = DateTime.UtcNow;
  35. private Guid createdBy = Guid.Empty;
  36. private DateTime lastModUtc = DateTime.UtcNow;
  37. private Guid lastModBy = Guid.Empty;
  38. #endregion
  39. #region Public Properties
  40. public Guid Guid
  41. {
  42. get { return guid; }
  43. set { guid = value; }
  44. }
  45. public Guid SiteGuid
  46. {
  47. get { return siteGuid; }
  48. set { siteGuid = value; }
  49. }
  50. public Guid ModuleGuid
  51. {
  52. get { return moduleGuid; }
  53. set { moduleGuid = value; }
  54. }
  55. public Guid ContentGuid
  56. {
  57. get { return contentGuid; }
  58. set { contentGuid = value; }
  59. }
  60. public string Name
  61. {
  62. get { return name; }
  63. set { name = value; }
  64. }
  65. public string Scheme
  66. {
  67. get { return scheme; }
  68. set { scheme = value; }
  69. }
  70. public string LangCode
  71. {
  72. get { return langCode; }
  73. set { langCode = value; }
  74. }
  75. public string Dir
  76. {
  77. get { return dir; }
  78. set { dir = value; }
  79. }
  80. public string MetaContent
  81. {
  82. get { return metaContent; }
  83. set { metaContent = value; }
  84. }
  85. public int SortRank
  86. {
  87. get { return sortRank; }
  88. set { sortRank = value; }
  89. }
  90. public DateTime CreatedUtc
  91. {
  92. get { return createdUtc; }
  93. set { createdUtc = value; }
  94. }
  95. public Guid CreatedBy
  96. {
  97. get { return createdBy; }
  98. set { createdBy = value; }
  99. }
  100. public DateTime LastModUtc
  101. {
  102. get { return lastModUtc; }
  103. set { lastModUtc = value; }
  104. }
  105. public Guid LastModBy
  106. {
  107. get { return lastModBy; }
  108. set { lastModBy = value; }
  109. }
  110. #endregion
  111. #region Comparison Methods
  112. /// <summary>
  113. /// Compares 2 instances of ContentMeta.
  114. /// </summary>
  115. public static int CompareByName(ContentMeta contentMeta1, ContentMeta contentMeta2)
  116. {
  117. return contentMeta1.Name.CompareTo(contentMeta2.Name);
  118. }
  119. /// <summary>
  120. /// Compares 2 instances of ContentMeta.
  121. /// </summary>
  122. public static int CompareByScheme(ContentMeta contentMeta1, ContentMeta contentMeta2)
  123. {
  124. return contentMeta1.Scheme.CompareTo(contentMeta2.Scheme);
  125. }
  126. /// <summary>
  127. /// Compares 2 instances of ContentMeta.
  128. /// </summary>
  129. public static int CompareByLangCode(ContentMeta contentMeta1, ContentMeta contentMeta2)
  130. {
  131. return contentMeta1.LangCode.CompareTo(contentMeta2.LangCode);
  132. }
  133. /// <summary>
  134. /// Compares 2 instances of ContentMeta.
  135. /// </summary>
  136. public static int CompareByDir(ContentMeta contentMeta1, ContentMeta contentMeta2)
  137. {
  138. return contentMeta1.Dir.CompareTo(contentMeta2.Dir);
  139. }
  140. /// <summary>
  141. /// Compares 2 instances of ContentMeta.
  142. /// </summary>
  143. public static int CompareByMetaContent(ContentMeta contentMeta1, ContentMeta contentMeta2)
  144. {
  145. return contentMeta1.MetaContent.CompareTo(contentMeta2.MetaContent);
  146. }
  147. /// <summary>
  148. /// Compares 2 instances of ContentMeta.
  149. /// </summary>
  150. public static int CompareBySortRank(ContentMeta contentMeta1, ContentMeta contentMeta2)
  151. {
  152. return contentMeta1.SortRank.CompareTo(contentMeta2.SortRank);
  153. }
  154. /// <summary>
  155. /// Compares 2 instances of ContentMeta.
  156. /// </summary>
  157. public static int CompareByCreatedUtc(ContentMeta contentMeta1, ContentMeta contentMeta2)
  158. {
  159. return contentMeta1.CreatedUtc.CompareTo(contentMeta2.CreatedUtc);
  160. }
  161. /// <summary>
  162. /// Compares 2 instances of ContentMeta.
  163. /// </summary>
  164. public static int CompareByLastModUtc(ContentMeta contentMeta1, ContentMeta contentMeta2)
  165. {
  166. return contentMeta1.LastModUtc.CompareTo(contentMeta2.LastModUtc);
  167. }
  168. #endregion
  169. }
  170. }