Пример #1
0
        private async void BtnLlamame_ClickAsync(object sender, EventArgs e)
        {
            dialogoLoadingBcoSecurityActivity.mostrarViewLoadingSecurity();
            try
            {
                rut = LoginActivity.returnRut();
                JsonValue jsonResponseAccessToken = await WebServiceSecurity.ServiciosSecurity.CallRESTaccessToken();

                JsonValue jt = jsonResponseAccessToken[varAccesstoken];
                JsonValue jsonResponseLLamar = await WebServiceSecurity.ServiciosSecurity.CallRESTLLamar(jt, SecurityEndpoints.STR_GRUPOIDG, rut, rut, SecurityEndpoints.STR_CODIGOTRANSACCION, SecurityEndpoints.SESSION_ID1, SecurityEndpoints.SESSION_ID2, SecurityEndpoints.ID_LOG, parametriaLogUtil.getIdDispositivoParaLog(UtilAndroid.getIMEI(this)), ParametriaLogUtil.GetIpLocal());

                JsonValue statusCodeLlamada = jsonResponseLLamar["statusCode"];

                if (statusCodeLlamada == 0)
                {
                    Intent i = new Intent(this, typeof(AutenticacionPorVozActivity));
                    StartActivity(i);
                }
                else
                {
                    DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                    DialogoErrorActivity.mostrarViewErrorLogin(this);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                DialogoErrorActivity.mostrarViewErrorLogin(this);
            }
        }
Пример #2
0
        async void obtenerSMS()
        {
            dialogoLoadingBcoSecurityActivity.mostrarViewLoadingSecurity();
            try
            {
                this.cleanEditTextClaveVoz();
                JsonValue jsonResponseAccessToken = await WebServiceSecurity.ServiciosSecurity.CallRESTaccessToken();

                JsonValue token       = jsonResponseAccessToken["access_token"];
                JsonValue smsResponse = await WebServiceSecurity.ServiciosSecurity.CallRESTSMS(token, LoginActivity.returnRut(), parametriaLogUtil.getIdDispositivoParaLog(UtilAndroid.getIMEI(this)), ParametriaLogUtil.GetIpLocal());

                string statusCodeSMS = smsResponse["statusCode"];

                if (statusCodeSMS != null && statusCodeSMS.Equals(ConstantesSecurity.ESTADO_SUCCESS)) // sin respuesta al success
                {
                }
                else
                {
                    DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                    DialogoErrorActivity.mostrarViewErrorLogin(this);
                }
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            }
            catch (Exception x) {
                Log.Error("", x.Message);
                DialogoErrorActivity.mostrarViewErrorLogin(this);
            }
        }
Пример #3
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     registrarListenerSMS();
     SetContentView(Resource.Layout.AutenticacionPorSMS);
     lblMsjClaveVoz                  = FindViewById <TextView>(Resource.Id.lblMsjClaveVoz);
     txtClaveVoz                     = FindViewById <EditText>(Resource.Id.txtClaveVoz);
     txtClaveVozSegundo              = FindViewById <EditText>(Resource.Id.txtClaveVozSegundo);
     txtClaveVozTercero              = FindViewById <EditText>(Resource.Id.txtClaveVozTercero);
     txtClaveVozCuarto               = FindViewById <EditText>(Resource.Id.txtClaveVozCuarto);
     txtClaveVozQuinto               = FindViewById <EditText>(Resource.Id.txtClaveVozQuinto);
     txtClaveVozSexto                = FindViewById <EditText>(Resource.Id.txtClaveVozSexto);
     lineTxtClaveVoz                 = FindViewById <View>(Resource.Id.lineTxtClaveVoz);
     lineTxtClaveVozSegundo          = FindViewById <View>(Resource.Id.lineTxtClaveVozSegundo);
     lineTxtClaveVozTercero          = FindViewById <View>(Resource.Id.lineTxtClaveVozTercero);
     lineTxtClaveVozCuarto           = FindViewById <View>(Resource.Id.lineTxtClaveVozCuarto);
     lineTxtClaveVozQuinto           = FindViewById <View>(Resource.Id.lineTxtClaveVozQuinto);
     lineTxtClaveVozSexto            = FindViewById <View>(Resource.Id.lineTxtClaveVozSexto);
     txtClaveVoz.TextChanged        += TxtClaveVoz_TextChanged;
     txtClaveVozSegundo.TextChanged += TxtClaveVozSegundo_TextChanged;
     txtClaveVozTercero.TextChanged += TxtClaveVozTercero_TextChanged;
     txtClaveVozCuarto.TextChanged  += TxtClaveVozCuarto_TextChanged;
     txtClaveVozQuinto.TextChanged  += TxtClaveVozQuinto_TextChanged;
     txtClaveVozSexto.TextChanged   += TxtClaveVozSexto_TextChanged;
     txtInstruccionAutenticacion     = FindViewById <TextView>(Resource.Id.txtInstruccionAutenticacion);
     lblCodigoSubTitulo              = FindViewById <TextView>(Resource.Id.lblCodigoSubTitulo);
     btnReLLamada                    = FindViewById <TextView>(Resource.Id.btnReLLamada);
     btnReLLamada.Click             += BtnReLLamada_ClickAsync;
     btnAutenticarClaveVoz           = FindViewById <Button>(Resource.Id.btnAutenticarClaveVoz);
     btnAutenticarClaveVoz.Click    += BtnAutenticarClaveVoz_ClickAsync;
     fontRegular                     = Typeface.CreateFromAsset(Assets, ConstantesSecurity.rutaFuenteTitiliumRegular);
     fontSemiBold                    = Typeface.CreateFromAsset(Assets, ConstantesSecurity.rutaFuenteTitiliumSemiBold);
     lblCodigoSubTitulo.Typeface     = fontRegular;
     lblMsjClaveVoz.Typeface         = fontRegular;
     txtClaveVoz.Typeface            = fontRegular;
     txtClaveVozSegundo.Typeface     = fontRegular;
     txtClaveVozTercero.Typeface     = fontRegular;
     txtClaveVozCuarto.Typeface      = fontRegular;
     txtClaveVozQuinto.Typeface      = fontRegular;
     txtClaveVozSexto.Typeface       = fontRegular;
     btnAutenticarClaveVoz.Typeface  = fontSemiBold;
     btnAutenticarClaveVoz.Enabled   = false;
     formatearTextos();
     if (!btnAutenticarClaveVoz.Enabled)
     {
         btnAutenticarClaveVoz.SetBackgroundResource(Resource.Drawable.cssBoton);
     }
     parametriaLogUtil = new ParametriaLogUtil();
     dialogoLoadingBcoSecurityActivity = new DialogoLoadingBcoSecurityActivity(this);
     obtenerSMS();
 }
Пример #4
0
        private async void btnIngresarLoginC_ClickAsync(object sender, EventArgs e)
        {
            dialogoLoadingBcoSecurityActivity.mostrarViewLoadingSecurity();
            try
            {
                String nombreArchivo = "app-bco_security_enrolamiento.sqlite";
                String rutaCarpeta   = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                String ruta          = System.IO.Path.Combine(rutaCarpeta, nombreArchivo);

                tokenFCM = new List <Contenido>();
                tokenFCM = DatabaseHelper.sqliteTokenFCM(ruta);

                foreach (var token in tokenFCM)
                {
                    if (token.Id == 1)
                    {
                        idDispositivoTokenFCM = token.Password;
                        break;
                    }
                }
                string idDispositivoConsultaEnrolado = UtilAndroid.getIMEI(this) + relleno + idDispositivoTokenFCM;
                string rut = LoginActivity.returnRut();

                JsonValue jsonResponseAccessToken = await WebServiceSecurity.ServiciosSecurity.CallRESTaccessToken();

                JsonValue jt = jsonResponseAccessToken[varAccesstoken];
                JsonValue jsonResponseConsultaEnrrolado = await WebServiceSecurity.ServiciosSecurity.CallRESTConsultaEnrrolado(jt, idDispositivoConsultaEnrolado, SecurityEndpoints.SISTEMA_ANDROID, rut, idDispositivoConsultaEnrolado, ParametriaLogUtil.GetIpLocal());

                string jce = jsonResponseConsultaEnrrolado[varStatusCode];
                if (jce.Equals(responseBusinessException))
                {
                    DialogoErrorActivity.mostrarViewErrorLogin(this);
                    return;
                }
                jceNombre = jsonResponseConsultaEnrrolado[varConsultaEnroladoNombre];
                jceRut    = jsonResponseConsultaEnrrolado[varConsultaEnroladoRut];

                if (jce.Equals(responseSuccess))
                {
                    Intent iLoginConocido = new Intent(this, typeof(LoginConocidoActivity));
                    StartActivity(iLoginConocido);
                    DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                }
            }
            catch (Exception xe)
            {
                Console.WriteLine(xe);
                ExceptionGeneric();
            }
        }
Пример #5
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            DialogoLoadingBcoSecurityActivity.mostrarViewLoadingSecurity(Activity);
            View view = inflater.Inflate(Resource.Layout.OnOff, container, false);

            base.OnCreate(savedInstanceState);
            titulocarrusel     = view.FindViewById <TextView>(Resource.Id.titulocarrusel);
            componenteCarrusel = view.FindViewById <ViewPager>(Resource.Id.componente_carrusel);
            var font = Typeface.CreateFromAsset(this.Activity.Assets, rutaFuenteTitilium);

            titulocarrusel.Typeface = font;
            parametriaLogUtil       = new ParametriaLogUtil();
            generarPaginasCarrusel();

            return(view);
        }
Пример #6
0
        /// Metodo que instancia la vista y recursos de la vista y la devuelve
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            notificacionesUtil = new NotificacionesUtil(this.Activity);
            View     view = inflater.Inflate(Resource.Layout.Notificaciones, container, false);
            TextView lblNotificacionesTitulo = view.FindViewById <TextView>(Resource.Id.lblNotificacionesTitulo);

            lblMarcarComoLeida                          = view.FindViewById <TextView>(Resource.Id.lblMarcarComoLeida);
            btnCamapanaNotificaciones                   = Activity.FindViewById <ImageView>(Resource.Id.btnCamapanaNotificaciones);
            btnCamapanaNotificacionesNoLeida            = Activity.FindViewById <ImageView>(Resource.Id.btnCamapanaNotificacionesNoLeida);
            lblContadorNotificacionesNoLeidas           = Activity.FindViewById <TextView>(Resource.Id.lblContadorNotificacionesNoLeidas);
            relativeLayoutCampanaNotificacionesContador = Activity.FindViewById <RelativeLayout>(Resource.Id.relativeLayoutCampanaNotificacionesContador);
            NotificacionesListView                      = view.FindViewById <ListView>(Resource.Id.notificacionesListView);
            var font = Typeface.CreateFromAsset(Activity.Assets, ConstantesSecurity.fuente);

            lblNotificacionesTitulo.Typeface  = font;
            lblMarcarComoLeida.Typeface       = font;
            dialogoLoadingBcoSecurityActivity = new DialogoLoadingBcoSecurityActivity(Activity);
            return(view);
        }
Пример #7
0
        /// <summary>
        /// metodo onCreate de la vista
        /// </summary>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(WebServiceSecurity.CertificadoSecurity.ValidateServerCertificate);
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Login);
            txtUsername      = FindViewById <EditText>(Resource.Id.txtUsername);
            txtClave         = FindViewById <EditText>(Resource.Id.txtClave);
            lblMensaje       = FindViewById <TextView>(Resource.Id.lblMensaje);
            txtInputUsername = FindViewById <TextInputLayout>(Resource.Id.txtInputUsername);
            txtInputClave    = FindViewById <TextInputLayout>(Resource.Id.txtInputPassword);
            btnIniciaSesion  = FindViewById <Button>(Resource.Id.btnIniciaSesion);

            btnIniciaSesion.Click   += BtnIniciaSesion_Click;
            btnProblemasClave        = FindViewById <ImageView>(Resource.Id.btnProblemasClave);
            btnProblemasClave.Click += BtnProblemasClave_Click;
            txtUsername.ImeOptions   = Android.Views.InputMethods.ImeAction.Next;
            txtClave.ImeOptions      = Android.Views.InputMethods.ImeAction.Done;

            var fontRegular  = Typeface.CreateFromAsset(Assets, "fonts/titillium_web/TitilliumWeb-Regular.ttf");
            var fontSemiBold = Typeface.CreateFromAsset(Assets, "fonts/titillium_web/TitilliumWeb-SemiBold.ttf");

            txtUsername.Typeface      = fontRegular;
            btnIniciaSesion.Typeface  = fontSemiBold;
            txtClave.Typeface         = fontRegular;
            txtInputClave.Typeface    = fontRegular;
            lblMensaje.Typeface       = fontRegular;
            txtInputUsername.Typeface = fontRegular;

            parametriaLogUtil = new ParametriaLogUtil();
            nombreArchivo     = "app-bco_security_enrolamiento.sqlite";
            rutaCarpeta       = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            ruta = System.IO.Path.Combine(rutaCarpeta, nombreArchivo);

            mascarasTextWatcher = new MascarasTextWatcher(txtUsername, this, MascarasTextWatcher.TIPO_RUT);
            txtUsername.AddTextChangedListener(mascarasTextWatcher);
            txtUsername.TextChanged          += TxtUsername_TextChanged;
            txtClave.TextChanged             += TxtClave_TextChanged;
            lineTxtUsername                   = FindViewById <View>(Resource.Id.lineTxtUsername);
            lineTxtClave                      = FindViewById <View>(Resource.Id.lineTxtClave);
            dialogoLoadingBcoSecurityActivity = new DialogoLoadingBcoSecurityActivity(this);
        }
Пример #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ConfirmacionEnrolado);
            lblIndicacion            = FindViewById <TextView>(Resource.Id.lblIndicacion);
            lblIndicacion1           = FindViewById <TextView>(Resource.Id.lblIndicacion1);
            lblIndicacion2           = FindViewById <TextView>(Resource.Id.lblIndicacion2);
            lblIndicacion3           = FindViewById <TextView>(Resource.Id.lblIndicacion3);
            btnIngresarLoginC        = FindViewById <Button>(Resource.Id.btnIngresarLoginC);
            btnIngresarLoginC.Click += btnIngresarLoginC_ClickAsync;

            var fontRegular  = Typeface.CreateFromAsset(Assets, rutaFuenteTitiliumRegular);
            var fontSemiBold = Typeface.CreateFromAsset(Assets, rutaFuenteTitiliumSemiBold);

            btnIngresarLoginC.Typeface        = fontSemiBold;
            lblIndicacion.Typeface            = fontSemiBold;
            lblIndicacion1.Typeface           = fontRegular;
            lblIndicacion2.Typeface           = fontRegular;
            lblIndicacion3.Typeface           = fontSemiBold;
            parametriaLogUtil                 = new ParametriaLogUtil();
            dialogoLoadingBcoSecurityActivity = new DialogoLoadingBcoSecurityActivity(this);
        }
Пример #9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.LLamame);
            btnLlamame        = FindViewById <Button>(Resource.Id.btnLlamame);
            txtParrafo1       = FindViewById <TextView>(Resource.Id.txtParrafo1);
            txtParrafo2       = FindViewById <TextView>(Resource.Id.txtParrafo2);
            txtParrafo3       = FindViewById <TextView>(Resource.Id.txtParrafo3);
            txtParrafo4       = FindViewById <TextView>(Resource.Id.txtParrafo4);
            btnLlamame.Click += BtnLlamame_ClickAsync;

            var fontRegular  = Typeface.CreateFromAsset(Assets, rutaFuenteTitiliumRegular);
            var fontSemiBold = Typeface.CreateFromAsset(Assets, rutaFuenteTitiliumSemiBold);

            btnLlamame.Typeface  = fontSemiBold;
            txtParrafo1.Typeface = fontRegular;
            txtParrafo2.Typeface = fontSemiBold;
            txtParrafo3.Typeface = fontRegular;
            txtParrafo4.Typeface = fontRegular;
            parametriaLogUtil    = new ParametriaLogUtil();
            dialogoLoadingBcoSecurityActivity = new DialogoLoadingBcoSecurityActivity(this);
        }
Пример #10
0
        private async void generarPaginasCarrusel()
        {
            List <OnOffData> lstResult = new List <OnOffData>();

            // DialogoLoadingBcoSecurityActivity.mostrarViewLoadingSecurity(Activity);
            try{
                JsonValue jsonResponseAccessToken = await WebServiceSecurity.ServiciosSecurity.CallRESTaccessToken();

                if (!string.IsNullOrEmpty(jsonResponseAccessToken.ToString()))
                {
                    JsonValue token = jsonResponseAccessToken["access_token"];

                    JsonValue jsonResponseConsultaProductoNotificaciones = await WebServiceSecurity.ServiciosSecurity.CallRESTConsultaProductoNotificaciones(token, SecurityEndpoints.flagInicio, SecurityEndpoints.tamanoBloque, SecurityEndpoints.paginaConsultar, SecurityEndpoints.numeroRegistros, SecurityEndpoints.totalPaginas, SecurityEndpoints.ultimoRegistro, UtilAndroid.getRut(), parametriaLogUtil.getIdDispositivoParaLog(UtilAndroid.getIMEI(this.Activity)), ParametriaLogUtil.GetIpLocal());

                    if (!string.IsNullOrEmpty(jsonResponseConsultaProductoNotificaciones.ToString()))
                    {
                        string jcpnStatus = jsonResponseConsultaProductoNotificaciones["statusCode"];

                        if (jcpnStatus.Equals(ConstantesOnOff.TEXTO_ESTADO_SUCCESS))
                        {
                            JsonValue     productosBcoSecurity = jsonResponseConsultaProductoNotificaciones["ProductosNotificaciones"];
                            int           tarjetaProducto      = 0;
                            JArray        arregloProductos     = JArray.Parse(productosBcoSecurity.ToString());
                            List <JToken> listadoProductosBco  = arregloProductos.Children().ToList();
                            ProductoCard  pc = new ProductoCard();

                            foreach (var items in listadoProductosBco)
                            {
                                string    numeroProducto             = Convert.ToString(JObject.Parse(items.ToString())["numeroProducto"]).Trim();
                                string    codigoTipoProducto         = Convert.ToString(JObject.Parse(items.ToString())["codigoTipoProducto"]).Trim();
                                string    tipoProducto               = Convert.ToString(JObject.Parse(items.ToString())["tipoProducto"]).Trim();
                                string    glosaProducto              = Convert.ToString(JObject.Parse(items.ToString())["glosaProducto"]).Trim();
                                string    estadoNotificacionProducto = Convert.ToString(JObject.Parse(items.ToString())["estadoNotificacionProducto"]);
                                string    montoPesos           = Convert.ToString(JObject.Parse(items.ToString())["montoPesos"]);
                                string    montoDolar           = Convert.ToString(JObject.Parse(items.ToString())["montoDolar"]);
                                string    nombreTarjeta        = Convert.ToString(JObject.Parse(items.ToString())["nombreTarjeta"]).Trim();
                                JsonValue estadoTarjetaCredito = null;
                                JsonValue estadoTarjetaDebito  = null;

                                bool validadorAgregar = false;

                                if (tipoProducto.Equals("TARJETA DEBITO"))
                                {
                                    tarjetaProducto = Resource.Drawable.td;
                                    string pan           = numeroProducto;
                                    int    contadorFinal = pan.Length - 3;
                                    pan = pan.Substring(3, contadorFinal); // para redbank no se envia los ceros del comienzo.

                                    estadoTarjetaDebito = WebServiceSecurity.ServiciosSecurity.CallRESTCheckCardStatus(token, SecurityEndpoints.cceFi, SecurityEndpoints.cceAbaBranch, pan,
                                                                                                                       SecurityEndpoints.cceAccountType, UtilAndroid.getRut(),
                                                                                                                       parametriaLogUtil.getIdDispositivoParaLog(UtilAndroid.getIMEI(this.Activity)),
                                                                                                                       ParametriaLogUtil.GetIpLocal());


                                    string codigoEstadoDebito = estadoTarjetaDebito["statusCode"];
                                    if (codigoEstadoDebito != null && codigoEstadoDebito.Equals(TEXTO_ESTADO_SUCCESS))
                                    {
                                        validadorAgregar = true;
                                    }
                                }
                                else if (tipoProducto.Equals("TARJETA CREDITO"))
                                {
                                    if (glosaProducto.Equals("MASTER BLACK"))
                                    {
                                        tarjetaProducto = Resource.Drawable.tcb;//imagen
                                    }
                                    else if (glosaProducto.Equals("MASTER GOLD"))
                                    {
                                        tarjetaProducto = Resource.Drawable.tc;//imagen
                                    }
                                    estadoTarjetaCredito = WebServiceSecurity.ServiciosSecurity.CallRESTGetCardData(token, UtilAndroid.getRut(), numeroProducto,
                                                                                                                    parametriaLogUtil.getIdDispositivoParaLog(UtilAndroid.getIMEI(this.Activity)), ParametriaLogUtil.GetIpLocal());

                                    string codigoEstadoCredito = estadoTarjetaCredito["statusCode"];
                                    if (codigoEstadoCredito != null && codigoEstadoCredito.Equals(TEXTO_ESTADO_SUCCESS))
                                    {
                                        validadorAgregar = true;
                                    }
                                }

                                if (validadorAgregar == true)
                                {
                                    lstResult.Add(new OnOffData()
                                    {
                                        Pan                        = numeroProducto,
                                        ImageId                    = tarjetaProducto,
                                        TipoProducto               = tipoProducto,
                                        CodigoTipoProducto         = codigoTipoProducto,
                                        GlosaProducto              = glosaProducto,
                                        EstadoNotificacionProducto = estadoNotificacionProducto,
                                        MontoPesos                 = montoPesos,
                                        MontoDolar                 = montoDolar,
                                        NombreTarjeta              = nombreTarjeta,
                                        estadoTarjetaCredito       = estadoTarjetaCredito,
                                        estadoTarjetaDebito        = estadoTarjetaDebito
                                    });
                                }
                            }
                            DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                        }
                        else
                        {
                            DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                            //DialogoErrorActivity.mostrarViewErrorHome(this.Activity);
                        }
                    }
                    else
                    {
                        //DialogoErrorActivity.mostrarViewErrorLoginEnrolado(this.Activity);
                    }
                }
                else
                {
                    //DialogoErrorActivity.mostrarViewErrorLoginEnrolado(this.Activity);
                }
            }
            catch (System.Exception ex)
            {
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                //DialogoErrorActivity.mostrarViewErrorHome(this.Activity);
                Console.WriteLine(ex.Message);
            }

            adapterCarrusel            = new OnOffAdapter(this.Activity, lstResult, componenteCarrusel);
            componenteCarrusel.Adapter = adapterCarrusel;
            DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
        }
Пример #11
0
        /// Metodo que envia los rescursos de la lista al adaptador.
        public async override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);
            setUpViews();
            dialogoLoadingBcoSecurityActivity.mostrarViewLoadingSecurity();
            await notificacionesUtil.Llamarservicio(this.Activity, UtilAndroid.getRut());

            DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            var agrupacion = notificacionesUtil.NotificacionesPorFecha();

            listadoFinal = new List <Notificacion>();
            foreach (var grupo in agrupacion)
            {
                var notifFecha = new Notificacion();
                notifFecha.esFecha = true;
                DateTime fecha       = DateTime.Parse(grupo.Key, CultureInfo.CurrentCulture);
                var      mes         = NombreMes(fecha.Month);
                var      fechaFormat = fecha.Day + " " + mes;
                notifFecha.mensajeNotificacion = fechaFormat;

                listadoFinal.Add(notifFecha);
                listadoFinal.AddRange(grupo.ToList());
            }
            adapterHistoricoNotificaciones = new NotificacionesAdapter(Activity, listadoFinal);
            NotificacionesListView.Adapter = adapterHistoricoNotificaciones;

            NotificacionesListView.ItemClick += (sender, e) => {
                Bean.Notificacion notiSelected = adapterHistoricoNotificaciones.GetNotificacion(e.Position);
                foreach (var notificacion in listadoFinal)
                {
                    if (notificacion.idNotificacion == notiSelected.idNotificacion)
                    {
                        if (notificacion.estado)
                        {
                            notificacion.estado = false;
                        }
                        else
                        {
                            notificacion.estado = true;
                        }
                    }
                }
                listNotificacionLeidas = preferenciasNotificacionesLeidas.obneterListadoDeNotificacionesLeidas(Activity);
                if (listNotificacionLeidas.Count == 0)
                {
                    if (listNotificacionLeidas == null)
                    {
                        listNotificacionLeidas.Remove(null);
                    }
                    preferenciasNotificacionesLeidas.guardarPreferencia(Activity, notiSelected.idNotificacion);
                }
                else
                {
                    foreach (string notificacionLeida in listNotificacionLeidas)
                    {
                        if (!notificacionLeida.Equals(notiSelected.idNotificacion))
                        {
                            preferenciasNotificacionesLeidas.guardarPreferencia(Activity, notiSelected.idNotificacion);
                        }
                    }
                }

                if (listNotificacionLeidas != null || listNotificacionLeidas.Count != 0)
                {
                    int contadorDeNotificacionesRefrescado = preferenciasNotificacionesLeidas.getContadorNotificacionesNoLeidas(Activity, listadoFinal);
                    lblContadorNotificacionesNoLeidas      = Activity.FindViewById <TextView>(Resource.Id.lblContadorNotificacionesNoLeidas);
                    lblContadorNotificacionesNoLeidas.Text = contadorDeNotificacionesRefrescado + string.Empty;
                }
                adapterHistoricoNotificaciones.NotifyDataSetChanged();
            };

            lblMarcarComoLeida.Click += delegate {
                foreach (var notificacion in listadoFinal)
                {
                    listNotificacionLeidas = preferenciasNotificacionesLeidas.obneterListadoDeNotificacionesLeidas(Activity);
                    if (listNotificacionLeidas.Count == 0)
                    {
                        if (listNotificacionLeidas == null)
                        {
                            listNotificacionLeidas.Remove(null);
                        }
                        preferenciasNotificacionesLeidas.guardarPreferencia(Activity, notificacion.idNotificacion);
                    }
                    else
                    {
                        preferenciasNotificacionesLeidas.guardarPreferencia(Activity, notificacion.idNotificacion);
                    }
                    notificacion.estado = true;
                }

                relativeLayoutCampanaNotificacionesContador.Visibility = ViewStates.Gone;
                btnCamapanaNotificaciones.Visibility = ViewStates.Visible;

                adapterHistoricoNotificaciones.NotifyDataSetChanged();
            };
        }
Пример #12
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Home);
            nombreConocido          = MainActivity.returnNombreConsultaEnrolado();
            nombreDesdeConfirmacion = ConfirmacionEnroladoActivity.returnNombreConsultaEnroladoConocido();
            // NotificacionesFragment NotificacionesFragment = new NotificacionesFragment();
            nombreTitulo = nombreConocido;
            if (string.IsNullOrEmpty(nombreTitulo))
            {
                nombreTitulo = nombreDesdeConfirmacion;
            }
            string nombreLogin = nombreTitulo;

            nombreUsuario        = nombreLogin.Split(' ');
            primerNombreUsuario  = nombreUsuario[0].ToLower();
            segundoNombreUsuario = nombreUsuario[1].ToLower();
            string primeraLetraPrimerNombre    = primerNombreUsuario.Substring(0, 1).ToUpper();
            string restoPrimernombreFormateado = primerNombreUsuario.Substring(1, primerNombreUsuario.Length - 1);

            primerNombreFormateado = primeraLetraPrimerNombre + restoPrimernombreFormateado;
            if (!string.IsNullOrEmpty(segundoNombreUsuario))
            {
                string primeraLetraSegundoNombre    = segundoNombreUsuario.Substring(0, 1).ToUpper();
                string restoSegundonombreFormateado = segundoNombreUsuario.Substring(1, segundoNombreUsuario.Length - 1);
                segundoNombreFormateado = primeraLetraSegundoNombre + restoSegundonombreFormateado;
            }
            string nombreUserFormateado = primerNombreFormateado + " " + segundoNombreFormateado;

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            btnBurger    = FindViewById <ImageView>(Resource.Id.btnBurger);
            btnCamapanaNotificaciones                   = FindViewById <ImageView>(Resource.Id.btnCamapanaNotificaciones);
            btnCamapanaNotificacionesNoLeida            = FindViewById <ImageView>(Resource.Id.btnCamapanaNotificacionesNoLeida);
            lblContadorNotificacionesNoLeidas           = FindViewById <TextView>(Resource.Id.lblContadorNotificacionesNoLeidas);
            relativeLayoutCampanaNotificacionesContador = FindViewById <RelativeLayout>(Resource.Id.relativeLayoutCampanaNotificacionesContador);
            notificacionesUtil = new NotificacionesUtil(this);
            preferenciasNotificacionesLeidas = new PreferenciasNotificacionesLeidas();
            listadoFinal = await notificacionesUtil.Llamarservicio(this, UtilAndroid.getRut());

            int contadorNotificaciones = preferenciasNotificacionesLeidas.getContadorNotificacionesNoLeidas(this, listadoFinal);

            if (contadorNotificaciones == 0)
            {
                relativeLayoutCampanaNotificacionesContador.Visibility = ViewStates.Gone;
                btnCamapanaNotificaciones.Visibility = ViewStates.Visible;
                btnCamapanaNotificaciones.Click     += BtnCamapanaNotificaciones_Click;
            }
            else
            {
                lblContadorNotificacionesNoLeidas.Text = contadorNotificaciones + string.Empty;
                relativeLayoutCampanaNotificacionesContador.Visibility = ViewStates.Visible;
                btnCamapanaNotificaciones.Visibility    = ViewStates.Gone;
                btnCamapanaNotificacionesNoLeida.Click += BtnCamapanaNotificacionesNoLeida_Click;
            }
            btnBurger.Click += BtnBurger_Click;
            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
            View hView = navigationView.GetHeaderView(cero);

            lblUsuarioMenu      = hView.FindViewById <TextView>(Resource.Id.lblUsuarioMenu);
            lblUsuarioMenu.Text = nombreUserFormateado;
            var fontRegular = Typeface.CreateFromAsset(Assets, rutaFuenteTitilium);
            var fontBold    = Typeface.CreateFromAsset(Assets, rutaFuenteTitiliumBold);

            lblUsuarioMenu.Typeface = fontRegular;
            cambiarFuenteMenu();
            var fragmentOnOff = FragmentManager.BeginTransaction();

            fragmentOnOff.AddToBackStack(null);
            fragmentOnOff.Add(Resource.Id.HomeLayout, new OnOffFragment());
            fragmentOnOff.Commit();
            dialogoLoadingBcoSecurityActivity = new DialogoLoadingBcoSecurityActivity(this);
        }
Пример #13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateServerCertificate);
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.LoginConocido);
            nombreConocido          = MainActivity.returnNombreConsultaEnrolado();
            nombreDesdeConfirmacion = ConfirmacionEnroladoActivity.returnNombreConsultaEnroladoConocido();

            nombreTitulo = nombreConocido;
            if (string.IsNullOrEmpty(nombreTitulo))
            {
                nombreTitulo = nombreDesdeConfirmacion;
            }

            string nombreLogin = nombreTitulo;

            nombreUsuario        = nombreLogin.Split(' ');
            primerNombreUsuario  = nombreUsuario[0].ToLower();
            segundoNombreUsuario = nombreUsuario[1].ToLower();

            parametriaLogUtil = new ParametriaLogUtil();
            string primeraLetraPrimerNombre    = primerNombreUsuario.Substring(0, 1).ToUpper();
            string restoPrimernombreFormateado = primerNombreUsuario.Substring(1, primerNombreUsuario.Length - 1);

            primerNombreFormateado = primeraLetraPrimerNombre + restoPrimernombreFormateado;
            if (!string.IsNullOrEmpty(segundoNombreUsuario))
            {
                string primeraLetraSegundoNombre    = segundoNombreUsuario.Substring(0, 1).ToUpper();
                string restoSegundonombreFormateado = segundoNombreUsuario.Substring(1, segundoNombreUsuario.Length - 1);
                segundoNombreFormateado = primeraLetraSegundoNombre + restoSegundonombreFormateado;
            }
            string nombreUserFormateado = primerNombreFormateado + " " + segundoNombreFormateado;

            rutConocido          = MainActivity.returnRutConsultaEnrolado();
            rutDesdeConfirmacion = ConfirmacionEnroladoActivity.returnRutConsultaEnroladoConocido();
            rutDefinitivo        = rutConocido;
            if (string.IsNullOrEmpty(rutDefinitivo))
            {
                rutDefinitivo = rutDesdeConfirmacion;
            }


            String nombreArchivo = "app-bco_security.sqlite";
            String rutaCarpeta   = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            String ruta          = System.IO.Path.Combine(rutaCarpeta, nombreArchivo);

            KEY_NAME = DatabaseHelper.pass(ruta);

            KeyguardManager    keyguardManager    = (KeyguardManager)GetSystemService(KeyguardService);
            FingerprintManager fingerprintManager = (FingerprintManager)GetSystemService(FingerprintService);

            if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.UseFingerprint) != (int)Android.Content.PM.Permission.Granted)
            {
                return;
            }

            if (!fingerprintManager.IsHardwareDetected)
            {
                //Toast.MakeText(ApplicationContext, "Lector de huella no habilitado", ToastLength.Long).Show();
            }
            else
            {
                if (!fingerprintManager.HasEnrolledFingerprints)
                {
                    //Toast.MakeText(ApplicationContext, "Debes enrolar tu huella a la app", ToastLength.Long).Show();
                }
                else
                {
                    if (!keyguardManager.IsKeyguardSecure)
                    {
                        Toast.MakeText(ApplicationContext, "No tienes habilitada la configuracion del scaner dactilar", ToastLength.Short).Show();
                    }
                    else
                    {
                        GenKey();
                    }

                    if (CipherInit())
                    {
                        FingerprintManager.CryptoObject cryptoObject = new FingerprintManager.CryptoObject(cipher);
                        FingerprintHandlerLogin         helperLogin  = new FingerprintHandlerLogin(this);
                        helperLogin.StartAuthentication(fingerprintManager, cryptoObject);
                    }
                }
            }

            txtUsernameConocido      = FindViewById <TextView>(Resource.Id.txtUsernameConocido);
            txtUsernameConocido.Text = "Hola, " + nombreUserFormateado;
            txtClaveConocido         = FindViewById <EditText>(Resource.Id.txtClaveConocido);
            lblMensajeConocido       = FindViewById <TextView>(Resource.Id.lblMensajeConocido);
            txtInputClaveConocido    = FindViewById <TextInputLayout>(Resource.Id.txtInputClaveConocido);

            btnIniciaSesionConocido        = FindViewById <Button>(Resource.Id.btnIniciaSesionConocido);
            btnIniciaSesionConocido.Click += BtnIniciaSesionConocido_ClickAsync;

            btnProblemasClaveConocido        = FindViewById <ImageView>(Resource.Id.btnProblemasClaveConocido);
            btnProblemasClaveConocido.Click += BtnProblemasClaveConocido_Click;
            txtClaveConocido.TextChanged    += TxtClaveConocido_TextChanged;
            btnAyudaLoginConocido            = FindViewById <ImageView>(Resource.Id.btnAyudaLoginConocido);


            var fontRegular  = Typeface.CreateFromAsset(Assets, rutaFuenteTitiliumRegular);
            var fontSemiBold = Typeface.CreateFromAsset(Assets, rutaFuenteTitiliumSemiBold);

            txtUsernameConocido.Typeface      = fontRegular;
            btnIniciaSesionConocido.Typeface  = fontSemiBold;
            txtClaveConocido.Typeface         = fontRegular;
            txtInputClaveConocido.Typeface    = fontRegular;
            lblMensajeConocido.Typeface       = fontRegular;
            lineTxtClaveConocido              = FindViewById <View>(Resource.Id.lineTxtClaveConocido);
            dialogoLoadingBcoSecurityActivity = new DialogoLoadingBcoSecurityActivity(this);
        }
Пример #14
0
        private async void BtnIniciaSesionConocido_ClickAsync(object sender, EventArgs e)
        {
            dialogoLoadingBcoSecurityActivity.mostrarViewLoadingSecurity();
            if (string.IsNullOrEmpty(txtClaveConocido.Text))
            {
                lblMensajeConocido.Text = "Clave incorrecta";
                lineTxtClaveConocido.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            }
            else if (txtClaveConocido.Text.Trim().Length < 8)
            {
                lineTxtClaveConocido.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                lblMensajeConocido.Text = "Clave incorrecta";
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            }
            else if (txtClaveConocido.Text.Trim().Length > 8)
            {
                lineTxtClaveConocido.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                lblMensajeConocido.Text = "Clave incorrecta";
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            }
            else
            {
                lblMensajeConocido.Text = string.Empty;
                try
                {
                    lineTxtClaveConocido.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.green);
                    string    imei = this.getIMEI();
                    string    idDispositivoLogLogin   = parametriaLogUtil.getIdDispositivoParaLog(imei);
                    string    ipDisposiivoLogLogin    = ParametriaLogUtil.GetIpLocal();
                    JsonValue jsonResponseAccessToken = await WebServiceSecurity.ServiciosSecurity.CallRESTaccessToken();

                    JsonValue jt = jsonResponseAccessToken["access_token"];

                    JsonValue jsonResponseLogin = await WebServiceSecurity.ServiciosSecurity.CallRESTlogin(jt, rutDefinitivo.Trim(), txtClaveConocido.Text, SecurityEndpoints.userTypeWS_LOGIN, SecurityEndpoints.channelNameWS_LOGIN, idDispositivoLogLogin, ipDisposiivoLogLogin);

                    string jl = jsonResponseLogin["statusCode"];

                    if (jl.Equals("Success"))
                    {
                        string operationResult = jsonResponseLogin["operationResult"];
                        if (operationResult.Equals("Success_1"))
                        {
                            Intent i = new Intent(this, typeof(HomeActivity));
                            StartActivity(i);
                        }
                        else if (operationResult.Equals("ErrorInvalidUser_4") ||
                                 operationResult.Equals("ErrorUserDeleted_7") ||
                                 operationResult.Equals("ErrorGenericError_8") ||
                                 operationResult.Equals("ErrorDocumentNumberWithInvalidFormat_9") ||
                                 operationResult.Equals("ErrorUserAndPasswordDoNotMatch_10") ||
                                 operationResult.Equals("InvalidChannel_11") ||
                                 operationResult.Equals("InvalidPassword_12") ||
                                 operationResult.Equals("NotMatchUserAndUserType_13") ||
                                 operationResult.Equals("ErrorCredentialNotAvailable_14") ||
                                 operationResult.Equals("SuccessPendingValidatePIN_15")
                                 )
                        {
                            txtClaveConocido.Text = string.Empty;
                            DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                            lineTxtClaveConocido.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                            lblMensajeConocido.Text = "Estimado cliente, usuario ingresado es invalido. Por favor ingréselo nuevamente.";
                        }
                        else if (operationResult.Equals("ErrorUserBlockedByPassword_5") ||
                                 operationResult.Equals("ErrorUserBlockedByAdministrator_6") ||
                                 operationResult.Equals("ErrorUserBlockedBySecurityQuestion_16") ||
                                 operationResult.Equals("ErrorUserBlockedByAttemptsPinActivation_17")
                                 )
                        {
                            txtClaveConocido.Text = string.Empty;
                            DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                            lineTxtClaveConocido.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                            lblMensajeConocido.Text = "Estimado Cliente, su clave se encuentra bloqueada. Por favor contáctese con el Servicio Atención Clientes Security +56 2 2222 2222.";
                        }
                        else
                        {
                            ExceptionGeneric();
                        }
                    }
                    else
                    {
                        DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                        lineTxtClaveConocido.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                        lblMensajeConocido.Text = "Error, debes ingresar tus credenciales de Banco Security";
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    ExceptionGeneric();
                }
            }
        }
Пример #15
0
        /// <summary>
        /// metodo el cual contiene el evento click del boton ingresar.
        /// </summary>
        private async void BtnIniciaSesion_Click(object sender, EventArgs e)
        {
            dialogoLoadingBcoSecurityActivity.mostrarViewLoadingSecurity();
            if (string.IsNullOrEmpty(txtUsername.Text) && string.IsNullOrEmpty(txtClave.Text))
            {
                lblMensaje.Text = "Error al ingresar los datos";
                lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                lineTxtClave.BackgroundTintList    = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            }
            else if (validarRut(txtUsername.Text) == false && txtUsername.Text.Trim().Length >= 1 && txtClave.Text.Trim().Length == 8)
            {
                lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                lineTxtClave.BackgroundTintList    = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.green);
                lblMensaje.Text = "Error al ingresar los datos";
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            }

            else if (txtClave.Text.Trim().Length >= 1 && txtClave.Text.Trim().Length < 8 && validarRut(txtUsername.Text) == true)
            {
                lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.green);
                lineTxtClave.BackgroundTintList    = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                lblMensaje.Text = "Clave incorrecta";
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            }
            else if (string.IsNullOrEmpty(txtClave.Text) && validarRut(txtUsername.Text) == true)
            {
                lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.green);
                lineTxtClave.BackgroundTintList    = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                lblMensaje.Text = "Clave incorrecta";
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            }
            else if (string.IsNullOrEmpty(txtUsername.Text) && txtClave.Text.Trim().Length == 8)
            {
                lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                lineTxtClave.BackgroundTintList    = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.green);

                lblMensaje.Text = "Error al ingresar los datos";
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            }
            else if (txtClave.Text.Trim().Length <= 8 && !validarRut(txtUsername.Text))
            {
                lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                lineTxtClave.BackgroundTintList    = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                lblMensaje.Text = "Error al ingresar los datos";
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            }

            else if (txtClave.Text.Trim().Length < 8 && validarRut(txtUsername.Text))
            {
                lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                lineTxtClave.BackgroundTintList    = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                lblMensaje.Text = "Clave incorrecta";
                DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
            }
            else
            {
                lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.green);
                lineTxtClave.BackgroundTintList    = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.green);
                //lblMensaje.Text = "Cargando datos...";

                try
                {
                    idTokenFCM = MyFirebaseIIDService.SendRegistrationToServer();
                    var key = new Contenido()
                    {
                        Password = idTokenFCM
                    };

                    if (idTokenFCM != null)
                    {
                        DatabaseHelper.Insertar(ref key, ruta);
                    }
                    string    imei = this.getIMEI();
                    string    idDispositivoLogLogin   = parametriaLogUtil.getIdDispositivoParaLog(imei);
                    string    ipDisposiivoLogLogin    = ParametriaLogUtil.GetIpLocal();
                    JsonValue jsonResponseAccessToken = await WebServiceSecurity.ServiciosSecurity.CallRESTaccessToken();

                    JsonValue jt = jsonResponseAccessToken["access_token"];

                    string    rutServicio       = MascarasEditText.limpiaRut(txtUsername.Text);
                    JsonValue jsonResponseLogin = await WebServiceSecurity.ServiciosSecurity.CallRESTlogin(jt, rutServicio, txtClave.Text, SecurityEndpoints.userTypeWS_LOGIN, SecurityEndpoints.channelNameWS_LOGIN, idDispositivoLogLogin, ipDisposiivoLogLogin);

                    string jl = jsonResponseLogin["statusCode"];
                    if (jl.Equals("Success"))
                    {
                        string operationResult = jsonResponseLogin["operationResult"];
                        if (operationResult.Equals("Success_1"))
                        {
                            Intent i = new Intent(this, typeof(TerminoYCondicionesActivity));
                            StartActivity(i);
                        }
                        else if (operationResult.Equals("ErrorInvalidUser_4") ||
                                 operationResult.Equals("ErrorUserDeleted_7") ||
                                 operationResult.Equals("ErrorGenericError_8") ||
                                 operationResult.Equals("ErrorDocumentNumberWithInvalidFormat_9") ||
                                 operationResult.Equals("ErrorUserAndPasswordDoNotMatch_10") ||
                                 operationResult.Equals("InvalidChannel_11") ||
                                 operationResult.Equals("InvalidPassword_12") ||
                                 operationResult.Equals("NotMatchUserAndUserType_13") ||
                                 operationResult.Equals("ErrorCredentialNotAvailable_14") ||
                                 operationResult.Equals("SuccessPendingValidatePIN_15")
                                 )
                        {
                            CleaningEntryLogin();
                            DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                            lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                            lineTxtClave.BackgroundTintList    = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                            lblMensaje.Text = "Estimado cliente, usuario ingresado es invalido. Por favor ingréselo nuevamente.";
                        }
                        else if (operationResult.Equals("ErrorUserBlockedByPassword_5") ||
                                 operationResult.Equals("ErrorUserBlockedByAdministrator_6") ||
                                 operationResult.Equals("ErrorUserBlockedBySecurityQuestion_16") ||
                                 operationResult.Equals("ErrorUserBlockedByAttemptsPinActivation_17")
                                 )
                        {
                            CleaningEntryLogin();
                            DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                            lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                            lineTxtClave.BackgroundTintList    = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                            lblMensaje.Text = "Estimado Cliente, su clave se encuentra bloqueada. Por favor contáctese con el Servicio Atención Clientes Security +56 2 2222 2222.";
                        }
                        else
                        {
                            ExceptionGeneric();
                        }
                    }
                    else
                    {
                        lineTxtUsername.BackgroundTintList = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                        lineTxtClave.BackgroundTintList    = Android.Support.V4.Content.ContextCompat.GetColorStateList(ApplicationContext, Resource.Color.red);
                        lblMensaje.Text = "Error al ingresar los datos";
                        DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    ExceptionGeneric();
                }
            }
        }
Пример #16
0
        private async void BtnAutenticarClaveVoz_ClickAsync(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtClaveVoz.Text))
            {
                lblMsjClaveVoz.Text = "Código no coincide, ingréselo nuevamente";
                pintarLineaEditText(lineTxtClaveVoz, lineTxtClaveVozSegundo, lineTxtClaveVozTercero, lineTxtClaveVozCuarto, lineTxtClaveVozQuinto, lineTxtClaveVozSexto, Resource.Color.red);
            }
            else
            {
                dialogoLoadingBcoSecurityActivity.mostrarViewLoadingSecurity();
                try
                {
                    String nombreArchivo = "app-bco_security_enrolamiento.sqlite";
                    String rutaCarpeta   = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                    String ruta          = System.IO.Path.Combine(rutaCarpeta, nombreArchivo);
                    tokenFCM = DatabaseHelper.sqliteTokenFCM(ruta);

                    foreach (var token in tokenFCM)
                    {
                        if (token.Id == 1)
                        {
                            idDispositivoTokenFCM = token.Password;
                            break;
                        }
                    }
                    string    idDispositivoConsultaEnrolado = UtilAndroid.getIMEI(this) + relleno + idDispositivoTokenFCM;
                    string    codigoAutenticar        = txtClaveVoz.Text + txtClaveVozSegundo.Text + txtClaveVozTercero.Text + txtClaveVozCuarto.Text + txtClaveVozQuinto.Text + txtClaveVozSexto.Text;
                    JsonValue jsonResponseAccessToken = await WebServiceSecurity.ServiciosSecurity.CallRESTaccessToken();

                    JsonValue jt = jsonResponseAccessToken["access_token"];
                    JsonValue jsonResponseAutenticarClaveVoz = await WebServiceSecurity.ServiciosSecurity.CallRESTAutenticarClaveVoz(jt, SecurityEndpoints.A_GRUPOIDG, SecurityEndpoints.A_STR_IDMECANISMO, LoginActivity.returnRut(), LoginActivity.returnRut(), codigoAutenticar, SecurityEndpoints.A_CODIGOTRANSACCION, SecurityEndpoints.A_STR_SESSIONID1, SecurityEndpoints.A_STR_SESSIONID2, SecurityEndpoints.A_IDLOG, SecurityEndpoints.A_STR_IP, parametriaLogUtil.getIdDispositivoParaLog(UtilAndroid.getIMEI(this)), ParametriaLogUtil.GetIpLocal());

                    JsonValue jcv    = jsonResponseAutenticarClaveVoz["statusCode"];
                    string    status = jcv.ToString();

                    if (status.Equals("0"))
                    {
                        pintarLineaEditText(lineTxtClaveVoz, lineTxtClaveVozSegundo, lineTxtClaveVozTercero, lineTxtClaveVozCuarto, lineTxtClaveVozQuinto, lineTxtClaveVozSexto, Resource.Color.green);
                        lblMsjClaveVoz.Text = string.Empty;
                        JsonValue jsonResponseAccessTokenn = await WebServiceSecurity.ServiciosSecurity.CallRESTaccessToken();

                        JsonValue jtt = jsonResponseAccessTokenn["access_token"];
                        JsonValue jsonResponseEnrolarDispositivo = await WebServiceSecurity.ServiciosSecurity.CallRESTEnrolarDispositivo(jtt, idDispositivoConsultaEnrolado, LoginActivity.returnRut(), SecurityEndpoints.ED_SISTEMA, SecurityEndpoints.ED_CANAL, SecurityEndpoints.ED_ESTADO, SecurityEndpoints.ED_SISTEMA_ANDROID, getDispositivo(), getNameModel(), parametriaLogUtil.getIdDispositivoParaLog(UtilAndroid.getIMEI(this)), ParametriaLogUtil.GetIpLocal());

                        string jed = jsonResponseEnrolarDispositivo["statusCode"];
                        if (jed.Equals("Success"))
                        {
                            Intent i = new Intent(this, typeof(FingerPrintAuthActivity));
                            StartActivity(i);
                        }
                        else
                        {
                            DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                            pintarLineaEditText(lineTxtClaveVoz, lineTxtClaveVozSegundo, lineTxtClaveVozTercero, lineTxtClaveVozCuarto, lineTxtClaveVozQuinto, lineTxtClaveVozSexto, Resource.Color.red);
                            lblMsjClaveVoz.Text = "Operación sin exito";
                        }
                    }
                    else
                    {
                        DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                        pintarLineaEditText(lineTxtClaveVoz, lineTxtClaveVozSegundo, lineTxtClaveVozTercero, lineTxtClaveVozCuarto, lineTxtClaveVozQuinto, lineTxtClaveVozSexto, Resource.Color.red);
                        lblMsjClaveVoz.Text = "Código no coincide, ingréselo nuevamente";
                    }
                }catch (Exception x) {
                    Log.Error("", x.Message);
                    DialogoErrorActivity.mostrarViewErrorLogin(this);
                }
            }
        }