Person.cs
Description du code
Person.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# (Person.cs) (182 lignes)
using System; using System.Collections.Generic; using System.Text; using System.Data; using be.gaudry.observer; using be.gaudry.bibliobrol.model.identity; namespace be.gaudry.bibliobrol.model { [Serializable] public class Person : Observable { #region constructor and declarations private int id; private Identity identity; /// <summary> /// Set to true when use in editing mode to avoid concurent modifications. /// If brolLocked, saving it is not allowed /// </summary> private bool edited; public Person() { reinit(true); } public Person(int id, String lastName):this() { this.id = id; identity.LastName = lastName; } /// <summary> /// Create a person with only a lastName and a firstName. /// Person id has -1 value /// </summary> /// <param name="lastName">(String) lastName</param> /// <param name="firstName">(String) firstName</param> public Person(String lastName, String firstName) { reinit(true); identity.LastName = lastName; identity.FirstName = firstName; } #endregion #region overrided methods public override String ToString() { if(identity!=null) return identity.ToString(); return id.ToString(); } public override int GetHashCode() { if (identity != null) return identity.GetHashCode(); return id.GetHashCode(); } public override bool Equals(Object o) { Person p = (Person)o; if (identity == null && p.identity == null) return id == p.id; return id == p.id && identity.Equals(p.identity); } #endregion #region properties public int Id { get { return this.id; } set { this.id = value; } } /// <summary> /// Set to true when use in editing mode to avoid concurent modifications. /// If brolLocked, saving it is not allowed /// </summary> public bool Edited { get { return this.edited; } set { this.edited = value; } } #endregion #region identity properties public String LastName { get { return identity.LastName; } set { identity.LastName = value; } } public String FirstName { get { return identity.FirstName; } set { identity.FirstName = value; } } public String Pseudo { get { return identity.Pseudo; } set { identity.Pseudo = value; } } public SEX Sex { // if not set, return first enum value // be sure than the first value is "_" get { return identity.Sex; } set { identity.Sex = value; } } public DateTime Birthdate { get { return identity.Birthdate; } set { identity.Birthdate = value; } } #endregion #region public methods public void setIdentity(Identity identity) { this.identity = identity; } public Identity getIdentity() { return this.identity; } /// <summary> /// Create a person with all values from an other person /// </summary> /// <param name="person">(Person) person to copy</param> public void copy(Person person) { if (person != null) { try { id = person.id; edited = person.edited; //identity = person.identity is not allowed : copy references and not values LastName = person.LastName; FirstName = person.FirstName; Pseudo = person.Pseudo; Birthdate = person.Birthdate; Sex = person.Sex; } catch (Exception e) { } } else { notify(new Notification(Notification.VERBOSE.error,"Copie de personne : impossible de copier une valeur nulle", this)); } } /// <summary> /// Used to fill all field with default values /// </summary> /// <param name="total">(bool) Reset also person Id if true</param> public void reinit(bool total) { if(total)id = -1; edited = false; } /// <summary> /// Used to get local sex name /// </summary> /// <param name="s">(SEX) sex</param> /// <returns>(String) local sex name</returns> public String getSexName(SEX s) { switch (s) { case SEX.F: return "Femme"; case SEX.M: return "Homme"; default: return "?"; } } #endregion } }
Structure et Fichiers du projet
Afficher/masquer...Icône | Nom | Taille | Modification |
Icône | Nom | Taille | Modification |
| _ | Répertoire parent | 0 octets | 1731728297 16/11/2024 04:38:17 |
| _ | 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//Person.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.