Exemple #1
0
        public void EjecutarGuardado(CuentaPagarDTO _oCuentaPagar)
        {
            string       cResultado  = string.Empty;
            ICuentaPagar IGuardarCxP = new CuentaPagar(_oCuentaPagar);

            Console.WriteLine(IGuardarCxP.Guardar());

            //Se debe guardar un historial al guardar una CXP.
            DecoradorCuentaPagar IGuardarHistorial = new HistorialCuentaPagar(IGuardarCxP);

            Console.WriteLine(IGuardarHistorial.Guardar());

            //Se requiere que cuando se guarde una CXP se envié un correo a un usuario.
            DecoradorCuentaPagar IGuardarCxpCorreo = new Correo(IGuardarCxP);

            IGuardarCxpCorreo.cNombreUsuario = _oCuentaPagar.cNombreUsuario;
            Console.WriteLine(IGuardarCxpCorreo.Guardar());

            //Se requiere que cuando se guarde una CXP se guarde un historial, y se envié un correo a un usuario.
            DecoradorCuentaPagar IGuardarCxpHistorialCorreo = new Correo(IGuardarHistorial);

            IGuardarCxpHistorialCorreo.cNombreUsuario = _oCuentaPagar.cNombreUsuario;
            Console.WriteLine(IGuardarCxpHistorialCorreo.Guardar());
        }
Exemple #2
0
        static void Main(string[] args)
        {
            string         cId          = string.Empty;
            string         cImporte     = string.Empty;
            CuentaPagarDTO oCuentaPagar = new CuentaPagarDTO();
            Cliente        oCliente     = new Cliente();

            Console.WriteLine("******************** PATRÓN: DECORADOR ********************");
            Console.Write("\n");
            Console.WriteLine("DATOS DE LA CUENTA POR PAGAR.");
            Console.Write("Escribe el ID de la cuenta por pagar: ");
            cId = Console.ReadLine();
            oCuentaPagar.iId = int.Parse(cId);
            Console.Write("Escribe el importe de la cuenta por pagar: ");
            cImporte = Console.ReadLine();
            oCuentaPagar.dImporte = decimal.Parse(cImporte);
            Console.Write("Escribe la naturaleza de la cuenta por pagar (Cargo/Abono): ");
            oCuentaPagar.cNaturaleza = Console.ReadLine();
            Console.Write("Escribe el nombre del usuario: ");
            oCuentaPagar.cNombreUsuario = Console.ReadLine();

            oCliente.EjecutarGuardado(oCuentaPagar);
            Console.ReadLine();
        }