Exemplo n.º 1
0
        public string PostarArquivo(ArquivoDTO dto, int id)
        {
            string mensagem = "";

            for (int i = 0; i < dto.NumeroNotasFiscais; i++)
            {
                var novaNota = new NotaFiscal();
                novaNota.EmpresaId = id;
                var respota = _notasFiscaisRepositorio.PostarNotaFiscal(novaNota);
                if (!respota.sucesso)
                {
                    mensagem = mensagem + respota.mensagem + "/n";
                }
            }

            for (int i = 0; i < dto.NumeroDebitos; i++)
            {
                var novoDebito = new Debito();
                novoDebito.EmpresaId = id;
                var resposta = _debitoRepositorio.PostarDebito(novoDebito);
                if (!resposta.sucesso)
                {
                    mensagem = mensagem + resposta.mensagem + "/n";
                }
            }
            return(mensagem);
        }
        public async Task <DebitarResult> Execute(Guid contaId, Valor valor)
        {
            if (valor <= 0)
            {
                throw new ValorInvalidoException();
            }

            var conta = await this.contaRepository.Obter(contaId);

            if (conta == null)
            {
                throw new ContaNaoEncontradaException(contaId);
            }

            if (conta.ClienteId != usuarioAutenticado.Id)
            {
                throw new UsuarioLogadoNaoEhDonoDaContaException(contaId);
            }

            conta.Debitar(valor);

            Debito debito = conta.ObterUltimaTransacao() as Debito;

            await this.contaRepository.SalvarTransacao(conta, debito);

            return(new DebitarResult(debito, conta.ObterSaldo()));
        }
Exemplo n.º 3
0
        public void Realizar_DebitoTest()
        {
            Debito met = new Debito();
            string monto = "20"; string descripcion = "Porque te robo"; string fecha = "22/03/2017 8:03:00"; string cuenta = "2"; string cuenta_destino = "A-00001"; string cod_usuario = "2";

            Assert.AreEqual(true, met.Realizar_Debito2(monto, descripcion, fecha, cuenta, cuenta_destino, cod_usuario));
        }
Exemplo n.º 4
0
        public async Task <ContaCorrente> Obter(Guid contaId)
        {
            var entity = await context.Contas.FirstOrDefaultAsync(s => s.Id.Equals(contaId));

            if (entity == null)
            {
                throw new ContaNaoEncontradaException(contaId);
            }

            List <ITransacao> transacoes = new List <ITransacao>();

            var creditos = await this.ObterCreditos(entity.Id);

            foreach (var credito in creditos)
            {
                transacoes.Add(Credito.Carregar(credito.Id, credito.TransacaoId, credito.ContaId, credito.DataTransacao, credito.Valor));
            }

            var debitos = await this.ObterDebitos(entity.Id);

            foreach (var debito in debitos)
            {
                transacoes.Add(Debito.Carregar(debito.Id, debito.TransacaoId, debito.ContaId, debito.DataTransacao, debito.Valor));
            }

            transacoes.OrderBy(s => s.DataTransacao);

            LancamentoCollection transacaoCollection = new LancamentoCollection();

            transacaoCollection.Adicionar(transacoes);

            var conta = ContaCorrente.Carregar(entity.Id, entity.ClienteId, entity.NumeroAgencia, entity.NumeroConta, entity.DigitoConta, transacaoCollection);

            return(conta);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Boleto boleto = new Boleto();

            Credito credito = new Credito();

            Debito debito = new Debito();
        }
        public void IdExistente()
        {
            var debito  = new Debito(1000, lista);
            var debito2 = new Debito(1000, lista);

            Assert.True(debito.IdTransacao > 0);
            Assert.True(debito2.IdTransacao > 0);
        }
Exemplo n.º 7
0
 public DebitoViewModel(Debito deb)
 {
     Id      = deb.Id;
     Data    = deb.Data.ToString("yyyy/MM");
     Entrada = deb.Entrada;
     Saida   = deb.Saida;
     Valor   = deb.Valor;
     Total   = ((Entrada - Saida) < 0?"- ":"") + "R$" + Math.Abs(Entrada - Saida).ToString("F");
 }
        public IActionResult PostDebito(Debito debito)
        {
            if (debito.EmpresaId <= 0)
            {
                return(BadRequest("Debito precisa conter um Id de Empresa"));
            }

            var resposta = _debitoRepositorio.PostarDebito(debito);

            return(CreatedAtAction(resposta.mensagem, new { debito.Id }, debito));
        }
        public static List <Tarjeta> ListarVencidasDebito()
        {
            int      oNroT;
            Boolean  oPersonalizada;
            DateTime oFechaVen;
            Cliente  Cli;
            double   oSaldo;
            int      oCantC;

            List <Tarjeta> oListadoTarjetasVencidas = new List <Tarjeta>();
            Debito         d;

            SqlDataReader oReader;


            SqlConnection oConexion = new SqlConnection(CONEXION.STR);
            SqlCommand    oComando  = new SqlCommand("sp_ListarTarjetasDebitoVencidas", oConexion);

            oComando.CommandType = CommandType.StoredProcedure;

            try
            {
                oConexion.Open();
                oReader = oComando.ExecuteReader();


                while (oReader.Read())
                {
                    oNroT          = Convert.ToInt32((int)oReader["NroT"]);
                    Cli            = PersistenciaCliente.Buscar(Convert.ToInt32((int)oReader["CI"]));
                    oFechaVen      = Convert.ToDateTime((DateTime)oReader["FechaVencimiento"]);
                    oPersonalizada = (bool)oReader["Personalizada"];
                    oSaldo         = Convert.ToDouble((double)oReader["Saldo"]);
                    oCantC         = Convert.ToInt32((int)oReader["CantCuentas"]);


                    d = new Debito(oNroT, Cli, oFechaVen, oPersonalizada, oSaldo, oCantC);
                    oListadoTarjetasVencidas.Add(d);
                }

                oReader.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                oConexion.Close();
            }
            return(oListadoTarjetasVencidas);
        }
        public async Task <TransferirResult> Execute(NumeroAgencia numeroAgenciaOrigem, NumeroConta numeroContaOrigem, DigitoConta digitoContaOrigem, NumeroAgencia numeroAgenciaDestino, NumeroConta numeroContaDestino, DigitoConta digitoContaDestino, Valor valor)
        {
            if (valor <= 0)
            {
                throw new ValorInvalidoException();
            }

            var contaDebito = await this.contaRepository.Obter(numeroAgenciaOrigem, numeroContaOrigem, digitoContaOrigem);

            if (contaDebito == null)
            {
                throw new ContaNaoEncontradaException(numeroAgenciaOrigem, numeroContaOrigem, digitoContaOrigem);
            }

            if (contaDebito.ClienteId != usuarioAutenticado.Id)
            {
                throw new UsuarioLogadoNaoEhDonoDaContaException(contaDebito.Id);
            }

            var contaCredito = await this.contaRepository.Obter(numeroAgenciaDestino, numeroContaDestino, digitoContaDestino);

            if (contaCredito == null)
            {
                throw new ContaNaoEncontradaException(numeroAgenciaDestino, numeroContaDestino, digitoContaDestino);
            }


            if (contaCredito.Id == contaDebito.Id)
            {
                throw new ContaCreditoIgualContaDebitoException();
            }

            contaDebito.Debitar(valor);

            Guid transacaoId = Guid.NewGuid();

            Debito debito = contaDebito.ObterUltimaTransacao() as Debito;

            debito.AtrelarTransacao(transacaoId);

            await this.contaRepository.SalvarTransacao(contaDebito, debito);

            contaCredito.Creditar(valor);

            Credito credito = contaCredito.ObterUltimaTransacao() as Credito;

            credito.AtrelarTransacao(debito.TransacaoId);

            await this.contaRepository.SalvarTransacao(contaCredito, credito);

            return(new TransferirResult(valor, transacaoId, credito.DataTransacao, contaCredito, contaDebito));
        }
Exemplo n.º 11
0
        public async Task SalvarTransacao(ContaCorrente conta, Debito debito)
        {
            var entity = new Entities.Debito()
            {
                ContaId       = conta.Id,
                DataTransacao = debito.DataTransacao,
                Valor         = debito.Valor
            };

            await context.Debitos.AddAsync(entity);

            await context.SaveChangesAsync();
        }
Exemplo n.º 12
0
        public FileContentResult GetImage(int Id_ventas)
        {
            Debito pro = ctx.Debito.FirstOrDefault(c => c.Id_ventas == Id_ventas);

            if (pro != null)
            {
                return(File(pro.Imagen, pro.N_img));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            Console.WriteLine("Digite o valor da compra: ");
            float valorDaCompra = float.Parse(Console.ReadLine());

            Console.WriteLine("Selecione um método de pagamento");
            Console.WriteLine("1 - Boleto");
            Console.WriteLine("2 - Cartão");
            int opcao = int.Parse(Console.ReadLine());

            switch (opcao)
            {
            case 1:
                Boleto boleto = new Boleto();
                boleto.Registrar();
                Console.WriteLine($"Código de Barras - {boleto.CodigoDeBarras}");
                boleto.Valor = valorDaCompra;
                boleto.Data  = DateTime.Now;

                boleto.GerarBoleto();
                break;

            case 2:
                Console.WriteLine("Selecione um método de pagamento");
                Console.WriteLine("1 - Crédito");
                Console.WriteLine("2 - Débito");
                int tipo = int.Parse(Console.ReadLine());
                switch (tipo)
                {
                case 1:
                    Credito credito = new Credito();
                    credito.valorFinal = 1221;
                    credito.Gerar();
                    break;

                case 2:
                    Debito debito = new Debito();
                    Console.WriteLine($"Valor Final: {debito.saldo}");
                    break;

                default:
                    Console.WriteLine("Opção inválida, tente novamente!!");
                    break;
                }
                break;

            default:
                Console.WriteLine("Opção inválida, tente novamente!!");
                break;
            }
        }
Exemplo n.º 14
0
        public async void ConsegueSalvarAdicionarUmDebitoNaContaSallva()
        {
            ContaCorrente conta = new ContaCorrente(Guid.NewGuid(), "123", "456789", "2");

            Debito debito = new Debito(conta.Id, 50);

            await repository.SalvarTransacao(conta, debito);

            var debitos = await repository.ObterDebitos(conta.Id);

            Assert.Single(debitos);

            Assert.Equal(50, debitos[0].Valor);
        }
        public static List <Debito> ListarDebitoCliente(int oci)
        {
            int      oNroT;
            Boolean  oPersonalizada;
            DateTime oFechaVen;
            Cliente  Cli;

            Double oSaldo;
            int    oCantCuentas;

            List <Debito> oListadoTarjetasDebito = new List <Debito>();
            SqlDataReader oReader;

            SqlConnection oConexion = new SqlConnection(CONEXION.STR);
            SqlCommand    oComando  = new SqlCommand("exec sp_ListarTarjetaDebito " + oci, oConexion);



            try
            {
                oConexion.Open();
                oReader = oComando.ExecuteReader();
                if (oReader.HasRows)
                {
                    while (oReader.Read())
                    {
                        oNroT          = Convert.ToInt32((int)oReader["NroT"]);
                        oFechaVen      = (DateTime)oReader["FechaVencimiento"];
                        Cli            = PersistenciaCliente.Buscar(Convert.ToInt32((int)oReader["CI"]));
                        oPersonalizada = (bool)oReader["Personalizada"];
                        oSaldo         = Convert.ToDouble((Double)oReader["Saldo"]);
                        oCantCuentas   = Convert.ToInt32((int)oReader["CantCuentas"]);

                        Debito d = new Debito(oNroT, Cli, oFechaVen, oPersonalizada, oSaldo, oCantCuentas);
                        oListadoTarjetasDebito.Add(d);
                    }
                }
                oReader.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                oConexion.Close();
            }
            return(oListadoTarjetasDebito);
        }
Exemplo n.º 16
0
        public async Task <IList <Debito> > ObterDebitos(Guid contaId)
        {
            var debitoEntities = await context.Debitos.Where(s => s.ContaId.Equals(contaId)).ToListAsync();

            List <Debito> debitos = new List <Debito>();

            if (debitoEntities != null)
            {
                foreach (var creditoEntity in debitoEntities)
                {
                    debitos.Add(Debito.Carregar(creditoEntity.Id, creditoEntity.TransacaoId, creditoEntity.ContaId, creditoEntity.DataTransacao, creditoEntity.Valor));
                }
            }
            return(debitos);
        }
Exemplo n.º 17
0
        public void ConsegueCarregarUmObjetoDebito()
        {
            Guid     id            = Guid.NewGuid();
            Guid     transacaoId   = Guid.NewGuid();
            Guid     contaId       = Guid.NewGuid();
            DateTime dataTransacao = DateTime.UtcNow;
            double   valor         = 49.9;

            var debito = Debito.Carregar(id, transacaoId, contaId, dataTransacao, valor);

            Assert.Equal(id, debito.Id);
            Assert.Equal(transacaoId, debito.TransacaoId);
            Assert.Equal(contaId, debito.ContaId);
            Assert.Equal(dataTransacao, debito.DataTransacao);
            Assert.Equal <double>(valor, debito.Valor);
        }
Exemplo n.º 18
0
        static void Main(string[] args)
        {
            bool opcaoValida = false;

            Console.WriteLine($@"
            Escolha uma forma de pagamento:
            
            B - Boleto
            C - Crédito
            D - Débito
            X - Cancelar pagamento");

            string opcao = Console.ReadLine().ToLower();

            do
            {
                switch (opcao)
                {
                case "b":
                    Boleto b = new Boleto();
                    b.Registrar();
                    break;

                case "c":
                    Credito c = new Credito();
                    Console.WriteLine(c.SalvarCartao());
                    c.Pagar();
                    break;

                case "d":
                    Debito d = new Debito();
                    Console.WriteLine(d.SalvarCartao());
                    d.pagar();
                    break;

                case "x":
                    Pagamento p = new Pagamento();
                    Console.WriteLine(p.Cancelar());
                    break;

                default:
                    Console.WriteLine("Opcão inválida.");
                    opcaoValida = true;
                    break;
                }
            } while (opcaoValida);
        }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            Console.WriteLine("Digite o valor da compra:");
            float valorDaCompra = float.Parse(Console.ReadLine());

            Console.WriteLine("Selecione o tipo de pagamento:");
            Console.WriteLine("[1] - Boleto  [2] - Cartão");
            int opcao = int.Parse(Console.ReadLine());

            switch (opcao)
            {
            case 1:
                Boleto boleto = new Boleto();
                boleto.Valor = valorDaCompra;
                boleto.Registrar(boleto.Valor, boleto.Data, boleto.CodigoDeBarras);
                break;

            case 2:
                Console.WriteLine("Selecione o tipo de pagamento:");
                Console.WriteLine("[1] - Crédito  [2] - Débito");
                int tipoCartao = int.Parse(Console.ReadLine());
                switch (tipoCartao)
                {
                case 1:
                    Credito credito = new Credito();
                    credito.SalvarCartao();
                    credito.Pagar(valorDaCompra);
                    break;

                case 2:
                    Debito debito = new Debito();
                    debito.SalvarCartao();
                    debito.Pagar(valorDaCompra);
                    break;

                default:
                    Console.WriteLine("Opção inválida!");
                    break;
                }
                break;

            default:
                Console.WriteLine("Opção inválida!");
                break;
            }
        }
    protected void btnAlta_Click(object sender, EventArgs e)
    {
        try
        {
            Debito oDebito = new Debito(Convert.ToInt32(txtCI.Text), Convert.ToDateTime(CalendarioDebito.SelectedDate), Convert.ToInt32(txtPersonalizada.Text),
                                        Convert.ToInt32(txtSaldo.Text), Convert.ToInt32(txtCuentasAsociadas.Text));

            LogicaTarjeta.Alta(oDebito);

            lblError.Text = "Alta exitosa";
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
        this.LimpioFormulario();
    }
Exemplo n.º 21
0
        static void Main(string[] args)
        {
            Boleto  boleto  = new Boleto();
            Debito  debito  = new Debito();
            Credito credito = new Credito();
            float   valor;

            Console.WriteLine("Adicione o valor do produto adquirido:");
            valor = float.Parse(Console.ReadLine());

            Console.WriteLine("-----------------------------------------");
            Console.WriteLine("-----------------------------------------");

            Console.WriteLine("Escolha sua forma de pagamento");
            Console.WriteLine("[1] - Boleto");
            Console.WriteLine("[2] - Debito");
            Console.WriteLine("[3] - Credito");

            string opcao = Console.ReadLine();

            switch (opcao)
            {
            case "1":
                Console.WriteLine("-----------------------------------------");
                Console.WriteLine(boleto.Condicao(valor));
                break;

            case "2":
                Console.WriteLine("-----------------------------------------");
                Console.WriteLine(debito.Condicao(valor));
                break;

            case "3":
                Console.WriteLine("-----------------------------------------");
                Console.WriteLine("Em quantas vezes gostaria de parcelar?");
                int parcelas = int.Parse(Console.ReadLine());
                Console.WriteLine(credito.Condicao(valor, parcelas));
                break;

            default:
                Console.WriteLine("-----------------------------------------");
                Console.WriteLine("opção invalida");
                break;
            }
        }
        public static void Agregar(Debito pDebito)
        {
            SqlConnection oConexion = new SqlConnection(CONEXION.STR);
            SqlCommand    oComando  = new SqlCommand("sp_AgregarTarjetaDebito", oConexion);

            oComando.CommandType = CommandType.StoredProcedure;

            oComando.Parameters.AddWithValue("@ced", pDebito.Cli.Cedula);
            oComando.Parameters.AddWithValue("@fechaVen", pDebito.FechaVencimiento);
            oComando.Parameters.AddWithValue("@per", pDebito.Personalizada);
            oComando.Parameters.AddWithValue("@sal", pDebito.Saldo);
            oComando.Parameters.AddWithValue("@cantc", pDebito.CantCuentas);

            SqlParameter oRetorno = new SqlParameter("@Retorno", SqlDbType.Int);

            oRetorno.Direction = ParameterDirection.ReturnValue;
            oComando.Parameters.Add(oRetorno);


            try
            {
                oConexion.Open();
                oComando.ExecuteNonQuery();

                if ((int)oRetorno.Value == 0)
                {
                    throw new Exception("Cedula no existe!");
                }

                else if ((int)oRetorno.Value == -1)
                {
                    throw new Exception("Error al agregar tarjeta!");
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                oConexion.Close();
            }
        }
Exemplo n.º 23
0
        public static void Alta(Debito oDebito)
        {
            SqlConnection oConexion = new SqlConnection(Conexion.STR);
            SqlCommand    oComando  = new SqlCommand("sp_AgregarTarjetaDebito", oConexion);

            oComando.CommandType = CommandType.StoredProcedure;

            oComando.Parameters.AddWithValue("@ci", oDebito.CI);
            oComando.Parameters.AddWithValue("@fechaVencimiento", oDebito.FechaVencimiento);
            oComando.Parameters.AddWithValue("@pers", oDebito.Personalizada);
            oComando.Parameters.AddWithValue("@CantCuentAsoc", oDebito.CuentasAsociadas);
            oComando.Parameters.AddWithValue("@saldo", oDebito.Saldo);

            SqlParameter oParametro = new SqlParameter("@Retorno", SqlDbType.Int);

            oParametro.Direction = ParameterDirection.ReturnValue;
            oComando.Parameters.Add(oParametro);

            try
            {
                oConexion.Open();
                oComando.ExecuteNonQuery();

                int ValReturn = (int)oComando.Parameters["@Retorno"].Value;

                if (ValReturn == -1)
                {
                    throw new Exception("No existe cliente");
                }
                else if (ValReturn == -2)
                {
                    throw new Exception("Error SQL");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                oConexion.Close();
            }
        }
Exemplo n.º 24
0
        }                                            // Atributo do tipo string para receber a data e hora atual

        public frmPrincipal()
        {
            InitializeComponent();
            img.imagens(1);
            img1.Load(img.imagem);
            img.imagens(5);
            img2.Load(img.imagem);
            img.imagens(6);            // Carregando todas as imagens puxando enderecos do banco de dados no contrutor do form principal
            img3.Load(img.imagem);
            img.imagens(7);
            Debito.Load(img.imagem);
            img.imagens(8);
            Cartoes.Load(img.imagem);
            img.imagens(9);
            Pagamentos.Load(img.imagem);
            img.imagens(10);
            Contatos.Load(img.imagem);
            img.imagens(11);
            logo.Load(img.imagem);
        }
Exemplo n.º 25
0
        public bool Modificar(Debito pro)
        {
            var obj = (from o in ctx.Debito
                       where o.Id_ventas == pro.Id_ventas
                       select o).Single();

            obj.Imagen         = pro.Imagen;
            obj.Cod_deposito   = pro.Cod_deposito;
            obj.Num_cuenta     = pro.Num_cuenta;
            obj.Fecha_deposito = pro.Fecha_deposito;
            obj.N_img          = pro.N_img;

            ctx.SaveChanges();

            var obj2 = ctx.Ventas.Where(v => v.Id_ventas == pro.Id_ventas).SingleOrDefault();

            obj2.Estado = "VERIFICANDO";
            ctx.SaveChanges();
            return(true);
        }
Exemplo n.º 26
0
        private void GravarNotasDebitos(Notas notas, IUnitOfWork unitOfWork)
        {
            for (int i = 0; i < notas.ListaNotas.Count(); i++)
            {
                Debito nota = new Debito();
                nota.IdEmpresa = notas.IdEmpresa;
                nota.IdDebito = unitOfWork.NotaDebitoRepository().GetNextValue() + i;
                nota.Data = Convert.ToDateTime(notas.ListaNotas[0].Data);

                for (int j = 0; j < notas.ListaNotas[i].Item.Count(); j++)
                {
                    nota.Item = Convert.ToInt32(notas.ListaNotas[i].Item[j]);
                    nota.Nome = notas.ListaNotas[i].Nome[j];
                    nota.Quantidade = Convert.ToInt32(notas.ListaNotas[i].Quantidade[j]);
                    nota.Preco = Convert.ToInt32(notas.ListaNotas[i].Preco[j]);

                    unitOfWork.NotaDebitoRepository().Add(nota);
                }
            }
        }
        public (string mensagem, bool sucesso) PostarDebito(Debito debito)
        {
            debito.Data = DateTime.Now;

            _context.Debitos.Add(debito);

            var empresa = _context.Empresas.Where(e => e.Id == debito.EmpresaId)
                          .Include(e => e.Debitos)
                          .SingleOrDefault();

            var resposta = empresa.AdicionarDebito();

            _context.Empresas.Update(empresa);

            _context.SaveChanges();

            debito.Empresa = empresa;

            return(resposta);
        }
Exemplo n.º 28
0
        public void Add(Debito obj)
        {
            string sqlInsert = @"INSERT INTO dbo.Debito
                                    (iddebito, item, idempresa, nome, quantidade, preco, data)
                                VALUES
                                    (@iddebito, @item, @idempresa ,@nome, @quantidade, @preco, @data)";

            SqlCommand cmd = new SqlCommand(sqlInsert, _conn);

            cmd.Transaction = _trans;
            cmd.Parameters.Add(new SqlParameter("@iddebito", obj.IdDebito));
            cmd.Parameters.Add(new SqlParameter("@item", obj.Item));
            cmd.Parameters.Add(new SqlParameter("@idempresa", obj.IdEmpresa));
            cmd.Parameters.Add(new SqlParameter("@nome", obj.Nome));
            cmd.Parameters.Add(new SqlParameter("@quantidade", obj.Quantidade));
            cmd.Parameters.Add(new SqlParameter("@preco", obj.Preco));
            cmd.Parameters.Add(new SqlParameter("@data", obj.Data));

            cmd.ExecuteNonQuery();
        }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            Console.WriteLine("Digite o valor da compra");
            float valorDaCompra = float.Parse(Console.ReadLine());

            Console.WriteLine("Selecione o tipo de pagamento");
            Console.WriteLine("[1] Boleto");
            Console.WriteLine("[2] Cartao");
            int opcao = int.Parse(Console.ReadLine());

            switch (opcao)
            {
            case 1:
                Boleto boleto = new Boleto();
                boleto.valor = valorDaCompra;
                boleto.Registrar(boleto.valor, boleto.data, boleto.codigoDeBarras);
                break;

            case 2:
                Console.WriteLine("Selecione o tipo de pagamento");
                Console.WriteLine("[1] - Crédito");
                Console.WriteLine("[2] - Débito");
                int tipocard = int.Parse(Console.ReadLine());

                switch (tipocard)
                {
                case 1:
                    Credito credito = new Credito();
                    credito.numero   = "123245-12345-12345";
                    credito.bandeira = "MasterCard";
                    credito.titular  = "Carlos Tsukamoto";
                    credito.cvv      = "123"
                                       credito.Pagar(valorDaCompra);
                    break;

                case 2:
                    Debito debito = new Debito();
                    break;
                }
            }
        }
Exemplo n.º 30
0
        public ActionResult DebitoDetalle(FormCollection f, HttpPostedFileBase imagen)
        {
            try
            {
                DebitoDAL deb    = new DebitoDAL();
                Debito    debito = new Debito();
                if (imagen != null)
                {
                    debito.N_img  = imagen.ContentType;
                    debito.Imagen = new byte[imagen.ContentLength];
                    imagen.InputStream.Read(debito.Imagen, 0, imagen.ContentLength);
                }

                int deposito = Int32.Parse(f["Cod_deposito"]);
                debito.Id_ventas      = Int32.Parse(f["Id_ventas"]);
                debito.Cod_deposito   = deposito;
                debito.Num_cuenta     = f["Num_cuenta"];
                debito.Fecha_deposito = f["Fecha_deposito"];
                //var id_user = ctx.Ventas.Where(c => c.Id_ventas == debito.Id_ventas).Select(c => c.id_user).SingleOrDefault();
                //int Id_user =id_user;


                bool validar = deb.Modificar(debito);
                if (validar == true)
                {
                    ViewBag.Estado = "Datos ingresados exitosamente.";
                    return(RedirectToAction("Vestado", "Home", new { estado = "1" }));
                }
                else
                {
                    ViewBag.Estado = "Los datos ingresados contienen errores.";
                    return(RedirectToAction("Vestado", "Home", new { estado = "0" }));
                }
            }
            catch (Exception)
            {
                ViewBag.Estado = "Los datos ingresados contienen errores.";
                return(PartialView("Error", "Home"));
            }
        }