예제 #1
0
        public EstruturaCarta DetalheCarta(int id)
        {
            try
            {
                StringBuilder sql   = new StringBuilder();
                var           carta = new EstruturaCarta();
                sql.Append(@"SELECT ID, NumeroProcesso, Cartao, Cv, DataCompra, DataCarta, ValorChargeback, ValorTransacao, AcaoTomadaAF FROM tChargeBack WHERE ID = @ID");
                sql.Replace("@ID", id.ToString());
                bd.Consulta(sql);

                while (bd.Consulta().Read())
                {
                    carta.CartaID         = bd.LerInt("ID");
                    carta.NumeroProcesso  = bd.LerString("NumeroProcesso");
                    carta.Cartao          = bd.LerString("Cartao");
                    carta.Cv              = bd.LerString("Cv");
                    carta.DataCompra      = bd.LerString("DataCompra");
                    carta.DataCarta       = bd.LerString("DataCarta");
                    carta.ValorChargeBack = bd.LerString("ValorChargeBack");
                    carta.ValorTransacao  = bd.LerString("ValorTransacao");
                    carta.AcaoTomadaAF    = bd.LerString("AcaoTomadaAF");
                }

                return(carta);
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                bd.Fechar();
            }
        }
예제 #2
0
        public void Inserir(EstruturaCarta carta)
        {
            try
            {
                StringBuilder sql = new StringBuilder();
                sql.Append("INSERT INTO tChargeBack (NumeroProcesso, NroCartao, Cartao, Cv, DataCompra, DataCarta, ValorChargeBack, ValorTransacao, AcaoTomadaAF, Origem) VALUES(@001, @010, @002, @003, @004, @005, @006, @007, @008, @009)");
                sql.Replace("@001", "'" + carta.NumeroProcesso + "'");
                sql.Replace("@002", "'" + carta.Cartao + "'");
                sql.Replace("@003", "'" + carta.Cv + "'");
                sql.Replace("@004", "'" + carta.DataCompra + "'");
                sql.Replace("@005", "'" + carta.DataCarta + "'");
                sql.Replace("@006", carta.ValorChargeBack.Replace(',', '.'));
                sql.Replace("@007", carta.ValorTransacao.Replace(',', '.'));
                sql.Replace("@008", "'" + carta.AcaoTomadaAF + "'");
                sql.Replace("@009", "'" + carta.Origem + "'");
                sql.Replace("@010", "'" + carta.NroCartao + "'");

                bd.Executar(sql);
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #3
0
        public void EditarCarta(int id, EstruturaCarta carta)
        {
            try
            {
                StringBuilder sql = new StringBuilder();
                sql.Append(@"UPDATE tChargeBack SET
									NumeroProcesso = @001,
									Cartao = @002,
									Cv = @003,
									DataCompra = @004,
									DataCarta = @005,
									ValorChargeBack = @006,
									ValorTransacao = @007,
									AcaoTomadaAF = @008
									WHERE ID = @000"                                    );

                sql.Replace("@000", "'" + id + "'");
                sql.Replace("@001", "'" + carta.NumeroProcesso + "'");
                sql.Replace("@002", "'" + carta.Cartao + "'");
                sql.Replace("@003", "'" + carta.Cv + "'");
                sql.Replace("@004", "'" + carta.DataCompra + "'");
                sql.Replace("@005", "'" + carta.DataCarta + "'");
                sql.Replace("@006", carta.ValorChargeBack.Replace(',', '.'));
                sql.Replace("@007", carta.ValorTransacao.Replace(',', '.'));
                sql.Replace("@008", "'" + carta.AcaoTomadaAF + "'");
                bd.Executar(sql);
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                bd.Fechar();
            }
        }