예제 #1
0
파일: SmsDAL.cs 프로젝트: hacsonchen/wuyiju
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Wuyiju.Model.Sms model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("update ec_sms set ");

            sql.Append(" mobile = @mobile , ");
            sql.Append(" validateCode = @validateCode , ");
            sql.Append(" add_time = @add_time  ");
            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("更新数据无效");
            }
        }
예제 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Wuyiju.Model.Sms obj)
        {
            if (obj == null)
            {
                throw new ApplicationException("参数不能为空");
            }

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

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

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

            dao.Delete(obj.Id);
        }
예제 #4
0
파일: SmsDAL.cs 프로젝트: hacsonchen/wuyiju
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Insert(Wuyiju.Model.Sms model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("insert into ec_sms(");
            sql.Append("mobile,validateCode,add_time");
            sql.Append(") values (");
            sql.Append("@mobile,@validateCode,@add_time");
            sql.Append(") ");

            DynamicParameters param = new DynamicParameters();

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

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

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