Exemple #1
0
        public void GuardarCxP(CuentaPorPagar cuentaPorPagar)
        {
            string mensaje = string.Format("Se guardó la CxP: Id = {0}, Importe = {1}, Naturaleza = {2}",
                                           cuentaPorPagar.Id.ToString(), cuentaPorPagar.Importe.ToString(), Enum.GetName(typeof(Naturaleza), cuentaPorPagar.Naturaleza));

            Console.WriteLine(mensaje);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            IMailService              mailService              = new MailService();
            IHistorialRepository      historialRepository      = new HistorialRepository();
            ICuentaPorPagarRepository cuentaPorPagarRepository = new CuentaPorPagarRepository();
            ISalvarCuentaPorPagar     servicioSimple           = new ServicioCuentasPorPagar(cuentaPorPagarRepository);
            ISalvarCuentaPorPagar     servicioHistorial        = new ServicioCuentasPorPagarHistorialDecorator(servicioSimple, historialRepository);
            ISalvarCuentaPorPagar     servicioMail             = new ServicioCuentasPorPagarEmailDecorator(servicioSimple, mailService);
            ISalvarCuentaPorPagar     servicioDoble            =
                new ServicioCuentasPorPagarHistorialMailDecorator(servicioHistorial, (ISendMailCxP)servicioMail);

            Console.WriteLine("Para guardar una Cuenta por pagar proporcione el importe");
            decimal importe = decimal.Parse(Console.ReadLine());

            CuentaPorPagar cuentaPorPagar = new CuentaPorPagar()
            {
                Importe    = importe,
                Id         = 1,
                Naturaleza = Naturaleza.Acreedora
            };

            servicioDoble.SaveCxP(cuentaPorPagar);

            Console.ReadKey();
        }
Exemple #3
0
 public void SaveHistoric(CuentaPorPagar cuentaPorPagar)
 {
     _historialRepository.Add(
         new HistorialCuentaPorPagar()
     {
         Id            = 2908,
         Cuenta        = cuentaPorPagar,
         FechaCreacion = new DateTime()
     });
 }
Exemple #4
0
        static void Main(string[] args)
        {
            CuentaPorPagar cuentaPorPagar = new CuentaPorPagar()
            {
                Id         = 1,
                Importe    = 1003.64,
                Naturaleza = Naturaleza.Acreedora
            };

            Console.WriteLine("----- Guardar una de CXP -----");
            ICuentaPorPagarService guardarService = new CuentaPorPagarService();

            guardarService.GuardarCxP(cuentaPorPagar);
            Console.WriteLine("\t");

            Console.WriteLine("----- Guardar un historial al guardar una CXP -----");
            ICuentaPorPagarService guardarService2 = new CuentaPorPagarService();
            ICuentaPorPagarService historial       = new HistorialDecorator(guardarService2);

            historial.GuardarCxP(cuentaPorPagar);
            Console.WriteLine("\t");

            Console.WriteLine("----- Enviar un correo a un usuario al guardar una CXP -----");
            ICuentaPorPagarService guardarService3 = new CuentaPorPagarService();
            ICuentaPorPagarService envioCorreo     = new EnvioCorreoDecorator(guardarService3);

            envioCorreo.GuardarCxP(cuentaPorPagar);
            Console.WriteLine("\t");

            Console.WriteLine("----- Guardar un historial y enviar un correo a un usuario al guardar una CXP -----");
            ICuentaPorPagarService guardarService4      = new CuentaPorPagarService();
            ICuentaPorPagarService historial2           = new HistorialDecorator(guardarService4);
            IEnvioCorreoDecorator  envioCorreo2         = new EnvioCorreoDecorator(guardarService3);
            ICuentaPorPagarService HistorialEnvioCorreo = new HistorialEnvioCorreoDecorator(historial2, envioCorreo2);

            HistorialEnvioCorreo.GuardarCxP(cuentaPorPagar);
            Console.WriteLine("\t");
        }
Exemple #5
0
 public void Add(CuentaPorPagar cuentaPorPagar)
 {
     Console.WriteLine("Se guardo la cuenta por pagar {0}, importe {1}",
                       cuentaPorPagar.Id,
                       cuentaPorPagar.Importe);
 }
Exemple #6
0
 public void SaveCxP(CuentaPorPagar cuentaPorPagar)
 {
     _servicioPrincipal.SaveCxP(cuentaPorPagar);
     SaveHistoric(cuentaPorPagar);
 }
 public void EnviarCorreo(CuentaPorPagar cuentaPorPagar)
 {
     _envioCorreoDecorator.EnviarCorreo(cuentaPorPagar);
 }
 public void GuardarCxP(CuentaPorPagar cuentaPorPagar)
 {
     _guardarService.GuardarCxP(cuentaPorPagar);
     EnviarCorreo(cuentaPorPagar);
 }