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

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

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

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

            dao.Delete(obj.Id);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Wuyiju.Model.AdminCopy model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("update AdminCopy set ");

            sql.Append(" username = @username , ");
            sql.Append(" name = @name , ");
            sql.Append(" password = @password , ");
            sql.Append(" sex = @sex , ");
            sql.Append(" status = @status , ");
            sql.Append(" email = @email , ");
            sql.Append(" valicode = @valicode , ");
            sql.Append(" pre_login_time = @pre_login_time , ");
            sql.Append(" login_time = @login_time , ");
            sql.Append(" pre_login_ip = @pre_login_ip , ");
            sql.Append(" login_ip = @login_ip , ");
            sql.Append(" login_nums = @login_nums , ");
            sql.Append(" uid = @uid , ");
            sql.Append(" position = @position , ");
            sql.Append(" parent_id = @parent_id , ");
            sql.Append(" photo_img = @photo_img , ");
            sql.Append(" job_number = @job_number , ");
            sql.Append(" qq = @qq , ");
            sql.Append(" phone = @phone , ");
            sql.Append(" mobile = @mobile , ");
            sql.Append(" score = @score  ");
            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("更新数据无效");
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Insert(Wuyiju.Model.AdminCopy model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("insert into ec_admin_copy(");
            sql.Append("username,name,password,sex,status,email,valicode,pre_login_time,login_time,pre_login_ip,login_ip,login_nums,uid,position,parent_id,photo_img,job_number,qq,phone,mobile,score");
            sql.Append(") values (");
            sql.Append("@username,@name,@password,@sex,@status,@email,@valicode,@pre_login_time,@login_time,@pre_login_ip,@login_ip,@login_nums,@uid,@position,@parent_id,@photo_img,@job_number,@qq,@phone,@mobile,@score");
            sql.Append(") ");

            DynamicParameters param = new DynamicParameters();

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

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

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