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

            sql.Append("update Paylog set ");

            sql.Append(" order_id = @order_id , ");
            sql.Append(" amount = @amount , ");
            sql.Append(" order_type = @order_type , ");
            sql.Append(" is_paid = @is_paid  ");
            sql.Append(" where log_id=@log_id ");

            DynamicParameters param = new DynamicParameters();

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

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

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

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

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

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

            dao.Delete(obj.Log_Id);
        }
Esempio n. 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Insert(Wuyiju.Model.Paylog model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("insert into ec_paylog(");
            sql.Append("order_id,amount,order_type,is_paid");
            sql.Append(") values (");
            sql.Append("@order_id,@amount,@order_type,@is_paid");
            sql.Append(") ");

            DynamicParameters param = new DynamicParameters();

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

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

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