Example #1
0
        // Метод для тестовой рассылки письма
        private void SendMail(User user)
        {
            const string subject = "Вопрос от пользователя Дядя Коля";
            var template =
                new ParametrizedFileTemplate(
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Templates", "Mail", "UserQuestion.html"), new
                    {
                        Subject = subject
                    });

            Locator.GetService<IMailNotificationManager>().Notify(user, subject, template.ToString());
        }
Example #2
0
        public ActionResult ProcessProductFeedback(long id, long productId, string Email, string Subject, string Content, string Name)
        {
            // Инициализируем пользотваеля
            InitializeUser(id);

            // Навигационная цепочка
            PushNavigationChainItem("Главная", string.Format("/vendor/{0}", id));
            PushNavigationChainItem("Отправка сообщения", string.Format("/vendor/feedback", id), true);

            var product = Locator.GetService<IProductsRepository>().Load(productId);

            // Формируем шаблон
            var template =
                new ParametrizedFileTemplate(
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Templates", "Mail", "UserQuestion.html"), new
                    {
                        Subject = Subject,
                        Email = Email,
                        Content = Content,
                        Name = Name,
                        IP = Request.UserHostAddress,
                        FIO = product.User.FIO,
                        Phone = IsAuthentificated ? CurrentUser.GetMainPhone() : "",
                        CompanyName = product.User.Company,
                        TEmail = product.User.Email,
                        ProductName = product.Title,
                        ProductImage = "http://karteltrade.ru/files/prodimage/"+product.Img,
                        ACompanyName = IsAuthentificated ? CurrentUser.Company : "",
                        ACompanyCountry = IsAuthentificated ? CurrentUser.Country : "",
                        ACompanyCity = IsAuthentificated ? CurrentUser.City : "",
                    });

            var user = UsersRepository.Load(id);
            if (user == null)
            {
                return RedirectToAction("Index", new { id = id });
            }

            Locator.GetService<IMailNotificationManager>().Notify(user, "Картель.рф: " + Subject, template.ToString());

            return View("Feedback");
        }
Example #3
0
        public ActionResult Feedback(long id, string Name, string Email, string Content, string Subject)
        {
            // Инициализируем пользотваеля
            InitializeUser(id);

            // Навигационная цепочка
            PushNavigationChainItem("Главная", string.Format("/vendor/{0}", id));
            PushNavigationChainItem("Отправка сообщения", string.Format("/vendor/feedback", id), true);

            // Формируем шаблон
            var template =
                new ParametrizedFileTemplate(
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Templates", "Mail", "Feedback.html"), new
                        {
                            Subject = Subject,
                            Email = Email,
                            Content = Content,
                            Name = Name,
                            IP = Request.UserHostAddress
                        });

            var user = UsersRepository.Load(id);
            if (user == null)
            {
                return RedirectToAction("Index",new {id = id});
            }

            Locator.GetService<IMailNotificationManager>().Notify(user,"Картель.рф: "+Subject,template.ToString());

            return View();
        }
Example #4
0
        public ActionResult ForgotPassword(string email)
        {
            if (IsAuthentificated)
            {
                return RedirectToAction("Index", "Main");
            }

            var userRepository = Locator.GetService<IUsersRepository>();
            var user = userRepository.Find(f => f.Email == email);
            if (user == null)
            {
                TempData["Error"] = "Пользователь с таким логином (email) не найден.";
                return View("ForgotPassword");
            }

            user.PasswordHash = PasswordUtils.Hashify(user.PasswordHash, 5).ToLower();

            const string subject = "Восстановление пароля";
            var template =
                new ParametrizedFileTemplate(
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Templates", "Mail", "ResetPassword.html"), new
                        {
                            Subject = subject,
                            Content = Url.Action("ResetPassword", null,
                            new { email = user.Email, reset =  user.PasswordHash }, Request.Url.Scheme)
                        });

            Locator.GetService<IMailNotificationManager>().Notify(user, subject, template.ToString());
            userRepository.SubmitChanges();
            TempData["Message"] = "Инструкция по восстановлению пароля отправлена на e-mail, указанный при регистрации";

            return View();
        }
Example #5
0
        public ActionResult Feedback(string Name, string Phone,string Email, string Content, string Subject)
        {
            // Навигационная цепочка
            PushNavigationChainItem("Главная страница", "/");
            PushNavigationChainItem("Личный кабинет", "", false);
            PushNavigationChainItem("Связаться с администратором", "/feedback");

            // Формируем шаблон
            var template =
                new ParametrizedFileTemplate(
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Templates", "Mail", "AdminFeedback.html"), new
                    {
                        Subject = Subject,
                        Email = Email,
                        Content = Content,
                        Name = Name,
                        Phone = Phone,
                        IP = Request.UserHostAddress
                    });

            Locator.GetService<IMailNotificationManager>().Notify("*****@*****.**", "Картель.рф: сообщение от пользователя " + CurrentUser.FIO, template.ToString());

            return View("FeedbackSuccess");
        }
        public ActionResult SendMessage(long id, string type)
        {
            try
            {
                var rep = Locator.GetService<IUsersRepository>();
                var user = rep.Load(id);

                string template = "";
                switch (type)
                {
                    case "gold":
                        template = "GoldenVendor.html";
                        break;
                    case "renew":
                        template = "RenewalRater.html";
                        break;
                }

                // Формируем путь
                var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Templates", "Mail", template);

                var temp = new ParametrizedFileTemplate(path, user).ToString();

                Locator.GetService<IMailNotificationManager>().Notify(user,"Сообщение с сайта Картель.рф",temp);

                return JsonSuccess();
            }
            catch (Exception e)
            {
                return JsonErrors(e.Message);
            }
        }