Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
        public void User(string correo, string pass)
        {
            Use us = new Use();

            us.Correo   = correo;
            us.Password = pass;
            XmlSerializer serializar = new XmlSerializer(typeof(Use));
            string        Ruta       = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            StreamWriter  Escritura  = new StreamWriter(Ruta + "usuario.xml");

            serializar.Serialize(Escritura, us);
            Escritura.Close();
            Toast.MakeText(this, us.Correo + " " + us.Password, ToastLength.Short).Show();
        }
Ejemplo n.º 3
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();
     }
 }
Ejemplo n.º 4
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));
            }
        }