/DotNetNuke.Core/DotNetNuke.Entities.Users/UserProfile.cs

# · C# · 382 lines · 361 code · 21 blank · 0 comment · 80 complexity · e4b0da314b0057960a62681d18c8854f MD5 · raw file

  1. namespace DotNetNuke.Entities.Users
  2. {
  3. using DotNetNuke.Common.Utilities;
  4. using Microsoft.VisualBasic.CompilerServices;
  5. using System;
  6. using System.Collections;
  7. using System.Runtime.CompilerServices;
  8. public class UserProfile
  9. {
  10. private bool _ObjectHydrated;
  11. private Hashtable _profileProperties;
  12. private const string cCell = "Cell";
  13. private const string cCity = "City";
  14. private const string cCountry = "Country";
  15. private const string cFax = "Fax";
  16. private const string cFirstName = "FirstName";
  17. private const string cIM = "IM";
  18. private const string cLastName = "LastName";
  19. private const string cPostalCode = "PostalCode";
  20. private const string cPreferredLocale = "PreferredLocale";
  21. private const string cRegion = "Region";
  22. private const string cStreet = "Street";
  23. private const string cTelephone = "Telephone";
  24. private const string cTimeZone = "TimeZone";
  25. private const string cUnit = "Unit";
  26. private const string cWebsite = "Website";
  27. private void SetProfileProperty(string propName, object propValue)
  28. {
  29. if (this.ProfileProperties.ContainsKey(propName))
  30. {
  31. this._profileProperties[propName] = RuntimeHelpers.GetObjectValue(propValue);
  32. }
  33. else
  34. {
  35. this._profileProperties.Add(propName, RuntimeHelpers.GetObjectValue(propValue));
  36. }
  37. }
  38. public string Cell
  39. {
  40. get
  41. {
  42. if (((!this._profileProperties.ContainsKey("Cell") || (this._profileProperties["Cell"] == null)) ? 1 : 0) != 0)
  43. {
  44. return Null.NullString;
  45. }
  46. return this._profileProperties["Cell"].ToString();
  47. }
  48. set
  49. {
  50. this.SetProfileProperty("Cell", value);
  51. if (!this.ObjectHydrated)
  52. {
  53. this.ObjectHydrated = true;
  54. }
  55. }
  56. }
  57. public string City
  58. {
  59. get
  60. {
  61. if (((!this._profileProperties.ContainsKey("City") || (this._profileProperties["City"] == null)) ? 1 : 0) != 0)
  62. {
  63. return Null.NullString;
  64. }
  65. return this._profileProperties["City"].ToString();
  66. }
  67. set
  68. {
  69. this.SetProfileProperty("City", value);
  70. if (!this.ObjectHydrated)
  71. {
  72. this.ObjectHydrated = true;
  73. }
  74. }
  75. }
  76. public string Country
  77. {
  78. get
  79. {
  80. if (((!this._profileProperties.ContainsKey("Country") || (this._profileProperties["Country"] == null)) ? 1 : 0) != 0)
  81. {
  82. return Null.NullString;
  83. }
  84. return this._profileProperties["Country"].ToString();
  85. }
  86. set
  87. {
  88. this.SetProfileProperty("Country", value);
  89. if (!this.ObjectHydrated)
  90. {
  91. this.ObjectHydrated = true;
  92. }
  93. }
  94. }
  95. public string Fax
  96. {
  97. get
  98. {
  99. if (((!this._profileProperties.ContainsKey("Fax") || (this._profileProperties["Fax"] == null)) ? 1 : 0) != 0)
  100. {
  101. return Null.NullString;
  102. }
  103. return this._profileProperties["Fax"].ToString();
  104. }
  105. set
  106. {
  107. this.SetProfileProperty("Fax", value);
  108. if (!this.ObjectHydrated)
  109. {
  110. this.ObjectHydrated = true;
  111. }
  112. }
  113. }
  114. public string FirstName
  115. {
  116. get
  117. {
  118. if (((!this._profileProperties.ContainsKey("FirstName") || (this._profileProperties["FirstName"] == null)) ? 1 : 0) != 0)
  119. {
  120. return Null.NullString;
  121. }
  122. return this._profileProperties["FirstName"].ToString();
  123. }
  124. set
  125. {
  126. this.SetProfileProperty("FirstName", value);
  127. if (!this.ObjectHydrated)
  128. {
  129. this.ObjectHydrated = true;
  130. }
  131. }
  132. }
  133. public string FullName
  134. {
  135. get
  136. {
  137. return (this.FirstName + " " + this.LastName);
  138. }
  139. }
  140. public string IM
  141. {
  142. get
  143. {
  144. if (((!this._profileProperties.ContainsKey("IM") || (this._profileProperties["IM"] == null)) ? 1 : 0) != 0)
  145. {
  146. return Null.NullString;
  147. }
  148. return this._profileProperties["IM"].ToString();
  149. }
  150. set
  151. {
  152. this.SetProfileProperty("IM", value);
  153. if (!this.ObjectHydrated)
  154. {
  155. this.ObjectHydrated = true;
  156. }
  157. }
  158. }
  159. public string LastName
  160. {
  161. get
  162. {
  163. if (((!this._profileProperties.ContainsKey("LastName") || (this._profileProperties["LastName"] == null)) ? 1 : 0) != 0)
  164. {
  165. return Null.NullString;
  166. }
  167. return this._profileProperties["LastName"].ToString();
  168. }
  169. set
  170. {
  171. this.SetProfileProperty("LastName", value);
  172. if (!this.ObjectHydrated)
  173. {
  174. this.ObjectHydrated = true;
  175. }
  176. }
  177. }
  178. public bool ObjectHydrated
  179. {
  180. get
  181. {
  182. return this._ObjectHydrated;
  183. }
  184. set
  185. {
  186. this._ObjectHydrated = value;
  187. }
  188. }
  189. public string PostalCode
  190. {
  191. get
  192. {
  193. if (((!this._profileProperties.ContainsKey("PostalCode") || (this._profileProperties["PostalCode"] == null)) ? 1 : 0) != 0)
  194. {
  195. return Null.NullString;
  196. }
  197. return this._profileProperties["PostalCode"].ToString();
  198. }
  199. set
  200. {
  201. this.SetProfileProperty("PostalCode", value);
  202. if (!this.ObjectHydrated)
  203. {
  204. this.ObjectHydrated = true;
  205. }
  206. }
  207. }
  208. public string PreferredLocale
  209. {
  210. get
  211. {
  212. if (((!this._profileProperties.ContainsKey("PreferredLocale") || (this._profileProperties["PreferredLocale"] == null)) ? 1 : 0) != 0)
  213. {
  214. return Null.NullString;
  215. }
  216. return this._profileProperties["PreferredLocale"].ToString();
  217. }
  218. set
  219. {
  220. this.SetProfileProperty("PreferredLocale", value);
  221. if (!this.ObjectHydrated)
  222. {
  223. this.ObjectHydrated = true;
  224. }
  225. }
  226. }
  227. public Hashtable ProfileProperties
  228. {
  229. get
  230. {
  231. if (this._profileProperties == null)
  232. {
  233. this._profileProperties = new Hashtable();
  234. }
  235. return this._profileProperties;
  236. }
  237. set
  238. {
  239. if (this._profileProperties == null)
  240. {
  241. this._profileProperties = new Hashtable();
  242. }
  243. this._profileProperties = value;
  244. }
  245. }
  246. public string Region
  247. {
  248. get
  249. {
  250. if (((!this._profileProperties.ContainsKey("Region") || (this._profileProperties["Region"] == null)) ? 1 : 0) != 0)
  251. {
  252. return Null.NullString;
  253. }
  254. return this._profileProperties["Region"].ToString();
  255. }
  256. set
  257. {
  258. this.SetProfileProperty("Region", value);
  259. if (!this.ObjectHydrated)
  260. {
  261. this.ObjectHydrated = true;
  262. }
  263. }
  264. }
  265. public string Street
  266. {
  267. get
  268. {
  269. if (((!this._profileProperties.ContainsKey("Street") || (this._profileProperties["Street"] == null)) ? 1 : 0) != 0)
  270. {
  271. return Null.NullString;
  272. }
  273. return this._profileProperties["Street"].ToString();
  274. }
  275. set
  276. {
  277. this.SetProfileProperty("Street", value);
  278. if (!this.ObjectHydrated)
  279. {
  280. this.ObjectHydrated = true;
  281. }
  282. }
  283. }
  284. public string Telephone
  285. {
  286. get
  287. {
  288. if (((!this._profileProperties.ContainsKey("Telephone") || (this._profileProperties["Telephone"] == null)) ? 1 : 0) != 0)
  289. {
  290. return Null.NullString;
  291. }
  292. return this._profileProperties["Telephone"].ToString();
  293. }
  294. set
  295. {
  296. this.SetProfileProperty("Telephone", value);
  297. if (!this.ObjectHydrated)
  298. {
  299. this.ObjectHydrated = true;
  300. }
  301. }
  302. }
  303. public int TimeZone
  304. {
  305. get
  306. {
  307. if (((!this._profileProperties.ContainsKey("TimeZone") || (this._profileProperties["TimeZone"] == null)) ? 1 : 0) != 0)
  308. {
  309. return Null.NullInteger;
  310. }
  311. return Conversions.ToInteger(this._profileProperties["TimeZone"]);
  312. }
  313. set
  314. {
  315. this.SetProfileProperty("TimeZone", value);
  316. if (!this.ObjectHydrated)
  317. {
  318. this.ObjectHydrated = true;
  319. }
  320. }
  321. }
  322. public string Unit
  323. {
  324. get
  325. {
  326. if (((!this._profileProperties.ContainsKey("Unit") || (this._profileProperties["Unit"] == null)) ? 1 : 0) != 0)
  327. {
  328. return Null.NullString;
  329. }
  330. return this._profileProperties["Unit"].ToString();
  331. }
  332. set
  333. {
  334. this.SetProfileProperty("Unit", value);
  335. if (!this.ObjectHydrated)
  336. {
  337. this.ObjectHydrated = true;
  338. }
  339. }
  340. }
  341. public string Website
  342. {
  343. get
  344. {
  345. if (((!this._profileProperties.ContainsKey("Website") || (this._profileProperties["Website"] == null)) ? 1 : 0) != 0)
  346. {
  347. return Null.NullString;
  348. }
  349. return this._profileProperties["Website"].ToString();
  350. }
  351. set
  352. {
  353. this.SetProfileProperty("Website", value);
  354. if (!this.ObjectHydrated)
  355. {
  356. this.ObjectHydrated = true;
  357. }
  358. }
  359. }
  360. }
  361. }