public void Can_Send_Email() {

            // Arrange - create and populate a cart
            Cart cart = new Cart();
            cart.AddItem(new Product { ProductID = 1, Name = "Banana", Price = 10M }, 2);
            cart.AddItem(new Product { ProductID = 2, Name = "Apple", Price = 5M }, 2);

            // Arrange - create and populate some shipping details
            ShippingDetails shipDetails = new ShippingDetails {
                Name = "Joe Smith",
                Line1 = "Apartment 4a",
                Line2 = "123 West Street",
                City = "Northtown",
                State = "GA",
                Country = "USA",
                Zip = "12345"
            };

            // Arrange - create the test-specific email settings
            EmailSettings settings = new EmailSettings {
            
                // put test specific settings here
                WriteAsFile = true
            };

            // Arrange - create the EmailOrderProcessor class
            EmailOrderProcessor proc = new EmailOrderProcessor(settings);

            // Act - process the order
            proc.ProcessOrder(cart, shipDetails);

            // NOTE - there is assert in this test

        }
        //BODY EVENT
        public void Handle(ActivateEmailNewUserEvent @event)
        {
            //must to
            EmailSettings       settings = new EmailSettings();
            EmailOrderProcessor test     = new EmailOrderProcessor(settings);

            test.ProcessOrderNewUser(@event.idUser, @event.Email);
        }
Ejemplo n.º 3
0
        public static void InitializeConnection(bool EF)
        {
            if (EF)
            {
                EFProductRepository Entity = new EFProductRepository();
                Connections.Add(Entity);

                EmailOrderProcessor Order = new EmailOrderProcessor(GlobalConfig.emailSettings);
                OrderConnections.Add(Order);
            }
        }
Ejemplo n.º 4
0
 public ActionResult CV(MessageToMe message)
 {
     if (message.Email != null)
     {
         EmailOrderProcessor email = new EmailOrderProcessor(new EmailSettings());
         email.ContactWotchMe(message);
         return(View("Dziekuje"));
     }
     else
     {
         return(View("CV"));
     }
 }
Ejemplo n.º 5
0
        public ActionResult Contact(MessageToMe message)
        {
            if (ModelState.IsValid)
            {
                EmailOrderProcessor email = new EmailOrderProcessor(new EmailSettings());

                email.ContactWotchMe(message);

                return(View("Dziekuje"));
            }
            else
            {
                return(View("Contact"));
            }
        }
Ejemplo n.º 6
0
        public static void Log(String lines)
        {
            try
            {
                EmailOrderProcessor em = new EmailOrderProcessor(new EmailSettings());
                em.FromServerPayPal("Error" + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + " --> " + lines);

                System.IO.StreamWriter file = new System.IO.StreamWriter(LogDirectoryPath + "\\Error.log", true);
                file.WriteLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + " --> " + lines);
                file.Close();
            }
            catch
            {
            }
        }
Ejemplo n.º 7
0
        public ViewResult List(string category, int page = 1)
        {
            //--  user ip should  get--------------------
            UserIP userIP = new UserIP();

            string ip      = userIP.GetClientIpaddress();
            int    howLong = ip.Length;

            if (ip != null && ip != "::1")        // this is if running on local server
            {
                ip = ip.Remove(14, howLong - 14); // deleting some digits which are always different
            }
            //remenber

            if (Session["IP"] == null || Session["IP"].ToString() != ip) // if something is null then you cant comapare  like this, first you have to comapare to null
            {
                if (ip != "37.228.244.103" && ip != "::1")
                {
                    Session["IP"] = userIP.GetClientIpaddress();

                    EmailOrderProcessor email = new EmailOrderProcessor(new EmailSettings());
                    email.FromServerPayPal(userIP.GetClientIpaddress());

                    if (ip != null && ip != "::1")
                    {                                                                      // this is if running on local server the number ::1 this is server on my computer
                        howLong       = Session["IP"].ToString().Length;
                        Session["IP"] = Session["IP"].ToString().Remove(14, howLong - 14); // from 14 digit  next six digits remve
                    }
                }
            }

            //--------------------------------------------
            ProductsListViewModel viewModel = new ProductsListViewModel
            {
                MyItems    = repository.Myitems.Where(p => category == null || p.Category == category).OrderBy(p => p.NumberID).Skip((page - 1) * PageSize).Take(PageSize),
                PagingInfo = new PagingInfo
                {
                    CurrentPage  = page,
                    ItemsPerPage = PageSize,

                    TotalItems = category == null?repository.Myitems.Count() : repository.Myitems.Where(e => e.Category == category).Count()
                },
                CurrentCategory = category
            };

            return(View(viewModel));
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            var cart = new Cart();

            cart.AddItem(new Product()
            {
                ProductID = 1,
                Name      = "TEST1",
                Price     = 10
            }, 2);

            var persons = new ShippingDetails()
            {
                Name     = "asdad",
                Address  = "asdas",
                City     = "asdas",
                GiftWrap = true
            };


            foreach (var port in ports)
            {
                var mail = new EmailOrderProcessor(new EmailSettings(port));
                try
                {
                    Console.WriteLine("Запуск для порта " + port);
                    mail.ProcessOrder(cart, persons);
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("Отправлено");
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(ex.Message);
                }
                Console.ResetColor();

                Console.WriteLine("Завершено");
            }
            Console.ReadLine();
        }
Ejemplo n.º 9
0
        public void Can_Send_Email()
        {
            // Arrange - create and populate a cart
            Cart cart = new Cart();

            cart.AddItem(new Product {
                ProductID = 1, Name = "Banana", Price = 10M
            }, 2);
            cart.AddItem(new Product {
                ProductID = 2, Name = "Apple", Price = 5M
            }, 2);

            // Arrange - create and populate some shipping details
            ShippingDetails shipDetails = new ShippingDetails {
                Name    = "Joe Smith",
                Line1   = "Apartment 4a",
                Line2   = "123 West Street",
                City    = "Northtown",
                State   = "GA",
                Country = "USA",
                Zip     = "12345"
            };

            // Arrange - create the test-specific email settings
            EmailSettings settings = new EmailSettings {
                // put test specific settings here
                WriteAsFile = true
            };

            // Arrange - create the EmailOrderProcessor class
            EmailOrderProcessor proc = new EmailOrderProcessor(settings);

            // Act - process the order
            proc.ProcessOrder(cart, shipDetails);

            // NOTE - there is assert in this test
        }
 public CartController(EmailOrderProcessor proc)
 {
     this.proc = proc;
 }