private void modificarHotel_Click(object sender, EventArgs e) { try{ RepositorioHotel repoHotel = new RepositorioHotel(); List <Regimen> regimenes = new List <Regimen>(); foreach (DataGridViewRow item in this.regimenesGrid.SelectedRows) { regimenes.Add(item.DataBoundItem as Regimen); } validarQuitaRegimen(hotel.getRegimenes(), regimenes); String nombre = Utils.validateStringFields(nombreText.Text.Trim(), "Nombre"); String pais = Utils.validateStringFields((String)paisText.Text.Trim(), "Pais"); String ciudad = Utils.validateStringFields((String)ciudadText.Text.Trim(), "Ciudad"); String calle = Utils.validateStringFields((String)calleText.Text.Trim(), "Calle"); int numeroCalle = Utils.validateIntField((String)numeroCalleText.Text.Trim(), "NumeroCalle"); Categoria categoria = (Categoria)Utils.validateFields(estrellasComboBox.SelectedItem, "Categoria"); String email = Utils.validateStringFields(emailText.Text.Trim(), "Email"); String telefono = Utils.validateStringFields(telefonoText.Text.Trim(), "Telefono"); DateTime fechaInicioActividades = (DateTime)Utils.validateFields(creacionTime.Value, "Fecha Inicio de Actividades"); Direccion direccion = new Direccion(hotel.getDireccion().getIdDireccion(), pais, ciudad, calle, numeroCalle, 0, ""); Hotel hotelToUpdateSave = new Hotel(hotel.getIdHotel(), categoria, direccion, nombre, email, telefono, fechaInicioActividades, regimenes); if (repoHotel.yaExisteHotelMismoNombre(hotelToUpdateSave)) { MessageBox.Show("Ya existe un hotel registrado con el mismo nombre.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } repoHotel.update(hotelToUpdateSave); MessageBox.Show("Hotel modificado correctamente.", "Gestion de Datos TP 2018 1C - LOS_BORBOTONES", MessageBoxButtons.OK, MessageBoxIcon.Information); hotel = repoHotel.getById(hotel.getIdHotel()); this.initModificacionHotel(); } /* * catch (NoExisteIDException exceptionUpdateHotel) * { * MessageBox.Show(exceptionUpdateHotel.Message, "Gestion de Datos TP 2018 1C - LOS_BORBOTONES", MessageBoxButtons.OK, MessageBoxIcon.Error); * } */ catch (Exception exc) { MessageBox.Show(exc.Message, "Gestion de Datos TP 2018 1C - LOS_BORBOTONES", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonNuevoCierre_Click(object sender, EventArgs e) { using (DropHotel cierreTemporalForm = new DropHotel(this.hotel)) { var result = cierreTemporalForm.ShowDialog(); //ME TRAIGO EL HOTEL MODIFICADO this.hotel.getCierresTemporales(); RepositorioHotel repoHotel = new RepositorioHotel(); hotel = repoHotel.getById(hotel.getIdHotel()); //AL CERRAR LA VENTANA DESPUES DE DAR DE ALTA UN NUEVO CIERRE TEMPORAL VUELVO A CARGAR LA LISTA this.initModificacionHotel(); } }
public void Test_Repo_Hotel_CreacionInstancia_Hotel() { RepositorioHotel repositorioHotel = new RepositorioHotel(); Hotel hotel = repositorioHotel.getById(13); Direccion direccionHotel = hotel.getDireccion(); Categoria categoriaHotel = hotel.getCategoria(); Assert.AreEqual("Balcarce 2520", hotel.getNombre()); Assert.AreEqual("No Posee", hotel.getMail()); Assert.AreEqual("No Posee", hotel.getTelefono()); Assert.AreEqual(2017, hotel.getFechaInicioActividades().Year); Assert.AreEqual(1, categoriaHotel.getEstrellas()); Assert.AreEqual(10, categoriaHotel.getRecargaEstrellas()); Assert.AreEqual("Argentina", direccionHotel.getPais()); Assert.AreEqual("Bs. As. Oeste", direccionHotel.getCiudad()); Assert.AreEqual("Balcarce", direccionHotel.getCalle()); Assert.AreEqual(2520, direccionHotel.getNumeroCalle()); Assert.AreEqual(0, direccionHotel.getPiso()); Assert.AreEqual("", direccionHotel.getDepartamento()); }