Пример #1
0
        public static void EnviarEmail(List<Cliente> clientes, Reserva reserva, Cliente user)
        {
            SmtpClient SmtpServer = new SmtpClient();
            SmtpServer.Credentials = new System.Net.NetworkCredential
                        ("*****@*****.**", "colabora1234");
            SmtpServer.Port = 587;
            SmtpServer.Host = "smtp.gmail.com";
            SmtpServer.EnableSsl = true;
            var mail = new MailMessage();
            String[] addr = clientes.Select(c => c.Email).ToArray();
            try
            {
                mail.From = new MailAddress("*****@*****.**",
                "Developers", System.Text.Encoding.UTF8);
                Byte i;
                for( i = 0;i< addr.Length; i++)
                    mail.To.Add(addr[i]);
                mail.Subject = "Reserva de sala";
                mail.Body = user.Nombre + " " + user.Apellido + " te ha enviado una notificación de la reserva a la sala " + reserva.Sala.ID + ", desde " + reserva.Desde.ToShortDateString()
                    + " hasta " + reserva.Hasta.ToShortDateString();

                mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
                mail.ReplyTo = new MailAddress("*****@*****.**");
                SmtpServer.Send(mail);
            }
            catch (Exception ex){

            }
        }
Пример #2
0
 public void Reserva_SePuedeNotificar_Valido()
 {
     var BD = Singleton.GetInstance();
     Reserva reserva = new Reserva(BD.GetClientePorID("1"), BD.GetSala("1"), DateTime.Today, DateTime.Today.AddDays(5));
     var obtenido = reserva.SePuedeNotificar();
     Assert.AreEqual(true, obtenido);
 }
Пример #3
0
 public void Reserva_CalcularTotal()
 {
     var BD = Singleton.GetInstance();
     var cliente = BD.GetClientePorID("1");
     var sala = BD.GetSala("1");
     Reserva reserva = new Reserva(cliente, sala, DateTime.Today, DateTime.Today.AddDays(5));
     double obtenido = reserva.CalcularTotal();
     Assert.AreEqual(122, obtenido);
 }
Пример #4
0
        public void GetReservaById()
        {
            var BD = Singleton.GetInstance();
            var sala = BD.GetSala("2");
            var cliente = BD.GetClientePorID("1");
            var reserva = new Reserva(cliente, sala, DateTime.Today, DateTime.Today.AddDays(5));
            BD.NewReserva(reserva);

            var obtenido = BD.GetReservaById(reserva.ID);
            Assert.AreEqual(reserva, obtenido);
        }
Пример #5
0
 public void NewReserva(Reserva r)
 {
     this.Reservas.Add(r);
 }
Пример #6
0
 public bool DeleteFactura(string idCliente, Membresia membresia = null, Reserva reserva = null)
 {
     Factura factura = Facturas.Where(f => f.Cliente.ID.Equals(idCliente) && f.Reserva.Equals(reserva) && f.Membresia.Equals(membresia)).FirstOrDefault();
     if (factura != null)
     {
         Facturas.Remove(factura);
         return true;
     }
     return false;
 }
Пример #7
0
 public void AddReserva(DateTime desde, DateTime hasta, Sala sala, Cliente cliente)
 {
     Reserva reserva = new Reserva(cliente, sala, desde, hasta);
     Reservas.Add(reserva);
 }