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

            dao.Insert(obj);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Remove(Wuyiju.Model.UserConsignee 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.UserConsignee model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("update UserConsignee 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(" address = @address , ");
            sql.Append(" mobile = @mobile , ");
            sql.Append(" phone = @phone , ");
            sql.Append(" consignee = @consignee , ");
            sql.Append(" zip = @zip , ");
            sql.Append(" qq = @qq , ");
            sql.Append(" email = @email , ");
            sql.Append(" create_time = @create_time , ");
            sql.Append(" fax = @fax , ");
            sql.Append(" is_def = @is_def , ");
            sql.Append(" region_values = @region_values  ");
            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.UserConsignee model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("insert into ec_user_consignee(");
            sql.Append("user_id,region_lv1,region_lv2,region_lv3,region_lv4,address,mobile,phone,consignee,zip,qq,email,create_time,fax,is_def,region_values");
            sql.Append(") values (");
            sql.Append("@user_id,@region_lv1,@region_lv2,@region_lv3,@region_lv4,@address,@mobile,@phone,@consignee,@zip,@qq,@email,@create_time,@fax,@is_def,@region_values");
            sql.Append(") ");

            DynamicParameters param = new DynamicParameters();

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

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

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