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); }
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(); }
public void SaveHistoric(CuentaPorPagar cuentaPorPagar) { _historialRepository.Add( new HistorialCuentaPorPagar() { Id = 2908, Cuenta = cuentaPorPagar, FechaCreacion = new DateTime() }); }
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"); }
public void Add(CuentaPorPagar cuentaPorPagar) { Console.WriteLine("Se guardo la cuenta por pagar {0}, importe {1}", cuentaPorPagar.Id, cuentaPorPagar.Importe); }
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); }