protected void btnUpdate_Click(object sender, EventArgs e) { HotelManager hm = new HotelManager(); Hotel hotel = new Hotel(); ICityManager cm = (ICityManager)BusinessObjectManager.GetCityManager(); hotel.HotelId = Convert.ToInt64(txtHotelId.Text); hotel.HotelName = txtHotelName.Text; hotel.Address = txtAddress.Text; hotel.City = cm.GetCityById(Convert.ToInt64(dpCity.SelectedValue)); hotel.CityID = Convert.ToInt32(dpCity.SelectedValue); hotel.BriefNote = txtBrief.Text; hotel.Email = txtEMail.Text; hotel.ContactNo = txtContact.Text; hotel.Pincode = txtPincode.Text; hotel.StarRanking = Convert.ToInt32(dpStarRanking.SelectedValue); hotel.PhotoUrl = txtPhoto.Text; hotel.WebsiteURL = txtWebsite.Text; hm.UpdateHotel(hotel); ResetHotelDataSet(); Response.Redirect("~/Admin/ViewHotel.aspx"); }
protected void btnAdd_Click(object sender, EventArgs e) { try { HotelManager hm = new HotelManager(); Hotel hotel = new Hotel(); ICityManager cm = (ICityManager)BusinessObjectManager.GetCityManager(); hotel.HotelName = txtHotelName.Text; hotel.Address = txtAddress.Text; hotel.City = cm.GetCityById(Convert.ToInt64(dpCity.SelectedValue)); hotel.CityID = Convert.ToInt32(dpCity.SelectedValue); hotel.BriefNote = txtBrief.Text; hotel.Email = txtEMail.Text; hotel.ContactNo = txtContact.Text; hotel.Pincode = txtPincode.Text; hotel.StarRanking = Convert.ToInt32(dpStarRanking.SelectedValue); hotel.PhotoUrl = txtPhoto.Text; hotel.WebsiteURL = txtWebsite.Text; hm.SaveHotel(hotel); //Resetting the session to invalidate the hotels Session["HOTELDS"] = null; Response.Redirect("~/Admin/ViewHotel.aspx"); } catch (Exception ex) { lblError.Text = ex.Message; } }