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

            sql.Append("update Payment set ");

            sql.Append(" pay_name = @pay_name , ");
            sql.Append(" pay_code = @pay_code , ");
            sql.Append(" pay_desc = @pay_desc , ");
            sql.Append(" pay_logo = @pay_logo , ");
            sql.Append(" enabled = @enabled , ");
            sql.Append(" pay_order = @pay_order , ");
            sql.Append(" pay_content = @pay_content , ");
            sql.Append(" pay_fee = @pay_fee , ");
            sql.Append(" partner_id = @partner_id , ");
            sql.Append(" partner_key = @partner_key , ");
            sql.Append(" is_online = @is_online  ");
            sql.Append(" where pay_id=@pay_id ");

            DynamicParameters param = new DynamicParameters();

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

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

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

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

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

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

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

            sql.Append("insert into ec_payment(");
            sql.Append("pay_name,pay_code,pay_desc,pay_logo,enabled,pay_order,pay_content,pay_fee,partner_id,partner_key,is_online");
            sql.Append(") values (");
            sql.Append("@pay_name,@pay_code,@pay_desc,@pay_logo,@enabled,@pay_order,@pay_content,@pay_fee,@partner_id,@partner_key,@is_online");
            sql.Append(") ");

            DynamicParameters param = new DynamicParameters();

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

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

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