Example #1
0
        /// <summary>
        /// ACCION QUE AGREGA UN CLIENTE
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAgregar_Click(object sender, EventArgs e)
        {
            //SE INFLA LA VISTA CON EL LAYOUT DETALLE DE LIBRO
            View view = LayoutInflater.Inflate(Resource.Layout.CustomerAdd, null);

            //SE CREA EL POP UP DEL LIBRO
            Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder((Activity)rootView.Context)
                                              .SetTitle("Agregar cliente")
                                              .SetIcon(Android.Resource.Drawable.IcDialogInfo).Create();
            //ASIGNACION DE TEXTOS :v
            edtCode = view.FindViewById <EditText>(Resource.Id.editText1);
            EditText    edtName     = view.FindViewById <EditText>(Resource.Id.editText2);
            EditText    edtLastName = view.FindViewById <EditText>(Resource.Id.editText3);
            ImageButton b           = view.FindViewById <ImageButton>(Resource.Id.imageButton1);

#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            b.SetBackgroundDrawable(null);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
            b.Click += async delegate {
                //Tell our scanner to use the default overlay
                scanner.UseCustomOverlay = false;

                //PERSONALIZAR LOS MENSAJES QUE SE MOSTRARAN EN LA CAMARA DEL SCANNER
                scanner.TopText    = "Por favor, no mueva el dispositivo móvil\nMantengalo al menos 10cm de distancia";
                scanner.BottomText = "Espere mientras el scanner lee el código de barra";

                //COMIENZO DEL SCANEO
                var result = await scanner.Scan();

                HandleScanResult(result);
            };
            view.FindViewById <Button>(Resource.Id.button1).Click += delegate {
                if (edtCode.Text != "" && edtName.Text != "" && edtLastName.Text != "")
                {
                    var save = Service.AddCustomer(edtName.Text, edtLastName.Text, edtCode.Text);
                    if (save.band)
                    {
                        edtCedula.Text  = edtCode.Text;
                        edtNombres.Text = edtName.Text + " " + edtLastName.Text;

                        //BUSCAR EL CLIENTE PARA SU ID
                        idCliente = Service.GetCustomerData(edtCode.Text).Id;
                        Toast.MakeText(rootView.Context, save.message, ToastLength.Long).Show();
                        //CERRAR EL DIALOG
                        builder.Dismiss();
                    }
                    else
                    {
                        Toast.MakeText(rootView.Context, save.message, ToastLength.Long).Show();
                    }
                }
                else
                {
                    Toast.MakeText(rootView.Context, "Llene los campos importantes", ToastLength.Long).Show();
                }
            };

            builder.SetView(view);
            builder.Show();
        }
Example #2
0
        private void BtnBuscar_Click(object sender, EventArgs e)
        {
            var cliente = Service.GetCustomerData(edtCodigoC.Text);

            if (cliente != null)
            {
                edtNombresA.Text = cliente.Nombres + " " + cliente.Apellidos;

                //BUSCA ALQUILERES DEL CLIENTE
                alquiler = Service.PendingByCustomer(cliente.Id);


                if (alquiler != null)
                {
                    //LLENAR EL ENCABEZADO
                    edtCodigoC.Text  = cliente.Codigo;
                    edtNombresA.Text = cliente.Nombres + " " + cliente.Apellidos;

                    //LLENAR EL ADAPTADOR
                    lista.Adapter = new AdapterPendingList((Activity)rootView.Context, alquiler);
                }
                else
                {
                    Toast.MakeText(rootView.Context, "El cliente no tiene alquileres pendientes", ToastLength.Long).Show();
                }
            }
            else
            {
                Toast.MakeText(rootView.Context, "Ingrese el número de cédula", ToastLength.Long).Show();
            }
        }
Example #3
0
        /// <summary>
        /// EVENTO PARA SCANEAR EL CODIGO Y SUS ACCIONES
        /// </summary>
        /// <param name="result"></param>
        void HandleScanResult(ZXing.Result result)
        {
            if (result != null && !string.IsNullOrEmpty(result.Text))
            {
                //LONGITUD DE CEDULA CLIENTE
                if (result.Text.Length == 14)
                {
                    //BUSCAR EL CLIENTE
                    var cliente = Service.GetCustomerData(result.Text);
                    if (cliente != null)
                    {
                        idCliente = cliente.Id;
                        //LLENAR EL ENCABEZADO
                        edtCedula.Text  = cliente.Codigo;
                        edtNombres.Text = cliente.Nombres + " " + cliente.Apellidos;
                    }
                    else
                    if (cliente == null)
                    {
                        edtCode.Text = result.Text;
                    }
                }
                else//LONGITUD DE ISBN LIBRO
                if (result.Text.Length == 13)
                {
                    var libro = Service.SearchBook(result.Text);
                    if (libro != null)
                    {
                        //LLENO LOS EDITEXT
                        edtisbn.Text   = libro.ISBN;
                        edttitulo.Text = libro.Titulo;

                        //BUSCO LAS COPIAS DISPONIBLES DEL LIBRO ENCONTRADO
                        listasp = Service.CopiesByBook(libro.ISBN);
                        //LLENAR EL ADAPTER CON LA LISTA DEL SERVICIO
                        spCopias.Adapter = new AdapterSpCopias((Activity)rootView.Context, listasp);
                        //spCopias.SetSelection(0,true);
                        spCopias.ItemSelected += SpCopias_ItemSelected;
                    }
                    else
                    {
                        Toast.MakeText(rootView.Context, "No se encontro el libro", ToastLength.Long).Show();
                    }
                }
                else
                {
                    Toast.MakeText(rootView.Context, "Error en los datos", ToastLength.Long).Show();
                }
            }
            else
            {
                Toast.MakeText(rootView.Context, "Vuelva a escanear", ToastLength.Long).Show();
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.personalizacion);
            // Create your application here

            //OBTENER LOS PERMISOS DE LA APP
            RequestPermissions(permissionGroup, 0);

            //PARA OBTENER LA IMAGEN DE PERFIL
            var c = Service.GetCustomerData(Service.Identification);

            //ASIGNACION DE IMAGEN DEL PERFIL, SI NO CONTIENE IMAGEN
            if (c.Foto == null)
            {
                Img = FindViewById <ImageView>(Resource.Id.imageView1);
                Img.SetImageResource(Resource.Drawable.perfil);
            }
            else
            {
                //SI TIENE IMAGEN
                Bitmap bitmap = BitmapFactory.DecodeByteArray(c.Foto, 0, c.Foto.Length);

                Img = FindViewById <ImageView>(Resource.Id.imageView1);
                Img.SetImageBitmap(bitmap);
            }
            //DATOS DEL CLIENTE
            FindViewById <TextView>(Resource.Id.textView2).Text = Service.Identification;
            FindViewById <TextView>(Resource.Id.textView5).Text = Service.Fullname;
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            FindViewById <TextView>(Resource.Id.textView7).Text = Service.Email;

            txtContra = FindViewById <TextView>(Resource.Id.textView8);

            button        = FindViewById <ImageButton>(Resource.Id.button1);
            button.Click += Button_Click;

            //CAMBIAR EL FONDO DEL ICONO DE IMEGEN
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            button.SetBackgroundDrawable(null);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos

            //CAMBIAR LA CONTRASEÑA DE LA CUENTA DEL CLIENTE
            txtContra.Click += TxtContra_Click;
        }
Example #5
0
 private void BtnAceptar_Click(object sender, EventArgs e)
 {
     if (edtCedula.Text != "")
     {
         //BUSCAR EL CLIENTE
         var cliente = Service.GetCustomerData(edtCedula.Text);
         if (cliente != null)
         {
             idCliente = cliente.Id;
             //LLENAR EL ENCABEZADO
             edtCedula.Text  = cliente.Codigo;
             edtNombres.Text = cliente.Nombres + " " + cliente.Apellidos;
         }
         else
         {
             Toast.MakeText(rootView.Context, "No existe el cliente con ese número de cédula", ToastLength.Long).Show();
         }
     }
     else
     {
         Toast.MakeText(rootView.Context, "Ingrese un número de cédula", ToastLength.Long).Show();
     }
 }
Example #6
0
        void HandleScanResult(ZXing.Result result)
        {
            if (result != null && !string.IsNullOrEmpty(result.Text))
            {
                //BUSCAR EL CLIENTE
                var cliente = Service.GetCustomerData(result.Text);

                //SI SE ENCUENTRA EL CLIENTE
                if (cliente != null)
                {
                    //BUSCA ALQUILERES DEL CLIENTE
                    alquiler = Service.PendingByCustomer(cliente.Id);

                    if (alquiler != null)
                    {
                        //LLENAR EL ENCABEZADO
                        edtCodigoC.Text  = cliente.Codigo;
                        edtNombresA.Text = cliente.Nombres + " " + cliente.Apellidos;

                        //LLENAR EL ADAPTADOR
                        lista.Adapter = new AdapterPendingList((Activity)rootView.Context, alquiler);
                    }
                    else
                    {
                        Toast.MakeText(rootView.Context, "El cliente no tiene alquileres pendientes", ToastLength.Long).Show();
                    }
                }
                else
                {
                    Toast.MakeText(rootView.Context, "No existe el cliente con ese codigo", ToastLength.Long).Show();
                }
            }
            else
            {
                Toast.MakeText(rootView.Context, "Vuelva a escanear", ToastLength.Long).Show();
            }
        }