Пример #1
0
        /// <summary>
        /// 获取前台用户填写积分值的要求(后台不需要设置积分值的动作)
        /// </summary>
        /// <param name="action">动作</param>
        /// <param name="minRemaining">交易后允许剩余的最低余额 不能低于积分下限(null时为积分下限) </param>
        /// <param name="minValue">交易的最小金额</param>
        /// <param name="maxValue">交易的最大金额</param>
        public void GetActionPointValueSetting(string action, int userId, out int?minRemaining, out int minValue, out int?maxValue)
        {
            PointActionItem item = GetPointActionItem(action, userId);

            if (item == null)
            {
                minRemaining = null;

                PointActionItem temp = new PointActionItem();
                minValue = temp.MinValue;
                maxValue = temp.MaxValue;
            }
            else
            {
                if (item.MinRemaining == int.MinValue)
                {
                    minRemaining = null;
                }
                else
                {
                    minRemaining = item.MinRemaining;
                }

                minValue = item.MinValue;

                if (item.MaxValue == int.MaxValue)
                {
                    maxValue = null;
                }
                else
                {
                    maxValue = item.MaxValue;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 对于不需要设置值的积分 返回该动作需要操作的积分类型
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public UserPointType GetUserPointType(string action, int userId)
        {
            PointActionItem item = GetPointActionItem(action, userId);

            if (item != null)
            {
                return(item.PointType);
            }
            return(UserPointType.Point1);
        }
Пример #3
0
        /// <summary>
        /// 按优先级顺序 RoleID 为 Guid.Empty的 在集合最前面
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public PointActionItemCollection GetPointActionItems(string action)
        {
            PointActionItemCollection tempPointActionItems = new PointActionItemCollection();

            PointActionItem tempItem = null;

            foreach (PointActionItem item in PointActionItems)
            {
                if (string.Compare(item.Action, action, true) == 0)
                {
                    if (item.RoleID == Guid.Empty)
                    {
                        tempItem = item;
                        continue;
                    }
                    int index = tempPointActionItems.Count;
                    for (int i = 0; i < tempPointActionItems.Count; i++)
                    {
                        if (item.RoleSortOrder > tempPointActionItems[i].RoleSortOrder)
                        {
                            index = i;
                            break;
                        }
                    }

                    tempPointActionItems.Insert(index, item);
                }
            }

            PointActionItemCollection results = new PointActionItemCollection();

            if (tempItem != null)
            {
                results.Add(tempItem);
            }

            for (int i = tempPointActionItems.Count - 1; i >= 0; i--)
            {
                results.Add(tempPointActionItems[i]);
            }

            //if (tempItem != null)
            //    tempPointActionItems.Insert(0,tempItem);

            return(results);
        }
Пример #4
0
        /// <summary>
        /// 对于需要设置值的积分  返回该动作需要操作的积分值  始终返回8个
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public int[] GetPoints(string action, int userId)
        {
            PointActionItem item = GetPointActionItem(action, userId);

            if (item == null)
            {
                return(new int[8]);
            }
            else
            {
                int[] points = new int[8];
                for (int i = 0; i < item.Points.Length; i++)
                {
                    points[i] = item.Points[i];
                }
                return(points);
            }
        }
Пример #5
0
        public PointActionSettings()
        {
            PointActions = new PointActionCollection();

            PointAction     pointAction;
            PointActionItem item;

#if !Passport
            #region  ForumPointAction
            pointAction      = new PointAction();
            pointAction.Type = "ForumPointAction";

            item             = new PointActionItem();
            item.Action      = ForumPointType.CreateThread.ToString();
            item.PointValues = new StringList(new string[8] {
                "10", "1", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = ForumPointType.ReplyThread.ToString();
            item.PointValues = new StringList(new string[8] {
                "2", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = ForumPointType.DeleteOwnThreads.ToString();
            item.PointValues = new StringList(new string[8] {
                "-10", "-1", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = ForumPointType.DeleteOwnPosts.ToString();
            item.PointValues = new StringList(new string[8] {
                "-2", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);


            item             = new PointActionItem();
            item.Action      = ForumPointType.DeleteAnyThreads.ToString();
            item.PointValues = new StringList(new string[8] {
                "-20", "-2", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = ForumPointType.DeleteAnyPosts.ToString();
            item.PointValues = new StringList(new string[8] {
                "-4", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = ForumPointType.ShieldPost.ToString();
            item.PointValues = new StringList(new string[8] {
                "-20", "-2", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = ForumPointType.SetThreadsValued.ToString();
            item.PointValues = new StringList(new string[8] {
                "20", "4", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item          = new PointActionItem();
            item.Action   = ForumPointValueType.SellThread.ToString();
            item.MinValue = 0;
            pointAction.PointActionItems.Add(item);

            item          = new PointActionItem();
            item.Action   = ForumPointValueType.SellAttachment.ToString();
            item.MinValue = 0;
            pointAction.PointActionItems.Add(item);

            PointActions.Add(pointAction);

            #endregion

            #region  SharePointAction
            pointAction      = new PointAction();
            pointAction.Type = "SharePointAction";

            item             = new PointActionItem();
            item.Action      = SharePointType.CreateShare.ToString();
            item.PointValues = new StringList(new string[8] {
                "1", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = SharePointType.CreateCollection.ToString();
            item.PointValues = new StringList(new string[8] {
                "1", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = SharePointType.ShareWasDeletedByAdmin.ToString();
            item.PointValues = new StringList(new string[8] {
                "-2", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = SharePointType.ShareWasDeletedBySelf.ToString();
            item.PointValues = new StringList(new string[8] {
                "-1", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            PointActions.Add(pointAction);
            #endregion

            #region  AlbumPointAction

            pointAction      = new PointAction();
            pointAction.Type = "AlbumPointAction";

            item             = new PointActionItem();
            item.Action      = AlbumPointType.CreatePhoto.ToString();
            item.PointValues = new StringList(new string[8] {
                "2", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);


            item             = new PointActionItem();
            item.Action      = AlbumPointType.PhotoWasCommented.ToString();
            item.PointValues = new StringList(new string[8] {
                "1", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = AlbumPointType.PhotoWasDeletedBySelf.ToString();
            item.PointValues = new StringList(new string[8] {
                "-2", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);


            item             = new PointActionItem();
            item.Action      = AlbumPointType.PhotoWasDeletedByAdmin.ToString();
            item.PointValues = new StringList(new string[8] {
                "-4", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);


            item             = new PointActionItem();
            item.Action      = AlbumPointType.AlbumWasDeletedByAdmin.ToString();
            item.PointValues = new StringList(new string[8] {
                "-10", "-2", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            PointActions.Add(pointAction);
            #endregion

            #region  BlogPointAction

            pointAction      = new PointAction();
            pointAction.Type = "BlogPointAction";

            item             = new PointActionItem();
            item.Action      = BlogPointType.PostArticle.ToString();
            item.PointValues = new StringList(new string[8] {
                "10", "1", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);


            item             = new PointActionItem();
            item.Action      = BlogPointType.ArticleWasDeletedBySelf.ToString();
            item.PointValues = new StringList(new string[8] {
                "-10", "-1", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = BlogPointType.ArticleWasDeletedByAdmin.ToString();
            item.PointValues = new StringList(new string[8] {
                "-20", "-2", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);


            item             = new PointActionItem();
            item.Action      = BlogPointType.ArticleWasCommented.ToString();
            item.PointValues = new StringList(new string[8] {
                "1", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            PointActions.Add(pointAction);
            #endregion

            #region  CommentPointAction

            pointAction      = new PointAction();
            pointAction.Type = "CommentPointAction";

            item             = new PointActionItem();
            item.Action      = CommentPointType.AddApprovedComment.ToString();
            item.PointValues = new StringList(new string[8] {
                "2", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);


            item             = new PointActionItem();
            item.Action      = CommentPointType.CommentIsApproved.ToString();
            item.PointValues = new StringList(new string[8] {
                "2", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = CommentPointType.DeleteCommentBySelf.ToString();
            item.PointValues = new StringList(new string[8] {
                "-2", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);


            item             = new PointActionItem();
            item.Action      = CommentPointType.DeleteCommentByAdmin.ToString();
            item.PointValues = new StringList(new string[8] {
                "-4", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            PointActions.Add(pointAction);
            #endregion

            #region  DoingPointAction

            pointAction      = new PointAction();
            pointAction.Type = "DoingPointAction";



            item             = new PointActionItem();
            item.Action      = DoingPointType.DoingWasCommented.ToString();
            item.PointValues = new StringList(new string[8] {
                "1", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);


            item             = new PointActionItem();
            item.Action      = DoingPointType.DoingWasDeletedByAdmin.ToString();
            item.PointValues = new StringList(new string[8] {
                "-2", "0", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            PointActions.Add(pointAction);
            #endregion
#endif

            #region  UserPointAction

            pointAction      = new PointAction();
            pointAction.Type = "UserPointAction";

            item             = new PointActionItem();
            item.Action      = UserPoints.PerfectInfomation.ToString();
            item.PointValues = new StringList(new string[8] {
                "20", "2", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            item             = new PointActionItem();
            item.Action      = UserPoints.ValidateEmail.ToString();
            item.PointValues = new StringList(new string[8] {
                "10", "1", "0", "0", "0", "0", "0", "0"
            });
            pointAction.PointActionItems.Add(item);

            PointActions.Add(pointAction);
            #endregion
        }