/// <summary> /// For Update Hotel Information /// </summary> /// <param name="hotelDS"></param> /// <returns>Status of the edit operation on a hotel</returns> public bool EditHotel(HappyTrip.Model.Entities.Hotel.Hotel hotel) { bool isUpdated = true; try { DataSet hotelDS = this.GetHotelById(hotel.HotelId); DataRow row = hotelDS.Tables[0].NewRow(); row["HotelId"] = hotel.HotelId; row["Address"] = hotel.Address; row["BriefNote"] = hotel.BriefNote; row["CityId"] = hotel.CityID; row["PhotoURL"] = hotel.PhotoUrl; row["ContactNo"] = hotel.ContactNo; row["EMail"] = hotel.Email; row["Pincode"] = hotel.Pincode; row["StarRanking"] = hotel.StarRanking; row["WebsiteURL"] = hotel.WebsiteURL; hotelDS.Tables[0].Rows.Add(row); SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(dataAdapter as SqlDataAdapter); dataAdapter.Update(hotelDS); } catch (SqlException ex) { throw new HotelDAOException("Unable to edit hotel info", ex); } catch (Exception e) { throw new HotelDAOException("Unable to edit hotel info", e); } return(isUpdated); }
/// <summary> /// Inserts a given hotel information into the database /// </summary> /// <param name="hotel"></param> /// <returns>Status of the insert operation</returns> public bool SaveHotel(HappyTrip.Model.Entities.Hotel.Hotel hotel) { try { ValidateHotelInfo(hotel); return(hotelRepository.SaveHotel(hotel)); } catch (HotelDAOException ex) { LogMessage message = new LogMessage(); message.Message = ex.Message; message.ClassName = "HotelManager.cs"; message.MethodName = "SaveHotel(Hotel hotel)"; message.MessageDateTime = DateTime.Now; LogManager.WriteToLog(message); throw new HotelManagerException("Unable to insert hotel information", ex); } catch (Exception ex) { LogMessage message = new LogMessage(); message.Message = ex.Message; message.ClassName = "HotelManager.cs"; message.MethodName = "SaveHotel(Hotel hotel)"; message.MessageDateTime = DateTime.Now; LogManager.WriteToLog(message); throw new HotelManagerException("Unable to insert hotel information", ex); } }
/// <summary> /// Updates the hotel information /// </summary> /// <param name="hotel"></param> /// <returns>Status of the update</returns> public bool UpdateHotel(HappyTrip.Model.Entities.Hotel.Hotel hotel) { try { return(hotelRepository.EditHotel(hotel)); } catch (HotelDAOException ex) { throw new HotelManagerException("Unable to update hotel information", ex); } catch (Exception ex) { throw new HotelManagerException("Unable to update hotel information", ex); } }
private void ValidateHotelInfo(HappyTrip.Model.Entities.Hotel.Hotel hotel) { //throw new NotImplementedException(); }
/// <summary> /// To add hotel into the result /// </summary> /// <param name="NewHotel"></param> public void AddHotel(Hotel NewHotel) { Hotels.Add(NewHotel); }
private void ValidateHotelInfo(HappyTrip.Model.Entities.Hotel.Hotel hotel) { }