コード例 #1
0
        public static async Task <string> modificarCuentaJson(string strIdentificacion, string strIdUsuario, List <clsCooperativa> lstCooperativas)
        {
            clsServicioCuenta objServicioCuenta = new clsServicioCuenta();
            string            strCuentaJsonTemp = string.Empty;

            try
            {
                strCuentaJsonTemp = await objServicioCuenta.consultarCuentasRegistradas(strIdentificacion, strIdUsuario, lstCooperativas);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Alerta " + ex.Message);
            }
            return(strCuentaJsonTemp);
        }
コード例 #2
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();
                });
            }
        }
コード例 #3
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            strTipo = Intent.GetStringExtra(clsConstantes.strTipoTransaccion);

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.PinSeguridad);

            if (strTipo == clsConstantes.strNuevaCuenta)
            {
                string strNombreUsuario         = Intent.GetStringExtra(clsConstantes.strNombreUsuario);
                string strIdentificacionUsuario = Intent.GetStringExtra(clsConstantes.strIdentificacionUsuario);
                objUsuario.Id                 = Intent.GetStringExtra(clsConstantes.strIdUsuario);
                objUsuario.displayName        = 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);
                objUsuario.identificacion     = strIdentificacionUsuario;
                strCuentaJson                 = Intent.GetStringExtra(clsConstantes.strCuentaJson);
                idCooperativa                 = Intent.GetStringExtra(clsConstantes.idCooperativa);
                strCooperativa                = Intent.GetStringExtra(clsConstantes.strCooperativas);
                lstCooperativa                = JsonConvert.DeserializeObject <List <clsCooperativa> >(strCooperativa);
            }
            else
            {
                clsServicioCuenta objServicioCuenta = new clsServicioCuenta();
                objUsuario.Id             = Intent.GetStringExtra(clsConstantes.strIdUsuario);
                objUsuario.pin            = Intent.GetStringExtra(clsConstantes.strPINUsuario);
                objUsuario.displayName    = Intent.GetStringExtra(clsConstantes.strNombreUsuario);
                objUsuario.imageUrl       = Intent.GetStringExtra(clsConstantes.strURLImagenUsuario);
                objUsuario.identificacion = Intent.GetStringExtra(clsConstantes.strIdentificacionUsuario);
                strCooperativa            = Intent.GetStringExtra(clsConstantes.strCooperativas);
                lstCooperativa            = JsonConvert.DeserializeObject <List <clsCooperativa> >(strCooperativa);
                strCuentaJson             = await objServicioCuenta.consultarCuentasRegistradas(objUsuario.identificacion, objUsuario.Id, lstCooperativa);
            }

            // Buscar en la pantalla botones
            lblMensaje  = FindViewById <TextView>(Resource.Id.lblMensajePin);
            txtPassword = FindViewById <EditText>(Resource.Id.txtPasswordPin);
            btnCero     = FindViewById <Button>(Resource.Id.btn0);
            btnUno      = FindViewById <Button>(Resource.Id.btn1);
            btnDos      = FindViewById <Button>(Resource.Id.btn2);
            btnTres     = FindViewById <Button>(Resource.Id.btn3);
            btnCuatro   = FindViewById <Button>(Resource.Id.btn4);
            btnCinco    = FindViewById <Button>(Resource.Id.btn5);
            btnSeis     = FindViewById <Button>(Resource.Id.btn6);
            btnSiete    = FindViewById <Button>(Resource.Id.btn7);
            btnOcho     = FindViewById <Button>(Resource.Id.btn8);
            btnNueve    = FindViewById <Button>(Resource.Id.btn9);
            btnBorrar   = FindViewById <Button>(Resource.Id.btnClear);

            lblMensaje.SetTextColor(Color.White);

            btnUno.Click += (object sender, EventArgs args) =>
            {
                strValorNumero = "1";
                btnNumero_Click(sender, args);
            };
            btnDos.Click += (object sender, EventArgs args) =>
            {
                strValorNumero = "2";
                btnNumero_Click(sender, args);
            };
            btnTres.Click += (object sender, EventArgs args) =>
            {
                strValorNumero = "3";
                btnNumero_Click(sender, args);
            };
            btnCuatro.Click += (object sender, EventArgs args) =>
            {
                strValorNumero = "4";
                btnNumero_Click(sender, args);
            };
            btnCinco.Click += (object sender, EventArgs args) =>
            {
                strValorNumero = "5";
                btnNumero_Click(sender, args);
            };
            btnSeis.Click += (object sender, EventArgs args) =>
            {
                strValorNumero = "6";
                btnNumero_Click(sender, args);
            };
            btnSiete.Click += (object sender, EventArgs args) =>
            {
                strValorNumero = "7";
                btnNumero_Click(sender, args);
            };
            btnOcho.Click += (object sender, EventArgs args) =>
            {
                strValorNumero = "8";
                btnNumero_Click(sender, args);
            };
            btnNueve.Click += (object sender, EventArgs args) =>
            {
                strValorNumero = "9";
                btnNumero_Click(sender, args);
            };
            btnCero.Click += (object sender, EventArgs args) =>
            {
                strValorNumero = "0";
                btnNumero_Click(sender, args);
            };
            btnBorrar.Click += (object sender, EventArgs args) =>
            {
                strValorNumero = string.Empty;
                btnClear_Click(sender, args);
            };
        }
コード例 #4
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();
                });
            }
        }