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

            sql.Append("update AdPosition set ");

            sql.Append(" name = @name , ");
            sql.Append(" type = @type , ");
            sql.Append(" width = @width , ");
            sql.Append(" height = @height , ");
            sql.Append(" description = @description , ");
            sql.Append(" status = @status  ");
            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("更新数据无效");
            }
        }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Wuyiju.Model.AdPosition obj)
        {
            if (obj == null)
            {
                throw new ApplicationException("参数不能为空");
            }

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

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

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

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

            sql.Append("insert into ec_ad_position(");
            sql.Append("name,type,width,height,description,status");
            sql.Append(") values (");
            sql.Append("@name,@type,@width,@height,@description,@status");
            sql.Append(") ");

            DynamicParameters param = new DynamicParameters();

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

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

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