Exemplo n.º 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);
        }
Exemplo n.º 2
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));
 }