/// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(HotelOrderInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into wx_hotel_dingdan(");
            strSql.Append("hotelid,openid,oderName,orderNumber,wxOrderNumber,identityNumber,tel,arriveTime,leaveTime,roomType,orderTime,orderNum,price,orderStatus,isDelete,createDate,roomid,yuanjia,remark)");
            strSql.Append(" values (");
            strSql.Append("@hotelid,@openid,@oderName,@orderNumber,@wxOrderNumber,@identityNumber,@tel,@arriveTime,@leaveTime,@roomType,@orderTime,@orderNum,@price,@orderStatus,@isDelete,@createDate,@roomid,@yuanjia,@remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@hotelid", SqlDbType.Int,4),
                    new SqlParameter("@openid", SqlDbType.VarChar,200),
                    new SqlParameter("@oderName", SqlDbType.VarChar,100),
                    new SqlParameter("@tel", SqlDbType.VarChar,100),
                    new SqlParameter("@arriveTime", SqlDbType.DateTime),
                    new SqlParameter("@leaveTime", SqlDbType.DateTime),
                    new SqlParameter("@roomType", SqlDbType.VarChar,200),
                    new SqlParameter("@orderTime", SqlDbType.DateTime),
                    new SqlParameter("@orderNum", SqlDbType.Int,4),
                    new SqlParameter("@price", SqlDbType.Float,8),
                    new SqlParameter("@orderStatus", SqlDbType.Int,4),
                    new SqlParameter("@isDelete", SqlDbType.Int,4),
                    new SqlParameter("@createDate", SqlDbType.DateTime),
                    new SqlParameter("@roomid", SqlDbType.Int,4),
                    new SqlParameter("@yuanjia", SqlDbType.Float,8),
                    new SqlParameter("@remark", SqlDbType.NVarChar,100),
                    new SqlParameter("@orderNumber", SqlDbType.VarChar,50),
                    new SqlParameter("@wxOrderNumber", SqlDbType.VarChar,50),
                    new SqlParameter("@identityNumber", SqlDbType.VarChar,50)};
            parameters[0].Value = model.hotelid;
            parameters[1].Value = model.openid;
            parameters[2].Value = model.oderName;
            parameters[3].Value = model.tel;
            parameters[4].Value = model.arriveTime;
            parameters[5].Value = model.leaveTime;
            parameters[6].Value = model.roomType;
            parameters[7].Value = model.orderTime;
            parameters[8].Value = model.orderNum;
            parameters[9].Value = model.price;
            parameters[10].Value = model.orderStatus;
            parameters[11].Value = model.isDelete;
            parameters[12].Value = model.createDate;
            parameters[13].Value = model.roomid;
            parameters[14].Value = model.yuanjia;
            parameters[15].Value = model.remark;
            parameters[16].Value = model.orderNumber;
            parameters[17].Value = model.wxOrderNumber;
            parameters[18].Value = model.identityNumber;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        public HotelOrderInfo GetModel(string outTradeNo)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,hotelid,openid,oderName,orderNumber,wxOrderNumber,identityNumber,tel,arriveTime,leaveTime,roomType,orderTime,orderNum,price,orderStatus,isDelete,createDate,roomid,yuanjia,remark from wx_hotel_dingdan ");
            strSql.Append(" where orderNumber=@orderNumber and isDelete='0' ");
            SqlParameter[] parameters = {
                    new SqlParameter("@orderNumber", SqlDbType.VarChar,50)
            };
            parameters[0].Value = outTradeNo;

            HotelOrderInfo model = new HotelOrderInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
        public HotelOrderInfo GetLastUserModel(string openid)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 * from wx_hotel_dingdan ");
            strSql.Append(" where openid =@id and isDelete='0'  ORDER BY orderTime DESC ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.VarChar,200)
            };
            parameters[0].Value = openid;

            HotelOrderInfo model = new HotelOrderInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
        public bool Updatehotel(HotelOrderInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update wx_hotel_dingdan set ");
            strSql.Append("oderName=@oderName,");
            //            strSql.Append("orderNumber=@orderNumber,");
            strSql.Append("wxOrderNumber=@wxOrderNumber,");
            strSql.Append("identityNumber=@identityNumber,");
            strSql.Append("tel=@tel,");
            strSql.Append("arriveTime=@arriveTime,");
            strSql.Append("leaveTime=@leaveTime,");
            strSql.Append("orderNum=@orderNum,");
            strSql.Append("price=@price,");
            strSql.Append("yuanjia=@yuanjia,");
            strSql.Append("remark=@remark");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@oderName", SqlDbType.VarChar,100),
                    new SqlParameter("@tel", SqlDbType.VarChar,100),
                    new SqlParameter("@arriveTime", SqlDbType.DateTime),
                    new SqlParameter("@leaveTime", SqlDbType.DateTime),
                    new SqlParameter("@orderNum", SqlDbType.Int,4),
                    new SqlParameter("@price", SqlDbType.Float,8),
                    new SqlParameter("@yuanjia", SqlDbType.Float,8),
                    new SqlParameter("@remark", SqlDbType.NVarChar,100),
                    new SqlParameter("@id", SqlDbType.Int,4),
//                    new SqlParameter("@orderNumber", SqlDbType.NVarChar,50),
                    new SqlParameter("@wxOrderNumber", SqlDbType.NVarChar,50),
                    new SqlParameter("@identityNumber", SqlDbType.NVarChar,50)};
            parameters[0].Value = model.oderName;
            parameters[1].Value = model.tel;
            parameters[2].Value = model.arriveTime;
            parameters[3].Value = model.orderNum;
            parameters[4].Value = model.price;
            parameters[5].Value = model.yuanjia;
            parameters[6].Value = model.remark;
            parameters[7].Value = model.id;
            //            parameters[8].Value = model.OrderNumber;
            parameters[8].Value = model.wxOrderNumber;
            parameters[9].Value = model.identityNumber;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HotelOrderInfo DataRowToModel(DataRow row)
 {
     HotelOrderInfo model = new HotelOrderInfo();
     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["openid"] != null)
         {
             model.openid = row["openid"].ToString();
         }
         if (row["oderName"] != null)
         {
             model.oderName = row["oderName"].ToString();
         }
         if (row["orderNumber"] != null)
         {
             model.orderNumber = row["orderNumber"].ToString();
         }
         if (row["wxOrderNumber"] != null)
         {
             model.wxOrderNumber = row["wxOrderNumber"].ToString();
         }
         if (row["identityNumber"] != null)
         {
             model.identityNumber = row["identityNumber"].ToString();
         }
         if (row["tel"] != null)
         {
             model.tel = row["tel"].ToString();
         }
         if (row["arriveTime"] != null && row["arriveTime"].ToString() != "")
         {
             model.arriveTime = DateTime.Parse(row["arriveTime"].ToString());
         }
         if (row["leaveTime"] != null && row["leaveTime"].ToString() != "")
         {
             model.leaveTime = DateTime.Parse(row["leaveTime"].ToString());
         }
         if (row["roomType"] != null)
         {
             model.roomType = row["roomType"].ToString();
         }
         if (row["orderTime"] != null && row["orderTime"].ToString() != "")
         {
             model.orderTime = DateTime.Parse(row["orderTime"].ToString());
         }
         if (row["orderNum"] != null && row["orderNum"].ToString() != "")
         {
             model.orderNum = int.Parse(row["orderNum"].ToString());
         }
         if (row["price"] != null && row["price"].ToString() != "")
         {
             model.price = double.Parse(row["price"].ToString());
         }
         if (row["orderStatus"] != null && row["orderStatus"].ToString() != "")
         {
             model.orderStatus = int.Parse(row["orderStatus"].ToString());
         }
         if (row["isDelete"] != null && row["isDelete"].ToString() != "")
         {
             model.isDelete = int.Parse(row["isDelete"].ToString());
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["roomid"] != null && row["roomid"].ToString() != "")
         {
             model.roomid = int.Parse(row["roomid"].ToString());
         }
         if (row["yuanjia"] != null && row["yuanjia"].ToString() != "")
         {
             model.yuanjia = double.Parse(row["yuanjia"].ToString());
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
     }
     return model;
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(HotelOrderInfo model)
 {
     return _repository.Update(model);
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(HotelOrderInfo model)
 {
     return _repository.Add(model);
 }