No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

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

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Data;
  5. using be.gaudry.observer;
  6. using be.gaudry.bibliobrol.model.identity;
  7.  
  8. namespace be.gaudry.bibliobrol.model
  9. {
  10. [Serializable]
  11. public class Person : Observable
  12. {
  13. #region constructor and declarations
  14. private int id;
  15. private Identity identity;
  16.  
  17. /// <summary>
  18. /// Set to true when use in editing mode to avoid concurent modifications.
  19. /// If brolLocked, saving it is not allowed
  20. /// </summary>
  21. private bool edited;
  22.  
  23. public Person()
  24. {
  25. reinit(true);
  26. }
  27. public Person(int id, String lastName):this()
  28. {
  29. this.id = id;
  30. identity.LastName = lastName;
  31. }
  32. /// <summary>
  33. /// Create a person with only a lastName and a firstName.
  34. /// Person id has -1 value
  35. /// </summary>
  36. /// <param name="lastName">(String) lastName</param>
  37. /// <param name="firstName">(String) firstName</param>
  38. public Person(String lastName, String firstName)
  39. {
  40. reinit(true);
  41. identity.LastName = lastName;
  42. identity.FirstName = firstName;
  43. }
  44. #endregion
  45.  
  46. #region overrided methods
  47. public override String ToString()
  48. {
  49. if(identity!=null)
  50. return identity.ToString();
  51. return id.ToString();
  52. }
  53. public override int GetHashCode()
  54. {
  55. if (identity != null)
  56. return identity.GetHashCode();
  57. return id.GetHashCode();
  58. }
  59. public override bool Equals(Object o)
  60. {
  61. if (!(o is Person)) return false;
  62. Person p = (Person)o;
  63.  
  64. if (identity == null && p.identity == null)
  65. return id == p.id;
  66. return id == p.id && identity.Equals(p.identity);
  67. }
  68. #endregion
  69.  
  70. #region properties
  71. public int Id
  72. {
  73. get { return this.id; }
  74. set { this.id = value; }
  75. }
  76. /// <summary>
  77. /// Set to true when use in editing mode to avoid concurent modifications.
  78. /// If brolLocked, saving it is not allowed
  79. /// </summary>
  80. public bool Edited
  81. {
  82. get { return this.edited; }
  83. set { this.edited = value; }
  84. }
  85. #endregion
  86.  
  87. #region identity properties
  88. public String LastName
  89. {
  90. get { return identity.LastName; }
  91. set { identity.LastName = value; }
  92. }
  93. public String FirstName
  94. {
  95. get { return identity.FirstName; }
  96. set { identity.FirstName = value; }
  97. }
  98. public String Pseudo
  99. {
  100. get { return identity.Pseudo; }
  101. set { identity.Pseudo = value; }
  102. }
  103. public SEX Sex
  104. {
  105. // if not set, return first enum value
  106. // be sure than the first value is "_"
  107. get { return identity.Sex; }
  108. set { identity.Sex = value; }
  109. }
  110. public DateTime Birthdate
  111. {
  112. get { return identity.Birthdate; }
  113. set { identity.Birthdate = value; }
  114. }
  115. #endregion
  116.  
  117. #region public methods
  118. public void setIdentity(Identity identity)
  119. {
  120. this.identity = identity;
  121. }
  122. public Identity getIdentity()
  123. {
  124. return this.identity;
  125. }
  126. /// <summary>
  127. /// Create a person with all values from an other person
  128. /// </summary>
  129. /// <param name="person">(Person) person to copy</param>
  130. public void copy(Person person)
  131. {
  132. if (person != null)
  133. {
  134. try
  135. {
  136. id = person.id;
  137. edited = person.edited;
  138. //identity = person.identity is not allowed : copy references and not values
  139. LastName = person.LastName;
  140. FirstName = person.FirstName;
  141. Pseudo = person.Pseudo;
  142. Birthdate = person.Birthdate;
  143. Sex = person.Sex;
  144. }
  145. catch (Exception e)
  146. {
  147. notify(new Notification(Notification.VERBOSE.error, "Copie de personne", e, this));
  148. }
  149. }
  150. else
  151. {
  152. notify(new Notification(Notification.VERBOSE.error,"Copie de personne : impossible de copier une valeur nulle", this));
  153. }
  154. }
  155. /// <summary>
  156. /// Used to fill all field with default values
  157. /// </summary>
  158. /// <param name="total">(bool) Reset also person Id if true</param>
  159. public void reinit(bool total)
  160. {
  161. if(total)id = -1;
  162. edited = false;
  163. identity = new Identity();
  164. }
  165.  
  166. /// <summary>
  167. /// Used to get local sex name
  168. /// </summary>
  169. /// <param name="s">(SEX) sex</param>
  170. /// <returns>(String) local sex name</returns>
  171. public String getSexName(SEX s)
  172. {
  173. switch (s)
  174. {
  175. case SEX.F: return "Femme";
  176. case SEX.M: return "Homme";
  177. default: return "?";
  178. }
  179. }
  180. #endregion
  181. }
  182. }

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 octets1714936398 05/05/2024 21:13:18
| _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.

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.