示例#1
0
        public void ListarCartao()
        {
            _dtCartoes = BusinesCartao.ListarDebito();
            MessageBox.Show(_dtCartoes.Rows[0]["taxa_credito"].ToString());
            var dt = _dtCartoes.AsEnumerable().Where(x => x.Field <decimal>("taxa_credito") > 0).Select(k =>
            {
                var row       = _dtCartoes.NewRow();
                row.ItemArray = new object[]
                {
                    k.Field <Int32>("id_bandeira"),
                    k.Field <string>("nome_bandeira"),
                    k.Field <decimal>("taxa_debito"),
                    k.Field <decimal>("taxa_credito")
                };
                return(row);
            });

            if (dt.Any())
            {
                dgvCredito.DataSource = dt.CopyToDataTable();
                dgvCredito.Columns["id_bandeira"].Visible  = false;
                dgvCredito.Columns["taxa_credito"].Visible = false;
                dgvCredito.Columns["taxa_debito"].Visible  = false;
            }
            else
            {
                MessageBox.Show("nada aqui");
            }
        }
示例#2
0
        private void FormCartoes_Load(object sender, EventArgs e)
        {
            dgvCadastros.DataSource = BusinesCartao.ListarDebito();
            dgvCadastros.Columns["id_bandeira"].Visible = false;
            DataGridViewButtonColumn btnExcluir = new DataGridViewButtonColumn();

            btnExcluir.HeaderText = "Excluir";
            btnExcluir.Text       = "X";
            btnExcluir.UseColumnTextForButtonValue = true;
            dgvCadastros.Columns.Add(btnExcluir);
        }
示例#3
0
        private void btnValidar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.txtDebito.Text == string.Empty || this.txtCredito.Text == string.Empty)
                {
                    lblSuc.Visible = false;
                    msgError("Alguns campos obrigatórios não foram preenchidos!");
                }
                else if (BusinesCartao.ValidaCartao(Bandeira()))
                {
                    rpta = BusinesCartao.UpdateCartao(Bandeira(), decimal.Parse(txtDebito.Text), decimal.Parse(txtCredito.Text));
                    if (rpta.Equals("OK"))
                    {
                        lblError.Visible = false;
                        lblSuc.Visible   = true;
                        msgSuccess("Cadastro ATUALIZADO com sucesso!");
                    }
                }
                else
                {
                    rpta = BusinesCartao.CadastroCartao(Bandeira(), decimal.Parse(txtDebito.Text), decimal.Parse(txtCredito.Text));

                    if (rpta.Equals("OK"))
                    {
                        lblError.Visible = false;
                        lblSuc.Visible   = true;
                        msgSuccess("Cadastro REALIZADO com sucesso!");
                    }
                    else
                    {
                        lblError.Visible = true;
                        lblSuc.Visible   = false;
                        msgError(rpta);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }

            BloquearCampos();
        }