private async void CargaOtrasHabitaciones()
        {
            var connection = await this.apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Mensajes.Alerta(connection.Message);

                return;
            }


            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("", ""),
            });


            var response = await this.apiService.Get <HabitacionesReturn>("/hotel_spa/habitaciones", "/indexApp", content);

            if (!response.IsSuccess)
            {
                await Mensajes.Alerta("Ha habido un error en tu solicitud, por favor volvé a intentarlo");

                return;
            }

            try
            {
                this.listHabitaciones = (HabitacionesReturn)response.Result;

                HabitacionesDetalle = new ObservableCollection <HabitacionesDetalle>();

                foreach (var l in listHabitaciones.resultado)
                {
                    int    PosicionEspacio1 = l.hab_nombre.IndexOf(" ");
                    string Arreglo1         = l.hab_nombre.Substring(0, PosicionEspacio1);
                    string Arreglo2         = l.hab_nombre.Substring(PosicionEspacio1 + 1);


                    HabitacionesDetalle.Add(new HotelItemViewModel()
                    {
                        hab_id                  = l.hab_id,
                        hab_nombre              = Arreglo1,
                        hab_nombre2             = Arreglo2,
                        hab_descripcion         = l.hab_descripcion,
                        hab_imagen              = VariablesGlobales.RutaServidor + l.hab_imagen,
                        hab_titulo_1            = l.hab_titulo_1,
                        hab_descripcion_1       = l.hab_descripcion_1,
                        hab_imagen_1            = l.hab_imagen_1,
                        hab_titulo_2            = l.hab_titulo_2,
                        hab_descripcion_2       = l.hab_descripcion_2,
                        hab_imagen_2            = l.hab_imagen_2,
                        hab_titulo_3            = l.hab_titulo_3,
                        hab_id_usuario_creo     = l.hab_id_usuario_creo,
                        hab_fecha_hora_creo     = l.hab_fecha_hora_creo,
                        hab_id_usuario_modifico = l.hab_id_usuario_modifico,
                        hab_fecha_hora_modifico = l.hab_fecha_hora_modifico,
                        hab_estatus             = l.hab_estatus,
                        hab_descripcion_3       = l.hab_descripcion_3,
                        hab_imagen_3            = l.hab_imagen_3,
                        hab_imagen_4            = l.hab_imagen_4,
                        hab_imagen_5            = l.hab_imagen_5,
                        hab_imagen_6            = l.hab_imagen_6
                    });



                    //            HabitacionesDetalle = new ObservableCollection<HotelItemViewModel>(this.ToHabitacionesItemViewModel());
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        private async void LoadHabitaciones()
        {
            try
            {
                var connection = await this.apiService.CheckConnection();

                if (!connection.IsSuccess)
                {
                    await Mensajes.Alerta("Verificá tu conexión a Internet");

                    return;
                }


                var content = new FormUrlEncodedContent(new[]
                {
                    new KeyValuePair <string, string>("", ""),
                });


                var response = await this.apiService.Get <HabitacionesReturn>("/hotel_spa/habitaciones", "/indexApp", content);

                if (!response.IsSuccess)
                {
                    //await Mensajes.Alerta("Error al cargar Habitaciones");

                    return;
                }

                this.listHabitaciones = (HabitacionesReturn)response.Result;

                HabitacionesDetalle = new ObservableCollection <HotelItemViewModel>();

                foreach (var l in listHabitaciones.resultado)
                {
                    int    PosicionEspacio1 = l.hab_nombre.IndexOf(" ");
                    string Arreglo1         = l.hab_nombre.Substring(0, PosicionEspacio1);
                    string Arreglo2         = l.hab_nombre.Substring(PosicionEspacio1 + 1);


                    HabitacionesDetalle.Add(new HotelItemViewModel()
                    {
                        hab_id                  = l.hab_id,
                        hab_nombre              = Arreglo1,
                        hab_nombre2             = Arreglo2,
                        hab_descripcion         = l.hab_descripcion,
                        hab_imagen              = VariablesGlobales.RutaServidor + l.hab_imagen,
                        hab_titulo_1            = l.hab_titulo_1,
                        hab_descripcion_1       = l.hab_descripcion_1,
                        hab_imagen_1            = l.hab_imagen_1,
                        hab_titulo_2            = l.hab_titulo_2,
                        hab_descripcion_2       = l.hab_descripcion_2,
                        hab_imagen_2            = l.hab_imagen_2,
                        hab_titulo_3            = l.hab_titulo_3,
                        hab_id_usuario_creo     = l.hab_id_usuario_creo,
                        hab_fecha_hora_creo     = l.hab_fecha_hora_creo,
                        hab_id_usuario_modifico = l.hab_id_usuario_modifico,
                        hab_fecha_hora_modifico = l.hab_fecha_hora_modifico,
                        hab_estatus             = l.hab_estatus,
                        hab_descripcion_3       = l.hab_descripcion_3,
                        hab_imagen_3            = l.hab_imagen_3,
                        hab_imagen_4            = l.hab_imagen_4,
                        hab_imagen_5            = l.hab_imagen_5,
                        hab_imagen_6            = l.hab_imagen_6
                    });



                    //            HabitacionesDetalle = new ObservableCollection<HotelItemViewModel>(this.ToHabitacionesItemViewModel());

                    int contador = HabitacionesDetalle.Count;

                    switch (contador)
                    {
                    case 1:
                        TamanoHabitacion = 125;
                        break;

                    case 2:
                        TamanoHabitacion = 125;
                        break;

                    case 3:
                        TamanoHabitacion = 125;
                        break;

                    case 4:
                        TamanoHabitacion = 250;
                        break;

                    case 5:
                        TamanoHabitacion = 250;
                        break;

                    case 6:
                        TamanoHabitacion = 250;
                        break;

                    case 7:
                        TamanoHabitacion = 375;
                        break;

                    case 8:
                        TamanoHabitacion = 375;
                        break;

                    case 9:
                        TamanoHabitacion = 375;
                        break;

                    case 10:
                        TamanoHabitacion = 500;
                        break;

                    case 11:
                        TamanoHabitacion = 500;
                        break;

                    case 12:
                        TamanoHabitacion = 500;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                //await Mensajes.Error("Hotel - Habitaciones" + ex.ToString());
            }
        }