コード例 #1
0
        protected string GetUnreadPrivateMessages()
        {
            string result = string.Empty;

            if (ForumManager.AllowPrivateMessages &&
                NopContext.Current.User != null && !NopContext.Current.User.IsGuest)
            {
                int totalRecords    = 0;
                var privateMessages = ForumManager.GetAllPrivateMessages(0,
                                                                         NopContext.Current.User.CustomerId, false, null, false, string.Empty, 1, 0, out totalRecords);

                if (totalRecords > 0)
                {
                    result = string.Format(GetLocaleResourceString("PrivateMessages.TotalUnread"), totalRecords);

                    //notifications here
                    if (SettingManager.GetSettingValueBoolean("Common.ShowAlertForPM") &&
                        !NopContext.Current.User.NotifiedAboutNewPrivateMessages)
                    {
                        this.DisplayAlertMessage(string.Format(GetLocaleResourceString("PrivateMessages.YouHaveUnreadPM", totalRecords)));
                        NopContext.Current.User.NotifiedAboutNewPrivateMessages = true;
                    }
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: ForumHelper.cs プロジェクト: terry2012/DSV
        public static List <PrivateMessage> GetCurrentUserInboxPrivateMessages(int StartIndex, int PageSize, out int totalRecords)
        {
            if (PageSize <= 0)
            {
                PageSize = 10;
            }
            if (PageSize == int.MaxValue)
            {
                PageSize = int.MaxValue - 1;
            }

            int PageIndex = StartIndex / PageSize;

            totalRecords = 0;

            if (NopContext.Current.User == null)
            {
                return(new List <PrivateMessage>());
            }

            var result = ForumManager.GetAllPrivateMessages(0, NopContext.Current.User.CustomerId, null, null, false,
                                                            string.Empty, PageSize, PageIndex, out totalRecords);

            return(result);
        }
コード例 #3
0
        public static PrivateMessageCollection GetCurrentUserSentPrivateMessages(int StartIndex, int PageSize, out int totalRecords)
        {
            PrivateMessageCollection result = new PrivateMessageCollection();

            if (PageSize <= 0)
            {
                PageSize = 10;
            }
            if (PageSize == int.MaxValue)
            {
                PageSize = int.MaxValue - 1;
            }

            int PageIndex = StartIndex / PageSize;

            totalRecords = 0;

            if (NopContext.Current.User == null)
            {
                return(result);
            }

            result = ForumManager.GetAllPrivateMessages(NopContext.Current.User.CustomerId, 0, null, false, null,
                                                        string.Empty, PageSize, PageIndex, out totalRecords);
            return(result);
        }
コード例 #4
0
        protected string GetUnreadPrivateMessages()
        {
            string result = string.Empty;

            if (NopContext.Current.User != null && !NopContext.Current.User.IsGuest)
            {
                int totalRecords = 0;
                PrivateMessageCollection privateMessages = ForumManager.GetAllPrivateMessages(0,
                                                                                              NopContext.Current.User.CustomerID, false, null, false, string.Empty, 1, 0, out totalRecords);

                if (totalRecords > 0)
                {
                    result = string.Format(GetLocaleResourceString("PrivateMessages.TotalUnread"), totalRecords);
                }
            }
            return(result);
        }