private async void VincularTarjeta() { UserDialogs.Instance.ShowLoading("Procesando...", MaskType.Black); if (string.IsNullOrEmpty(NumeroSocio)) { UserDialogs.Instance.HideLoading(); await Mensajes.Alerta("El número de socio es obligatorio para vincular la tarjeta win"); return; } else { var MensajeTarjeta = await ValidaTarjetaUsuario(NumeroSocio); if (MensajeTarjeta == "OK") { //await Mensajes.Alerta("Tarjeta vinculada correctamente"); } else { UserDialogs.Instance.HideLoading(); await Mensajes.Alerta("La tarjeta colocada no existe, por favor verificala"); NumeroSocio = ""; return; } } var content = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("usu_fecha_nacimiento", Application.Current.Properties["FechaNacimiento"].ToString()), new KeyValuePair <string, string>("usu_contrasena", Application.Current.Properties["Pass"].ToString()), new KeyValuePair <string, string>("usu_id", Application.Current.Properties["IdUsuario"].ToString()), new KeyValuePair <string, string>("usu_usuario", Application.Current.Properties["Email"].ToString()), new KeyValuePair <string, string>("usu_tipo_contrasena", "1"), new KeyValuePair <string, string>("usu_usuario_bloquedado", "0"), new KeyValuePair <string, string>("usu_nombre", Application.Current.Properties["NombreCompleto"].ToString()), new KeyValuePair <string, string>("usu_apellidos", ""), new KeyValuePair <string, string>("usu_email", Application.Current.Properties["Email"].ToString()), new KeyValuePair <string, string>("usu_telefono", ""), new KeyValuePair <string, string>("usu_celular", ""), new KeyValuePair <string, string>("usu_id_tarjeta_socio", this.NumeroSocio), new KeyValuePair <string, string>("usu_ciudad", Application.Current.Properties["Ciudad"].ToString()), new KeyValuePair <string, string>("usu_id_rol", "6"), new KeyValuePair <string, string>("usu_estatus", "1"), new KeyValuePair <string, string>("usu_tipo_documento", this.TipoDocumento), new KeyValuePair <string, string>("usu_no_documento", this.NumeroDocumento), new KeyValuePair <string, string>("passUpdate", "1"), }); // // var response = await this.apiService.Get <ActualizaUsuarioReturn>("/usuarios", "/update", content); if (!response.IsSuccess) { await Mensajes.Alerta("Ocurrió un error al tratar de vincular la tarjeta win, intenta de nuevo"); return; } list = (ActualizaUsuarioReturn)response.Result; Application.Current.Properties["TipoDocumento"] = TipoDocumento; Application.Current.Properties["NumeroDocumento"] = NumeroDocumento; Application.Current.Properties["NumeroSocio"] = NumeroSocio; await Application.Current.SavePropertiesAsync(); // 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(); //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; var content1 = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("mensaje", "Gracias por registrarte a City Center Rosario, Ahora podras disfrutar de los beneficios de utilizar la app."), new KeyValuePair <string, string>("nombre", "Bienvenido a City Center Rosario"), new KeyValuePair <string, string>("email", Application.Current.Properties["Email"].ToString()), }); var response1 = await this.apiService.Get <GuardadoGenerico>("/correo", "/envioemail", content1); if (!response1.IsSuccess) { await Mensajes.Alerta("Ocurrió un error al tratar de enviar correo"); return; } await((MasterPage)Application.Current.MainPage).Detail.Navigation.PushModalAsync(new PaginaAceptar()); UserDialogs.Instance.HideLoading(); //await Mensajes.Alerta("Bienvenido " + Application.Current.Properties["NombreCompleto"].ToString()); }
private async void ActualizaPerfil() { try { UserDialogs.Instance.ShowLoading("Procesando...", MaskType.Black); if (string.IsNullOrEmpty(this.Nombre)) { await Mensajes.Alerta("Nombre y Apellido es requerida"); UserDialogs.Instance.HideLoading(); return; } if (string.IsNullOrEmpty(this.Email)) { await Mensajes.Alerta("Correo electrónico es requerido"); UserDialogs.Instance.HideLoading(); return; } if (Application.Current.Properties["TipoCuenta"].ToString() == "CityCenter") { if (string.IsNullOrEmpty(this.Contraseña)) { await Mensajes.Alerta("Contraseña es requerida"); UserDialogs.Instance.HideLoading(); return; } if (string.IsNullOrEmpty(this.Contraseña2)) { await Mensajes.Alerta("Contraseña es requerida"); UserDialogs.Instance.HideLoading(); return; } if (Contraseña != Contraseña2) { await Mensajes.Alerta("Las contraseñas no coinciden, verificar los campos"); 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" || string.IsNullOrEmpty(this.fecha)) { await Mensajes.Alerta("La fecha de nacimiento es obligatoria"); UserDialogs.Instance.HideLoading(); return; } 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 utilizar la app"); UserDialogs.Instance.HideLoading(); return; } if (string.IsNullOrEmpty(NumeroSocio)) { // await Mensajes.Alerta("Usuario actual no cuenta con tarjeta Win"); } else { var MensajeTarjeta = await ValidaTarjetaUsuario(NumeroSocio); if (MensajeTarjeta == "OK") { // await Mensajes.Alerta("Tarjeta vinculada correctamente"); } else { await Mensajes.Alerta(MensajeTarjeta); NumeroSocio = ""; } } string Dia = this.Fecha.Substring(0, 2); string Mes = this.Fecha.Substring(3, 2); string Año = this.Fecha.Substring(6, 4); var content = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("usu_fecha_nacimiento", Convert.ToString(Año + "-" + Mes + "-" + Dia)), new KeyValuePair <string, string>("usu_contrasena", this.contraseña), new KeyValuePair <string, string>("usu_id", Application.Current.Properties["IdUsuario"].ToString()), new KeyValuePair <string, string>("usu_usuario", this.Email), new KeyValuePair <string, string>("usu_tipo_contrasena", "1"), new KeyValuePair <string, string>("usu_usuario_bloquedado", "0"), new KeyValuePair <string, string>("usu_nombre", Nombre), new KeyValuePair <string, string>("usu_apellidos", ""), new KeyValuePair <string, string>("usu_email", this.Email), new KeyValuePair <string, string>("usu_telefono", ""), new KeyValuePair <string, string>("usu_celular", ""), new KeyValuePair <string, string>("usu_id_tarjeta_socio", this.NumeroSocio), new KeyValuePair <string, string>("usu_ciudad", this.Ciudad), new KeyValuePair <string, string>("usu_id_rol", "6"), new KeyValuePair <string, string>("usu_estatus", "1"), new KeyValuePair <string, string>("usu_tipo_documento", this.TipoDocumento), new KeyValuePair <string, string>("usu_no_documento", this.NumeroDocumento), new KeyValuePair <string, string>("passUpdate", "1"), }); var response = await this.apiService.Get <ActualizaUsuarioReturn>("/usuarios", "/update", content); if (!response.IsSuccess) { await Mensajes.Alerta("Ha habido un error en tu solicitud, por favor volvé a intentarlo"); return; } list = (ActualizaUsuarioReturn)response.Result; string RutaImagen; if (string.IsNullOrEmpty(VariablesGlobales.RutaImagene)) { RutaImagen = ""; } else { RutaImagen = await GuardaImagen(Convert.ToInt32(Application.Current.Properties["IdUsuario"].ToString())); if (RutaImagen == "Error") { try { RutaImagen = Application.Current.Properties["FotoPerfil"].ToString(); GlobalResources.Current.ImagenPerfil = Application.Current.Properties["FotoPerfil"].ToString(); } catch (Exception ex) { RutaImagen = ""; GlobalResources.Current.ImagenPerfil = ""; } } else { Application.Current.Properties["FotoPerfil"] = RutaImagen; GlobalResources.Current.ImagenPerfil = RutaImagen; } } //string RutaImagen = await GuardaImagen(list.resultado.); Application.Current.Properties["Email"] = Email; Application.Current.Properties["NombreCompleto"] = Nombre; Application.Current.Properties["Ciudad"] = Ciudad; Application.Current.Properties["Pass"] = Contraseña; // Application.Current.Properties["Pass"] = Contraseña2; Application.Current.Properties["FechaNacimiento"] = Fecha; Application.Current.Properties["TipoDocumento"] = TipoDocumento; Application.Current.Properties["NumeroDocumento"] = NumeroDocumento; Application.Current.Properties["NumeroSocio"] = NumeroSocio; await Application.Current.SavePropertiesAsync(); await Mensajes.Alerta("Perfil actualizado con éxito"); VariablesGlobales.ActualizaDatos = true; UserDialogs.Instance.HideLoading(); } catch (Exception ex) { await Mensajes.Alerta("Ocurrio un error al actualizar el perfil,favor de volve a intentar mas tarde"); UserDialogs.Instance.HideLoading(); } }