Пример #1
0
 /// <summary>
 /// 为房间表删除一行数据并返回,需要提供房间编号(名称)
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public DataTable RoomDelect(string name)
 {
     foreach (DataRow item in HotelData.Data.Tables["RoomSchedules"].Rows)
     {
         if (item["RoomNumber"].ToString().Trim() == name.Trim())
         {
             item.Delete();
             break;
         }
     }
     HotelData.UploadData();
     return(HotelData.Data.Tables["RoomSchedules"]);
 }
Пример #2
0
        /// <summary>
        /// 为房间表插入一行数据并返回,需要提供房间对象
        /// </summary>
        /// <param name="room">插入的房间信息</param>
        /// <returns></returns>
        public DataTable RoomInsert(RoomSchedules room)
        {
            DataRow dr = HotelData.Data.Tables["RoomSchedules"].NewRow();

            dr["RoomNumber"] = room.RoomNumber;
            dr["Floor"]      = room.Floor;
            dr["RoomType"]   = room.RoomType.No;
            dr["RoomStatus"] = room.RoomStatus.No;

            HotelData.Data.Tables["RoomSchedules"].Rows.Add(dr);
            HotelData.UploadData();

            return(HotelData.Data.Tables["RoomSchedules"]);
        }
Пример #3
0
 /// <summary>
 /// 为房间表修改一行数据并返回,需要提供房间编号(名称),以及修改的内容
 /// </summary>
 /// <param name="num"></param>
 /// <param name="room"></param>
 /// <returns></returns>
 public DataTable RoomUpdate(string num, RoomSchedules room)
 {
     for (int i = 0; i < HotelData.Data.Tables["RoomSchedules"].Rows.Count; i++)
     {
         if (HotelData.Data.Tables["RoomSchedules"].Rows[i]["RoomNumber"].ToString() == num)
         {
             HotelData.Data.Tables["RoomSchedules"].Rows[i]["RoomType"]   = room.RoomType.No;
             HotelData.Data.Tables["RoomSchedules"].Rows[i]["RoomStatus"] = room.RoomStatus.No;
             break;
         }
     }
     HotelData.UploadData();
     return(HotelData.Data.Tables["RoomSchedules"]);
 }
Пример #4
0
 /// <summary>
 /// 数据上传
 /// </summary>
 public void UploadData()
 {
     HotelData.UploadData();
 }