protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            ctlProfile.Title = PageResources.UserProfile_UserProfile_Title;
            string userName = string.Empty;
            if (UrlParams.UserProfile.UserName.HasValue)
                userName = UrlParams.UserProfile.UserName.Value;
            ctlProfile.ShowWorkingModeSwitch = false;
            Guid userId = SecurityUtility.GetUserId(userName);
            if (!String.IsNullOrEmpty(userName) && !Guid.Empty.Equals(userId))
            {
                this.SetPageTitle(String.Format(MonoSoftware.MonoX.Resources.PageResources.UserProfile_Title, userName));
                CurrentUser = DependencyInjectionFactory.Resolve<IUserProfileBLL>().GetCachedUserProfile(userId);
                if (CurrentUser != null)
                {
                    if ((SecurityUtility.GetUserId() == CurrentUser.Id) && Page.User.Identity.IsAuthenticated)
                        ctlProfile.ShowWorkingModeSwitch = true;

                    ctlProfile.UserId = CurrentUser.Id;
                }
            }
            else
            {
                this.SetPageTitle(MonoSoftware.MonoX.Resources.PageResources.UserProfile_NoSuchUser);
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            #region Demo code used for Visibility, Titles etc.
            ctlProfile.ShowASPNETProfile = false;
            ctlProfile.MyStatusChanged += new EventHandler(ctlProfile_MyStatusChanged);
            ctlProfile.Title = PageResources.UserProfile_UserProfile_Title;
            snPeopleSearch.InfoText = PageResources.UserProfile_PeopleSearch_InfoText;
            ctlInvitationsReceived.Title = PageResources.Module_InvitationsReceived;
            ctlInvitationsSent.Title = PageResources.Module_InvitationsSent;

            string userName = string.Empty;
            if (UrlParams.UserProfile.UserName.HasValue)
                userName = UrlParams.UserProfile.UserName.Value;
            ctlProfile.ShowWorkingModeSwitch = false;
            Guid userId = SecurityUtility.GetUserId(userName);
            if (userId.Equals(Guid.Empty) && Page.User.Identity.IsAuthenticated)
            {
                userId = SecurityUtility.GetUserId();
                userName = Membership.GetUser(userId).UserName;
            }
            snFriendList.Visible = false;
            snWallNotes.Visible = false;
            discussionTopicMessages.Visible = false;
            ctlInvitationsSent.Visible = false;
            ctlInvitationsReceived.Visible = false;
            if (!String.IsNullOrEmpty(userName) && !Guid.Empty.Equals(userId))
            {
                snPeopleSearch.Title = string.Format(PageResources.UserProfile_PeopleSearch_Title, userName);
                snWallNotes.Title = String.Format(PageResources.Module_WallNotes, userName);
                this.SetPageTitle(String.Format(MonoSoftware.MonoX.Resources.PageResources.UserProfile_Title, userName));
                CurrentUser = UserProfileBLL.GetInstance().GetCachedUserProfile(userId);
                if (CurrentUser != null)
                {
                    string nameToShow = (CurrentUser != null && !string.IsNullOrEmpty(CurrentUser.FirstName) ? CurrentUser.FirstName : CurrentUser.AspnetUser.UserName);
                    snFriendList.Title = String.Format(PageResources.Module_UserProfileFriends, nameToShow);
                    discussionTopicMessages.Title = PageResources.UserProfile_DiscussionMessages_Title;

                    if ((SecurityUtility.GetUserId() == CurrentUser.Id) && Page.User.Identity.IsAuthenticated)
                        ctlProfile.ShowWorkingModeSwitch = true;

                    ctlProfile.UserId = CurrentUser.Id;
                    ctlInvitationsSent.UserId = CurrentUser.Id;
                    ctlInvitationsReceived.UserId = CurrentUser.Id;
                    snFriendList.UserId = CurrentUser.Id;
                    snFriendList.Visible = true;
                    discussionTopicMessages.UserId = CurrentUser.Id;
                    discussionTopicMessages.Visible = true;
                    discussionTopicMessages.BindData();
                    snWallNotes.UserId = CurrentUser.Id;
                    snWallNotes.Visible = true;
                    snPeopleSearch.UserId = CurrentUser.Id;
                }
            }
            else
            {
                this.SetPageTitle(MonoSoftware.MonoX.Resources.PageResources.UserProfile_NoSuchUser);
            }
            #endregion
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            ctlProfile.MyStatusChanged += new EventHandler(ctlProfile_MyStatusChanged);
            ctlProfile.Title = PageResources.UserProfile_UserProfile_Title;
            snPeopleSearch.InfoText = PageResources.UserProfile_PeopleSearch_InfoText;
            ctlInvitationsReceived.Title = PageResources.Module_InvitationsReceived;
            ctlInvitationsSent.Title = PageResources.Module_InvitationsSent;

            string userName = string.Empty;
            if (UrlParams.UserProfile.UserName.HasValue)
                userName = MonoSoftware.Web.UrlEncoder.UrlDecode(UrlParams.UserProfile.UserName.Value);
            ctlProfile.ShowWorkingModeSwitch = false;
            Guid userId = SecurityUtility.GetUserId(userName);
            snFriendList.Visible = false;
            snWallNotes.Visible = false;
            discussionTopicMessages.Visible = false;
            ctlInvitationsSent.Visible = false;
            ctlInvitationsReceived.Visible = false;
            if (!String.IsNullOrEmpty(userName) && !Guid.Empty.Equals(userId))
            {
                snPeopleSearch.Title = string.Format(PageResources.UserProfile_PeopleSearch_Title, userName);
                snWallNotes.Title = String.Format(PageResources.Module_WallNotes, userName);
                this.SetPageTitle(String.Format(MonoSoftware.MonoX.Resources.PageResources.UserProfile_Title, userName));
                CurrentUser = DependencyInjectionFactory.Resolve<IUserProfileBLL>().GetCachedUserProfile(userId);
                if (CurrentUser != null)
                {
                    string nameToShow = (CurrentUser != null && !string.IsNullOrEmpty(CurrentUser.FirstName)? CurrentUser.FirstName : CurrentUser.AspnetUser.UserName);
                    snFriendList.Title = String.Format(PageResources.Module_UserProfileFriends, nameToShow);
                    discussionTopicMessages.Title = PageResources.UserProfile_DiscussionMessages_Title;

                    if ((SecurityUtility.GetUserId() == CurrentUser.Id) && Page.User.Identity.IsAuthenticated)
                        ctlProfile.ShowWorkingModeSwitch = true;

                    ctlProfile.UserId = CurrentUser.Id;
                    ctlInvitationsSent.UserId = CurrentUser.Id;
                    ctlInvitationsReceived.UserId = CurrentUser.Id;
                    snFriendList.UserId = CurrentUser.Id;
                    snFriendList.Visible = true;
                    discussionTopicMessages.UserId = CurrentUser.Id;
                    discussionTopicMessages.Visible = true;
                    discussionTopicMessages.BindData();
                    snWallNotes.UserId = CurrentUser.Id;
                    snWallNotes.Visible = true;
                    snPeopleSearch.UserId = CurrentUser.Id;
                }
            }
            else
            {
                this.SetPageTitle(MonoSoftware.MonoX.Resources.PageResources.UserProfile_NoSuchUser);
            }
        }
 private static UserProfileEntity GetCurrentProfile()
 {
     System.Web.Security.MembershipUser membershipUser = System.Web.HttpContext.Current.User.GetMembershipUser();
     if (membershipUser != null)
     {
         UserProfileEntity userProfile = new UserProfileEntity(membershipUser.GetProviderUserKey());
         using (IDataAccessAdapter adapter = MonoSoftware.Web.Workspace.WebContext.GetContext(typeof(UserProfileEntity).Assembly).GetAdapter())
         {
             if (adapter.FetchEntity(userProfile))
             {
                 return userProfile;
             }
         }
     }
     return null;
 }
 /// <summary> setups the sync logic for member _userProfile</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncUserProfile(IEntityCore relatedEntity)
 {
     if(_userProfile!=relatedEntity)
     {
         DesetupSyncUserProfile(true, true);
         _userProfile = (UserProfileEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity( _userProfile, new PropertyChangedEventHandler( OnUserProfilePropertyChanged ), "UserProfile", MonoSoftware.MonoX.DAL.RelationClasses.StaticAspnetUsersRelations.UserProfileEntityUsingIdStatic, false, new string[] {  } );
     }
 }
 /// <summary> Removes the sync logic for member _userProfile</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncUserProfile(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity( _userProfile, new PropertyChangedEventHandler( OnUserProfilePropertyChanged ), "UserProfile", MonoSoftware.MonoX.DAL.RelationClasses.StaticAspnetUsersRelations.UserProfileEntityUsingIdStatic, false, signalRelatedEntity, "AspnetUser", false, new int[] { (int)AspnetUsersFieldIndex.UserId } );
     _userProfile = null;
 }
 protected AspnetUsersEntity(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     if(SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _aspnetPersonalizationPerUser = (EntityCollection<AspnetPersonalizationPerUserEntity>)info.GetValue("_aspnetPersonalizationPerUser", typeof(EntityCollection<AspnetPersonalizationPerUserEntity>));
         _aspnetUsersInRoles = (EntityCollection<AspnetUsersInRolesEntity>)info.GetValue("_aspnetUsersInRoles", typeof(EntityCollection<AspnetUsersInRolesEntity>));
         _auditInfos = (EntityCollection<AuditInfoEntity>)info.GetValue("_auditInfos", typeof(EntityCollection<AuditInfoEntity>));
         _blogs = (EntityCollection<BlogEntity>)info.GetValue("_blogs", typeof(EntityCollection<BlogEntity>));
         _blogEditors = (EntityCollection<BlogEditorEntity>)info.GetValue("_blogEditors", typeof(EntityCollection<BlogEditorEntity>));
         _blogPosts = (EntityCollection<BlogPostEntity>)info.GetValue("_blogPosts", typeof(EntityCollection<BlogPostEntity>));
         _calendars = (EntityCollection<CalendarEntity>)info.GetValue("_calendars", typeof(EntityCollection<CalendarEntity>));
         _calendarEvents = (EntityCollection<CalendarEventEntity>)info.GetValue("_calendarEvents", typeof(EntityCollection<CalendarEventEntity>));
         _calendarModerators = (EntityCollection<CalendarModeratorEntity>)info.GetValue("_calendarModerators", typeof(EntityCollection<CalendarModeratorEntity>));
         _documents = (EntityCollection<DocumentEntity>)info.GetValue("_documents", typeof(EntityCollection<DocumentEntity>));
         _lists = (EntityCollection<ListEntity>)info.GetValue("_lists", typeof(EntityCollection<ListEntity>));
         _newsItems = (EntityCollection<NewsItemEntity>)info.GetValue("_newsItems", typeof(EntityCollection<NewsItemEntity>));
         _newsletters = (EntityCollection<NewsletterEntity>)info.GetValue("_newsletters", typeof(EntityCollection<NewsletterEntity>));
         _newsPublishQueue = (EntityCollection<NewsPublishQueueEntity>)info.GetValue("_newsPublishQueue", typeof(EntityCollection<NewsPublishQueueEntity>));
         _oaTokens = (EntityCollection<OaTokenEntity>)info.GetValue("_oaTokens", typeof(EntityCollection<OaTokenEntity>));
         _page = (EntityCollection<PageEntity>)info.GetValue("_page", typeof(EntityCollection<PageEntity>));
         _polls = (EntityCollection<PollEntity>)info.GetValue("_polls", typeof(EntityCollection<PollEntity>));
         _privacyLevelDefinition = (EntityCollection<PrivacyLevelDefinitionEntity>)info.GetValue("_privacyLevelDefinition", typeof(EntityCollection<PrivacyLevelDefinitionEntity>));
         _snAlbums = (EntityCollection<SnAlbumEntity>)info.GetValue("_snAlbums", typeof(EntityCollection<SnAlbumEntity>));
         _snBlockUsers = (EntityCollection<SnBlockUserEntity>)info.GetValue("_snBlockUsers", typeof(EntityCollection<SnBlockUserEntity>));
         _snBlockUsers_ = (EntityCollection<SnBlockUserEntity>)info.GetValue("_snBlockUsers_", typeof(EntityCollection<SnBlockUserEntity>));
         _snComments = (EntityCollection<SnCommentEntity>)info.GetValue("_snComments", typeof(EntityCollection<SnCommentEntity>));
         _snDiscussionMessage = (EntityCollection<SnDiscussionMessageEntity>)info.GetValue("_snDiscussionMessage", typeof(EntityCollection<SnDiscussionMessageEntity>));
         _snEvents = (EntityCollection<SnEventEntity>)info.GetValue("_snEvents", typeof(EntityCollection<SnEventEntity>));
         _snFriendEvents = (EntityCollection<SnEventEntity>)info.GetValue("_snFriendEvents", typeof(EntityCollection<SnEventEntity>));
         _snFiles = (EntityCollection<SnFileEntity>)info.GetValue("_snFiles", typeof(EntityCollection<SnFileEntity>));
         _snFriendsUsers = (EntityCollection<SnFriendEntity>)info.GetValue("_snFriendsUsers", typeof(EntityCollection<SnFriendEntity>));
         _snFriendsFriends = (EntityCollection<SnFriendEntity>)info.GetValue("_snFriendsFriends", typeof(EntityCollection<SnFriendEntity>));
         _snFriendLists = (EntityCollection<SnFriendListEntity>)info.GetValue("_snFriendLists", typeof(EntityCollection<SnFriendListEntity>));
         _snFriendListMembers = (EntityCollection<SnFriendListMemberEntity>)info.GetValue("_snFriendListMembers", typeof(EntityCollection<SnFriendListMemberEntity>));
         _snFriendRequestsFriends = (EntityCollection<SnFriendRequestEntity>)info.GetValue("_snFriendRequestsFriends", typeof(EntityCollection<SnFriendRequestEntity>));
         _snFriendRequestsUsers = (EntityCollection<SnFriendRequestEntity>)info.GetValue("_snFriendRequestsUsers", typeof(EntityCollection<SnFriendRequestEntity>));
         _snGroups = (EntityCollection<SnGroupEntity>)info.GetValue("_snGroups", typeof(EntityCollection<SnGroupEntity>));
         _snGroupMembers = (EntityCollection<SnGroupMemberEntity>)info.GetValue("_snGroupMembers", typeof(EntityCollection<SnGroupMemberEntity>));
         _snGroupRequests = (EntityCollection<SnGroupRequestEntity>)info.GetValue("_snGroupRequests", typeof(EntityCollection<SnGroupRequestEntity>));
         _snMessages = (EntityCollection<SnMessageEntity>)info.GetValue("_snMessages", typeof(EntityCollection<SnMessageEntity>));
         _snMessageRecipients = (EntityCollection<SnMessageRecipientEntity>)info.GetValue("_snMessageRecipients", typeof(EntityCollection<SnMessageRecipientEntity>));
         _snNotesPostedTo = (EntityCollection<SnNoteEntity>)info.GetValue("_snNotesPostedTo", typeof(EntityCollection<SnNoteEntity>));
         _snNotesAuthoredBy = (EntityCollection<SnNoteEntity>)info.GetValue("_snNotesAuthoredBy", typeof(EntityCollection<SnNoteEntity>));
         _snRating = (EntityCollection<SnRatingEntity>)info.GetValue("_snRating", typeof(EntityCollection<SnRatingEntity>));
         _snRelationshipss = (EntityCollection<SnRelationshipEntity>)info.GetValue("_snRelationshipss", typeof(EntityCollection<SnRelationshipEntity>));
         _snSubscribers = (EntityCollection<SnSubscriberEntity>)info.GetValue("_snSubscribers", typeof(EntityCollection<SnSubscriberEntity>));
         _userSocialIdentities = (EntityCollection<UserSocialIdentityEntity>)info.GetValue("_userSocialIdentities", typeof(EntityCollection<UserSocialIdentityEntity>));
         _aspnetApplications = (AspnetApplicationsEntity)info.GetValue("_aspnetApplications", typeof(AspnetApplicationsEntity));
         if(_aspnetApplications!=null)
         {
             _aspnetApplications.AfterSave+=new EventHandler(OnEntityAfterSave);
         }
         _aspnetMembership = (AspnetMembershipEntity)info.GetValue("_aspnetMembership", typeof(AspnetMembershipEntity));
         if(_aspnetMembership!=null)
         {
             _aspnetMembership.AfterSave+=new EventHandler(OnEntityAfterSave);
         }
         _aspnetProfile = (AspnetProfileEntity)info.GetValue("_aspnetProfile", typeof(AspnetProfileEntity));
         if(_aspnetProfile!=null)
         {
             _aspnetProfile.AfterSave+=new EventHandler(OnEntityAfterSave);
         }
         _userAvatar = (UserAvatarEntity)info.GetValue("_userAvatar", typeof(UserAvatarEntity));
         if(_userAvatar!=null)
         {
             _userAvatar.AfterSave+=new EventHandler(OnEntityAfterSave);
         }
         _userProfile = (UserProfileEntity)info.GetValue("_userProfile", typeof(UserProfileEntity));
         if(_userProfile!=null)
         {
             _userProfile.AfterSave+=new EventHandler(OnEntityAfterSave);
         }
         this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
     }
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
        protected void Page_Init(object sender, EventArgs e)
        {
            //Note: TO ENABLE ASP.NET PROFILE PLEASE FOLLOW THE STEP BELOW
            //1. Compile the project as is
            //2. Go to web.config and uncomment the ASP.NET Profile that is commented out, and comment the empty one
            //3. Compile the project again
            // Now you should be able to see the ASP.NET Profile fields in your profile

            ctlProfile.ShowASPNETProfile = true;
            ctlProfile.MyStatusChanged += new EventHandler(ctlProfile_MyStatusChanged);
            ctlProfile.Title = PageResources.UserProfile_UserProfile_Title;
            snPeopleSearch.InfoText = PageResources.UserProfile_PeopleSearch_InfoText;

            string userName = string.Empty;
            if (UrlParams.UserProfile.UserName.HasValue)
                userName = UrlParams.UserProfile.UserName.Value;
            ctlProfile.ShowWorkingModeSwitch = false;
            Guid userId = SecurityUtility.GetUserId(userName);
            if (userId.Equals(Guid.Empty) && Page.User.Identity.IsAuthenticated)
            {
                userId = SecurityUtility.GetUserId();
                userName = Membership.GetUser(userId).UserName;
            }
            snFriendList.Visible = false;
            snWallNotes.Visible = false;
            discussionTopicMessages.Visible = false;
            ctlInvitationsSent.Visible = false;
            ctlInvitationsReceived.Visible = false;
            if (!String.IsNullOrEmpty(userName) && !Guid.Empty.Equals(userId))
            {
                snPeopleSearch.Title = string.Format(PageResources.UserProfile_PeopleSearch_Title, userName);
                snWallNotes.Title = String.Format(PageResources.Module_WallNotes, userName);
                this.SetPageTitle(String.Format(MonoSoftware.MonoX.Resources.PageResources.UserProfile_Title, userName));
                CurrentUser = UserProfileBLL.GetInstance().GetCachedUserProfile(userId);
                if (CurrentUser != null)
                {
                    string nameToShow = (CurrentUser != null && !string.IsNullOrEmpty(CurrentUser.FirstName) ? CurrentUser.FirstName : CurrentUser.AspnetUser.UserName);
                    snFriendList.Title = String.Format(PageResources.Module_UserProfileFriends, nameToShow);
                    discussionTopicMessages.Title = PageResources.UserProfile_DiscussionMessages_Title;

                    if ((SecurityUtility.GetUserId() == CurrentUser.Id) && Page.User.Identity.IsAuthenticated)
                        ctlProfile.ShowWorkingModeSwitch = true;

                    ctlProfile.UserId = CurrentUser.Id;
                    ctlInvitationsSent.UserId = CurrentUser.Id;
                    ctlInvitationsReceived.UserId = CurrentUser.Id;
                    snFriendList.UserId = CurrentUser.Id;
                    snFriendList.Visible = true;
                    discussionTopicMessages.UserId = CurrentUser.Id;
                    discussionTopicMessages.Visible = true;
                    discussionTopicMessages.BindData();
                    snWallNotes.UserId = CurrentUser.Id;
                    snWallNotes.Visible = true;
                    snPeopleSearch.UserId = CurrentUser.Id;
                }
            }
            else
            {
                this.SetPageTitle(MonoSoftware.MonoX.Resources.PageResources.UserProfile_NoSuchUser);
            }
        }