Exemple #1
0
        /// <summary>
        /// 获取某个动作 会更新的积分类型和值
        /// </summary>
        /// <param name="actionType"></param>
        /// <param name="userId"></param>
        /// <param name="template">显示格式如:{0}:{1}  其中{0}表示积分名称 {1}表示值</param>
        /// <param name="separator">多个积分之间的分隔符</param>
        /// <returns></returns>
        public string GetActionUserPointValue(T1 actionType, int userId, int nodeID, string template, string separator)
        {
            Dictionary <UserPoint, int> points = PointActionManager.GetActionUserPointValue <T1>(userId, Type, actionType, nodeID);

            StringBuilder valueString = new StringBuilder();

            MaxLabs.bbsMax.Entities.User user = UserBO.Instance.GetUser(userId);
            if (user == null)
            {
                return(string.Empty);
            }

            foreach (KeyValuePair <UserPoint, int> pair in points)
            {
                string value;

                if (pair.Value >= 0)
                {
                    value = "+" + pair.Value;
                }
                else
                {
                    value = pair.Value.ToString();
                }

                valueString.Append(string.Format(template, pair.Key.Name, value, user.ExtendedPoints[(int)pair.Key.Type])).Append(separator);
            }

            if (valueString.Length > 0)
            {
                return(valueString.ToString(0, valueString.Length - separator.Length));
            }

            return(string.Empty);
        }
Exemple #2
0
        ///// <summary>
        ///// 获取某个动作 会更新的积分类型和值
        ///// </summary>
        ///// <param name="actionType"></param>
        ///// <returns></returns>
        //public Dictionary<UserPoint, int> GetActionUserPointValue(int userId,string actionType)
        //{
        //    return UserBO.Instance.GetActionUserPointValue<string>(userId, Type, actionType);
        //}

        /// <summary>
        /// 获取 某个动作 会更新的积分类型
        /// </summary>
        /// <param name="actionType"></param>
        /// <param name="minRemainingValue">交易后积分剩余最低值 null为不限制 但不能低于积分下限</param>
        /// <param name="minValue">本次最小交易值</param>
        /// <param name="maxValue">本次最大交易值 null为不限制</param>
        /// <returns></returns>
        public UserPoint GetUserPoint(int userId, string actionType, int nodeID, out int?minRemainingValue, out int minValue, out int?maxValue)
        {
            PointAction pointAction;
            UserPoint   userPoint = PointActionManager.GetUserPoint <string>(userId, Type, actionType, nodeID, out pointAction);

            pointAction.GetActionPointValueSetting(actionType.ToString(), userId, out minRemainingValue, out minValue, out maxValue);

            return(userPoint);
        }
Exemple #3
0
 /// <summary>
 /// 更新多个用户的多个动作的积分
 /// <para>可能抛出的错误:</para>
 /// <para>UserPointOverMaxValueError 积分超出上限</para>
 /// <para>UserPointOverMinValueError 积分超出下限</para>
 /// </summary>
 /// <param name="beforeUpdate"></param>
 /// <returns></returns>
 public bool UpdateUsersPoints(PointActionManager.TryUpdateUserPointCallback3 <T1> beforeUpdate)
 {
     return(PointActionManager.UpdateUsersPoints <T1>(Type, true, 0, beforeUpdate));
 }
Exemple #4
0
 /// <summary>
 /// 批量更新用户的积分
 /// <para>可能抛出的错误:</para>
 /// <para>UserPointOverMaxValueError 积分超出上限</para>
 /// <para>UserPointOverMinValueError 积分超出下限</para>
 /// </summary>
 /// <param name="actionType"></param>
 /// <param name="beforeUpdate"></param>
 /// <returns></returns>
 public bool UpdateUsersPoint(T1 actionType, PointActionManager.TryUpdateUserPointCallback2 beforeUpdate)
 {
     return(PointActionManager.UpdateUserPoint <T1>(Type, actionType, true, beforeUpdate));
 }
Exemple #5
0
 public bool UpdateUserPointValue(int userID, T2 actionType, int nodeID, int value, PointActionManager.TryUpdateUserPointCallback beforeUpdate)
 {
     return(PointActionManager.UpdateUserPointValue <T2>(userID, Type, actionType, nodeID, value, beforeUpdate));
 }
Exemple #6
0
 /// <summary>
 /// 获取某个动作 会更新的积分类型和值
 /// </summary>
 /// <param name="actionType"></param>
 /// <returns></returns>
 public Dictionary <UserPoint, int> GetActionUserPointValue(T1 actionType, int userId, int nodeID)
 {
     return(PointActionManager.GetActionUserPointValue <T1>(userId, Type, actionType, nodeID));
 }
Exemple #7
0
 /// <summary>
 /// 对同一个用户的不同动作 操作积分
 /// </summary>
 /// <param name="userID">操作该用户的积分</param>
 /// <param name="noNeedValueActions">(key:动作类型 value:操作倍数) 不需要用户填值的积分动作类型 如果没有用null</param>
 /// <param name="needValueActions">(key:动作类型 value:积分值) 需要用户填值的积分动作类型 如果没有用null</param>
 /// <param name="nodeID"></param>
 /// <param name="beforeUpdate"></param>
 /// <returns></returns>
 public bool UpdateUserPoints(int userID, Dictionary <T1, int> noNeedValueActions, Dictionary <T2, int> needValueActions, int nodeID, PointActionManager.TryUpdateUserPointCallback beforeUpdate)
 {
     return(PointActionManager.UpdateUserPoints <T1, T2>(userID, noNeedValueActions, needValueActions, Type, nodeID, beforeUpdate));
 }
Exemple #8
0
 /// <summary>
 /// 更新多个用户的多个动作 积分  (针对不同的用户)
 /// </summary>
 /// <param name="userActions">key:userID value:动作</param>
 /// <param name="count">更新倍数</param>
 /// <param name="beforeUpdate"></param>
 /// <returns></returns>
 public bool UpdateUsersPointWithNoTrans(Dictionary <int, T1> userActions, int count, int nodeID, PointActionManager.TryUpdateUserPointCallback beforeUpdate)
 {
     return(PointActionManager.UpdateUsersPoint <T1>(userActions, Type, count, nodeID, beforeUpdate));
 }
Exemple #9
0
 /// <summary>
 /// 更新用户积分
 /// <para>可能抛出的错误:</para>
 /// <para>UserPointOverMaxValueError 积分超出上限</para>
 /// <para>UserPointOverMinValueError 积分超出下限</para>
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="actionType">动作枚举</param>
 /// <param name="count">更新次数 如:批量删除了3篇日志,这里应该为3</param>
 /// <param name="isNormal">如果为false则取积分的相反值(通常发生在类似帖子由正常变成未审核,此时为false)</param>
 /// <param name="beforeUpdate"></param>
 /// <returns></returns>
 internal bool UpdateUserPoint(int userID, T1 actionType, int count, bool isNormal, int nodeID, PointActionManager.TryUpdateUserPointCallback beforeUpdate)
 {
     return(PointActionManager.UpdateUserPoint <T1>(userID, Type, actionType, count, isNormal, nodeID, beforeUpdate));
 }
Exemple #10
0
 /// <summary>
 /// 更新用户积分
 /// <para>可能抛出的错误:</para>
 /// <para>UserPointOverMaxValueError 积分超出上限</para>
 /// <para>UserPointOverMinValueError 积分超出下限</para>
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="actionType">动作枚举</param>
 /// <param name="count">更新次数 如:批量删除了3篇日志,这里应该为3</param>
 /// <param name="beforeUpdate"></param>
 /// <returns></returns>
 public bool UpdateUserPoint(int userID, T1 actionType, int count, PointActionManager.TryUpdateUserPointCallback beforeUpdate)
 {
     return(PointActionManager.UpdateUserPoint <T1>(userID, Type, actionType, count, true, 0, beforeUpdate));
 }
Exemple #11
0
 /// <summary>
 /// 批量更新用户的积分
 /// <para>可能抛出的错误:</para>
 /// <para>UserPointOverMaxValueError 积分超出上限</para>
 /// <para>UserPointOverMinValueError 积分超出下限</para>
 /// </summary>
 /// <param name="userIDs">key:用户ID;value:更新倍数</param>
 /// <param name="actionType"></param>
 /// <param name="isNormal">如果为false则取积分的相反值(通常发生在类似帖子由正常变成未审核,此时为false)</param>
 /// <param name="beforeUpdate"></param>
 /// <returns></returns>
 public bool UpdateUsersPoint(Dictionary <int, int> userIDs, T1 actionType, bool isNormal, int nodeId, PointActionManager.TryUpdateUserPointCallback beforeUpdate)
 {
     return(PointActionManager.UpdateUserPoint <T1>(userIDs, Type, actionType, isNormal, nodeId, beforeUpdate));
 }
Exemple #12
0
 /// <summary>
 /// 批量更新用户的积分
 /// <para>可能抛出的错误:</para>
 /// <para>UserPointOverMaxValueError 积分超出上限</para>
 /// <para>UserPointOverMinValueError 积分超出下限</para>
 /// </summary>
 /// <param name="userIDs">key:用户ID;value:更新倍数</param>
 /// <param name="actionType"></param>
 /// <param name="beforeUpdate"></param>
 /// <returns></returns>
 public bool UpdateUsersPoint(Dictionary <int, int> userIDs, T1 actionType, PointActionManager.TryUpdateUserPointCallback beforeUpdate)
 {
     return(PointActionManager.UpdateUserPoint <T1>(userIDs, Type, actionType, true, 0, beforeUpdate));
 }
Exemple #13
0
 /// <summary>
 /// 更新多个用户的多个动作的积分
 /// <para>可能抛出的错误:</para>
 /// <para>UserPointOverMaxValueError 积分超出上限</para>
 /// <para>UserPointOverMinValueError 积分超出下限</para>
 /// </summary>
 /// <param name="isNormal">通常为true,如果为false则取积分的相反值(通常发生在类似帖子由正常变成未审核,此时为false)</param>
 /// <param name="nodeId">没有则为0</param>
 /// <param name="beforeUpdate"></param>
 /// <returns></returns>
 public bool UpdateUsersPoints(bool isNormal, int nodeId, PointActionManager.TryUpdateUserPointCallback3 <T1> beforeUpdate)
 {
     return(PointActionManager.UpdateUsersPoints <T1>(Type, isNormal, nodeId, beforeUpdate));
 }