Brol.cs

Description du code

Brol.cs est un fichier du projet BiblioBrol.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/src/.

Projet BiblioBrol :

Gestion de media en CSharp.

Pour plus d'infos, vous pouvez consulter la brève analyse.

Code source ou contenu du fichier

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace be.gaudry.bibliobrol.model
  6. {
  7. /// <summary>
  8. /// General item. It contains only informations about a general item,
  9. /// but not about a specific occurence item.
  10. /// I.E. we may have informations about a film, but not about the occurence
  11. /// of that film stored into the biblio.
  12. /// </summary>
  13. [Serializable]
  14. public class Brol : IBrol
  15. {
  16. #region constructors and declarations
  17. private int id, cotation;
  18. private String title, synopsis, comment;
  19. private List<BrolCategory> categories;
  20. private List<Actor> actors;
  21. private List<SerieItem> serieItems;
  22. private BrolType brolType;
  23. private DateTime date;
  24. private bool brolLocked;
  25. public Brol()
  26. : this(-1)
  27. {
  28. }
  29. public Brol(int id)
  30. : this(id, "", "")
  31. {
  32. }
  33. public Brol(int id, String title, String synopsis)
  34. : this(id, title, new List<BrolCategory>(), synopsis, 0, "")
  35. {
  36. }
  37. public Brol(int id, String title, List<BrolCategory> categories, String synopsis, int cotation)
  38. : this(id, title, categories, synopsis, cotation, "")
  39. {
  40. }
  41. public Brol(int id, String title, List<BrolCategory> categories, String synopsis,
  42. int cotation, String comment)
  43. : this(id, title, categories, synopsis, cotation, comment, new DateTime(0L))
  44. {
  45. }
  46. public Brol(int id, String title, List<BrolCategory> categories, String synopsis,
  47. int cotation, String comment, DateTime date)
  48. {
  49. this.id = id;
  50. this.cotation = cotation;
  51. this.title = title;
  52. this.synopsis = synopsis;
  53. this.comment = comment;
  54. this.categories = categories;
  55. this.date = date;
  56. this.actors = new List<Actor>();
  57. this.serieItems = new List<SerieItem>();
  58. this.brolType = new BrolType();
  59. this.date = new DateTime(0L);
  60. }
  61.  
  62. public Brol(Brol brol)
  63. {
  64. this.id = brol.id;
  65. this.title = brol.title;
  66. this.synopsis = brol.synopsis;
  67. this.comment = brol.comment;
  68. categories = new List<BrolCategory>();
  69. addCategories(brol.Categories);
  70. actors = new List<Actor>();
  71. addActors(brol.Actors);
  72. this.brolType = brol.brolType;
  73. this.date = brol.date;
  74. this.brolLocked = brol.brolLocked;
  75. this.cotation = brol.cotation;
  76. }
  77. #endregion
  78.  
  79. #region overrided methods
  80. public override String ToString()
  81. {
  82. return title;
  83. }
  84. public override int GetHashCode()
  85. {
  86. int PRIME = 31;
  87. int result = 1;
  88. result = PRIME * result + ((actors == null) ? 0 : actors.GetHashCode());
  89. result = PRIME * result + (brolLocked ? 1231 : 1237);
  90. result = PRIME * result + ((brolType == null) ? 0 : brolType.GetHashCode());
  91. result = PRIME * result + ((categories == null) ? 0 : categories.GetHashCode());
  92. result = PRIME * result + ((comment == null) ? 0 : comment.GetHashCode());
  93. result = PRIME * result + cotation;
  94. result = PRIME * result + ((date == null) ? 0 : date.GetHashCode());
  95. result = PRIME * result + id;
  96. result = PRIME * result + ((serieItems == null) ? 0 : serieItems.GetHashCode());
  97. result = PRIME * result + ((synopsis == null) ? 0 : synopsis.GetHashCode());
  98. result = PRIME * result + ((title == null) ? 0 : title.GetHashCode());
  99. return result;
  100. }
  101. public override bool Equals(Object obj)
  102. {
  103. /*if (this == o) return true;
  104.   if (!(o is Brol)) return false;
  105.   Brol b = (Brol)o;
  106.   if (this.Id != b.Id) return false;
  107.   if (!this.title.Equals(b.title)) return false;
  108.   if (this.synopsis != null)
  109.   {
  110.   if (!this.synopsis.Equals(b.synopsis)) return false;
  111.   }
  112.   else
  113.   if (b.synopsis!=null) return false;
  114.   if (this.comment != null)
  115.   {
  116.   if (!this.comment.Equals(b.comment)) return false;
  117.   }
  118.   else
  119.   if (b.comment != null) return false;
  120.   if (!this.categories.Equals(b.categories)) return false;
  121.   //if (!testCatEquals(this.categories, b.categories)) return false;
  122.  
  123.   if (!this.actors.Equals(b.actors)) return false;
  124.   if (!this.brolType.Equals(b.brolType)) return false;
  125.   if (!this.date.Equals(b.date)) return false;
  126.   if (this.cotation != b.cotation) return false;
  127.   return true;*/
  128.  
  129. if (this == obj)
  130. return true;
  131. if (obj == null)
  132. return false;
  133. if (!(obj is Brol))
  134. return false;
  135. Brol other = (Brol) obj;
  136. if (id != other.id)
  137. return false;
  138. if (title == null) {
  139. if (other.title != null)
  140. return false;
  141. } else if (!title.Equals(other.title))
  142. return false;
  143. if (synopsis == null) {
  144. if (other.synopsis != null)
  145. return false;
  146. } else if (!synopsis.Equals(other.synopsis))
  147. return false;
  148. if (actors == null) {
  149. if (other.actors != null)
  150. return false;
  151. } else if (!actors.Equals(other.actors))
  152. return false;
  153. if (brolType == null) {
  154. if (other.brolType != null)
  155. return false;
  156. } else if (!brolType.Equals(other.brolType))
  157. return false;
  158. if (categories == null) {
  159. if (other.categories != null)
  160. return false;
  161. } else if (!categories.Equals(other.categories))
  162. return false;
  163. if (comment == null) {
  164. if (other.comment != null)
  165. return false;
  166. } else if (!comment.Equals(other.comment))
  167. return false;
  168. if (cotation != other.cotation)
  169. return false;
  170. if (date == null) {
  171. if (other.date != null)
  172. return false;
  173. } else if (!date.Equals(other.date))
  174. return false;
  175. if (serieItems == null) {
  176. if (other.serieItems != null)
  177. return false;
  178. } else if (!serieItems.Equals(other.serieItems))
  179. return false;
  180. return true;
  181.  
  182. }
  183. /*
  184.   private bool testCatEquals(List<BrolCategory> list1, List<BrolCategory> list2)
  185.   {
  186.   if (list1 == null || list1.Count == 0)
  187.   {
  188.   if (list2 == null || list2.Count == 0)
  189.   return true;
  190.   }
  191.   if (list2 == null) return false;
  192.   if (list1.Count != list2.Count)
  193.   return false;
  194.   bool catExist;
  195.   for (int i = 0; i < (list1.Count - 1); i++)
  196.   {
  197.   catExist = false;
  198.   for (int j = 0; j < (list2.Count - 1); j++)
  199.   {
  200.   if (list1[i].Equals(list2[j]))
  201.   {
  202.   catExist = true;
  203.   break;
  204.   }
  205.   if (catExist == false) return false;
  206.   }
  207.   }
  208.   return true;
  209.   }
  210.   */
  211. #endregion
  212.  
  213. #region getters and setters
  214. public int Id
  215. {
  216. get { return this.id; }
  217. set { this.id = value; }
  218. }
  219. public BrolType BrolType
  220. {
  221. get { return this.brolType; }
  222. set { this.brolType = value; }
  223. }
  224. public String Title
  225. {
  226. get { return this.title; }
  227. set { this.title = value; }
  228. }
  229. public String Synopsis
  230. {
  231. get { return this.synopsis; }
  232. set { this.synopsis = value; }
  233. }
  234. public String Comment
  235. {
  236. get { return this.comment; }
  237. set { this.comment = value; }
  238. }
  239. public List<BrolCategory> Categories
  240. {
  241. get { return this.categories; }
  242. set { this.categories = value; }
  243. }
  244. public int Cotation
  245. {
  246. get { return this.cotation; }
  247. set { this.cotation = value; }
  248. }
  249. public List<Actor> Actors
  250. {
  251. get { return this.actors; }
  252. set { this.actors = value; }
  253. }
  254. public List<SerieItem> SerieItems
  255. {
  256. get { return this.serieItems; }
  257. set { this.serieItems = value; }
  258. }
  259. public DateTime Date
  260. {
  261. get { return this.date; }
  262. set { this.date = value; }
  263. }
  264. /// <summary>
  265. /// Set to true when use in editing mode to avoid concurent modifications.
  266. /// If brolLocked, saving it is not allowed
  267. /// </summary>
  268. public bool BrolLocked
  269. {
  270. get { return this.brolLocked; }
  271. set { this.brolLocked = value; }
  272. }
  273. #endregion
  274.  
  275. #region public methods
  276. public void addCategory(BrolCategory category)
  277. {
  278. categories.Add(category);
  279. }
  280. public void addCategories(List<BrolCategory> categories)
  281. {
  282. categories.AddRange(categories);
  283. }
  284. public void addActor(Actor actor)
  285. {
  286. actors.Add(actor);
  287. }
  288. public void addActors(List<Actor> actors)
  289. {
  290. actors.AddRange(actors);
  291. }
  292. public void addSerieItem(SerieItem serieItem)
  293. {
  294. serieItems.Add(serieItem);
  295. }
  296. public void addSerieItems(List<SerieItem> serieItems)
  297. {
  298. serieItems.AddRange(serieItems);
  299. }
  300. public BrolCategory getCategoryById(int id)
  301. {
  302. foreach (BrolCategory category in categories)
  303. {
  304. if (category.Id == id)
  305. {
  306. return category;
  307. }
  308. }
  309. return null;
  310. }
  311. public Actor getActorById(int id)
  312. {
  313. foreach (Actor actor in actors)
  314. {
  315. if (actor.Id == id)
  316. {
  317. return actor;
  318. }
  319. }
  320. return null;
  321. }
  322. #endregion
  323. }
  324. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/src/model/ 
IcôneNomTailleModification
IcôneNomTailleModification
| _ Répertoire parent0 octets1715117834 07/05/2024 23:37:14
| _identity0 octets1541007175 31/10/2018 18:32:55
| _eid0 octets1541007175 31/10/2018 18:32:55
| _LightObjects0 octets1541007175 31/10/2018 18:32:55
| _comparators0 octets1541007174 31/10/2018 18:32:54
| _aws0 octets1541007173 31/10/2018 18:32:53
| _enums0 octets1541007175 31/10/2018 18:32:55
| _dao0 octets1541007174 31/10/2018 18:32:54
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/src/model/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csPhone.cs4.32 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csPerson.cs5.49 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csActor.cs3.86 Ko31/10/2018 18:32:23-refusé-
Afficher le fichier .cs|.csBrolType.cs1.05 Ko31/10/2018 18:32:23-refusé-
Afficher le fichier .cs|.csGenericContainer.cs1.41 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csStatus.cs1.24 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csQuality.cs2.2 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csIBrol.cs252 octets31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csIIdentityFull.cs1.18 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csBrol.cs10.49 Ko31/10/2018 18:32:23-refusé-
Afficher le fichier .cs|.csUser.cs5.17 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csMedia.cs2.04 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csCounter.cs1.17 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csSerieItem.cs1.42 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csIIdentityLight.cs333 octets31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csBorrow.cs2.45 Ko31/10/2018 18:32:23-refusé-
Afficher le fichier .cs|.csTask.cs3.01 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csMediaBrol.cs4.97 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csBrolCategory.cs856 octets31/10/2018 18:32:23-refusé-
Afficher le fichier .cs|.csGenericStateContainer.cs777 octets31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csSerie.cs688 octets31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csModelAdapter.cs33.51 Ko31/10/2018 18:32:24-refusé-
Afficher le fichier .cs|.csActorRole.cs2.72 Ko31/10/2018 18:32:23-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

Document créé le 16/10/2009, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/cs-bibliobrol-source-rf-model/Brol.cs.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.