Example #1
0
        /// <summary>
        /// 增加积分及检查升级
        /// </summary>
        /// <param name="user_id">用户ID</param>
        /// <param name="user_name">用户名</param>
        /// <param name="value">积分值可为正负</param>
        /// <param name="remark">备注</param>
        /// <param name="is_upgrade">是否检查升级</param>
        public int Add(int user_id, string user_name, int value, string remark, bool is_upgrade, int order_id, int islock)
        {
            Model.user_point_log model = new Model.user_point_log();
            model.user_id   = user_id;
            model.user_name = user_name;
            model.value     = value;
            model.remark    = remark;
            model.order_id  = order_id;
            model.islock    = islock;

            int result = dal.Add(model);

            //new Tea.BLL.users().JiSuan(model.user_id);

            //int point = new Tea.BLL.users().GetModel(model.user_id).point;
            //UpdateField(result, "jieyu=" + point + "");

            try
            {
                //購物金
                int all = Utils.StrToInt(Tea.DBUtility.DbHelperSQL.Query("select sum(value) as c from shop_user_point_log where user_id=" + user_id + "").Tables[0].Rows[0][0].ToString(), 0);
                new Tea.BLL.users().UpdateField(user_id, "point=" + all + "");
            }
            catch (Exception eee) { }

            return(result);
        }
Example #2
0
        /// <summary>
        /// 增加积分及检查升级
        /// </summary>
        /// <param name="user_id">用户ID</param>
        /// <param name="user_name">用户名</param>
        /// <param name="value">积分值可为正负</param>
        /// <param name="remark">备注</param>
        /// <param name="is_upgrade">是否检查升级</param>
        public int Add(int user_id, string user_name, int value, string remark, bool is_upgrade)
        {
            Model.user_point_log model = new Model.user_point_log();
            model.user_id   = user_id;
            model.user_name = user_name;
            model.value     = value;
            model.remark    = remark;
            int result = dal.Add(model, is_upgrade);

            if (is_upgrade && value > 0 && result > 0)
            {
                new BLL.users().Upgrade(user_id);
            }
            return(result);
        }