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

            sql.Append("update ec_Order set ");

            sql.Append(" sn = @sn , ");
            sql.Append(" product_id = @product_id , ");
            sql.Append(" status = @status , ");
            sql.Append(" pay_statu = @pay_statu , ");
            sql.Append(" username = @username , ");
            sql.Append(" name = @name , ");
            sql.Append(" uid = @uid , ");
            sql.Append(" seller_id = @seller_id , ");
            sql.Append(" tel = @tel , ");
            sql.Append(" mobile = @mobile , ");
            sql.Append(" email = @email , ");
            sql.Append(" add_time = @add_time , ");
            sql.Append(" rest_time = @rest_time , ");
            sql.Append(" countdown = @countdown , ");
            sql.Append(" pay_time = @pay_time , ");
            sql.Append(" pay_id = @pay_id , ");
            sql.Append(" discount = @discount , ");
            sql.Append(" coupon = @coupon , ");
            sql.Append(" price = @price , ");
            sql.Append(" num = @num , ");
            sql.Append(" total_fee = @total_fee , ");
            sql.Append(" pay_fee = @pay_fee , ");
            sql.Append(" trade_no = @trade_no , ");
            sql.Append(" txt = @txt , ");
            sql.Append(" del = @del , ");
            sql.Append(" del_time = @del_time , ");
            sql.Append(" send_mail = @send_mail , ");
            sql.Append(" fee = @fee , ");
            sql.Append(" ensure = @ensure , ");
            sql.Append(" techfee = @techfee , ");
            sql.Append(" deposit = @deposit  ");
            sql.Append(" where id=@id ");

            DynamicParameters param = new DynamicParameters();

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

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

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

            using (var db = new DataContext())
            {
                this.GetDao(db).Insert(obj);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Remove(Wuyiju.Model.Order obj)
        {
            if (obj == null)
            {
                throw new ApplicationException("参数不能为空");
            }

            using (var db = new DataContext())
            {
                var _dao = this.GetDao(db);
                var old  = _dao.Get(obj.Id);

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

                _dao.Delete(obj.Id);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Insert(Wuyiju.Model.Order model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("insert into ec_order(");
            sql.Append("sn,product_id,status,pay_statu,username,name,uid,seller_id,tel,mobile,email,add_time,rest_time,countdown,pay_time,pay_id,discount,coupon,price,num,total_fee,pay_fee,trade_no,txt,del,del_time,send_mail,fee,ensure,techfee,deposit");
            sql.Append(") values (");
            sql.Append("@sn,@product_id,@status,@pay_statu,@username,@name,@uid,@seller_id,@tel,@mobile,@email,@add_time,@rest_time,@countdown,@pay_time,@pay_id,@discount,@coupon,@price,@num,@total_fee,@pay_fee,@trade_no,@txt,@del,@del_time,@send_mail,@fee,@ensure,@techfee,@deposit");
            sql.Append(") ");

            DynamicParameters param = new DynamicParameters();

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

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

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