コード例 #1
0
        void limpaTabelas()
        {
            DBCadPedido       sqlCadPedido       = new DBCadPedido("delivery_db");
            DBCadPedidoItem   sqlCadPedidoItem   = new DBCadPedidoItem("delivery_db");
            DBCadCarrinho     sqlCadCarrinho     = new DBCadCarrinho("delivery_db");
            DBCadCarrinhoItem sqlCadCarrinhoItem = new DBCadCarrinhoItem("delivery_db");

            sqlCadPedido.DeleteRecord();
            sqlCadPedidoItem.DeleteRecord("delete from PEDIDO_ITEM");
            sqlCadCarrinho.DeleteRecord();
            sqlCadCarrinhoItem.DeleteRecord("delete from CARRINHO_ITEM");
        }
コード例 #2
0
ファイル: Carrinho.cs プロジェクト: nunesfelipe1/FastDelivery
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.frmCarrinho);

            if (MainActivity.iCodEmpresa > 0)
            {
                sqldb_carrinho      = new DBCadCarrinho("delivery_db");
                sqldb_carrinho_item = new DBCadCarrinhoItem("delivery_db");
                sqldb_pedido        = new DBCadPedido("delivery_db");
                sqldb_pedido_item   = new DBCadPedidoItem("delivery_db");

                lwCarrinho = FindViewById <ListView> (Resource.Id.lwCarrinho);
                ImageButton btAnt          = FindViewById <ImageButton> (Resource.Id.btAnt);
                ImageButton btCarrinho     = FindViewById <ImageButton> (Resource.Id.imgBtCarrinho);
                ImageButton imgBtMenu      = FindViewById <ImageButton> (Resource.Id.imgBtMenu);
                ImageButton btInseriPedido = FindViewById <ImageButton> (Resource.Id.btInseriPedido);
                ImageButton btSubTotal     = FindViewById <ImageButton> (Resource.Id.btSubTotal);
                txtSubTotal = FindViewById <TextView> (Resource.Id.txtSTotal);

                carrinho = carregaCarrinho();

                lwCarrinho.Adapter    = new adapter_carrinho(this, carrinho);
                lwCarrinho.ItemClick += OnListItemClick;

                btAnt.Click          += new EventHandler(btAnt_Click);
                imgBtMenu.Click      += new EventHandler(btMenu_Click);
                btInseriPedido.Click += new EventHandler(btInseriPedido_Click);
                btSubTotal.Click     += new EventHandler(btSubTotal_Click);
            }
            else
            {
                Finish();
                StartActivity(typeof(MainActivity));
            }
        }
コード例 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.frmCardItemDetalhes);

            if (MainActivity.iCodEmpresa > 0)
            {
                sqldb_prod         = new DBCadProduto("delivery_db");
                sqldb_cat          = new DBCadCategoria("delivery_db");
                sqldb_carrinho     = new DBCadCarrinho("delivery_db");
                sqldb_carrinhoItem = new DBCadCarrinhoItem("delivery_db");

                ImageButton btAnt        = FindViewById <ImageButton> (Resource.Id.btAnt);
                ImageButton btMenu       = FindViewById <ImageButton> (Resource.Id.btMenu);
                Button      btAdiciona   = FindViewById <Button> (Resource.Id.btAdiciona);
                TextView    txtProd      = FindViewById <TextView> (Resource.Id.txtProd);
                TextView    txtCategoria = FindViewById <TextView> (Resource.Id.txtCategoria);
                txtLembrete = FindViewById <EditText> (Resource.Id.txtLembrete);
                TextView txtItens = FindViewById <TextView> (Resource.Id.txtItens);
                TextView txtLoja  = FindViewById <TextView> (Resource.Id.txtLoja);
                txtPrUn  = FindViewById <TextView> (Resource.Id.txtPrUn);
                txtTotal = FindViewById <TextView> (Resource.Id.txtTotal);
                Spinner     cbQtde     = FindViewById <Spinner> (Resource.Id.spinner1);
                ImageButton btCarrinho = FindViewById <ImageButton> (Resource.Id.imgBtCarrinho);

                //buscando a descrição da categoria
                sql_cursor = sqldb_cat.GetRecordCursor(MainActivity.id_categoria);

                if (sql_cursor != null)
                {
                    sql_cursor.MoveToFirst();

                    txtCategoria.Text = "Categoria.: " + sql_cursor.GetString(1).ToString();
                }
                else
                {
                    txtCategoria.Text = "Categoria não encontrada";
                }

                //buscando a descrição da categoria
                sql_cursor = null;
                sql_cursor = sqldb_prod.GetRecordCursor(MainActivity.id_categoria, MainActivity.id_item_categorira);

                if (sql_cursor.Count > 0)
                {
                    sql_cursor.MoveToFirst();

                    txtProd.Text   = sql_cursor.GetString(2).ToString();
                    txtItens.Text  = "Item(ns): " + sql_cursor.GetString(4).ToString();
                    txtPrUn.Text   = String.Format("R$ : {0:0.00}  ", Convert.ToDouble(sql_cursor.GetString(5)));
                    iPrecoUnitario = Convert.ToDouble(sql_cursor.GetString(5));
                }
                else
                {
                    txtProd.Text   = "Produto não encontrado";
                    txtItens.Text  = "Item(ns): Não encontrado!";
                    txtPrUn.Text   = "R : 0.00";
                    iPrecoUnitario = 0;
                }

                List <string> list = new List <string> ();
                list.Add(" ");
                list.Add("1");
                list.Add("2");
                list.Add("3");
                list.Add("4");
                list.Add("5");

                ArrayAdapter <string> dataAdapter = new ArrayAdapter <string> (this, Android.Resource.Layout.SimpleSpinnerItem, list);
                dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                adapter        = new ArrayAdapter <string> (this, Android.Resource.Layout.SimpleSpinnerDropDownItem);
                cbQtde.Adapter = dataAdapter;

                btAnt.Click         += new EventHandler(btAnt_Click);
                btAnt.Click         += new EventHandler(btAnt_Click);
                btAdiciona.Click    += new EventHandler(btAdiciona_Click);
                btMenu.Click        += new EventHandler(btMenu_Click);
                cbQtde.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);
                btCarrinho.Click    += new EventHandler(btCarrinho_Click);

                txtLoja.Text = MainActivity.sNomeEmpresa;
            }
            else
            {
                Finish();
                StartActivity(typeof(MainActivity));
            }
        }