Пример #1
0
        public bool SendNormalMessage(bool ignoreProfileMessageRules, bool ignoreProfileEmailRules)
        {
            //Check if the receiver has blocked the sender
            if (!FriendHandler.IsBlocked(_UserId, _FromUserID))
            {
                //Check if the sender is a friend of the receiver
                if (FriendHandler.IsFriend(_UserId, _FromUserID))
                {
                    _TypOfMessage = (int)MessageTypes.FriendMessage;
                }
                else
                {
                    _TypOfMessage = (int)MessageTypes.NormalMessage;
                }

                MembershipUser objToUser = Membership.GetUser(_UserId, false);

                ReceiveMessageFrom rmfUserSetting = DataObjectUser.GetAllowedMessages(_UserId);
                if (ignoreProfileMessageRules || rmfUserSetting == ReceiveMessageFrom.All || (rmfUserSetting == ReceiveMessageFrom.Friends && _TypOfMessage == (int)MessageTypes.FriendMessage))
                {
                    Save();
                    if (ignoreProfileEmailRules || DataObjectUser.GetSendEmailOnMessage(_UserId) == YesNo.Yes)
                    {
                        MembershipUser objFromUser    = Membership.GetUser(_FromUserID, false);
                        string         messageCulture = !string.IsNullOrEmpty(UserProfile.GetProfile(objToUser.UserName).PrefferedCulture) ? UserProfile.GetProfile(objToUser.UserName).PrefferedCulture : SiteConfig.DefaultLanguage;
                        SendMail(objFromUser.UserName, objToUser, GuiLanguage.GetGuiLanguage("Pages.Popups.WebUI.Base", messageCulture).GetString("LableMessagePrivateMessage"), GuiLanguage.GetGuiLanguage("Templates", messageCulture).GetString("EmailNewMessageReceived"));
                    }
                }
            }
            return(true);
        }
Пример #2
0
        public bool SendInviteMessage()
        {
            //Check if the receiver has blocked the sender
            if (!FriendHandler.IsBlocked(_UserId, _FromUserID))
            {
                _TypOfMessage = (int)MessageTypes.InviteToCommunity;
                Save();
                MembershipUser objToUser = Membership.GetUser(_UserId, false);

                if (DataObjectUser.GetSendEmailOnMessage(_UserId) == YesNo.Yes)
                {
                    MembershipUser objFromUser = Membership.GetUser(_FromUserID, false);
                    SendMail(objFromUser.UserName, objToUser, "Einladung zur Privat-Community", GuiLanguage.GetGuiLanguage("Templates").GetString("EmailNewInvitationToCommunity"));
                }
            }
            return(true);
        }
Пример #3
0
        public bool SendRequestsMessage()
        {
            //Check if the receiver has blocked the sender
            if (!FriendHandler.IsBlocked(_UserId, _FromUserID))
            {
                _TypOfMessage = (int)MessageTypes.FriendRequest;
                Save();
                MembershipUser objToUser = Membership.GetUser(_UserId, false);

                if (DataObjectUser.GetSendEmailOnMessage(_UserId) == YesNo.Yes)
                {
                    MembershipUser objFromUser = Membership.GetUser(_FromUserID, false);
                    SendMail(objFromUser.UserName, objToUser, GuiLanguage.GetGuiLanguage("Shared").GetString("CommandFriendshipQuery"), GuiLanguage.GetGuiLanguage("Templates").GetString("EmailNewFriendRequestReceived"));
                }
            }
            return(true);
        }
Пример #4
0
        public bool SendInviteMessage()
        {
            //Check if the receiver has blocked the sender
            if (!FriendHandler.IsBlocked(_UserId, _FromUserID))
            {
                _TypOfMessage = (int)MessageTypes.InviteToCommunity;
                Save();
                MembershipUser objToUser = Membership.GetUser(_UserId, false);

                if (DataObjectUser.GetSendEmailOnMessage(_UserId) == YesNo.Yes)
                {
                    MembershipUser objFromUser    = Membership.GetUser(_FromUserID, false);
                    string         messageCulture = !string.IsNullOrEmpty(UserProfile.GetProfile(objToUser.UserName).PrefferedCulture) ? UserProfile.GetProfile(objToUser.UserName).PrefferedCulture : SiteConfig.DefaultLanguage;
                    SendMail(objFromUser.UserName, objToUser, "Einladung zur Privat-Community", GuiLanguage.GetGuiLanguage("Templates", messageCulture).GetString("EmailNewInvitationToCommunity"));
                }
            }
            return(true);
        }
Пример #5
0
        public bool SendRequestsMessage()
        {
            //Check if the receiver has blocked the sender
            if (!FriendHandler.IsBlocked(_UserId, _FromUserID))
            {
                _TypOfMessage = (int)MessageTypes.FriendRequest;
                Save();
                MembershipUser objToUser = Membership.GetUser(_UserId, false);

                if (DataObjectUser.GetSendEmailOnMessage(_UserId) == YesNo.Yes)
                {
                    MembershipUser objFromUser    = Membership.GetUser(_FromUserID, false);
                    string         messageCulture = !string.IsNullOrEmpty(UserProfile.GetProfile(objToUser.UserName).PrefferedCulture) ? UserProfile.GetProfile(objToUser.UserName).PrefferedCulture : SiteConfig.DefaultLanguage;
                    SendMail(objFromUser.UserName, objToUser, GuiLanguage.GetGuiLanguage("Shared", messageCulture).GetString("CommandFriendshipQuery"), GuiLanguage.GetGuiLanguage("Templates", messageCulture).GetString("EmailNewFriendRequestReceived"));
                }
            }
            return(true);
        }
Пример #6
0
        public static Guid CreateUserProfileCommunity(UserDataContext udc, UserProfile userProfile)
        {
            string layoutName    = CustomizationSection.CachedInstance.DefaultLayouts.ProfileCommunity;
            Guid   communityIdD  = Guid.NewGuid();
            Guid   currentPageId = Guid.NewGuid();
            string strUserKey    = userProfile.UserId.ToString();

            DataObjectProfileCommunity dataObjectCommunity = new DataObjectProfileCommunity(UserDataContext.GetUserDataContext(userProfile.Nickname));

            dataObjectCommunity.Status      = ObjectStatus.Public;
            dataObjectCommunity.Title       = userProfile.Nickname;
            dataObjectCommunity.CommunityID = communityIdD;
            dataObjectCommunity.Insert(udc);

            HitblCommunityCty community = new HitblCommunityCty();

            community.CtyInsertedDate = DateTime.Now;
            community.CtyUpdatedDate  = DateTime.Now;
            community.CtyVirtualUrl   = userProfile.Nickname;
            community.UsrIdInserted   = userProfile.UserId;
            community.UsrIdUpdated    = userProfile.UserId;
            community.CtyIsProfile    = true;
            community.CtyStatus       = (int)CommunityStatus.Initializing;
            community.CtyLayout       = layoutName;
            community.CtyTheme        = Constants.DEFAULT_THEME;
            community.CtyId           = communityIdD;
            community.Save();

            HirelCommunityUserCur.Insert(communityIdD, userProfile.UserId, true, 0, DateTime.Now, Guid.Empty);
            HirelCommunityUserCur.Insert(community.CtyId, new Guid(Constants.ADMIN_USERID), true, 0, DateTime.Now, Guid.Empty);

            userProfile.ProfileCommunityID = communityIdD;
            userProfile.Save();
            currentPageId       = PagesConfig.CreateNewPage(communityIdD, "Profile", "Private", "Dashboard").PagId;
            currentPageId       = PagesConfig.CreateNewPage(communityIdD, "Profile", "Start", "Home").PagId;
            community.CtyStatus = (int)CommunityStatus.Ready;
            community.Save();

            FriendHandler.TransferFriendAsCommunityMember(communityIdD, userProfile.UserId);

            return(communityIdD);
        }