/DotNetNuke.Core/DotNetNuke.Entities.Users/UserProfile.cs
# · C# · 382 lines · 361 code · 21 blank · 0 comment · 80 complexity · e4b0da314b0057960a62681d18c8854f MD5 · raw file
- namespace DotNetNuke.Entities.Users
- {
- using DotNetNuke.Common.Utilities;
- using Microsoft.VisualBasic.CompilerServices;
- using System;
- using System.Collections;
- using System.Runtime.CompilerServices;
-
- public class UserProfile
- {
- private bool _ObjectHydrated;
- private Hashtable _profileProperties;
- private const string cCell = "Cell";
- private const string cCity = "City";
- private const string cCountry = "Country";
- private const string cFax = "Fax";
- private const string cFirstName = "FirstName";
- private const string cIM = "IM";
- private const string cLastName = "LastName";
- private const string cPostalCode = "PostalCode";
- private const string cPreferredLocale = "PreferredLocale";
- private const string cRegion = "Region";
- private const string cStreet = "Street";
- private const string cTelephone = "Telephone";
- private const string cTimeZone = "TimeZone";
- private const string cUnit = "Unit";
- private const string cWebsite = "Website";
-
- private void SetProfileProperty(string propName, object propValue)
- {
- if (this.ProfileProperties.ContainsKey(propName))
- {
- this._profileProperties[propName] = RuntimeHelpers.GetObjectValue(propValue);
- }
- else
- {
- this._profileProperties.Add(propName, RuntimeHelpers.GetObjectValue(propValue));
- }
- }
-
- public string Cell
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("Cell") || (this._profileProperties["Cell"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["Cell"].ToString();
- }
- set
- {
- this.SetProfileProperty("Cell", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public string City
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("City") || (this._profileProperties["City"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["City"].ToString();
- }
- set
- {
- this.SetProfileProperty("City", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public string Country
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("Country") || (this._profileProperties["Country"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["Country"].ToString();
- }
- set
- {
- this.SetProfileProperty("Country", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public string Fax
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("Fax") || (this._profileProperties["Fax"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["Fax"].ToString();
- }
- set
- {
- this.SetProfileProperty("Fax", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public string FirstName
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("FirstName") || (this._profileProperties["FirstName"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["FirstName"].ToString();
- }
- set
- {
- this.SetProfileProperty("FirstName", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public string FullName
- {
- get
- {
- return (this.FirstName + " " + this.LastName);
- }
- }
-
- public string IM
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("IM") || (this._profileProperties["IM"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["IM"].ToString();
- }
- set
- {
- this.SetProfileProperty("IM", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public string LastName
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("LastName") || (this._profileProperties["LastName"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["LastName"].ToString();
- }
- set
- {
- this.SetProfileProperty("LastName", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public bool ObjectHydrated
- {
- get
- {
- return this._ObjectHydrated;
- }
- set
- {
- this._ObjectHydrated = value;
- }
- }
-
- public string PostalCode
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("PostalCode") || (this._profileProperties["PostalCode"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["PostalCode"].ToString();
- }
- set
- {
- this.SetProfileProperty("PostalCode", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public string PreferredLocale
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("PreferredLocale") || (this._profileProperties["PreferredLocale"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["PreferredLocale"].ToString();
- }
- set
- {
- this.SetProfileProperty("PreferredLocale", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public Hashtable ProfileProperties
- {
- get
- {
- if (this._profileProperties == null)
- {
- this._profileProperties = new Hashtable();
- }
- return this._profileProperties;
- }
- set
- {
- if (this._profileProperties == null)
- {
- this._profileProperties = new Hashtable();
- }
- this._profileProperties = value;
- }
- }
-
- public string Region
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("Region") || (this._profileProperties["Region"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["Region"].ToString();
- }
- set
- {
- this.SetProfileProperty("Region", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public string Street
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("Street") || (this._profileProperties["Street"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["Street"].ToString();
- }
- set
- {
- this.SetProfileProperty("Street", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public string Telephone
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("Telephone") || (this._profileProperties["Telephone"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["Telephone"].ToString();
- }
- set
- {
- this.SetProfileProperty("Telephone", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public int TimeZone
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("TimeZone") || (this._profileProperties["TimeZone"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullInteger;
- }
- return Conversions.ToInteger(this._profileProperties["TimeZone"]);
- }
- set
- {
- this.SetProfileProperty("TimeZone", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public string Unit
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("Unit") || (this._profileProperties["Unit"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["Unit"].ToString();
- }
- set
- {
- this.SetProfileProperty("Unit", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
-
- public string Website
- {
- get
- {
- if (((!this._profileProperties.ContainsKey("Website") || (this._profileProperties["Website"] == null)) ? 1 : 0) != 0)
- {
- return Null.NullString;
- }
- return this._profileProperties["Website"].ToString();
- }
- set
- {
- this.SetProfileProperty("Website", value);
- if (!this.ObjectHydrated)
- {
- this.ObjectHydrated = true;
- }
- }
- }
- }
- }