Ejemplo n.º 1
0
        public int InsertHotelInhabilitado(HotelInhabilitacion hotelInhabilitado)
        {
            SqlCommand command = DBConnection.CreateStoredProcedure("InsertHotelInhabilitado");

            AddHotelInhabilitadoParameters(hotelInhabilitado, command);
            return(DBConnection.ExecuteNonQuery(command));
        }
Ejemplo n.º 2
0
 private void AddHotelInhabilitadoParameters(HotelInhabilitacion hotelInhabilitado, SqlCommand command)
 {
     command.Parameters.AddWithValue("@hotelId", hotelInhabilitado.HotelId);
     command.Parameters.AddWithValue("@descripcion", hotelInhabilitado.Descripcion);
     command.Parameters.AddWithValue("@fechaCreacion", hotelInhabilitado.FechaCreacion);
     command.Parameters.AddWithValue("@fechaFin", hotelInhabilitado.FechaFin);
     command.Parameters.AddWithValue("@fechaInicio", hotelInhabilitado.FechaInicio);
 }
Ejemplo n.º 3
0
        private void btnCrear_Click(object sender, EventArgs e)
        {
            string error = ValidateForm();

            if (string.IsNullOrEmpty(error))
            {
                try
                {
                    HotelInhabilitacion hotelInhabilitado = new HotelInhabilitacion();
                    hotelInhabilitado.FechaCreacion = Session.Fecha;
                    hotelInhabilitado.FechaInicio   = dateDesde.Value;
                    hotelInhabilitado.FechaFin      = dateHasta.Value;
                    hotelInhabilitado.Descripcion   = txtDescripcion.Text;
                    hotelInhabilitado.HotelId       = this.hotelId;

                    ReservaService reservaService = new ReservaService();
                    if (reservaService.GetCountActiveReservaBetweenDatesByHotelId(hotelInhabilitado.HotelId, hotelInhabilitado.FechaInicio, hotelInhabilitado.FechaFin) == 0)
                    {
                        HotelService hotelService = new HotelService();
                        hotelService.InsertHotelInhabilitado(hotelInhabilitado);
                        MessageBox.Show("El hotel se ha inhabilitado.");
                    }
                    else
                    {
                        MessageBox.Show("El hotel no puede ser inhabilitado ya que posee reservas en esas fechas");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Ocurrió un error, no se ha podido inhabilitar el hotel.");
                }
            }
            else
            {
                MessageBox.Show(error);
            }
        }
Ejemplo n.º 4
0
        public int InsertHotelInhabilitado(HotelInhabilitacion hotelInhabilitado)
        {
            var repository = new HotelRepository();

            return(repository.InsertHotelInhabilitado(hotelInhabilitado));
        }