Пример #1
0
        public void venta()
        {
            Servicio.Servicio sw = new Servicio.Servicio();
            Use u = new Use();

            //sw.VentaCompleted += Sw_VentaCompleted;
            //sw.VentaAsync(id);
            foreach (var ite in car)
            {
                //sw.DetalleCompleted += Sw_DetalleCompleted;
                //sw.DetalleAsync(ite.Id_element);
            }
        }
Пример #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Registro);
            // Create your application here
            mToolBar      = FindViewById <SupportToolbar>(Resource.Id.toolbar);
            pb            = FindViewById <ProgressBar>(Resource.Id.pb);
            btnConfirmar  = FindViewById <Button>(Resource.Id.btnConfirmar);
            txt_nombre    = FindViewById <EditText>(Resource.Id.txt_nombre);
            txt_apellidos = FindViewById <EditText>(Resource.Id.txt_apellidos);
            txt_correo    = FindViewById <EditText>(Resource.Id.txt_correo);
            txt_pass      = FindViewById <EditText>(Resource.Id.txt_password);
            txt_cPass     = FindViewById <EditText>(Resource.Id.txt_Cpassword);
            pb.Visibility = ViewStates.Invisible;
            // Create your application here
            SetSupportActionBar(mToolBar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);


            btnConfirmar.Click += delegate
            {
                try
                {
                    if (txt_nombre.Text != string.Empty && txt_pass.Text != string.Empty && txt_correo.Text != string.Empty && txt_apellidos.Text != string.Empty)
                    {
                        if (txt_pass.Text == txt_cPass.Text)
                        {
                            Servicio.Servicio sw = new Servicio.Servicio();
                            pb.Visibility                 = ViewStates.Visible;
                            btnConfirmar.Enabled          = false;
                            sw.registrarUsuarioCompleted += Sw_RegistrarUsuarioCompleted;
                            sw.registrarUsuarioAsync(txt_nombre.Text, txt_apellidos.Text, txt_correo.Text, txt_pass.Text);
                        }
                        else
                        {
                            Toast.MakeText(this, "La confirmacion de la contraseña no corresponde", ToastLength.Long).Show();
                        }
                    }
                    else
                    {
                        Toast.MakeText(this, "Por favor ingresa todos los datos solicitados.", ToastLength.Short).Show();
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
                }
            };
        }
Пример #3
0
        //-------------------Lennar la lista--------------------
        public void llenarList()
        {
            lwElem         = FindViewById <ListView>(Resource.Id.lwElement);
            lwElem.Adapter = new adapter_datos(this, elem);

            try
            {
                Servicio.Servicio sw = new Servicio.Servicio();
                sw.ProductoShowCompleted += Sw_ProductoShowCompleted;
                sw.ProductoShowAsync();
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
            }
        }
Пример #4
0
 public void verDatos()
 {
     try
     {
         Use us = new Use();
         Servicio.Servicio sw          = new Servicio.Servicio();
         XmlSerializer     seriarlizar = new XmlSerializer(typeof(Use));
         string            ruta        = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
         StreamReader      Lectura     = new StreamReader(ruta + "usuario.xml");
         Use b = (Use)seriarlizar.Deserialize(Lectura);
         Lectura.Close();
         sw.InfoUsuarioCompleted += Sw_InfoUsuarioCompleted;
         sw.InfoUsuarioAsync(b.Correo, b.Password);
     }
     catch (Exception ex)
     {
         Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
         Toast.MakeText(this, "Inicia Sesion Nuevamente", ToastLength.Short).Show();
     }
 }
Пример #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);

            btnAcceso     = FindViewById <Button>(Resource.Id.btnLogin);
            btnRegistro   = FindViewById <Button>(Resource.Id.btnRegistro);
            txtCorreo     = FindViewById <EditText>(Resource.Id.txtUser);
            txtPass       = FindViewById <EditText>(Resource.Id.txtPassword);
            pb            = FindViewById <ProgressBar>(Resource.Id.pbBar);
            pb.Visibility = ViewStates.Invisible;


            btnAcceso.Click += delegate
            {
                //var inicio = new Intent(this, typeof(inicio));
                //StartActivity(inicio);
                if (txtPass.Text != string.Empty && txtCorreo.Text != string.Empty)
                {
                    //var home = new Intent(this, typeof(MainActivity));
                    //StartActivity(home);

                    Servicio.Servicio service = new Servicio.Servicio();
                    service.AccederCompleted += Service_AccederCompleted;
                    service.AccederAsync(txtCorreo.Text, txtPass.Text);
                    pb.Visibility       = ViewStates.Visible;
                    btnAcceso.Enabled   = false;
                    btnRegistro.Enabled = false;
                }
                else
                {
                    Toast.MakeText(this, "Ingresa correctamente los datos para acceder.", ToastLength.Short).Show();
                }
            };
            btnRegistro.Click += delegate
            {
                var registro = new Intent(this, typeof(registro));
                StartActivity(registro);
            };
        }
Пример #6
0
        //----------------------------------------------------------------------------------

        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (mDrawerToggle.OnOptionsItemSelected(item))
            {
                if (mDrawerLayout.IsDrawerOpen(mRightDrawer))
                {
                    mDrawerLayout.CloseDrawer(mRightDrawer);
                }
                return(true);
            }
            switch (item.ItemId)
            {
            case Resource.Id.action_help:
                if (mDrawerLayout.IsDrawerOpen(mRightDrawer))
                {
                    mDrawerLayout.CloseDrawer(mRightDrawer);
                }
                else
                {
                    mDrawerLayout.CloseDrawer(mLeftDrawer);
                    mDrawerLayout.OpenDrawer(mRightDrawer);
                }
                return(true);

            case Resource.Id.action_buy:
                if (car.Count == 0)
                {
                    Double precio = 0;
                    lbl_sub_total.Text = "Sub-Total: $ " + precio;
                    Toast.MakeText(this, "El carrito se encuentra vacio no se ha realizado la accion", ToastLength.Short).Show();
                }
                else
                {
                    new Android.Support.V7.App.AlertDialog.Builder(this).SetTitle("Alerta").SetMessage("¿Estas seguro de realizar esta compra?").SetPositiveButton("ok", delegate
                    {
                        double precio = 0;
                        foreach (var ite in car)
                        {
                            precio            += ite.Precio;
                            lbl_sub_total.Text = "Sub-Total: $ " + precio;
                        }
                        Toast.MakeText(this, "El costo de la compra es: " + precio.ToString(), ToastLength.Short).Show();
                        verDatos();
                        if (saldo >= precio)
                        {
                            Toast.MakeText(this, "Se ha realizado la compra", ToastLength.Short).Show();
                            Use us = new Use();
                            Servicio.Servicio sw      = new Servicio.Servicio();
                            XmlSerializer seriarlizar = new XmlSerializer(typeof(Use));
                            string ruta          = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                            StreamReader Lectura = new StreamReader(ruta + "usuario.xml");
                            Use b = (Use)seriarlizar.Deserialize(Lectura);
                            Lectura.Close();
                            venta();
                        }
                        else
                        {
                            precio = 0;
                            Toast.MakeText(this, "No cuentas con el saldo suficiente para realizar la compra", ToastLength.Short).Show();
                        }
                        mRightDrawer.Adapter = new adapter_carrito(this, car);
                        car.Clear();
                        mRightDrawer.Adapter = new adapter_carrito(this, car);
                    }).SetNegativeButton("Cancelar", delegate
                    {
                        Toast.MakeText(this, "Se ha cancelado la compra", ToastLength.Short).Show();
                        mRightDrawer.Adapter = new adapter_carrito(this, car);
                        car.Clear();
                        mRightDrawer.Adapter = new adapter_carrito(this, car);
                    }).Show();
                }
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }