Exemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WeiXinPF.Model.wx_hotel_room model)
        {
            StringBuilder query = new StringBuilder();

            query.Append("Update[dbo].[wx_hotel_room]");
            query.Append("     Set[hotelid] = @hotelid");
            query.Append("       ,[roomType] = @roomType");
            query.Append("       ,[indroduce] = @indroduce");
            query.Append("       ,[roomPrice] = @roomPrice");
            query.Append("       ,[salePrice] = @salePrice");
            query.Append("       ,[facilities] = @facilities");
            query.Append("       ,[createDate] = @createDate");
            query.Append("       ,[sortid] = @sortid");
            query.Append("       ,[RoomCode] = @RoomCode");
            query.Append("       ,[UseInstruction] = @UseInstruction");
            query.Append("       ,[RefundRule] = @RefundRule");
            query.Append("       ,[Status] = @Status");
            query.Append("       ,[ExpiryDate_Begin] = @ExpiryDate_Begin");
            query.Append("       ,[ExpiryDate_End] = @ExpiryDate_End");
            query.Append(" Where id=@Id");

            using (IDbConnection db = DbFactory.GetOpenedConnection())
            {
                return(db.Execute(query.ToString(), model) > 0);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WeiXinPF.Model.wx_hotel_room DataRowToModel(DataRow row)
 {
     WeiXinPF.Model.wx_hotel_room model = new WeiXinPF.Model.wx_hotel_room();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["hotelid"] != null && row["hotelid"].ToString() != "")
         {
             model.hotelid = int.Parse(row["hotelid"].ToString());
         }
         if (row["roomType"] != null)
         {
             model.roomType = row["roomType"].ToString();
         }
         if (row["indroduce"] != null)
         {
             model.indroduce = row["indroduce"].ToString();
         }
         if (row["roomPrice"] != null && row["roomPrice"].ToString() != "")
         {
             model.roomPrice = decimal.Parse(row["roomPrice"].ToString());
         }
         if (row["salePrice"] != null && row["salePrice"].ToString() != "")
         {
             model.salePrice = decimal.Parse(row["salePrice"].ToString());
         }
         if (row["facilities"] != null)
         {
             model.facilities = row["facilities"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["sortid"] != null && row["sortid"].ToString() != "")
         {
             model.sortid = int.Parse(row["sortid"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WeiXinPF.Model.wx_hotel_room model)
        {
            StringBuilder query = new StringBuilder();

            query.Append("Insert Into[dbo].[wx_hotel_room]");
            query.Append("([hotelid],[roomType],[indroduce],[roomPrice],[salePrice],[facilities],[createDate],[sortid],[RoomCode],[UseInstruction],[RefundRule],[Status],[ExpiryDate_Begin],[ExpiryDate_End])");
            query.Append("Values");
            query.Append("(@hotelid, @roomType, @indroduce, @roomPrice, @salePrice, @facilities, @createDate, @sortid, @RoomCode, @UseInstruction, @RefundRule, @Status,@ExpiryDate_Begin,@ExpiryDate_End);");
            query.Append("Select @Id = Scope_Identity()");
            //query.Append("Update dbo.wx_hotel_room Set RoomCode=Right('0000'+Cast(@Id As Varchar(10)),4) Where Id=@Id");
            using (IDbConnection db = DbFactory.GetOpenedConnection())
            {
                DynamicParameters dynamicParameters = new DynamicParameters();
                dynamicParameters.AddDynamicParams(model);
                dynamicParameters.Add("@Id", dbType: DbType.Int32, direction: ParameterDirection.Output);

                db.Execute(query.ToString(), dynamicParameters);

                return(dynamicParameters.Get <int>("@Id"));
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(WeiXinPF.Model.wx_hotel_room model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(WeiXinPF.Model.wx_hotel_room model)
 {
     return(dal.Add(model));
 }