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

            dao.Insert(obj);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Wuyiju.Model.UserInfo model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("update UserInfo set ");

            sql.Append(" user_id = @user_id , ");
            sql.Append(" region_lv1 = @region_lv1 , ");
            sql.Append(" region_lv2 = @region_lv2 , ");
            sql.Append(" region_lv3 = @region_lv3 , ");
            sql.Append(" region_lv4 = @region_lv4 , ");
            sql.Append(" region_values = @region_values , ");
            sql.Append(" sex = @sex , ");
            sql.Append(" brithday = @brithday , ");
            sql.Append(" blog = @blog , ");
            sql.Append(" info = @info , ");
            sql.Append(" share_num = @share_num , ");
            sql.Append(" like_num = @like_num , ");
            sql.Append(" follow_num = @follow_num , ");
            sql.Append(" fans_num = @fans_num , ");
            sql.Append(" constellation = @constellation , ");
            sql.Append(" job = @job , ");
            sql.Append(" qq = @qq , ");
            sql.Append(" realname = @realname , ");
            sql.Append(" alipay = @alipay , ");
            sql.Append(" rank = @rank , ");
            sql.Append(" money = @money , ");
            sql.Append(" frozen_money = @frozen_money , ");
            sql.Append(" points = @points , ");
            sql.Append(" rank_points = @rank_points , ");
            sql.Append(" forum = @forum , ");
            sql.Append(" salt = @salt , ");
            sql.Append(" is_validated = @is_validated  ");
            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.º 3
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Remove(Wuyiju.Model.UserInfo obj)
        {
            if (obj == null)
            {
                throw new ApplicationException("参数不能为空");
            }

            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.UserInfo model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("insert into ec_user_info(");
            sql.Append("user_id,region_lv1,region_lv2,region_lv3,region_lv4,region_values,sex,brithday,blog,info,share_num,like_num,follow_num,fans_num,constellation,job,qq,realname,alipay,rank,money,frozen_money,points,rank_points,forum,salt,is_validated");
            sql.Append(") values (");
            sql.Append("@user_id,@region_lv1,@region_lv2,@region_lv3,@region_lv4,@region_values,@sex,@brithday,@blog,@info,@share_num,@like_num,@follow_num,@fans_num,@constellation,@job,@qq,@realname,@alipay,@rank,@money,@frozen_money,@points,@rank_points,@forum,@salt,@is_validated");
            sql.Append(") ");

            DynamicParameters param = new DynamicParameters();

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

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

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