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
Code c# (Brol.cs) (324 lignes)
using System; using System.Collections.Generic; using System.Text; namespace be.gaudry.bibliobrol.model { /// <summary> /// General item. It contains only informations about a general item, /// but not about a specific occurence item. /// I.E. we may have informations about a film, but not about the occurence /// of that film stored into the biblio. /// </summary> [Serializable] public class Brol : IBrol { #region constructors and declarations private int id, cotation; private String title, synopsis, comment; private List<BrolCategory> categories; private List<Actor> actors; private List<SerieItem> serieItems; private BrolType brolType; private DateTime date; private bool brolLocked; public Brol() : this(-1) { } public Brol(int id) : this(id, "", "") { } public Brol(int id, String title, String synopsis) { } public Brol(int id, String title, List<BrolCategory> categories, String synopsis, int cotation) : this(id, title, categories, synopsis, cotation, "") { } public Brol(int id, String title, List<BrolCategory> categories, String synopsis, int cotation, String comment) { } public Brol(int id, String title, List<BrolCategory> categories, String synopsis, int cotation, String comment, DateTime date) { this.id = id; this.cotation = cotation; this.title = title; this.synopsis = synopsis; this.comment = comment; this.categories = categories; this.date = date; } public Brol(Brol brol) { this.id = brol.id; this.title = brol.title; this.synopsis = brol.synopsis; this.comment = brol.comment; addCategories(brol.Categories); addActors(brol.Actors); this.brolType = brol.brolType; this.date = brol.date; this.brolLocked = brol.brolLocked; this.cotation = brol.cotation; } #endregion #region overrided methods public override String ToString() { return title; } public override int GetHashCode() { int PRIME = 31; int result = 1; result = PRIME * result + ((actors == null) ? 0 : actors.GetHashCode()); result = PRIME * result + (brolLocked ? 1231 : 1237); result = PRIME * result + ((brolType == null) ? 0 : brolType.GetHashCode()); result = PRIME * result + ((categories == null) ? 0 : categories.GetHashCode()); result = PRIME * result + ((comment == null) ? 0 : comment.GetHashCode()); result = PRIME * result + cotation; result = PRIME * result + ((date == null) ? 0 : date.GetHashCode()); result = PRIME * result + id; result = PRIME * result + ((serieItems == null) ? 0 : serieItems.GetHashCode()); result = PRIME * result + ((synopsis == null) ? 0 : synopsis.GetHashCode()); result = PRIME * result + ((title == null) ? 0 : title.GetHashCode()); return result; } public override bool Equals(Object obj) { /*if (this == o) return true; if (!(o is Brol)) return false; Brol b = (Brol)o; if (this.Id != b.Id) return false; if (!this.title.Equals(b.title)) return false; if (this.synopsis != null) { if (!this.synopsis.Equals(b.synopsis)) return false; } else if (b.synopsis!=null) return false; if (this.comment != null) { if (!this.comment.Equals(b.comment)) return false; } else if (b.comment != null) return false; if (!this.categories.Equals(b.categories)) return false; //if (!testCatEquals(this.categories, b.categories)) return false; if (!this.actors.Equals(b.actors)) return false; if (!this.brolType.Equals(b.brolType)) return false; if (!this.date.Equals(b.date)) return false; if (this.cotation != b.cotation) return false; return true;*/ if (this == obj) return true; if (obj == null) return false; return false; Brol other = (Brol) obj; if (id != other.id) return false; if (title == null) { if (other.title != null) return false; } else if (!title.Equals(other.title)) return false; if (synopsis == null) { if (other.synopsis != null) return false; } else if (!synopsis.Equals(other.synopsis)) return false; if (actors == null) { if (other.actors != null) return false; } else if (!actors.Equals(other.actors)) return false; if (brolType == null) { if (other.brolType != null) return false; } else if (!brolType.Equals(other.brolType)) return false; if (categories == null) { if (other.categories != null) return false; } else if (!categories.Equals(other.categories)) return false; if (comment == null) { if (other.comment != null) return false; } else if (!comment.Equals(other.comment)) return false; if (cotation != other.cotation) return false; if (date == null) { if (other.date != null) return false; } else if (!date.Equals(other.date)) return false; if (serieItems == null) { if (other.serieItems != null) return false; } else if (!serieItems.Equals(other.serieItems)) return false; return true; } /* private bool testCatEquals(List<BrolCategory> list1, List<BrolCategory> list2) { if (list1 == null || list1.Count == 0) { if (list2 == null || list2.Count == 0) return true; } if (list2 == null) return false; if (list1.Count != list2.Count) return false; bool catExist; for (int i = 0; i < (list1.Count - 1); i++) { catExist = false; for (int j = 0; j < (list2.Count - 1); j++) { if (list1[i].Equals(list2[j])) { catExist = true; break; } if (catExist == false) return false; } } return true; } */ #endregion #region getters and setters public int Id { get { return this.id; } set { this.id = value; } } public BrolType BrolType { get { return this.brolType; } set { this.brolType = value; } } public String Title { get { return this.title; } set { this.title = value; } } public String Synopsis { get { return this.synopsis; } set { this.synopsis = value; } } public String Comment { get { return this.comment; } set { this.comment = value; } } public List<BrolCategory> Categories { get { return this.categories; } set { this.categories = value; } } public int Cotation { get { return this.cotation; } set { this.cotation = value; } } public List<Actor> Actors { get { return this.actors; } set { this.actors = value; } } public List<SerieItem> SerieItems { get { return this.serieItems; } set { this.serieItems = value; } } public DateTime Date { get { return this.date; } set { this.date = value; } } /// <summary> /// Set to true when use in editing mode to avoid concurent modifications. /// If brolLocked, saving it is not allowed /// </summary> public bool BrolLocked { get { return this.brolLocked; } set { this.brolLocked = value; } } #endregion #region public methods public void addCategory(BrolCategory category) { categories.Add(category); } public void addCategories(List<BrolCategory> categories) { categories.AddRange(categories); } public void addActor(Actor actor) { actors.Add(actor); } public void addActors(List<Actor> actors) { actors.AddRange(actors); } public void addSerieItem(SerieItem serieItem) { serieItems.Add(serieItem); } public void addSerieItems(List<SerieItem> serieItems) { serieItems.AddRange(serieItems); } public BrolCategory getCategoryById(int id) { foreach (BrolCategory category in categories) { if (category.Id == id) { return category; } } return null; } public Actor getActorById(int id) { foreach (Actor actor in actors) { if (actor.Id == id) { return actor; } } return null; } #endregion } }
Structure et Fichiers du projet
Afficher/masquer...Icône | Nom | Taille | Modification |
Icône | Nom | Taille | Modification |
| _ | Répertoire parent | 0 octets | 1734887210 22/12/2024 18:06:50 |
| _ | identity | 0 octets | 1541007175 31/10/2018 18:32:55 |
| _ | eid | 0 octets | 1541007175 31/10/2018 18:32:55 |
| _ | LightObjects | 0 octets | 1541007175 31/10/2018 18:32:55 |
| _ | comparators | 0 octets | 1541007174 31/10/2018 18:32:54 |
| _ | aws | 0 octets | 1541007173 31/10/2018 18:32:53 |
| _ | enums | 0 octets | 1541007175 31/10/2018 18:32:55 |
| _ | dao | 0 octets | 1541007174 31/10/2018 18:32:54 |
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.
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 16/10/2009, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/cs-bibliobrol-source-rf-model//Brol.cs.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.