private void SetProfileProperties(Saml.Response response, UserInfo uInfo) { try { Dictionary <string, string> properties = new Dictionary <string, string>(); ProfilePropertyDefinitionCollection props = ProfileController.GetPropertyDefinitionsByPortal(PortalSettings.PortalId); foreach (ProfilePropertyDefinition def in props) { string SAMLPropertyName = config.getProfilePropertySAMLName(def.PropertyName); if (SAMLPropertyName != "") { properties.Add(def.PropertyName, response.GetUserProperty(SAMLPropertyName)); } } foreach (KeyValuePair <string, string> kvp in properties) { uInfo.Profile.SetProfileProperty(kvp.Key, kvp.Value); } ProfileController.UpdateUserProfile(uInfo); } catch (Exception exc) { LogToEventLog("DNN.Authentication.SAML.SetProfileProperties", string.Format("Exception {0}", exc.Message)); } }
/// ----------------------------------------------------------------------------- /// <summary> /// DataBind binds the data to the controls /// </summary> /// <history> /// [cnurse] 03/01/2006 Created /// </history> /// ----------------------------------------------------------------------------- public override void DataBind() { if (IsAdmin) { lblTitle.Text = string.Format(Localization.GetString("ProfileTitle.Text", LocalResourceFile), User.Username, User.UserID); } else if (IsRegister) { lblTitle.Text = Localization.GetString("RequireProfile.Text", LocalResourceFile); } else { divTitle.Visible = false; } //Before we bind the Profile to the editor we need to "update" the visible data ProfilePropertyDefinitionCollection properties = new ProfilePropertyDefinitionCollection(); foreach (ProfilePropertyDefinition profProperty in UserProfile.ProfileProperties) { if (IsAdmin && !IsProfile) { profProperty.Visible = true; } if (!profProperty.Deleted) { properties.Add(profProperty); } } ProfileProperties.ShowVisibility = ShowVisibility; ProfileProperties.DataSource = properties; ProfileProperties.DataBind(); }
/// ----------------------------------------------------------------------------- /// <summary> /// CreateEditor creates the control collection. /// </summary> /// <history> /// [cnurse] 05/08/2006 created /// </history> /// ----------------------------------------------------------------------------- protected override void CreateEditor() { CategoryDataField = "PropertyCategory"; EditorDataField = "DataType"; NameDataField = "PropertyName"; RequiredDataField = "Required"; ValidationExpressionDataField = "ValidationExpression"; ValueDataField = "PropertyValue"; VisibleDataField = "Visible"; VisibilityDataField = "ProfileVisibility"; LengthDataField = "Length"; base.CreateEditor(); foreach (FieldEditorControl editor in Fields) { //Check whether Field is readonly string fieldName = editor.Editor.Name; ProfilePropertyDefinitionCollection definitions = editor.DataSource as ProfilePropertyDefinitionCollection; ProfilePropertyDefinition definition = definitions[fieldName]; if (definition != null && definition.ReadOnly && (editor.Editor.EditMode == PropertyEditorMode.Edit)) { PortalSettings ps = PortalController.Instance.GetCurrentPortalSettings(); if (!PortalSecurity.IsInRole(ps.AdministratorRoleName)) { editor.Editor.EditMode = PropertyEditorMode.View; } } //We need to wire up the RegionControl to the CountryControl if (editor.Editor is DNNRegionEditControl) { string country = null; foreach (FieldEditorControl checkEditor in Fields) { if (checkEditor.Editor is DNNCountryEditControl) { var countryEdit = (DNNCountryEditControl)checkEditor.Editor; country = Convert.ToString(countryEdit.Value); } } //Create a ListAttribute for the Region string countryKey; if (country != null) { countryKey = "Country." + country; } else { countryKey = "Country.Unknown"; } var attributes = new object[1]; attributes[0] = new ListAttribute("Region", countryKey, ListBoundField.Value, ListBoundField.Text); editor.Editor.CustomAttributes = attributes; } } }
/// <summary> /// This method is responsible for taking in posted information from the grid and /// persisting it to the property definition collection /// </summary> /// <history> /// [Jon Henning] 03/12/2006 created /// </history> private void ProcessPostBack() { try { ProfilePropertyDefinitionCollection objProperties = GetProperties(); string[] aryNewOrder = ClientAPI.GetClientSideReorder(this.grdProfileProperties.ClientID, this.Page); for (int i = 0; i < this.grdProfileProperties.Items.Count; i++) { DataGridItem objItem = this.grdProfileProperties.Items[i]; ProfilePropertyDefinition objProperty = objProperties[i]; CheckBox chk = (CheckBox)objItem.Cells[COLUMN_REQUIRED].Controls[0]; objProperty.Required = chk.Checked; chk = (CheckBox)objItem.Cells[COLUMN_VISIBLE].Controls[0]; objProperty.Visible = chk.Checked; } //assign vieworder for (int i = 0; i < aryNewOrder.Length; i++) { objProperties[Convert.ToInt32(aryNewOrder[i])].ViewOrder = i; } objProperties.Sort(); } catch (Exception ex) { throw (ex); } }
/// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 03/01/2006 /// </history> protected void Page_Load(Object sender, EventArgs e) { try { //Before we bind the Profile to the editor we need to "update" the visibility data ProfilePropertyDefinitionCollection properties = ctlProfile.UserProfile.ProfileProperties; foreach (ProfilePropertyDefinition profProperty in properties) { if (profProperty.Visible) { //Check Visibility if (profProperty.Visibility == UserVisibilityMode.AdminOnly) { //Only Visible if Admin (or self) profProperty.Visible = IsAdmin || IsUser; } else if (profProperty.Visibility == UserVisibilityMode.MembersOnly) { //Only Visible if Is a Member (ie Authenticated) profProperty.Visible = Request.IsAuthenticated; } } } //Bind the profile information to the control ctlProfile.DataBind(); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// DataBind binds the data to the controls /// </summary> /// <history> /// [cnurse] 03/01/2006 Created /// </history> public override void DataBind() { if (IsAdmin) { lblTitle.Text = string.Format(Localization.GetString("ProfileTitle.Text", LocalResourceFile), User.Username, User.UserID); } else { trTitle.Visible = false; } //Before we bind the Profile to the editor we need to "update" the visible data ProfilePropertyDefinitionCollection properties = UserProfile.ProfileProperties; foreach (ProfilePropertyDefinition profProperty in properties) { if (IsAdmin) { profProperty.Visible = true; } } ProfileProperties.ShowVisibility = ShowVisibility; ProfileProperties.DataSource = UserProfile.ProfileProperties; ProfileProperties.DataBind(); }
private void UpdateTimeZoneInfo(UserInfo user, ProfilePropertyDefinitionCollection properties) { ProfilePropertyDefinition newTimeZone = properties["PreferredTimeZone"]; ProfilePropertyDefinition oldTimeZone = properties["TimeZone"]; if (newTimeZone != null && oldTimeZone != null) { //Old timezone is present but new is not...we will set that up. if (!string.IsNullOrEmpty(oldTimeZone.PropertyValue) && string.IsNullOrEmpty(newTimeZone.PropertyValue)) { int oldOffset; int.TryParse(oldTimeZone.PropertyValue, out oldOffset); TimeZoneInfo timeZoneInfo = Localization.ConvertLegacyTimeZoneOffsetToTimeZoneInfo(oldOffset); newTimeZone.PropertyValue = timeZoneInfo.Id; UpdateUserProfile(user); } //It's also possible that the new value is set but not the old value. We need to make them backwards compatible else if (!string.IsNullOrEmpty(newTimeZone.PropertyValue) && string.IsNullOrEmpty(oldTimeZone.PropertyValue)) { TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(newTimeZone.PropertyValue); if (timeZoneInfo != null) { oldTimeZone.PropertyValue = timeZoneInfo.BaseUtcOffset.TotalMinutes.ToString(CultureInfo.InvariantCulture); } } } }
public static Dictionary <string, string> GetLocalizedCategories(ProfilePropertyDefinitionCollection ProfileProperties, UserInfo userInfo, bool isUpdateProfile = false) { Dictionary <string, string> CategoriesKeyValue = new Dictionary <string, string>(); List <string> PropertiesByCategories = new List <string>(); if (isUpdateProfile) { PropertiesByCategories = ProfileProperties.Cast <ProfilePropertyDefinition>().Where(x => !CannotDeleteProperty.Contains(x.PropertyName)).Select(x => x.PropertyCategory).Distinct().ToList(); } else { PropertiesByCategories = ProfileProperties.Cast <ProfilePropertyDefinition>().Where(x => CheckAccessLevel(x, userInfo) && !CannotDeleteProperty.Contains(x.PropertyName)).Select(x => x.PropertyCategory).Distinct().ToList(); } foreach (string Category in PropertiesByCategories) { var localizedCategoryName = Localization.GetString("ProfileProperties_" + Category + ".Header", Components.Constants.DnnUserProfileResourcesFile, PortalSettings.Current.CultureCode); if (string.IsNullOrEmpty(localizedCategoryName)) { localizedCategoryName = Category; } CategoriesKeyValue.Add(Category, localizedCategoryName); } return(CategoriesKeyValue); }
/// <summary> /// Deletes a property /// </summary> /// <param name="index">The index of the Property to delete</param> /// <history> /// [cnurse] 02/23/2006 created /// </history> private void DeleteProperty(int index) { ProfilePropertyDefinitionCollection profileProperties = GetProperties(); ProfilePropertyDefinition objProperty = profileProperties[index]; ProfileController.DeletePropertyDefinition(objProperty); RefreshGrid(); }
/// ----------------------------------------------------------------------------- /// <summary> /// Initialises the Profile with an empty collection of profile properties /// </summary> /// <remarks></remarks> /// <param name="portalId">The name of the property to retrieve.</param> /// <param name="useDefaults">A flag that indicates whether the profile default values should be /// copied to the Profile.</param> /// <history> /// [cnurse] 08/04/2006 Created /// </history> /// ----------------------------------------------------------------------------- public void InitialiseProfile(int portalId, bool useDefaults) { _profileProperties = ProfileController.GetPropertyDefinitionsByPortal(portalId, true, false); if (useDefaults) { foreach (ProfilePropertyDefinition ProfileProperty in _profileProperties) { ProfileProperty.PropertyValue = ProfileProperty.DefaultValue; } } }
/// <summary> /// UpdateUserProfile persists a user's Profile to the Data Store /// </summary> /// <remarks> /// </remarks> /// <param name="user">The user to persist to the Data Store.</param> /// <history> /// [cnurse] 03/29/2006 Created /// </history> public override void UpdateUserProfile(UserInfo user) { ProfilePropertyDefinitionCollection properties = user.Profile.ProfileProperties; foreach (ProfilePropertyDefinition profProperty in properties) { if ((profProperty.PropertyValue != null) && (profProperty.IsDirty)) { dataProvider.UpdateProfileProperty(Null.NullInteger, user.UserID, profProperty.PropertyDefinitionId, profProperty.PropertyValue, (int)profProperty.Visibility, DateTime.Now); } } }
private void BindSearchOptions() { ddlSearchType.Items.Add(AddSearchItem("RoleName")); ddlSearchType.Items.Add(AddSearchItem("Email")); ddlSearchType.Items.Add(AddSearchItem("Username")); ProfilePropertyDefinitionCollection profileProperties = ProfileController.GetPropertyDefinitionsByPortal(PortalId, false); foreach (ProfilePropertyDefinition definition in profileProperties) { ddlSearchType.Items.Add(AddSearchItem(definition.PropertyName)); } }
/// <summary> /// Updates any "dirty" properties /// </summary> /// <history> /// [cnurse] 02/23/2006 created /// </history> private void UpdateProperties() { ProfilePropertyDefinitionCollection profileProperties = GetProperties(); foreach (ProfilePropertyDefinition objProperty in profileProperties) { if (objProperty.IsDirty) { ProfileController.UpdatePropertyDefinition(objProperty); } } ClearCachedProperties(); }
/// <summary> /// cmdUpdate_Click runs when the Update Button is clicked /// </summary> /// <history> /// [cnurse] 03/01/2006 Created /// </history> protected void cmdUpdate_Click(object sender, EventArgs e) { if (IsValid) { ProfilePropertyDefinitionCollection properties = (ProfilePropertyDefinitionCollection)ProfileProperties.DataSource; //Update User's profile User = ProfileController.UpdateUserProfile(User, properties); OnProfileUpdated(EventArgs.Empty); OnProfileUpdateCompleted(EventArgs.Empty); } }
/// <summary> /// grdProfileProperties_ItemCheckedChanged runs when a checkbox in the grid /// is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 02/23/2006 Created /// </history> private void grdProfileProperties_ItemCheckedChanged(object sender, DNNDataGridCheckChangedEventArgs e) { string propertyName = e.Field; bool propertyValue = e.Checked; bool isAll = e.IsAll; int index = e.Item.ItemIndex; ProfilePropertyDefinitionCollection properties = GetProperties(); ProfilePropertyDefinition profProperty; if (isAll) { //Update All the properties foreach (ProfilePropertyDefinition tempLoopVar_profProperty in properties) { profProperty = tempLoopVar_profProperty; switch (propertyName) { case "Required": profProperty.Required = propertyValue; break; case "Visible": profProperty.Visible = propertyValue; break; } } } else { //Update the indexed property profProperty = properties[index]; switch (propertyName) { case "Required": profProperty.Required = propertyValue; break; case "Visible": profProperty.Visible = propertyValue; break; } } BindGrid(); }
/// <summary> /// Gets the properties /// </summary> /// <history> /// [cnurse] 02/23/2006 created /// </history> private ProfilePropertyDefinitionCollection GetProperties() { string strKey = ProfileController.PROPERTIES_CACHEKEY + "." + UsersPortalId; if (m_objProperties == null) { m_objProperties = (ProfilePropertyDefinitionCollection)DataCache.GetCache(strKey); if (m_objProperties == null) { m_objProperties = ProfileController.GetPropertyDefinitionsByPortal(UsersPortalId); DataCache.SetCache(strKey, m_objProperties); } } return(m_objProperties); }
private void BindProfilePropertyNames() { ProfilePropertyDefinitionCollection ppds = ProfileController.GetPropertyDefinitionsByPortal(PortalId); foreach (ProfilePropertyDefinition ppd in ppds) { string text = Localization.GetString("ProfileProperties_" + ppd.PropertyName + ".Text", _MyConfiguration.ProfileResourceFile, PortalSettings, UserInfo.Profile.PreferredLocale); if (text == null) { text = ppd.PropertyName; } ListItem li = new ListItem(text.TrimEnd(':'), ppd.PropertyName); ddlProfilePropertyName.Items.Add(li); } ddlProfilePropertyName.Items.Insert(0, new ListItem(Localization.GetString("NONE_SELECTED", _MyConfiguration.LocalSharedResourceFile), "")); }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected override void OnLoad(EventArgs e) { base.OnLoad(e); cmdSearch.Click += OnSearchClick; grdUsers.ItemDataBound += grdUsers_ItemDataBound; grdUsers.ItemCommand += grdUsers_ItemCommand; try { //Add an Action Event Handler to the Skin AddActionHandler(ModuleAction_Click); if (!Page.IsPostBack) { ClientAPI.RegisterKeyCapture(txtSearch, cmdSearch, 13); //Load the Search Combo ddlSearchType.Items.Add(AddSearchItem("Username")); ddlSearchType.Items.Add(AddSearchItem("Email")); ProfilePropertyDefinitionCollection profileProperties = ProfileController.GetPropertyDefinitionsByPortal(PortalId, false, false); foreach (ProfilePropertyDefinition definition in profileProperties) { var controller = new ListController(); ListEntryInfo imageDataType = controller.GetListEntryInfo("DataType", "Image"); if (imageDataType == null || definition.DataType == imageDataType.EntryID) { break; } ddlSearchType.Items.Add(AddSearchItem(definition.PropertyName)); } //Localize the Headers Localization.LocalizeDataGrid(ref grdUsers, LocalResourceFile); BindData(Filter, ddlSearchType.SelectedItem.Value); //Sent controls to current Filter if ((!String.IsNullOrEmpty(Filter) && Filter.ToUpper() != "NONE") && !String.IsNullOrEmpty(FilterProperty)) { txtSearch.Text = Filter; ddlSearchType.SelectedValue = FilterProperty; } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Moves a property /// </summary> /// <param name="index">The index of the Property to move</param> /// <param name="destIndex">The new index of the Property</param> /// <history> /// [cnurse] 02/23/2006 created /// </history> private void MoveProperty(int index, int destIndex) { ProfilePropertyDefinitionCollection profileProperties = GetProperties(); ProfilePropertyDefinition objProperty = profileProperties[index]; ProfilePropertyDefinition objNext = profileProperties[destIndex]; int currentOrder = objProperty.ViewOrder; int nextOrder = objNext.ViewOrder; //Swap ViewOrders objProperty.ViewOrder = nextOrder; objNext.ViewOrder = currentOrder; //'Refresh Grid profileProperties.Sort(); BindGrid(); }
protected override void LoadViewState(object savedState) { if (!(savedState == null)) { // Load State from the array of objects that was saved with SaveViewState. object[] myState = ((object[])(savedState)); if (!(myState[0] == null)) { base.LoadViewState(myState[0]); } // Load ModuleID if (!(myState[1] == null)) { _ProfileProperties = ((ProfilePropertyDefinitionCollection)(myState[1])); } } }
/// ----------------------------------------------------------------------------- /// <summary> /// UpdateUserProfile persists a user's Profile to the Data Store. /// </summary> /// <remarks> /// </remarks> /// <param name="user">The user to persist to the Data Store.</param> /// ----------------------------------------------------------------------------- public override void UpdateUserProfile(UserInfo user) { var key = this.GetProfileCacheKey(user); DataCache.ClearCache(key); ProfilePropertyDefinitionCollection properties = user.Profile.ProfileProperties; // Ensure old and new TimeZone properties are in synch var newTimeZone = properties["PreferredTimeZone"]; var oldTimeZone = properties["TimeZone"]; if (oldTimeZone != null && newTimeZone != null) { // preference given to new property, if new is changed then old should be updated as well. if (newTimeZone.IsDirty && !string.IsNullOrEmpty(newTimeZone.PropertyValue)) { var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(newTimeZone.PropertyValue); if (timeZoneInfo != null) { oldTimeZone.PropertyValue = timeZoneInfo.BaseUtcOffset.TotalMinutes.ToString(CultureInfo.InvariantCulture); } } // however if old is changed, we need to update new as well else if (oldTimeZone.IsDirty) { int oldOffset; int.TryParse(oldTimeZone.PropertyValue, out oldOffset); newTimeZone.PropertyValue = Localization.ConvertLegacyTimeZoneOffsetToTimeZoneInfo(oldOffset).Id; } } foreach (ProfilePropertyDefinition profProperty in properties) { if ((profProperty.PropertyValue != null) && profProperty.IsDirty) { var objSecurity = PortalSecurity.Instance; string propertyValue = objSecurity.InputFilter(profProperty.PropertyValue, PortalSecurity.FilterFlag.NoScripting); this._dataProvider.UpdateProfileProperty(Null.NullInteger, user.UserID, profProperty.PropertyDefinitionId, propertyValue, (int)profProperty.ProfileVisibility.VisibilityMode, profProperty.ProfileVisibility.ExtendedVisibilityString(), DateTime.Now); EventLogController.Instance.AddLog(user, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, string.Empty, "USERPROFILE_UPDATED"); } } }
/// <summary> /// Binds the Property Collection to the Grid /// </summary> /// <history> /// [cnurse] 02/23/2006 created /// </history> private void BindGrid() { ProfilePropertyDefinitionCollection properties = GetProperties(); bool allRequired = true; bool allVisible = true; //Check whether the checkbox column headers are true or false foreach (ProfilePropertyDefinition profProperty in properties) { if (profProperty.Required == false) { allRequired = false; } if (profProperty.Visible == false) { allVisible = false; } if (!allRequired && !allVisible) { goto endOfForLoop; } } endOfForLoop: foreach (DataGridColumn column in grdProfileProperties.Columns) { if (column.GetType() == typeof(CheckBoxColumn)) { //Manage CheckBox column events CheckBoxColumn cbColumn = (CheckBoxColumn)column; if (cbColumn.DataField == "Required") { cbColumn.Checked = allRequired; } if (cbColumn.DataField == "Visible") { cbColumn.Checked = allVisible; } } } grdProfileProperties.DataSource = properties; grdProfileProperties.DataBind(); }
protected override void LoadViewState(object savedState) { if (savedState != null) { //Load State from the array of objects that was saved with SaveViewState. var myState = (object[])savedState; //Load Base Controls ViewState if (myState[0] != null) { base.LoadViewState(myState[0]); } //Load ModuleID if (myState[1] != null) { _profileProperties = (ProfilePropertyDefinitionCollection)myState[1]; } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { if (!Page.IsPostBack) { ClientAPI.RegisterKeyCapture(txtSearch, cmdSearch, 13); //Load the Search Combo ddlSearchType.Items.Add(AddSearchItem("Username")); ddlSearchType.Items.Add(AddSearchItem("Email")); ddlSearchType.Items.Add(AddSearchItem("DisplayName")); var controller = new ListController(); ListEntryInfo imageDataType = controller.GetListEntryInfo("DataType", "Image"); ProfilePropertyDefinitionCollection profileProperties = ProfileController.GetPropertyDefinitionsByPortal(PortalId, false, false); foreach (ProfilePropertyDefinition definition in profileProperties) { if (imageDataType != null && definition.DataType != imageDataType.EntryID) { ddlSearchType.Items.Add(AddSearchItem(definition.PropertyName)); } } //Sent controls to current Filter if ((!String.IsNullOrEmpty(Filter) && Filter.ToUpper() != "NONE") && !String.IsNullOrEmpty(FilterProperty)) { txtSearch.Text = Filter; var findedItem = ddlSearchType.Items.FindItemByValue(FilterProperty, true); if (findedItem != null) { findedItem.Selected = true; } } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { if (ctlProfile.UserProfile == null) { lblNoProperties.Visible = true; return; } ProfilePropertyDefinitionCollection properties = ctlProfile.UserProfile.ProfileProperties; int visibleCount = 0; foreach (ProfilePropertyDefinition profProperty in properties) { if (profProperty.Visible) { if (profProperty.Visibility == UserVisibilityMode.AdminOnly) { profProperty.Visible = (IsAdmin || IsUser); } else if (profProperty.Visibility == UserVisibilityMode.MembersOnly) { profProperty.Visible = Request.IsAuthenticated; } } if (profProperty.Visible) { visibleCount += 1; } } ctlProfile.DataBind(); if (visibleCount == 0) { lblNoProperties.Visible = true; } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// DataBind binds the data to the controls /// </summary> /// <history> /// [cnurse] 03/01/2006 Created /// </history> /// ----------------------------------------------------------------------------- public override void DataBind() { //Before we bind the Profile to the editor we need to "update" the visible data var properties = new ProfilePropertyDefinitionCollection(); foreach (ProfilePropertyDefinition profProperty in UserProfile.ProfileProperties) { if (IsAdmin && !IsProfile) { profProperty.Visible = true; } if (!profProperty.Deleted) { properties.Add(profProperty); } } ProfileProperties.User = User; ProfileProperties.ShowVisibility = ShowVisibility; ProfileProperties.DataSource = properties; ProfileProperties.DataBind(); }
private void BindRepeater() { DataSet ds = new DataSet(); DataTable dt = ds.Tables.Add("Properties"); dt.Columns.Add("Property", typeof(string)); dt.Columns.Add("Mapping", typeof(string)); Dictionary <string, string> properties = new Dictionary <string, string>(); ProfilePropertyDefinitionCollection props = ProfileController.GetPropertyDefinitionsByPortal(PortalId); foreach (ProfilePropertyDefinition def in props) { if (def.PropertyName == "FirstName" || def.PropertyName == "LastName") { } else { string setting = Null.NullString; DataRow row = ds.Tables[0].NewRow(); row[0] = def.PropertyName + ":"; if (PortalController.Instance.GetPortalSettings(PortalId).TryGetValue(usrPREFIX + def.PropertyName, out setting)) { row[1] = setting; } else { row[1] = ""; } ds.Tables[0].Rows.Add(row); } } repeaterProps.DataSource = ds; repeaterProps.DataBind(); }
/// ----------------------------------------------------------------------------- /// <summary> /// DataBind binds the data to the controls /// </summary> /// ----------------------------------------------------------------------------- public override void DataBind() { //Before we bind the Profile to the editor we need to "update" the visible data var properties = new ProfilePropertyDefinitionCollection(); var imageType = new ListController().GetListEntryInfo("DataType", "Image"); foreach (ProfilePropertyDefinition profProperty in UserProfile.ProfileProperties) { if (IsAdmin && !IsProfile) { profProperty.Visible = true; } if (!profProperty.Deleted && (Request.IsAuthenticated || profProperty.DataType != imageType.EntryID)) { properties.Add(profProperty); } } ProfileProperties.User = User; ProfileProperties.ShowVisibility = ShowVisibility; ProfileProperties.DataSource = properties; ProfileProperties.DataBind(); }
/// ----------------------------------------------------------------------------- /// <summary> /// Refresh the Property Collection to the Grid /// </summary> /// ----------------------------------------------------------------------------- private void RefreshGrid() { _profileProperties = null; BindGrid(); }
/// ----------------------------------------------------------------------------- /// <summary> /// Refresh the Property Collection to the Grid. /// </summary> /// ----------------------------------------------------------------------------- private void RefreshGrid() { this._profileProperties = null; this.BindGrid(); }