private async void EnviaCorreShow()
        {
            if (string.IsNullOrEmpty(this.Nombres))
            {
                await Mensajes.Alerta("Nombre y Apellido requeridos");

                return;
            }

            if (string.IsNullOrEmpty(this.Correos))
            {
                await Mensajes.Alerta("Correo electrónico requerido");

                return;
            }

            if (!ValidaEmailMethod.ValidateEMail(this.Correos))
            {
                await Mensajes.Alerta("Correo electrónico mal estructurado");

                return;
            }

            if (string.IsNullOrEmpty(this.Telefonos))
            {
                await Mensajes.Alerta("Teléfono requerido");

                return;
            }


            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("pro_id", Convert.ToString(this.pd.pro_id)),
                new KeyValuePair <string, string>("nombre", Convert.ToString(this.Nombres)),
                new KeyValuePair <string, string>("email", Convert.ToString(this.correos)),
                new KeyValuePair <string, string>("telefono", Convert.ToString(this.telefonos))
            });


            var response = await this.apiService.Get <GuardadoGenerico>("/es/promocion-reserva", "/correo_reserva", content);

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


            this.Nombres   = string.Empty;
            this.Correos   = string.Empty;
            this.Telefonos = string.Empty;

            await Mensajes.Alerta("La información ha sido enviada correctamente");
        }
        private async void Restablece()
        {
            var connection = await this.apiService.CheckConnection();

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

                return;
            }


            if (string.IsNullOrEmpty(this.CorreoElectronico))
            {
                await Mensajes.Alerta("Correo electrónico requerido");

                return;
            }


            if (!ValidaEmailMethod.ValidateEMail(this.CorreoElectronico))
            {
                await Mensajes.Alerta("Correo electronico mal estructurado");

                return;
            }


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


            var response = await this.apiService.Get <ReiniciaPassReturn>("/usuarios", "/reinicia_contrasena", content);

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

                return;
            }

            this.CorreoElectronico = string.Empty;

            await Mensajes.Alerta("Contraseña temporal generada, se ha enviado a tu correo electrónico");
        }
        private async void EnviaCorreo()
        {
            if (string.IsNullOrEmpty(Nombre))
            {
                await Mensajes.Alerta("Nombre y Apellido Requerido");

                return;
            }

            if (string.IsNullOrEmpty(Correo))
            {
                await Mensajes.Alerta("correo electrónico Requerido");

                return;
            }


            if (!ValidaEmailMethod.ValidateEMail(this.Correo))
            {
                await Mensajes.Alerta("Correo electronico mal estructurado");

                return;
            }

            if (string.IsNullOrEmpty(TipoDocumento))
            {
                await Mensajes.Alerta("Tipo de documento Requerido");

                return;
            }

            if (string.IsNullOrEmpty(NumeroDocumento))
            {
                await Mensajes.Alerta("Numero de documento Requerido");

                return;
            }

            if (this.Fecha == "00/00/0000")
            {
                await Mensajes.Alerta("Campo fecha es requerida");

                return;
            }

            if (string.IsNullOrEmpty(Nacionalidad))
            {
                await Mensajes.Alerta("Nacionalidad Requerido");

                return;
            }


            if (string.IsNullOrEmpty(Pais))
            {
                await Mensajes.Alerta("Pais Requerido");

                return;
            }

            if (string.IsNullOrEmpty(Provincia))
            {
                await Mensajes.Alerta("Provincia Requerido");

                return;
            }


            if (string.IsNullOrEmpty(Ciudad))
            {
                await Mensajes.Alerta("Ciudad Requerido");

                return;
            }

            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("email", Correo),
                new KeyValuePair <string, string>("tor_nombre", td.tor_nombre),
                new KeyValuePair <string, string>("nombre", Convert.ToString(Nombre)),
                new KeyValuePair <string, string>("numero_documento", NumeroDocumento),
                new KeyValuePair <string, string>("nacionalidad", Nacionalidad),
                new KeyValuePair <string, string>("provincia", Provincia),
                new KeyValuePair <string, string>("tipo_de_documento", TipoDocumento),
                new KeyValuePair <string, string>("fecha_nac", Fecha),
                new KeyValuePair <string, string>("pais", Pais),
                new KeyValuePair <string, string>("ciudad", Ciudad)
            });


            var response = await this.apiService.Get <GuardadoGenerico>("/casino/torneos", "/registro_torneo", content);

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

                return;
            }

            await Mensajes.Alerta("La información ha sido enviada correctamente");

            Correo          = string.Empty;
            Nombre          = string.Empty;
            NumeroDocumento = string.Empty;
            Nacionalidad    = string.Empty;
            Provincia       = string.Empty;
            TipoDocumento   = string.Empty;
            Pais            = string.Empty;
            Ciudad          = string.Empty;
            Fecha           = "00/00/0000";
        }
Пример #4
0
        private async void Reservar()
        {
            this.DeshabilitaBoton = false;

            if (this.NombreRestaurante == "Seleccionar...")
            {
                await Mensajes.Alerta("Campo restaurante es requerida");

                this.DeshabilitaBoton = true;

                return;
            }

            if (this.FechaInicio == "00/00/0000")
            {
                await Mensajes.Alerta("Campo fecha es requerida");

                this.DeshabilitaBoton = true;
                return;
            }


            if (this.HoraInicio == "00:00")
            {
                await Mensajes.Alerta("Campo hora es requerida");

                this.DeshabilitaBoton = true;
                return;
            }


            if (string.IsNullOrEmpty(this.Nombre))
            {
                await Mensajes.Alerta("Nombre y Apellido requerido");

                this.DeshabilitaBoton = true;
                return;
            }

            if (string.IsNullOrEmpty(this.Correo))
            {
                await Mensajes.Alerta("correo electrónico requerido");

                this.DeshabilitaBoton = true;
                return;
            }

            if (!ValidaEmailMethod.ValidateEMail(this.Correo))
            {
                await Mensajes.Alerta("Correo electrónico mal estructurado");

                return;
            }

            if (string.IsNullOrEmpty(this.Telefono))
            {
                await Mensajes.Alerta("Numero telefonico requerido");

                this.DeshabilitaBoton = true;
                return;
            }


            //string CuerpoMensaje = "Fecha:" + this.FechaInicio + "\n" +
            //"Hora: " + this.HoraInicio + "\n" +
            //"Personas: " + this.NoPersonas + "\n" +
            //"Restaurant: " + this.NombreRestaurante + "\n" +
            //"Silla para niños: " + this.SillaNiños + "\n" +
            //"Nombre y apellido: " + this.Nombre + "\n" +
            //"Correo electrónico: " + this.Correo + "\n" +
            //"Teléfono: " + this.Telefono;


            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("nombre", this.Nombre),
                new KeyValuePair <string, string>("email", this.Correo),
                new KeyValuePair <string, string>("telefono", this.Telefono),
                new KeyValuePair <string, string>("restaurant", this.NombreRestaurante),
                new KeyValuePair <string, string>("fecha", this.FechaInicio),
                new KeyValuePair <string, string>("hora", this.HoraInicio),
                new KeyValuePair <string, string>("personas", this.SillaNiños),
                new KeyValuePair <string, string>("silla_ninos", this.Telefono),
            });


            var response = await this.apiService.Get <GuardadoGenerico>("/es/gastronomia/reserva", "/correo", content);


            if (!response.IsSuccess)
            {
                await Mensajes.Alerta("Ocurrio un error al enviar el correo");

                this.DeshabilitaBoton = true;
                return;
            }

            await Mensajes.Alerta("La información ha sido enviada correctamente");

            this.DeshabilitaBoton  = true;
            this.FechaInicio       = "00/00/0000";
            this.HoraInicio        = "00:00";
            this.NoPersonas        = "2";
            this.NombreRestaurante = "Seleccionar...";
            this.SillaNiños        = "No";
            this.Correo            = string.Empty;
            this.Telefono          = string.Empty;
            this.Nombre            = string.Empty;
        }
        private async void EnviaCorreo()
        {
            if (string.IsNullOrEmpty(this.Nombre))
            {
                await Mensajes.Alerta("Nombre y Apellido requerido");

                return;
            }

            if (string.IsNullOrEmpty(this.Correo))
            {
                await Mensajes.Alerta("Correo electrónico requerido");

                return;
            }

            if (!ValidaEmailMethod.ValidateEMail(this.Correo))
            {
                await Mensajes.Alerta("Correo electronico mal estructurado");

                UserDialogs.Instance.HideLoading();

                return;
            }

            //if (string.IsNullOrEmpty(this.Empresa))
            //{
            //    await Mensajes.Alerta("Empresa requerida");

            //    return;
            //}

            if (string.IsNullOrEmpty(this.Asistentes))
            {
                await Mensajes.Alerta("Cantidad de asistentes requerida");

                return;
            }


            if (string.IsNullOrEmpty(this.TipoEvento))
            {
                await Mensajes.Alerta("Tipo de evento requerido");

                return;
            }

            if (string.IsNullOrEmpty(this.Celular))
            {
                await Mensajes.Alerta("Celular requerido");

                return;
            }

            if (this.Fecha == "00/00/0000")
            {
                await Mensajes.Alerta("Fecha aproximada requerida");

                return;
            }


            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("fecha_aproximada", Convert.ToString(Fecha)),
                new KeyValuePair <string, string>("nombre", Nombre),
                new KeyValuePair <string, string>("email", Correo),
                new KeyValuePair <string, string>("empresa", Empresa),
                new KeyValuePair <string, string>("telefono", Celular),
                new KeyValuePair <string, string>("tipo_evento", TipoEvento),
                new KeyValuePair <string, string>("cantidad_asistentes", Asistentes),
                new KeyValuePair <string, string>("comentarios", Comentarios),
            });


            var response = await this.apiService.Get <GuardadoGenerico>("/es/convenciones-salas/tarifas-salas", "/correo", content);

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

            await Mensajes.Alerta("La información ha sido enviada correctamente");

            this.Fecha       = "00/00/0000";
            this.Celular     = string.Empty;
            this.Nombre      = string.Empty;
            this.Correo      = string.Empty;
            this.Empresa     = string.Empty;
            this.TipoEvento  = "Congresos, Convenciones, Seminarios";
            this.Asistentes  = string.Empty;
            this.Comentarios = string.Empty;
        }
Пример #6
0
        private async void Registro()
        {
            UserDialogs.Instance.ShowLoading("Procesando...", MaskType.Black);

            if (string.IsNullOrEmpty(this.Nombre))
            {
                await Mensajes.Alerta("Nombre y Apellido son requeridos");

                UserDialogs.Instance.HideLoading();

                return;
            }


            if (string.IsNullOrEmpty(this.Email))
            {
                await Mensajes.Alerta("Correo electrónico es requerido");

                UserDialogs.Instance.HideLoading();

                return;
            }

            if (!ValidaEmailMethod.ValidateEMail(this.Email))
            {
                await Mensajes.Alerta("Correo electronico mal estructurado");

                UserDialogs.Instance.HideLoading();

                return;
            }


            if (string.IsNullOrEmpty(this.Password))
            {
                await Mensajes.Alerta("Contraseña es requerida");

                UserDialogs.Instance.HideLoading();

                return;
            }

            if (string.IsNullOrEmpty(this.Password2))
            {
                await Mensajes.Alerta("Contraseña es requerida");

                UserDialogs.Instance.HideLoading();

                return;
            }


            if (string.IsNullOrEmpty(this.Ciudad))
            {
                await Mensajes.Alerta("Ciudad es requerida");

                UserDialogs.Instance.HideLoading();

                return;
            }


            if (this.Fecha == "00/00/0000")
            {
                await Mensajes.Alerta("Fecha de nacimiento es requerida");

                UserDialogs.Instance.HideLoading();

                return;
            }


            //DateTime FN = Convert.ToDateTime(this.Fecha);

            int Dia1 = Convert.ToInt32(this.Fecha.Substring(0, 2));
            int Mes1 = Convert.ToInt32(this.Fecha.Substring(3, 2));
            int Año1 = Convert.ToInt32(this.Fecha.Substring(6, 4));

            // DateTime FN = Convert.ToDateTime(this.Fecha);

            DateTime nacimiento = new DateTime(Año1, Mes1, Dia1); //Fecha de nacimiento
            int      edad       = DateTime.Today.AddTicks(-nacimiento.Ticks).Year - 1;

            if (edad < 18)
            {
                await Mensajes.Alerta("Debes ser mayor de edad para poder registrarte");

                UserDialogs.Instance.HideLoading();

                return;
            }


            if (this.Password != this.Password2)
            {
                await Mensajes.Alerta("Las contraseñas no coiciden, verificar de nuevo");

                UserDialogs.Instance.HideLoading();

                return;
            }

            string Dia = this.Fecha.Substring(0, 2);
            string Mes = this.Fecha.Substring(3, 2);
            string Año = this.Fecha.Substring(6, 4);

            //DateTime FechaConvertida = Convert.ToDateTime(Año + "-" + Mes + "-" + Dia);

            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("usu_usuario", this.Email),
                new KeyValuePair <string, string>("usu_contrasena", this.Password),
                new KeyValuePair <string, string>("usu_tipo_contrasena", "1"),
                new KeyValuePair <string, string>("usu_usuario_bloquedado", "0"),
                new KeyValuePair <string, string>("usu_nombre", this.Nombre),
                new KeyValuePair <string, string>("usu_apellidos", ""),
                new KeyValuePair <string, string>("usu_email", this.Email),
                new KeyValuePair <string, string>("usu_celular", ""),
                new KeyValuePair <string, string>("usu_telefono", ""),
                new KeyValuePair <string, string>("usu_ciudad", this.Ciudad),
                new KeyValuePair <string, string>("usu_id_rol", "6"),
                new KeyValuePair <string, string>("usu_id_tarjeta_socio", "1"),
                new KeyValuePair <string, string>("usu_estatus", "1"),
                new KeyValuePair <string, string>("usu_id_tarjeta_socio", ""),
                new KeyValuePair <string, string>("usu_fecha_nacimiento", Convert.ToString(Año + "-" + Mes + "-" + Dia)),
            });


            var response = await this.apiService.Get <RegistroReturn>("/usuarios", "/store", content);

            if (!response.IsSuccess)
            {
                await Mensajes.Alerta("Error al registra usuario, intenta de nuevo");

                UserDialogs.Instance.HideLoading();

                return;
            }

            listRegistro = (RegistroReturn)response.Result;

            try
            {
                var Contenido = new FormUrlEncodedContent(new[]
                {
                    new KeyValuePair <string, string>("neq_equipo", Application.Current.Properties["Token"].ToString()),
                    new KeyValuePair <string, string>("neq_id_usuario", Convert.ToString(listRegistro.resultado.usu_id)),
                    new KeyValuePair <string, string>("neq_dispositivo", CrossDeviceInfo.Current.Platform.ToString()),
                    new KeyValuePair <string, string>("neq_app_id", CrossDeviceInfo.Current.Id)
                });


                var response2 = await this.apiService.Get <GuardadoGenerico>("/notificaciones", "/guardar_equipo", Contenido);

                if (!response2.IsSuccess)
                {
                    var content3 = new FormUrlEncodedContent(new[]
                    {
                        new KeyValuePair <string, string>("nus_id_usuario", Convert.ToString(listRegistro.resultado.usu_id)),
                        new KeyValuePair <string, string>("nus_id_notificacion", Convert.ToString(0)),
                    });


                    var response3 = await this.apiService.Get <ActualizaUsuarioReturn>("/notificaciones", "/activar_notificacion", content3);

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

                        UserDialogs.Instance.HideLoading();
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                var content3 = new FormUrlEncodedContent(new[]
                {
                    new KeyValuePair <string, string>("nus_id_usuario", Convert.ToString(listRegistro.resultado.usu_id)),
                    new KeyValuePair <string, string>("nus_id_notificacion", Convert.ToString(0)),
                });


                var response3 = await this.apiService.Get <ActualizaUsuarioReturn>("/notificaciones", "/activar_notificacion", content3);

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

                    UserDialogs.Instance.HideLoading();
                    return;
                }
            }


            string RutaImagen;

            if (string.IsNullOrEmpty(VariablesGlobales.RutaImagene))
            {
                RutaImagen = "";
            }
            else
            {
                RutaImagen = await GuardaImagen(listRegistro.resultado.usu_id);
            }


            Application.Current.Properties["IsLoggedIn"]      = true;
            Application.Current.Properties["IdUsuario"]       = listRegistro.resultado.usu_id;
            Application.Current.Properties["Email"]           = this.Email;
            Application.Current.Properties["NombreCompleto"]  = this.Nombre;
            Application.Current.Properties["Ciudad"]          = this.Ciudad;
            Application.Current.Properties["Pass"]            = this.Password;
            Application.Current.Properties["FechaNacimiento"] = Convert.ToString(Año + "-" + Mes + "-" + Dia);
            Application.Current.Properties["FotoPerfil"]      = RutaImagen;
            Application.Current.Properties["TipoCuenta"]      = "CityCenter";

            Application.Current.Properties["RutaChatCasino"]     = "";
            Application.Current.Properties["VariableChatHotel"]  = "";
            Application.Current.Properties["VariableChatCasino"] = "";
            Application.Current.Properties["RutaChatHotel"]      = "";
            Application.Current.Properties["Casino"]             = 1;
            Application.Current.Properties["Hotel"] = 1;

            Application.Current.Properties["TipoDocumento"]   = "";
            Application.Current.Properties["NumeroDocumento"] = "";
            Application.Current.Properties["NumeroSocio"]     = "";

            await Application.Current.SavePropertiesAsync();

            //var db = new DBFire();
            //await db.saveRoom(new Room() { Email = this.Email, Name = this.Nombre });

            this.Email    = string.Empty;
            this.Nombre   = string.Empty;
            this.Ciudad   = string.Empty;
            this.Password = string.Empty;
            this.Ciudad   = string.Empty;

            MainViewModel.GetInstance().VincularTarjeta = new VincularTarjetaViewModel();

            await((MasterPage)Application.Current.MainPage).Detail.Navigation.PushModalAsync(new VincularTarjetaWin());

            UserDialogs.Instance.HideLoading();
        }
        private async void EnviaCorreoHotel()
        {
            if (string.IsNullOrEmpty(this.Nombreh))
            {
                await Mensajes.Alerta("Nombre y Apellido requeridos");

                return;
            }

            if (string.IsNullOrEmpty(this.Correoh))
            {
                await Mensajes.Alerta("Correo electrónico requerido");

                return;
            }

            if (!ValidaEmailMethod.ValidateEMail(this.Correoh))
            {
                await Mensajes.Alerta("Correo electrónico mal estructurado");

                return;
            }

            if (string.IsNullOrEmpty(this.Telefonoh))
            {
                await Mensajes.Alerta("Teléfono requerido");

                return;
            }

            if (string.IsNullOrEmpty(this.Fechah))
            {
                await Mensajes.Alerta("Fecha de nacimiento requerido");

                return;
            }


            if (string.IsNullOrEmpty(Convert.ToString(this.CantidadNoches)))
            {
                await Mensajes.Alerta("Cantidad de noches requerido");

                return;
            }

            if (string.IsNullOrEmpty(Convert.ToString(this.CantidadAdulto)))
            {
                await Mensajes.Alerta("Cantidad de adultos requerido");

                return;
            }

            if (string.IsNullOrEmpty(Convert.ToString(this.CantidadNiños)))
            {
                await Mensajes.Alerta("Cantidad de niños requerido");

                return;
            }

            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("pro_id", Convert.ToString(this.pd.pro_id)),
                new KeyValuePair <string, string>("nombre", Convert.ToString(this.Nombreh)),
                new KeyValuePair <string, string>("email", Convert.ToString(this.Correoh)),
                new KeyValuePair <string, string>("telefono", Convert.ToString(this.Telefonoh)),
                new KeyValuePair <string, string>("fecha_check_in", Convert.ToString(this.Fechah)),
                new KeyValuePair <string, string>("cantidad_noches", Convert.ToString(this.CantidadNoches)),
                new KeyValuePair <string, string>("cantidad_adultos", Convert.ToString(this.CantidadAdulto)),
                new KeyValuePair <string, string>("cantidad_ninos", Convert.ToString(this.CantidadNiños)),
            });


            var response = await this.apiService.Get <GuardadoGenerico>("/es/promocion-reserva", "/correo_reserva", content);

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

            this.Nombreh        = string.Empty;
            this.Correoh        = string.Empty;
            this.Telefonoh      = string.Empty;
            this.Fechah         = string.Empty;
            this.CantidadNoches = string.Empty;
            this.CantidadAdulto = string.Empty;
            this.CantidadNiños  = string.Empty;

            await Mensajes.Alerta("La información ha sido enviada correctamente");
        }
        private async void EnviaCorreoCasino()
        {
            if (string.IsNullOrEmpty(this.Nombrec))
            {
                await Mensajes.Alerta("Nombre y Apellido requeridos");

                return;
            }

            if (string.IsNullOrEmpty(this.Dni))
            {
                await Mensajes.Alerta("Dni requerido");

                return;
            }

            if (string.IsNullOrEmpty(this.Celularc))
            {
                await Mensajes.Alerta("Celular requerido");

                return;
            }

            if (string.IsNullOrEmpty(this.Correoc))
            {
                await Mensajes.Alerta("Correo electrónico requerido");

                return;
            }

            if (!ValidaEmailMethod.ValidateEMail(this.Correoc))
            {
                await Mensajes.Alerta("Correo electrónico mal estructurado");

                return;
            }


            if (string.IsNullOrEmpty(this.Fechac))
            {
                await Mensajes.Alerta("Fecha de nacimiento requerido");

                return;
            }

            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("pro_id", Convert.ToString(this.pd.pro_id)),
                new KeyValuePair <string, string>("nombre", Convert.ToString(this.Nombrec)),
                new KeyValuePair <string, string>("dni", Convert.ToString(this.Dni)),
                new KeyValuePair <string, string>("celular", Convert.ToString(this.Celularc)),
                new KeyValuePair <string, string>("fecha_nacimiento", Convert.ToString(this.Fechac))
            });

            //* Casino
            //nombre
            //dni
            //celular
            //email
            //fecha_nacimiento
            //* en el caso de los show vamos a dejar el formulario que ya tenemos

            var response = await this.apiService.Get <GuardadoGenerico>("/es/promocion-reserva", "/correo_reserva", content);

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

            await Mensajes.Alerta("La información ha sido enviada correctamente");

            this.Nombrec  = string.Empty;
            this.Dni      = string.Empty;
            this.Celularc = string.Empty;
            this.Correoc  = string.Empty;
            this.Fechac   = string.Empty;
        }
        private async void Reservar()
        {
            if (string.IsNullOrEmpty(this.Nombre))
            {
                await Mensajes.Alerta("Nombre y Apellido requerido");

                return;
            }

            if (string.IsNullOrEmpty(this.Correo))
            {
                await Mensajes.Alerta("correo electrónico requerido");

                return;
            }

            if (!ValidaEmailMethod.ValidateEMail(this.Correo))
            {
                await Mensajes.Alerta("Correo electronico mal estructurado");

                return;
            }


            if (string.IsNullOrEmpty(this.Telefono))
            {
                await Mensajes.Alerta("Número de teléfono requerido");

                return;
            }


            //string CuerpoMensaje = "Fecha:" + this.FechaInicio + "\n" +
            //"Hora: " + this.HoraInicio + "\n" +
            //"Personas: " + this.NoPersonas + "\n" +
            //"Restaurant: " + this.NombreRestaurante + "\n" +
            //"Silla para niños: " + this.SillaNiños + "\n" +
            //"Nombre y apellido: " + this.Nombre + "\n" +
            //"Correo electrónico: " + this.Correo + "\n" +
            //"Teléfono: " + this.Telefono;

            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("nombre", this.Nombre),
                new KeyValuePair <string, string>("email", this.Correo),
                new KeyValuePair <string, string>("telefono", this.Telefono),
                new KeyValuePair <string, string>("restaurant", this.rd.reb_nombre),
                new KeyValuePair <string, string>("fecha", this.FechaInicio),
                new KeyValuePair <string, string>("hora", this.HoraInicio),
                new KeyValuePair <string, string>("personas", this.SillaNiños),
                new KeyValuePair <string, string>("silla_ninos", this.Telefono),
            });


            var response = await this.apiService.Get <GuardadoGenerico>("/es/gastronomia/reserva", "/correo", content);

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

                return;
            }

            await Mensajes.Alerta("La información ha sido enviada correctamente");

            //this.FechaInicio
            //this.HoraInicio
            this.NoPersonas        = "2";
            this.NombreRestaurante = string.Empty;
            this.SillaNiños        = "No";
            this.Correo            = string.Empty;
            this.Telefono          = string.Empty;
            this.Nombre            = string.Empty;

            this.FechaInicio = "00/00/0000";


            if (rd.reb_nombre == "PIÚ")
            {
                this.HoraInicio = "12:30";
            }
            else if (rd.reb_nombre == "LE GULÁ")
            {
                this.HoraInicio = "21:00";
            }
            else
            {
                this.HoraInicio = "00:00";
            }
        }
Пример #10
0
        private async void Login()
        {
            try
            {
                UserDialogs.Instance.ShowLoading("Iniciando sesion...", MaskType.Black);

                if (string.IsNullOrEmpty(this.Email))
                {
                    await Mensajes.Alerta("Correo electrónico/Usuario requerido");

                    UserDialogs.Instance.HideLoading();

                    return;
                }

                if (!ValidaEmailMethod.ValidateEMail(this.Email))
                {
                    await Mensajes.Alerta("Correo electronico mal estructurado");

                    UserDialogs.Instance.HideLoading();

                    return;
                }

                if (string.IsNullOrEmpty(this.Password))
                {
                    await Mensajes.Alerta("Contraseña requerida");

                    UserDialogs.Instance.HideLoading();

                    return;
                }

                var content = new FormUrlEncodedContent(new[]
                {
                    new KeyValuePair <string, string>("usu_usuario", this.Email),
                    new KeyValuePair <string, string>("usu_contrasena", this.Password)
                });


                var response = await this.apiService.Get <LoginReturn>("/usuarios", "/loginApp", content);

                if (!response.IsSuccess)
                {
                    await Mensajes.Alerta("Usuario o Contraseña incorrectos");

                    UserDialogs.Instance.HideLoading();

                    return;
                }

                LoginReturn list = (LoginReturn)response.Result;


                if (list.estatus == 1)
                {
                    if (string.IsNullOrEmpty(list.resultado.usu_contrasena_temp))
                    {
                        Application.Current.Properties["IsLoggedIn"]      = true;
                        Application.Current.Properties["IdUsuario"]       = list.resultado.usu_id;
                        Application.Current.Properties["Email"]           = this.Email;
                        Application.Current.Properties["NombreCompleto"]  = list.resultado.usu_nombre + ' ' + list.resultado.usu_apellidos;
                        Application.Current.Properties["Ciudad"]          = list.resultado.usu_ciudad;
                        Application.Current.Properties["Pass"]            = this.Password;
                        Application.Current.Properties["FechaNacimiento"] = list.resultado.usu_fecha_nacimiento;
                        Application.Current.Properties["FotoPerfil"]      = VariablesGlobales.RutaServidor + list.resultado.usu_imagen;
                        Application.Current.Properties["TipoCuenta"]      = "CityCenter";

                        Application.Current.Properties["TipoDocumento"]   = list.resultado.usu_tipo_documento;
                        Application.Current.Properties["NumeroDocumento"] = list.resultado.usu_no_documento;
                        Application.Current.Properties["NumeroSocio"]     = list.resultado.usu_id_tarjeta_socio;

                        Application.Current.Properties["RutaChatCasino"]     = "";
                        Application.Current.Properties["VariableChatHotel"]  = "";
                        Application.Current.Properties["VariableChatCasino"] = "";
                        Application.Current.Properties["RutaChatHotel"]      = "";
                        Application.Current.Properties["Casino"]             = 1;
                        Application.Current.Properties["Hotel"] = 1;

                        await Application.Current.SavePropertiesAsync();

                        try
                        {
                            var Contenido = new FormUrlEncodedContent(new[]
                            {
                                new KeyValuePair <string, string>("neq_equipo", Application.Current.Properties["Token"].ToString()),
                                new KeyValuePair <string, string>("neq_id_usuario", Convert.ToString(list.resultado.usu_id)),
                                new KeyValuePair <string, string>("neq_dispositivo", CrossDeviceInfo.Current.Platform.ToString()),
                                new KeyValuePair <string, string>("neq_app_id", CrossDeviceInfo.Current.Id)
                            });


                            var response2 = await this.apiService.Get <GuardadoGenerico>("/notificaciones", "/guardar_equipo", Contenido);

                            if (!response2.IsSuccess)
                            {
                            }
                        }
                        catch (Exception ex)
                        {
                        }



                        //try
                        //{
                        //    Restcliente Cliente = new Restcliente();

                        //    var contentenido = new FormUrlEncodedContent(new[]
                        //    {
                        //        new KeyValuePair<string, string>("neq_equipo", Application.Current.Properties["Token"].ToString()),
                        //        new KeyValuePair<string, string>("neq_id_usuario", Convert.ToString(list.resultado.usu_id)),
                        //        new KeyValuePair<string, string>("neq_dispositivo", CrossDeviceInfo.Current.Platform.ToString()),
                        //        new KeyValuePair<string, string>("neq_app_id", CrossDeviceInfo.Current.Id)
                        //    });


                        //    var LoginReturn = await Cliente.Get<GuardadoGenerico>("/notificaciones/guardar_equipo", contentenido);

                        //    if (LoginReturn != null)
                        //    {
                        //        //await Mensajes.success("OK");
                        //    }
                        //    // Mensajes.Alerta(token);
                        //    // Mensajes.success(token);
                        //}
                        //catch (System.Exception)
                        //{


                        //}

                        this.Email    = string.Empty;
                        this.Password = string.Empty;

                        // MainViewModel.GetInstance().Master = new MasterViewModel();
                        MainViewModel.GetInstance().Inicio = new InicioViewModel();
                        MainViewModel.GetInstance().Detail = new DetailViewModel();
                        MainViewModel.GetInstance().Casino = new CasinoViewModel();
                        //MainViewModel.GetInstance().Hotel = new HotelViewModel();
                        //MainViewModel.GetInstance().SalasEventos = new SalasEventosViewModel();
                        //MainViewModel.GetInstance().Gastronomia = new GastronomiaViewModel();

                        //await Application.Current.MainPage.Navigation.PushModalAsync(new MasterPage());

                        MasterPage fpm = new MasterPage();
                        // fpm.Master = new DetailPage(); // You have to create a Master ContentPage()

                        //App.NavPage = new NavigationPage(new CustomTabPage()) { BarBackgroundColor = Color.FromHex("#23144B") };

                        // fpm.Detail = App.NavPage; // You have to create a Detail ContenPage()

                        Application.Current.MainPage = fpm;

                        await Mensajes.Alerta("Bienvenido " + list.resultado.usu_nombre + ' ' + list.resultado.usu_apellidos);


                        // --- aqui se genera el Room del chat con su correo
                        //var db = new DBFire();
                        //await db.saveRoom(new Room() { Name = this.Email });
                        //await Navigation.PopAsync();
                        // ---

                        UserDialogs.Instance.HideLoading();
                    }

                    else
                    {
                        if (list.resultado.usu_contrasena_temp == this.Password)
                        {
                            MainViewModel.GetInstance().CambiaContrasena = new CambiaPassViewModel();

                            VariablesGlobales.IDUsuario = Convert.ToString(list.resultado.usu_id);

                            ((MasterPage)Application.Current.MainPage).IsPresented = false;

                            await((MasterPage)Application.Current.MainPage).Detail.Navigation.PushAsync(new CambiaContraseña());

                            UserDialogs.Instance.HideLoading();
                        }
                        else
                        {
                            await Mensajes.Alerta("Usuario o Contraseña incorrectos");

                            UserDialogs.Instance.HideLoading();

                            return;
                        }
                    }
                }
                else
                {
                    //  await Mensajes.Error(list.mensaje);

                    UserDialogs.Instance.HideLoading();

                    return;
                }
            }
            catch (Exception ex)
            {
                // await Application.Current.MainPage.DisplayAlert(
                //           "Error",
                //            ex.ToString(),
                //           "Ok");

                UserDialogs.Instance.HideLoading();
            }
        }