Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            var textEmailAddress = FindViewById <EditText>(Resource.Id.editTextEmail);
            var etPassword       = FindViewById <EditText>(Resource.Id.editTextPassword);
            var btn = FindViewById <Button>(Resource.Id.buttonValidate);

            btn.Click += async(sender, e) =>
            {
                progress = new Android.App.ProgressDialog(this);
                progress.SetCancelable(false);
                progress.SetTitle("Trabajando");
                progress.SetMessage("Por favor, espera...");
                progress.SetProgressStyle(Android.App.ProgressDialogStyle.Horizontal);
                progress.Indeterminate = true;
                progress.Show();

                await Validate();

                Android.App.AlertDialog.Builder Builder =
                    new AlertDialog.Builder(this);
                AlertDialog Alert = Builder.Create();
                Alert.SetTitle("Resultado de la verificación");
                Alert.SetIcon(Resource.Drawable.dotnet);
                Alert.SetMessage(
                    $"{Result.Status}\n{Result.FullName}\n{Result.Token}");
                Alert.SetButton("Ok", (s, ev) => { });
                progress.Cancel();
                Alert.Show();
            };
        }
Пример #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Validar);

            var textEmailAddress = FindViewById <EditText>(Resource.Id.etCorreo);
            var etPassword       = FindViewById <EditText>(Resource.Id.etPassword);
            var btn    = FindViewById <Button>(Resource.Id.btn);
            var txview = FindViewById <TextView>(Resource.Id.txview);

            btn.Click += async(sender, e) =>
            {
                progress = new Android.App.ProgressDialog(this);
                progress.Indeterminate = true;
                progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                progress.SetMessage("Loading is Progress...");
                progress.SetCancelable(false);
                progress.Show();

                this.Email    = textEmailAddress.Text.ToString();
                this.Password = etPassword.Text.ToString();

                string res = await Validate();

                txview.Text = res.ToString();
                progress.Cancel();
            };
        }
Пример #3
0
        private clsTransferencia llenarDatosTransferencia()
        {
            clsTransferencia objTransferencia = new clsTransferencia();

            try
            {
                objTransferencia.Id = "0";
                objTransferencia.strIdentificacionEmisor = strIdentificacion;
                objTransferencia.strNumeroCuentaEmisor   = strNumeroCuenta;
                clsCuenta objCuenta = lstCuentas.Find(x => x.numero_cuenta == strNumeroCuenta);
                objCooperativa = lstCooperativas.Find(x => x.Id == objCuenta.idCooperativa);
                objTransferencia.strEntidadEmisor = objCooperativa.nombreCooperativa;
                objTransferencia.strIdentificacionBeneficiario = "9999999999";
                objTransferencia.strTipoCuentaBeneficiario     = objCuenta.tipo_cuenta;
                objTransferencia.strNumeroCuentaBeneficiario   = "99999999999";
                objTransferencia.strEntidadBeneficiario        = objCooperativa.nombreCooperativa;
                objTransferencia.dblMonto  = double.Parse(txtMontoPago.Text);
                objTransferencia.strMotivo = "PAGO SERVICIO " + objCabeceraFacturaServicio.tipo_suministro + " SUMINISTRO " + txtNumeroSuministro.Text;
            }
            catch (Exception)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                progress.Cancel();
                alert.SetTitle("Alerta");
                alert.SetMessage("Ocurió un problema al realizar el pago");

                RunOnUiThread(() => {
                    alert.Show();
                });
            }
            return(objTransferencia);
        }
Пример #4
0
        private clsTransferencia llenarDatosTransferencia()
        {
            clsTransferencia objTransferencia = new clsTransferencia();

            try
            {
                objTransferencia.strIdentificacionEmisor = strIdentificacion;
                objTransferencia.strNumeroCuentaEmisor   = strNumeroCuenta;
                clsCuenta objCuenta = lstCuentas.Find(x => x.numero_cuenta == strNumeroCuenta);
                objCooperativaEmisor = lstCooperativas.Find(x => x.Id == objCuenta.idCooperativa);
                objTransferencia.strEntidadEmisor = objCooperativaEmisor.nombreCooperativa;
                objTransferencia.strIdentificacionBeneficiario = "9999999999";
                objTransferencia.strTipoCuentaBeneficiario     = objCuenta.tipo_cuenta;
                objTransferencia.strNumeroCuentaBeneficiario   = "99999999999";
                objTransferencia.strEntidadBeneficiario        = objCooperativaBeneficiario.nombreCooperativa;
                objTransferencia.dblMonto  = double.Parse(txtMontoPagoTarjeta.Text);
                objTransferencia.strMotivo = "PAGO TARJETA " + txtTipoTarjetaSeleccionada.Text;
            }
            catch (Exception)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                progress.Cancel();
                alert.SetTitle("Alerta");
                alert.SetMessage("Ocurió un problema al realizar la transferencia");

                RunOnUiThread(() => {
                    alert.Show();
                });
            }
            return(objTransferencia);
        }
Пример #5
0
        public void OnConnectionSuspended(int cause)
        {
            Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
            progress.Cancel();
            alert.SetTitle("Alerta");
            alert.SetMessage("Ocurió un problema con la conexión");

            RunOnUiThread(() => {
                alert.Show();
            });
        }
Пример #6
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            var ListItemColor = FindViewById <ListView>(Resource.Id.ListItemColor);
            var txview        = FindViewById <TextView>(Resource.Id.txview);


            ListItemColor.Adapter = new CustomAdapters.ColorAdapter(this,

                                                                    Resource.Layout.ListItems,
                                                                    Resource.Id.textView2,
                                                                    Resource.Id.textView3,
                                                                    Resource.Id.imageView1
                                                                    );


            Data = new Complex();
            if (Data.res == null)
            {
                progress = new Android.App.ProgressDialog(this);
                progress.Indeterminate = true;
                progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                progress.SetMessage("Loading is Progress...");
                progress.SetCancelable(false);
                progress.Show();

                res = await Validate();

                Data.res = res;
                progress.Cancel();
            }
            else
            {
                res = Data.GetRes();
            }

            txview.Text = res;
        }
Пример #7
0
        private async Task <bool> ExisteUsuarioRegistrado()
        {
            clsServicioUsuario objServicioUsuario  = new clsServicioUsuario();
            clsUsuario         objUsuarioRespuesta = new clsUsuario();

            try
            {
                progress = new Android.App.ProgressDialog(this);
                progress.Indeterminate = true;
                progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                progress.SetMessage("Consultando Usuario");
                progress.SetCancelable(false);
                progress.Show();

                objUsuarioRespuesta = await objServicioUsuario.consultarUsuario(objUsuario.Id);

                if (objUsuarioRespuesta != null)
                {
                    objUsuario = objUsuarioRespuesta;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                progress.Cancel();
                alert.SetTitle("Alerta");
                alert.SetMessage("Ocurrió un problema al validar usuario registrado");

                RunOnUiThread(() => {
                    alert.Show();
                });
            }
            return(false);
        }
Пример #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.myButton);

            button.Click += async delegate
            {
                var    Client   = new SALLab13.ServiceClient();
                string EMail    = "*****@*****.**";          /* Aquí pon tu correo */
                string Password = "******";                 /* Aquí pon tu contraseña */

                progress = new Android.App.ProgressDialog(this);
                progress.Indeterminate = true;
                progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                progress.SetMessage("Por favor espera...");
                progress.SetCancelable(false);
                progress.Show();

                var Result = await Client.ValidateAsync(this, EMail, Password);

                Android.App.AlertDialog.Builder Builder =
                    new AlertDialog.Builder(this);
                progress.Cancel();

                AlertDialog Alert = Builder.Create();
                Alert.SetTitle("Resultado de la verificación");
                Alert.SetIcon(Resource.Drawable.dotnet);
                Alert.SetMessage(
                    $"{Result.Status}\n{Result.FullName}\n{Result.Token}");
                Alert.SetButton("Ok", (s, ev) => { });
                Alert.Show();
            };
        }
Пример #9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.PagoServicios);

            spinnerCuentaOrigen  = FindViewById <Spinner>(Resource.Id.spiCuentaOrigenPagoServicio);
            txtTipoSuministro    = FindViewById <EditText>(Resource.Id.txtTipoSuministroPagoServicio);
            btnRealizarPagos     = FindViewById <Button>(Resource.Id.btnRealizarPagoServicio);
            txtNumeroSuministro  = FindViewById <EditText>(Resource.Id.txtSuministroPagoServicio);
            txtMontoPago         = FindViewById <EditText>(Resource.Id.txtMontoPagoServicio);
            lblSaldoCuentaOrigen = FindViewById <TextView>(Resource.Id.lblSaldoCuentaPagoServicio);
            mToolBar             = FindViewById <SupportToolbar>(Resource.Id.toolbar4);
            SetSupportActionBar(mToolBar);

            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            SupportActionBar.SetTitle(mPagoServicios);

            //Guardar temporalmente varaibles pantalla
            strIdentificacion  = Intent.GetStringExtra(clsConstantes.strIdentificacionUsuario);
            strCuentaJson      = Intent.GetStringExtra(clsConstantes.strCuentaJson);
            imageUrl           = Intent.GetStringExtra(clsConstantes.strURLImagenUsuario);
            strIdUsuario       = Intent.GetStringExtra(clsConstantes.strIdUsuario);
            strFacturaServicio = Intent.GetStringExtra(clsConstantes.strFacturaServicio);
            strCooperativa     = Intent.GetStringExtra(clsConstantes.strCooperativas);

            lstCooperativas = JsonConvert.DeserializeObject <List <clsCooperativa> >(strCooperativa);

            string[] arrRespuesta = strCuentaJson.Split('|');
            string   strCuentas   = arrRespuesta[0];
            string   strTarjetas  = arrRespuesta[1];

            lstCuentas = JsonConvert.DeserializeObject <List <clsCuenta> >(strCuentas);

            objCabeceraFacturaServicio = JsonConvert.DeserializeObject <clsCabeceraFacturaServicio>(strFacturaServicio);


            spinnerCuentaOrigen.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            List <string> lstCuentasString = new List <string>();

            foreach (clsCuenta objCuenta in lstCuentas)
            {
                if (!lstCuentasString.Contains(objCuenta.numero_cuenta))
                {
                    lstCuentasString.Add(objCuenta.numero_cuenta);
                }
            }
            var adapter1 = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleDropDownItem1Line, lstCuentasString);

            adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
            spinnerCuentaOrigen.Adapter = adapter1;

            txtTipoSuministro.Text   = objCabeceraFacturaServicio.tipo_suministro;
            txtNumeroSuministro.Text = objCabeceraFacturaServicio.numero_suministro;
            txtMontoPago.Text        = objCabeceraFacturaServicio.detalle_factura.FindLast(x => x.detalle_item.ToLower().Contains("total")).valor_detalle.ToString();

            btnRealizarPagos.Click += async(sender, e) =>
            {
                if (String.IsNullOrEmpty(txtMontoPago.Text) ||
                    String.IsNullOrEmpty(txtNumeroSuministro.Text))
                {
                    Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);

                    alert.SetTitle("Alerta");
                    alert.SetMessage("Faltan campos por llenar");

                    RunOnUiThread(() => {
                        alert.Show();
                    });
                }

                else
                {
                    progress = new Android.App.ProgressDialog(this);
                    progress.Indeterminate = true;
                    progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                    progress.SetMessage("Realizando Pago");
                    progress.SetCancelable(true);
                    progress.Show();

                    string           strNumeroSuministro = objCabeceraFacturaServicio.numero_suministro;
                    string           strTipoServicio     = objCabeceraFacturaServicio.tipo_suministro;
                    clsTransferencia objTransferencia    = llenarDatosTransferencia();
                    string           strRespuesta        = await objServicioTransferencia.realizarPagoServicios(strIdentificacion, strNumeroSuministro, strTipoServicio, objTransferencia, objCooperativa);

                    if (!strRespuesta.ToLower().Contains("Alerta"))
                    {
                        strCuentaJson = await clsActividadesGenericas.modificarCuentaJson(strIdentificacion, strIdUsuario, lstCooperativas);

                        var intent = new Intent(this, typeof(ActivityMenu));
                        intent.PutExtra(clsConstantes.strIdentificacionUsuario, strIdentificacion);
                        intent.PutExtra(clsConstantes.strURLImagenUsuario, imageUrl);
                        intent.PutExtra(clsConstantes.strIdUsuario, strIdUsuario);
                        intent.PutExtra(clsConstantes.strCuentaJson, strCuentaJson);
                        intent.PutExtra(clsConstantes.strCooperativas, strCooperativa);
                        StartActivity(intent);
                        this.Finish();
                    }
                    else
                    {
                        Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                        progress.Cancel();
                        alert.SetTitle("Alerta");
                        alert.SetMessage("No se pudo procesar el pago");

                        RunOnUiThread(() => {
                            alert.Show();
                        });
                    }
                }
            };
        }
        public IMenuItem OnOptionsItemSelected(IMenuItem item, EditDetailFragment fragment, View viewEditDetail, Presentation presentation)
        {
            Logging.Log (this, Logging.LoggingTypeDebug, "OnOptionsItemSelected()");

            switch((ActionBarButtons)item.ItemId)
            {
            case ActionBarButtons.SelectPresentation:
                fragment.Activity.RunOnUiThread(() => {
                    EditActivity editActivity = context as EditActivity;

                    if (editActivity != null)
                        editActivity.ShowPresentationSelection();

                    fragment.SetHasOptionsMenu(false);
                });
                break;

            case ActionBarButtons.Save:
                if (presentation != null)
                {
                    SavePresentation(fragment, viewEditDetail, presentation);
                    Toast.MakeText(fragment.Activity, Resource.String.ToastPresentationSaved, ToastLength.Long).Show();
                }
                break;

            case ActionBarButtons.Render:
                // Async Daten Asyncron rendern lassen
                ProgressDialog pdlg = new ProgressDialog(fragment.Activity);
                pdlg.SetCancelable(false);
                pdlg.SetTitle(fragment.GetText(Resource.String.ProgressRenderPresentation));
                pdlg.SetMessage(fragment.GetText(Resource.String.PleaseWait));
                pdlg.Show();

                Task.Factory.StartNew(() => {
                    return new WSRenderGoogleIO2012(this.context).RenderPresentation(presentation.PresentationUID);
                }).ContinueWith(t => {
                    pdlg.Cancel();

                    if (t.Exception == null && t.Result)
                        Toast.MakeText(fragment.Activity, Resource.String.ToastPresentationRendered, ToastLength.Long).Show();
                    else
                    {
                        fragment.Activity.RunOnUiThread(delegate() {
                            ((BaseActivity)fragment.Activity).ShowErrorMsg(fragment.GetText(Resource.String.ToastErrorRenderPresentation));
                        });
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
                break;

            case ActionBarButtons.Present:
                StartPresentation(fragment, presentation);
                break;
            }

            return item;
        }
Пример #11
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            Android.Util.Log.Debug("Lab11Log", "Activity - On Create");

            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            var txview = FindViewById <TextView>(Resource.Id.txview);

            Data = (Complex)this.FragmentManager.FindFragmentByTag("Data");

            if (Data == null)
            {
                Data = new Complex();
                var FragmentTrans = this.FragmentManager.BeginTransaction();
                FragmentTrans.Add(Data, "Data");
                FragmentTrans.Commit();
            }

            if (Data.res == null)
            {
                progress = new Android.App.ProgressDialog(this);
                progress.Indeterminate = true;
                progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                progress.SetMessage("Loading is Progress...");
                progress.SetCancelable(false);
                progress.Show();

                text = await Validate();

                progress.Cancel();
                Data.res = text;
            }
            else
            {
                text = Data.ToRes();
            }

            txview.Text = text;

            if (savedInstanceState != null)
            {
                Counter = savedInstanceState.GetInt("CounterValue", 0);
                Android.Util.Log.Debug("Lab11Log", "Activity A - Recovery Instance State");
            }


            FindViewById <Button>(Resource.Id.StartActivity).Click += (sender, e) =>
            {
                var ActivityIntent =
                    new Android.Content.Intent(this, typeof(SecondActivity));
                StartActivity(ActivityIntent);
            };

            var ClickCounter =
                FindViewById <Button>(Resource.Id.ClicksCounter);

            ClickCounter.Text =
                Resources.GetString((Resource.Id.ClicksCounter));

            ClickCounter.Text += $"\n{Data.ToString()}";

            ClickCounter.Click += (sender, e) =>
            {
                Counter++;
                ClickCounter.Text =
                    Resources.GetString(Resource.String.ClicksCounter_Text);

                Data.Real++;
                Data.Ima++;


                ClickCounter.Text += $"\n{Data.ToString()}";
            };
        }
Пример #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                SetContentView(Resource.Layout.RegistroNuevaCuenta);
                spinnerCooperativa             = FindViewById <Spinner>(Resource.Id.spiCooperativaAgregarCuenta);
                btnAgregarCuenta               = FindViewById <Button>(Resource.Id.btnAgregarCuenta);
                txtIdentificacionAgregarCuenta = FindViewById <EditText>(Resource.Id.txtIdentificacionAgregarCuenta);
                mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolbar7);
                SetSupportActionBar(mToolBar);

                SupportActionBar.SetHomeButtonEnabled(true);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetTitle(mAgregarCuenta);

                //Guardar temporalmente varaibles pantalla
                strIdentificacion = Intent.GetStringExtra(clsConstantes.strIdentificacionUsuario);
                strCuentaJson     = Intent.GetStringExtra(clsConstantes.strCuentaJson);
                imageUrl          = Intent.GetStringExtra(clsConstantes.strURLImagenUsuario);
                strIdUsuario      = Intent.GetStringExtra(clsConstantes.strIdUsuario);
                strCooperativa    = Intent.GetStringExtra(clsConstantes.strCooperativas);

                lstCooperativas = JsonConvert.DeserializeObject <List <clsCooperativa> >(strCooperativa);

                spinnerCooperativa.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
                foreach (clsCooperativa objCooperativa in lstCooperativas)
                {
                    if (!lstCooperativasString.Contains(objCooperativa.nombreCooperativa))
                    {
                        lstCooperativasString.Add(objCooperativa.nombreCooperativa);
                    }
                }
                var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleDropDownItem1Line, lstCooperativasString);
                adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
                spinnerCooperativa.Adapter = adapter;

                btnAgregarCuenta.Click += async delegate
                {
                    if (String.IsNullOrEmpty(txtIdentificacionAgregarCuenta.Text))
                    {
                        Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                        progress.Cancel();
                        alert.SetTitle("Alerta");
                        alert.SetMessage("Faltan campos por llenar");

                        RunOnUiThread(() => {
                            alert.Show();
                        });
                    }

                    else
                    {
                        progress = new Android.App.ProgressDialog(this);
                        progress.Indeterminate = true;
                        progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                        progress.SetMessage("Agregando cuenta");
                        progress.SetCancelable(true);
                        progress.Show();

                        string strRespuesta = await objServicioCuenta.consultarCuentasRegistradas(strIdentificacion, objCooperativa);

                        if (!strRespuesta.ToUpper().Contains("ERROR"))
                        {
                            if (await objServicioCuenta.registrarCooperativa(strIdUsuario, idCooperativaSeleccionada))
                            {
                                strCuentaJson = objServicioCuenta.unirCuentasJson(strCuentaJson, strRespuesta, idCooperativaSeleccionada);
                                var intent = new Intent(this, typeof(ActivityMenu));
                                intent.PutExtra(clsConstantes.strIdentificacionUsuario, strIdentificacion);
                                intent.PutExtra(clsConstantes.strURLImagenUsuario, imageUrl);
                                intent.PutExtra(clsConstantes.strIdUsuario, strIdUsuario);
                                intent.PutExtra(clsConstantes.strCuentaJson, strCuentaJson);
                                intent.PutExtra(clsConstantes.strCooperativas, strCooperativa);
                                StartActivity(intent);
                                this.Finish();
                            }
                        }
                        else
                        {
                            Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                            progress.Cancel();
                            alert.SetTitle("Alerta");
                            alert.SetMessage("Ocurrió un problema al conectar con la cooperativa");

                            RunOnUiThread(() => {
                                alert.Show();
                            });
                        }
                    }
                };
            }
            catch (Exception)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);

                alert.SetTitle("Alerta");
                alert.SetMessage("Ocurrió un problema al cargar la pantalla");

                RunOnUiThread(() => {
                    alert.Show();
                });
            }
        }
Пример #13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            string strJsonCuenta = string.Empty;

            try
            {
                base.OnCreate(savedInstanceState);

                SetContentView(Resource.Layout.RegistroDatosCuenta);

                spinner           = FindViewById <Spinner>(Resource.Id.spiCooperativa);
                btnSiguiente      = FindViewById <Button>(Resource.Id.btnSiguiente);
                txtIdentificacion = FindViewById <EditText>(Resource.Id.txtIdentificacionRegistroDatosCuenta);
                imgFotoPerfil     = FindViewById <ImageView>(Resource.Id.imgFoto);

                objUsuario.Id                 = Intent.GetStringExtra(clsConstantes.strIdUsuario);
                objUsuario.displayName        = Intent.GetStringExtra(clsConstantes.strNombreUsuario);
                objUsuario.birthday           = Intent.GetStringExtra(clsConstantes.strFechaNacimiento);
                objUsuario.relationshipStatus = Intent.GetStringExtra(clsConstantes.strEstadoCivilUsuario);
                objUsuario.gender             = Intent.GetStringExtra(clsConstantes.strGeneroUsuario);
                objUsuario.imageUrl           = Intent.GetStringExtra(clsConstantes.strURLImagenUsuario);
                strCooperativa                = Intent.GetStringExtra(clsConstantes.strCooperativas);

                lstCooperativas = JsonConvert.DeserializeObject <List <clsCooperativa> >(strCooperativa);

                spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
                foreach (clsCooperativa objCooperativa in lstCooperativas)
                {
                    if (!lstCooperativasString.Contains(objCooperativa.nombreCooperativa))
                    {
                        lstCooperativasString.Add(objCooperativa.nombreCooperativa);
                    }
                }
                var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleDropDownItem1Line, lstCooperativasString);
                adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
                spinner.Adapter = adapter;

                btnSiguiente.Click += async(sender, e) =>
                {
                    if (String.IsNullOrEmpty(txtIdentificacion.Text))
                    {
                        Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                        progress.Cancel();
                        alert.SetTitle("Alerta");
                        alert.SetMessage("Faltan campos por llenar");

                        RunOnUiThread(() => {
                            alert.Show();
                        });
                    }

                    else
                    {
                        string strIdentificacionCliente = txtIdentificacion.Text;

                        progress = new Android.App.ProgressDialog(this);
                        progress.Indeterminate = true;
                        progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                        progress.SetMessage("Conectando con la cooperativa");
                        progress.SetCancelable(false);
                        progress.Show();

                        strJsonCuenta = await objServicioCuenta.consultarCuentasRegistradas(strIdentificacionCliente, objCooperativa);

                        if (strJsonCuenta.Length != 0 && !strJsonCuenta.ToUpper().Contains("ERROR"))
                        {
                            var intent = new Intent(this, typeof(ActivityPIN));
                            intent.PutExtra(clsConstantes.strIdUsuario, objUsuario.Id);
                            intent.PutExtra(clsConstantes.strNombreUsuario, objUsuario.displayName);
                            intent.PutExtra(clsConstantes.strFechaNacimiento, objUsuario.birthday);
                            intent.PutExtra(clsConstantes.strEstadoCivilUsuario, objUsuario.relationshipStatus);
                            intent.PutExtra(clsConstantes.strGeneroUsuario, objUsuario.gender);
                            intent.PutExtra(clsConstantes.strURLImagenUsuario, objUsuario.imageUrl);
                            intent.PutExtra(clsConstantes.strIdentificacionUsuario, strIdentificacionCliente);
                            intent.PutExtra(clsConstantes.strIdentificacionCooperativa, spinner.SelectedItemId.ToString());
                            intent.PutExtra(clsConstantes.strTipoTransaccion, clsConstantes.strNuevaCuenta);
                            intent.PutExtra(clsConstantes.idCooperativa, idCooperativa);
                            intent.PutExtra(clsConstantes.strCuentaJson, strJsonCuenta);
                            intent.PutExtra(clsConstantes.strCooperativas, strCooperativa);
                            StartActivity(intent);
                            this.Finish();
                        }
                        else
                        {
                            Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);

                            alert.SetTitle("Alerta");
                            alert.SetMessage(strJsonCuenta);

                            RunOnUiThread(() => {
                                alert.Show();
                            });

                            progress.Cancel();
                        }
                    }
                };


                var imageBitmap = GetImageBitmapFromUrl(objUsuario.imageUrl);
                imgFotoPerfil.SetImageBitmap(imageBitmap);
            }
            catch (Exception)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                progress.Cancel();
                alert.SetTitle("Alerta");
                alert.SetMessage("Ocurió un problema al cargar la pantalla");

                RunOnUiThread(() => {
                    alert.Show();
                });
            }
        }
Пример #14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Transferencia);

            spinnerCuentaOrigen           = FindViewById <Spinner>(Resource.Id.spiCuentaOrigenTrasnfer);
            spinnerCooperativasDestino    = FindViewById <Spinner>(Resource.Id.spiCooperativaDestinoTrasnfer);
            spinnerTipoCuenta             = FindViewById <Spinner>(Resource.Id.spiTipoCuenta);
            spinnerTipoIdentificacion     = FindViewById <Spinner>(Resource.Id.spiTipoIdentificacion);
            btnRealizarTransferencia      = FindViewById <Button>(Resource.Id.btnRealizarTransfer);
            txtIdentificacionBeneficiario = FindViewById <EditText>(Resource.Id.txtIdentificacionBeneficiarioTransfer);
            txtCuentaBeneficiario         = FindViewById <EditText>(Resource.Id.txtCuentaDestinoTransfer);
            txtMontoTransferencia         = FindViewById <EditText>(Resource.Id.txtMontoTransfer);
            txtMotivoTransferencia        = FindViewById <EditText>(Resource.Id.txtMotivoTransfer);

            mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolbar3);
            SetSupportActionBar(mToolBar);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetTitle(mTransferencia);

            //Guardar temporalmente varaibles pantalla
            strIdentificacion = Intent.GetStringExtra(clsConstantes.strIdentificacionUsuario);
            strCuentaJson     = Intent.GetStringExtra(clsConstantes.strCuentaJson);
            imageUrl          = Intent.GetStringExtra(clsConstantes.strURLImagenUsuario);
            strIdUsuario      = Intent.GetStringExtra(clsConstantes.strIdUsuario);
            strCooperativa    = Intent.GetStringExtra(clsConstantes.strCooperativas);

            string[] arrRespuesta = strCuentaJson.Split('|');
            string   strCuentas   = arrRespuesta[0];
            string   strTarjetas  = arrRespuesta[1];

            lstCuentas      = JsonConvert.DeserializeObject <List <clsCuenta> >(strCuentas);
            lstCooperativas = JsonConvert.DeserializeObject <List <clsCooperativa> >(strCooperativa);

            //spinner cooperativas
            spinnerCooperativasDestino.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelectedCooeprativa);

            foreach (clsCooperativa objCooperativa in lstCooperativas)
            {
                if (!lstCooperativasString.Contains(objCooperativa.nombreCooperativa))
                {
                    lstCooperativasString.Add(objCooperativa.nombreCooperativa);
                }
            }
            var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleDropDownItem1Line, lstCooperativasString);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
            spinnerCooperativasDestino.Adapter = adapter;

            //spinner cuenta de origen OJO
            spinnerCuentaOrigen.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            List <string> lstCuentasString = new List <string>();

            foreach (clsCuenta objCuenta in lstCuentas)
            {
                if (!lstCuentasString.Contains(objCuenta.numero_cuenta))
                {
                    lstCuentasString.Add(objCuenta.numero_cuenta);
                }
            }

            var adapter1 = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleDropDownItem1Line, lstCuentasString);

            adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
            spinnerCuentaOrigen.Adapter = adapter1;

            //spinner tipo cuenta
            spinnerTipoCuenta.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var adapter2 = ArrayAdapter.CreateFromResource(
                this, Resource.Array.tipo_cuentas_array, Android.Resource.Layout.SimpleDropDownItem1Line);

            adapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
            spinnerTipoCuenta.Adapter = adapter2;

            //spinner tipo identificacion
            spinnerTipoIdentificacion.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var adapter3 = ArrayAdapter.CreateFromResource(
                this, Resource.Array.tipo_identificaciones_array, Android.Resource.Layout.SimpleDropDownItem1Line);

            adapter3.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
            spinnerTipoIdentificacion.Adapter = adapter3;

            btnRealizarTransferencia.Click += async delegate
            {
                if (String.IsNullOrEmpty(txtMontoTransferencia.Text) ||
                    String.IsNullOrEmpty(txtCuentaBeneficiario.Text) ||
                    String.IsNullOrEmpty(txtIdentificacionBeneficiario.Text))
                {
                    Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);

                    alert.SetTitle("Alerta");
                    alert.SetMessage("Faltan campos por llenar");

                    RunOnUiThread(() => {
                        alert.Show();
                    });
                }

                else
                {
                    //Se mestra el cuadro de cargando
                    progress = new Android.App.ProgressDialog(this);
                    progress.Indeterminate = true;
                    progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                    progress.SetMessage("Realizando Transferencia");
                    progress.SetCancelable(true);
                    progress.Show();

                    //Se realiza la transferencia
                    string strMensaje = await realizarTransferencia();

                    strCuentaJson = await clsActividadesGenericas.modificarCuentaJson(strIdentificacion, strIdUsuario, lstCooperativas);

                    if (strMensaje.ToUpper().Contains("ALERTA"))
                    {
                        Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);

                        alert.SetTitle("Alerta");
                        alert.SetMessage(strMensaje.Replace("Alerta:", ""));
                        alert.SetMessage(strMensaje.Replace("alerta:", ""));

                        RunOnUiThread(() => {
                            alert.Show();
                        });
                        progress.Cancel();
                    }
                    else
                    {
                        //Cuando se completa la transferencia
                        var intent = new Intent(this, typeof(ActivityMenu));
                        intent.PutExtra(clsConstantes.strIdentificacionUsuario, strIdentificacion);
                        intent.PutExtra(clsConstantes.strURLImagenUsuario, imageUrl);
                        intent.PutExtra(clsConstantes.strIdUsuario, strIdUsuario);
                        intent.PutExtra(clsConstantes.strCuentaJson, strCuentaJson);
                        intent.PutExtra(clsConstantes.strCooperativas, strCooperativa);
                        StartActivity(intent);
                        this.Finish();
                    }
                }
            };
        }
Пример #15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ConsultaServicio);

            spiTipoConsultaServicio       = FindViewById <Spinner>(Resource.Id.spiTipoConsultaServicio);
            btnConsultarPagos             = FindViewById <Button>(Resource.Id.btnConsultarServicio);
            txtSuministroConsultaServicio = FindViewById <EditText>(Resource.Id.txtSuministroConsultaServicio);
            mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolbar8);
            SetSupportActionBar(mToolBar);

            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            SupportActionBar.SetTitle(mPagoServicios);

            //Guardar temporalmente varaibles pantalla
            strIdentificacion = Intent.GetStringExtra(clsConstantes.strIdentificacionUsuario);
            strCuentaJson     = Intent.GetStringExtra(clsConstantes.strCuentaJson);
            imageUrl          = Intent.GetStringExtra(clsConstantes.strURLImagenUsuario);
            strIdUsuario      = Intent.GetStringExtra(clsConstantes.strIdUsuario);
            strCooperativa    = Intent.GetStringExtra(clsConstantes.strCooperativas);

            spiTipoConsultaServicio.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var adapter = ArrayAdapter.CreateFromResource(
                this, Resource.Array.servicio_array, Android.Resource.Layout.SimpleDropDownItem1Line);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line);
            spiTipoConsultaServicio.Adapter = adapter;

            btnConsultarPagos.Click += async delegate
            {
                if (String.IsNullOrEmpty(txtSuministroConsultaServicio.Text))
                {
                    Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);

                    alert.SetTitle("Alerta");
                    alert.SetMessage("Faltan campos por llenar");

                    RunOnUiThread(() => {
                        alert.Show();
                    });
                }
                else
                {
                    progress = new Android.App.ProgressDialog(this);
                    progress.Indeterminate = true;
                    progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                    progress.SetMessage("Consultando Factura");
                    progress.SetCancelable(false);
                    progress.Show();

                    string strNumeroSuministro = txtSuministroConsultaServicio.Text.ToUpper();
                    string strFacturaServicio  = await objServicioConsulta.consultarServicios(strIdentificacion, strNumeroSuministro, strTipoServicio);

                    if (!strFacturaServicio.ToUpper().Contains("ERROR"))
                    {
                        var intent = new Intent(this, typeof(ActivityFacturaServicio));
                        intent.PutExtra(clsConstantes.strIdentificacionUsuario, strIdentificacion);
                        intent.PutExtra(clsConstantes.strURLImagenUsuario, imageUrl);
                        intent.PutExtra(clsConstantes.strIdUsuario, strIdUsuario);
                        intent.PutExtra(clsConstantes.strCuentaJson, strCuentaJson);
                        intent.PutExtra(clsConstantes.strFacturaServicio, strFacturaServicio);
                        intent.PutExtra(clsConstantes.strCooperativas, strCooperativa);
                        StartActivity(intent);
                        this.Finish();
                    }
                    else
                    {
                        Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);

                        alert.SetTitle("Alerta");
                        alert.SetMessage(strFacturaServicio);


                        RunOnUiThread(() => {
                            alert.Show();
                        });

                        progress.Cancel();
                    }
                }
            };
        }