public static void Validar(this IPagamento pagamento, string itemCertificadoApolice) { var dataPagamento = Assertion.GreaterThan(pagamento.DataPagamento, default(DateTime), $"A Data de Pagamento para o ItemCertificadoApolice: { itemCertificadoApolice }, não foi informada."); var dataApropriacao = Assertion.GreaterThan(pagamento.DataApropriacao, default(DateTime), $"A Data de Apropriação para o ItemCertificadoApolice: { itemCertificadoApolice }, não foi informada."); var valorPago = Assertion.GreaterThan(pagamento.ValorPago, default(decimal), $"O Valor Pago para o ItemCertificadoApolice: { itemCertificadoApolice }, não foi informado."); dataPagamento.and(dataApropriacao).and(valorPago).Validate(); }
public Pedido(INotificacao notificacao, IVerificaEstoque verificaEstoque, IPagamento pagamento) { //usando Injetor de dependencia _notificacao = notificacao; _verificaEstoque = verificaEstoque; _pagamento = pagamento; }
public PedidoService(ICarrinho carrinho, IPagamento pagamento, IEstoque estoqueService, IMail mailService, ISms smsService) { _carrinhoService = carrinho; _pagamentoService = pagamento; _estoqueService = estoqueService; _mailService = mailService; _smsService = smsService; }
public ATMFacade(string numeroCartao) { _cartao = new Cartao(); if (_cartao.ValidarCartao(numeroCartao)) { _correntista = _cartao.ObterCorrentista(); _conta = new Conta(_correntista); } _deposito = new Deposito(_conta); _emprestimo = new Emprestimo(_conta); _pagamento = new Pagamento(_conta); _saque = new Saque(_conta); }
public static PagamentoPremio ToPagamentoPremio(this IPagamento pagamento) { return(new PagamentoPremio() { DataPagamento = pagamento.DataPagamento, DataApropriacao = pagamento.DataApropriacao, ValorPago = pagamento.ValorPago, Desconto = pagamento.Desconto, Multa = pagamento.Multa, IOFRetido = pagamento.IOFRetido, IOFARecolher = pagamento.IOFARecolher, IdentificadorCredito = pagamento.IdentificadorCredito }); }
public PedidoService(IPagamento pagamento) { _pagamento = pagamento; }
public void FixtureSetUp() { _pagamento = PagamentoBuilder.UmBuilder().Build(); }
public ContratoServico(IPagamento pagamentoServico) { this.pagamentoServico = pagamentoServico; }
public LojaOnlineFacade(IEstoque gerenciadorDeEstoque, IValidadorPedido gerenciadorDePedido, IPagamento gerenciadorDePagamento) { this.gerenciadorDeEstoque = gerenciadorDeEstoque; this.gerenciadorDePedido = gerenciadorDePedido; this.gerenciadorDePagamento = gerenciadorDePagamento; }
public FacadeController(IPagamento pagamento) { _pagamentoService = pagamento; }
public PedidoService(IPagamento pagamento) =>
public LojaOnlineFacade(IEstoque gerenciadorDeEstoque, IValidadorPedido gerenciadorDePedido, IPagamento gerenciadorDePagamento) { this.gerenciadorDeEstoque = gerenciadorDeEstoque; this.gerenciadorDePedido = gerenciadorDePedido; this.gerenciadorDePagamento = gerenciadorDePagamento; }
public static double CalcularValorLíquido(IPagamento p, DateTime cobrança, double juros) { return Preço.Corrigir(p.ÚltimoVencimento, cobrança, p.Valor, juros); }
public Pedido(IPagamento pagamento) { _pagamento = pagamento; }
static void Main(string[] args) { Console.WriteLine("Hello World! from reflection"); Type tContato = typeof(Contato); Console.WriteLine($"Type Info - Comecando"); Console.WriteLine($"Type Info - {tContato.Name}"); Console.WriteLine($"Type Info - {tContato.Assembly.FullName}"); Console.WriteLine($"Type Info - {tContato.BaseType?.Name}"); Console.WriteLine($"Type Info - Fim"); Console.WriteLine(); var attributes = tContato.CustomAttributes; foreach (var item in attributes) { Console.WriteLine($"Type Info - Attributes {item.AttributeType.Name}"); } Console.WriteLine(); var publicProperties = tContato.GetProperties(); foreach (var item in publicProperties) { Console.WriteLine($"Type Info - Public Property Name {item.Name} Type {item.PropertyType.Name}"); } //tContato.GetMethods() //tContato.GetCustomAttributes() Console.WriteLine(); Contato c = new Contato(); c.Id = Guid.NewGuid(); c.Nome = "Nome teste"; c.Telefone = "11 929292929"; publicProperties = tContato.GetProperties(); foreach (var item in publicProperties) { Console.WriteLine($"Name {item.Name} " + $"Type {item.PropertyType.Name} " + $"Value {tContato.GetProperty(item.Name).GetValue(c)}"); } tContato.GetProperty("Telefone").SetValue(c, "29299292"); Console.WriteLine($"Telefone {c.Telefone}"); Console.ReadKey(); //carregar assembly em runtime Assembly assemly = Assembly.LoadFile("c:\\plugins\\mercadopago.dll"); //pega tipos disponiveis no assembly Type[] types = assemly.GetTypes(); //foreach nos types foreach (Type tItem in types) { //verifica se pertence a interface IPagamento if (tItem.IsAssignableFrom(typeof(IPagamento))) { //pega construtores var constrcutors = tItem.GetConstructors(); //ativa a instancia (cria novo objecto) IPagamento paReflection = Activator.CreateInstance(tItem) as IPagamento; //chama metodo paReflection.Pagar("123", 12.4m); } } }