Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Wuyiju.Model.UserRank model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("update ec_user_rank set ");

            sql.Append(" rank_name = @rank_name , ");
            sql.Append(" min_points = @min_points , ");
            sql.Append(" max_points = @max_points , ");
            sql.Append(" discount = @discount , ");
            sql.Append(" show_price = @show_price , ");
            sql.Append(" special_rank = @special_rank , ");
            sql.Append(" extension_code = @extension_code  ");
            sql.Append(" where rank_id=@rank_id ");

            DynamicParameters param = new DynamicParameters();

            if (model != null)
            {
                param.AddDynamicParams(model);
            }

            var rows = db.Execute(sql, param);

            if (rows < 1)
            {
                throw new ApplicationException("更新数据无效");
            }
        }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Wuyiju.Model.UserRank obj)
        {
            if (obj == null)
            {
                throw new ApplicationException("参数不能为空");
            }

            dao.Insert(obj);
        }
Example #3
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Remove(Wuyiju.Model.UserRank obj)
        {
            if (obj == null)
            {
                throw new ApplicationException("参数不能为空");
            }

            var old = dao.Get(obj.Rank_Id);

            if (old == null)
            {
                throw new ApplicationException("非法操作记录不存在");
            }

            dao.Delete(obj.Rank_Id);
        }
Example #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Insert(Wuyiju.Model.UserRank model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("insert into ec_user_rank(");
            sql.Append("rank_name,min_points,max_points,discount,show_price,special_rank,extension_code");
            sql.Append(") values (");
            sql.Append("@rank_name,@min_points,@max_points,@discount,@show_price,@special_rank,@extension_code");
            sql.Append(") ");

            DynamicParameters param = new DynamicParameters();

            if (model != null)
            {
                param.AddDynamicParams(model);
            }

            var rows = db.Execute(sql, param);

            if (rows < 1)
            {
                throw new ApplicationException("插入数据无效");
            }
        }