Beispiel #1
0
        private void Delete()
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.SetTitle("Tem certeza que deseja excluir esta tabela?");

            alert.SetNegativeButton("Não!", (senderAlert, args) =>
            {
            });

            alert.SetPositiveButton("Sim!", (senderAlert, args) =>
            {
                try
                {
                    var tabela = new TabelaPreco_Manager();
                    tabela.Delete(tblPreco);

                    Intent myIntent = new Intent(this, typeof(Activity_Cliente));
                    myIntent.PutExtra("mensagem", tabela.Mensagem);
                    SetResult(Result.Ok, myIntent);
                    Finish();
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
                }
            });

            RunOnUiThread(() =>
            {
                alert.Show();
            });
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(mContext).Inflate(Resource.Layout.Adapter_ProdTabelaPreco_ListView, null, false);
            }

            TabelaPreco         tblPreco;
            TabelaPreco_Manager tbl = new TabelaPreco_Manager();

            tblPreco = tbl.Get(mitems[position].id_tabpreco);

            Produto         prod;
            Produto_Manager prod_manager = new Produto_Manager();

            prod = prod_manager.Get(mitems[position].id_produto);

            row.FindViewById <TextView>(Resource.Id.txtDescProdutoTblPreco).Text      = "Produto: " + prod.ds_nome.ToString();
            row.FindViewById <TextView>(Resource.Id.txtDescTabelaPrecoTblPrecos).Text = "Tabela: " + tblPreco.ds_descricao.ToString();
            row.FindViewById <TextView>(Resource.Id.txtValorPrecos).Text = "Valor: " + mitems[position].vl_Valor.ToString("##,##0.00");

            return(row);
        }
        private void Sincronizar_TabelaPreco(IList <TabelaPreco> TabelasPreco)
        {
            var baselocal = new TabelaPreco_Manager();

            foreach (var item in TabelasPreco)
            {
                var tabelaprecodatabase = new core.Model.TabelaPreco
                {
                    id           = item.id,
                    ds_descricao = item.ds_descricao,
                    id_codigo    = item.id_codigo,
                    //vl_descontomaximo = item.vl_descontomaximo,
                    //vl_valor = item.vl_descontomaximo,
                };

                baselocal.Save(tabelaprecodatabase);
            }
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(mContext).Inflate(Resource.Layout.Adapter_Clientes_ListView, null, false);
            }

            row.FindViewById <TextView>(Resource.Id.txtCodigoCliente).Text = "Código do Cliente: " + mItems[position].id_Codigo.ToString();
            row.FindViewById <TextView>(Resource.Id.txtRazaoSocial).Text   = "Razão Social: " + mItems[position].ds_RazaoSocial.ToString();
            row.FindViewById <TextView>(Resource.Id.txtNomeFantasia).Text  = "Nome Fantasia: " + mItems[position].ds_NomeFantasia.ToString();
            row.FindViewById <TextView>(Resource.Id.txtCNPJ).Text          = "CNPJ: " + mItems[position].ds_Cnpj.ToString();

            TabelaPreco         tblPreco;
            TabelaPreco_Manager tbl = new TabelaPreco_Manager();

            tblPreco = tbl.Get(mItems[position].id_tabelapreco);

            row.FindViewById <TextView>(Resource.Id.txtTabelaPrecoCli).Text = "Tabela de Preços: " + tblPreco.ds_descricao.ToString();

            return(row);
        }
Beispiel #5
0
        private void Save()
        {
            if (!ValidateViews())
            {
                return;
            }

            try
            {
                BindModel();
                var tabelapreco = new TabelaPreco_Manager();
                tabelapreco.Save(tblPreco);

                Intent myIntent = new Intent(this, typeof(Activity_TabelaPreco));
                myIntent.PutExtra("mensagem", tabelapreco.Mensagem);
                SetResult(Result.Ok, myIntent);
                Finish();
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
            }
        }