Beispiel #1
0
 public static bool InsertCheckinInfo(string roomName, string staffUsername, long customerID, DateTime checkinDate)
 {
     using (var conn = DatabaseManager.Conn)
     {
         var checkinInfo = new RentInfo {
             RoomName = roomName, StaffUsername = staffUsername, CustomerID = customerID, CheckinDate = checkinDate
         };
         try
         {
             return(conn.Execute("INSERT INTO rent_info(room_name, staff_username, customer_id, checkin_date) VALUE (@RoomName, @StaffUsername, @CustomerID, @CheckinDate)", checkinInfo) > 0);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Beispiel #2
0
 public static bool UpdateRoomStatus(string roomName)
 {
     using (var conn = DatabaseManager.Conn)
     {
         try
         {
             if (RentInfo.FindRoomRented(roomName))
             {
                 return(conn.Execute("UPDATE room SET status = @Status WHERE name = @Name", new { Status = "NotAvailable", Name = roomName }) > 0);
             }
             else
             {
                 return(conn.Execute("UPDATE room SET status = @Status WHERE name = @Name", new { Status = "Available", Name = roomName }) > 0);
             }
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Beispiel #3
0
 public void RetrieveRentInfo()
 {
     _RentInfos = RentInfo.GetAllCurrentByRoomName(Name);
 }