Beispiel #1
0
        public ActionResult QuotationApprovalStatus(int id, int status)
        {
            var pqvm = new PurchaseQuotationViewModel();

            pqvm.quoteApproval = _repPurchaseQuotation.ChangeQuotationApprovalStatus(id, status);
            pqvm.approveId     = id;

            //Quotation Details
            pqvm.quotationDetails = _repPurchaseQuotation.GetQuotationDetails(id);

            if (pqvm.quoteApproval == 1)
            {
                var userMailer = new UserMailer();

                var msg = userMailer.PurchaseQuotationEmail(new PurchaseQuotationEmailViewModel
                {
                    To = "*****@*****.**",
                    //To = "*****@*****.**",
                    AssetName         = pqvm.quotationDetails.AssetName,
                    ModelNo           = pqvm.quotationDetails.Model,
                    Category          = pqvm.quotationDetails.AssetCategoryName,
                    Manufacturer      = pqvm.quotationDetails.Manufacturer,
                    ConfigurationInfo = pqvm.quotationDetails.ConfigurationInfo,
                    QuotedDate        = pqvm.quotationDetails.QuotedDate.ToString(),
                    PurchaseType      = pqvm.quotationDetails.PurchaseType,
                    TotalCost         = pqvm.quotationDetails.TotalCost,
                }).SendAsync();
            }

            return(Content(pqvm.quoteApproval.ToString()));
            //return PartialView(pqvm);
            //return pqvm;
        }
Beispiel #2
0
        public static void SendConfirmationEmail(TicketExportItem ticketExportItem, Project project)
        {
            TicketItemConfirmationViewModel ticketExportConfirmationViewModel = new TicketItemConfirmationViewModel()
            {
                ProjectName = project.TicketSetting.ProjectViewNameCZ,
                Email       = ticketExportItem.Email,
                IsExport    = true,
                DateStart   = project.TicketSetting.StartsCZ,
                Location    = project.TicketSetting.LocationCZ,
                Note        = project.TicketSetting.NoteCZ
            };

            List <TicketPDFGenerator.TicketToGenerateWrapper> ticketsToGenerate = new List <TicketPDFGenerator.TicketToGenerateWrapper>();

            TicketPDFGenerator.TicketToGenerateWrapper ticketWrapper = new TicketPDFGenerator.TicketToGenerateWrapper();

            ticketWrapper.CategoryName = ticketExportItem.TicketExport.Name;
            ticketWrapper.Location     = project.TicketSetting.LocationEN;
            ticketWrapper.StartDate    = project.TicketSetting.StartsEN;
            ticketWrapper.ProjectName  = project.TicketSetting.ProjectViewNameEN;
            ticketWrapper.Note         = project.TicketSetting.NoteCZ;

            ticketWrapper.VisitorEmail = ticketExportItem.Email;
            ticketWrapper.VisitorName  = ticketExportItem.Name;
            ticketWrapper.Code         = ticketExportItem.Code;
            ticketWrapper.QRCode       = ticketExportItem.QRCode;

            ticketsToGenerate.Add(ticketWrapper);


            IUserMailer userMailer = new UserMailer();
            var         email      = userMailer.SendTicketOrderConfirmation(ticketExportConfirmationViewModel, ticketsToGenerate, project.TicketSetting);

            email.Send();
        }
Beispiel #3
0
        public async Task <ActionResult> ForgotPassword(ForgotPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindByEmailAsync(model.Email);

                if (user == null || !(await UserManager.IsEmailConfirmedAsync(user.Id)))
                {
                    ModelState.AddModelError("", AccountResources.EmailDoesntExistOrNotConfirmed);
                    return(View());
                }

                string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);

                var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);

                IUserMailer userMailer = new UserMailer();
                var         email      = userMailer.SendPasswordReset(model.Email.Trim(), code, user.Id);
                email.SendAsync();

                var messageModel = new MessageViewModel()
                {
                    Body   = AccountResources.PasswordRecoveryEmailSent,
                    Header = AccountResources.PasswordRecovery
                };

                return(RedirectToAction("Message", "Home", messageModel));
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Beispiel #4
0
 public bool DeleteBooking(string bookingId)
 {
     try
     {
         int                   bId = int.Parse(bookingId);
         BookingEntities       ctx = new BookingEntities();
         BoatBooking           b   = ctx.BoatBooking.Where(x => x.Id == bId).First();
         BookingCancelledModel cm  = new BookingCancelledModel
         {
             UserEmail        = b.Member.Email,
             UserName         = b.Member.Name,
             SailingClub      = ConfigurationManager.AppSettings["SailingClub"],
             Signature        = ConfigurationManager.AppSettings["Signature"],
             BookingReference = b.BookingMemberId.ToString() + "/" + b.Id.ToString(),
             BookingDate      = b.BookingDate
         };
         ctx.BoatBooking.Remove(b);
         ctx.SaveChanges();
         UserMailer     um  = new UserMailer();
         MvcMailMessage msg = um.BoatCancelledTreasurer(cm);
         msg.Send();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Beispiel #5
0
        private void SendEmail(TicketOrderViewModel ticketOrderViewModel)
        {
            IUserMailer userMailer = new UserMailer();
            var         email      = userMailer.SendTicketOrder(ticketOrderViewModel);

            email.Send();
        }
Beispiel #6
0
        /// <summary>
        /// EmailNewPassword
        /// </summary>
        /// <param name="userName">User Name</param>
        /// <param name="password">Password</param>
        /// <param name="loginUrl">Login URL</param>
        private bool EmailNewPassword(string userName, string password, string loginUrl)
        {
            bool emailNewPasswordSuccess;

            try
            {
                var    mailer = new UserMailer();
                string mailTo = Membership.Provider.GetUser(userName, false).Email;

                var msg = mailer.PasswordReset(
                    firstName: userName,
                    email: mailTo,
                    newPassword: password,
                    loginUrl: loginUrl);

                msg.Send();

                emailNewPasswordSuccess = true;
            }
            catch (Exception)
            {
                emailNewPasswordSuccess = false;
            }

            return(emailNewPasswordSuccess);
        }
        public ActionResult ForgotUsername(string emailAddress)
        {
            if (ModelState.IsValid)
            {
                //try to find a user with the email address.
                var username = (new UserFactory()).GetUsernameFromEmail(emailAddress);
                //if found, email them their username and show the return to login page
                if (!string.IsNullOrEmpty(username))
                {
                    //email and show the return
                    var mailer = new UserMailer();
                    mailer.ForgotUsername(username, emailAddress).Send();



                    //if everythign was successful, then we need to return the login redirect view
                    return(ReturnLoginRedirectView("The username for that account has been emailed.",
                                                   "Forgot Username - Emailed"));
                }
                //Otherwise, show the message that email doesnt exist in system

                ModelState.AddModelError("", "We could not find that email address on file.");
            }

            // If we got this far, something failed. redisplay form
            return(View());
        }
        public ActionResult ForgotPassword(ForgotPasswordModel model)
        {
            if (ModelState.IsValid && WebSecurity.UserExists(model.UserName))
            {
                var user       = db.UserProfiles.AsEnumerable().First(e => e.UserID == WebSecurity.GetUserId(model.UserName));
                var email      = user.ContactInfo.Email;
                var token      = Path.GetRandomFileName();
                var expiration = DateTime.Now.AddMinutes(60);

                user.RecoverPasswordToken      = token;
                user.RecoverPasswordExpiration = expiration;

                string encryptedToken = Encryption.Encrypt(token);
                model.Email = email;

                var mailer = new UserMailer();
                mailer.ForgotPassword(email, encryptedToken, user.UserID, Server.MapPath("~/Content/images/logo-wella.png")).Send();
                db.SaveChanges();
                return(View("ForgotPasswordEmailSent", model));
            }

            // If we got this far, something failed, redisplay form
            Error("O usuário '" + model.UserName + "' não existe.");
            return(View(model));
        }
Beispiel #9
0
        public virtual ActionResult ForgotPassword(string email, bool captchaValid, string captchaErrorMessage)
        {
            if (!captchaValid)
            {
                ModelState.AddModelError("captcha", captchaErrorMessage);
            }

            if (ModelState.IsValid)
            {
                var user = YouConfDbContext.UserProfiles
                           .FirstOrDefault(x => x.Email == email);

                if (user != null && user.UserId > 0 && OAuthWebSecurity.HasLocalAccount(user.UserId))
                {
                    string token = WebSecurity.GeneratePasswordResetToken(user.UserName);

                    //Send them an email
                    UserMailer mailer         = new UserMailer();
                    var        mvcMailMessage = mailer.PasswordReset(user.Email, user.UserName, token);
                    var        emailMessage   = new SendEmailMessage()
                    {
                        Body    = mvcMailMessage.Body,
                        To      = user.Email,
                        Subject = "Password reset request"
                    };
                    SendQueueMessage(emailMessage);


                    return(View("PasswordResetEmailSent"));
                }
            }
            return(View());
        }
Beispiel #10
0
        /// <summary>
        /// Add the answer to Database
        /// </summary>
        /// <param name="data">Answer</param>
        public static void AddAnswer(Answer data, int questionID, int userid)
        {
            using (var db = new QaAContext())
            {
                data.Date       = DateTime.Now;
                data.UserId     = userid;
                data.QuestionId = questionID;
                db.Answers.Add(data);
                db.SaveChanges();

                HttpContext.Current.Cache.UpdateCache("AnsweredQuestions" + userid, data);
                HttpContext.Current.Cache.UpdateCache("AnswersToQuestion" + questionID, data);
                HttpContext.Current.Cache.UpdateCache("AnswersToQuestion" + questionID + "User" + userid, data);

                //Send mails to the subscripted users
                var         question       = db.Questions.Where(q => q.Id == questionID).SingleOrDefault();
                IUserMailer usermailer     = new UserMailer();
                var         tagsOfQuestion = question.QuestionHasTags.Select(s => s.TagId).ToList();
                var         tos            = db.UserProfiles.Where(up => (up.Subscriptions.Any(u => tagsOfQuestion.Any(x => x == u.TagId)) && up.Email != null && up.IsVerified == true)).ToList();

                foreach (var user in tos)
                {
                    usermailer.NewAnswer(question, user, data).SendAsync();
                }
            }
        }
        public ActionResult Contact(ContactVM contact)
        {
            var mailer = new UserMailer();

            mailer.Contact(contact.Name, contact.Email, contact.Title, contact.Message, Server.MapPath("~/Content/images/logo-wella.png")).Send();
            Success("Mensagem enviada com sucesso! Em breve entraremos em contato com você.");
            return(RedirectToAction("Contact"));
        }
        public ActionResult SendPasswordChangeSuccessEmail(string username)
        {
            Account acc = AccountRepos.Get(username);

            UserMailer mailer = new UserMailer();

            mailer.PasswordChangeSuccessMessage(acc.UserName).Send();
            return(RedirectToAction("RequestChangePasswordSuccess", "Account"));
        }
Beispiel #13
0
        public ActionResult Create(InvitationViewModel invitation)
        {
            if (ModelState.IsValid)
            {
                var org = db.Organizations.Find(invitation.OrganizationId);
                List <Invitation> invites = new List <Invitation>();
                foreach (var email in invitation.Emails.Split('\n'))
                {
                    Invitation invite = new Invitation()
                    {
                        CreatedDate      = DateTimeOffset.Now,
                        Email            = email.Trim(),
                        SalesPersonEmail = invitation.SalesPersonEmail,
                        Company          = org.Name,
                        OrganizationId   = invitation.OrganizationId,
                        Type             = invitation.Type
                    };

                    invites.Add(invite);
                    db.Invitations.Add(invite);
                }

                int count = db.SaveChanges();
                AddSuccess($"{count} invitations created.");

                // set the invite request to granted
                var request = db.InvitationRequests.Find(invitation.RequestId);
                if (request != null)
                {
                    request.Status = RequestStatus.Granted;
                    db.SaveChanges();
                }

                if (count > 0)
                {
                    IUserMailer UserMailer = new UserMailer();
                    foreach (var i in invites)
                    {
                        try {
                            System.Net.Mail.Attachment at  = new System.Net.Mail.Attachment(Server.MapPath("~/Content/VaworksInstructions.pdf"));
                            Mvc.Mailer.MvcMailMessage  msg = UserMailer.Invitation(i);
                            msg.Attachments.Add(at);
                            msg.Send();
                        } catch (Exception ex) {
                            return(View("MailDown", ex));
                        }
                    }
                }
                return(Confirmation());
            }

            PopulateDropDown(invitation.OrganizationId);
            return(View(invitation));
        }
Beispiel #14
0
        public bool SendFeedback(MailModel model)
        {
            model.FirstName = Token.FirstName;
            model.LastName  = Token.LastName;
            model.Email     = Token.Email;
            model.Username  = Token.Username;
            UserMailer mailer = new UserMailer();

            mailer.Contact(model).Send();

            return(true);
        }
        public ActionResult Contact(ContactVM contact)
        {
            var user = MemberHelper.GetUserProfile(db);

            contact.Name  = user.PersonalInfo.Name;
            contact.Email = user.ContactInfo.Email;

            var mailer = new UserMailer();

            mailer.Contact(contact.Name, contact.Email, contact.Title, contact.Message, Server.MapPath("~/Content/images/logo-wella.png")).Send();
            Success("Mensagem enviada com sucesso! Em breve entraremos em contato com você.");
            return(RedirectToAction("Contact"));
        }
Beispiel #16
0
        public static void ResponseNotification(ResponseVM response, string responsible, PortalContext db, HttpServerUtilityBase server)
        {
            foreach (var update in response.Updates)
            {
                update.RefundItem = db.RefundItems.First(r => r.RefundItemID == update.RefundItemID);
            }
            if (response.Updates.Length == 0 || response.Updates.All(u => u.Status == RefundItemStatus.REJECTED_NO_APPEAL))
            {
                return;
            }
            var mailer = new UserMailer();

            switch (response.OwnerType)
            {
            case ResponseOwnerType.EVENT:
                var Event = db.Events.Find(response.OwnerID);
                mailer.EventResponseNotification(
                    Event.Freelancer.RefundProfile.User.ContactInfo.Email,
                    "Freelancer",
                    responsible,
                    Event,
                    response.Updates,
                    server.MapPath("~/Content/images/logo-wella.png")
                    ).Send();
                break;

            case ResponseOwnerType.VISIT:
                var visit = db.Visits.Find(response.OwnerID);
                mailer.VisitResponseNotification(
                    visit.Freelancer.RefundProfile.User.ContactInfo.Email,
                    "Freelancer",
                    responsible,
                    visit,
                    response.Updates,
                    server.MapPath("~/Content/images/logo-wella.png")
                    ).Send();
                break;

            case ResponseOwnerType.MONTHLY:
                var monthly = db.Monthlies.Find(response.OwnerID);
                mailer.MonthlyResponseNotification(
                    monthly.Freelancer.RefundProfile.User.ContactInfo.Email,
                    "Freelancer",
                    responsible,
                    monthly,
                    response.Updates,
                    server.MapPath("~/Content/images/logo-wella.png")
                    ).Send();
                break;
            }
        }
Beispiel #17
0
        /**
         *  Vytvori uzivatele dle zadaneho emailu, vygeneruje mu nahodne heslo a zasle informacni email
         */
        public WpUser createUserInWordpress(string email)
        {
            // navratova hodnota
            var user = new WpUser();
            // vygeneruj heslo
            var password = this.generatePassword(10);

            // email a heslo jsou pouzitelne
            if (this.isValidEmail(email) && !String.IsNullOrEmpty(password))
            {
                // vytvor wp ucet
                try
                {
                    user       = this.SendRESTrequest(email, password);
                    user.email = email;
                }
                catch (Exception ex)
                {
                    user.code    = "create_account_fail";
                    user.email   = email;
                    user.message = String.Format("Nepodarilo se vytvorit ucet {0} ve wordpressu!", email);
                    user.data    = ex.ToString();
                }
                // posli email s heslem
                if (user.isValidUser())
                {
                    try
                    {
                        IUserMailer userMailer = new UserMailer();
                        var         emailer    = userMailer.SendUserCreatedJT(email, password);
                        emailer.Send();
                    }
                    catch (Exception ex)
                    {
                        user.code    = "send_email_fail";
                        user.email   = email;
                        user.message = String.Format("Nepodarilo se odeslat email uzivateli '{0}' s heslem '{1}'!", user.email, user.password);
                        user.data    = ex.ToString();
                    }
                }
            }
            else
            {
                // pridej chybovou hlasku
                user.code    = "bad_email_or_password";
                user.email   = email;
                user.message = "Chybne zadany email nebo spatne vygenerovane heslo!";
            }

            return(user);
        }
Beispiel #18
0
        public ActionResult RequestAccess(RequestInviteViewModel model)
        {
            if (ModelState.IsValid)
            {
                var invitationRequest = new InvitationRequest()
                {
                    RequestDate = DateTimeOffset.Now,
                    Company     = model.Company + " " + model.Comments,
                    Email       = model.Email,
                    Name        = model.Name,
                    Status      = RequestStatus.New
                };

                Database.InvitationRequests.Add(invitationRequest);

                Database.SaveChanges();

                var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(Database));

                var admins = from role in roleManager.Roles
                             where role.Name == "System Administrator"
                             from u in role.Users
                             select u.UserId;

                IUserMailer mailer = new UserMailer();
                foreach (var admin in admins)
                {
                    Database.SystemMessages.Add(new SystemMessage()
                    {
                        UserId   = admin,
                        DateSent = DateTimeOffset.Now,
                        Message  = $"{model.Name} from {model.Company} is requesting access."
                    });

                    // send the admin an email
                    var email = Database.Users.Where(u => u.Id == admin).FirstOrDefault().Email;

                    try {
                        mailer.InvitationRequest(invitationRequest, email).Send();
                    } catch (Exception ex) {
                        return(View("MailDown", ex));
                    }
                    return(View("RequestAccessConfirmation"));
                }

                return(View("RequestAccessConfirmation"));
            }

            return(View(model));
        }
        public ActionResult Invite(EmailaddressesViewModel invitedemails)
        {
            if (ModelState.IsValid)
            {
                int    userid        = invitedemails.UserID;
                string invalidemails = "";

                char[] delimiters = (",: ").ToCharArray();

                List <string> emails = invitedemails.Emailaddresses.Split(delimiters).ToList();
                IUserMailer   mailer = new UserMailer();


                EmailModel emailmodel = new EmailModel();
                emailmodel.From = db.UserProfiles.Where(x => x.UserId == userid).First().UserName;

                foreach (var emailaddress in emails)
                {
                    if (IsValidEmail(emailaddress))
                    {
                        emailmodel.To = emailaddress;

                        Common.sendMail(emailmodel, EmailExist(emailaddress));
                        InsertRequestInfo(userid, emailmodel.From, emailmodel.To);
                    }
                    else
                    {
                        invalidemails = invalidemails + "," + emailaddress;
                    }
                }
                if (invalidemails == "")
                {
                    //AccountController acc = new AccountController();
                    return(RedirectPage(userid));
                }

                else
                {
                    invitedemails.Emailaddresses = invalidemails;
                }


                invitedemails.ErrorMessage = "Please correct these emailaddresses";
                return(View(invitedemails));
            }
            else
            {
                return(View());
            }
        }
    void EmaiSenderWorker(object state)
    {
        var mystate = state as WorkerState;

        if (mystate != null && mystate.HttpContextReference != null)
        {
            System.Web.HttpContext.Current = mystate.HttpContextReference;
        }
        var mail = new UserMailer();
        var msg  = mail.Welcome();

        msg.SendAsync();
        s_reset.Set();
    }
        private void SendMonthlyNotification(UserProfile user, Monthly Monthly)
        {
            var mailer = new UserMailer();

            foreach (var manager in user.RefundProfile.Freelancer.Managers)
            {
                mailer.SendMonthlyNotification(
                    manager.RefundProfile.User.ContactInfo.Email,
                    Url.Action("MonthlyDetail", "Manager", new { @id = Monthly.MonthlyID }),
                    user.PersonalInfo.ArtisticName ?? user.PersonalInfo.Name,
                    Monthly.Month.DisplayName(),
                    Server.MapPath("~/Content/images/logo-wella.png")
                    ).Send();
            }
        }
        public ActionResult SendNotifyFailedLoginEmail(string username)
        {
            Account account = AccountRepos.Get(username);
            EmailNotifyFailedLoginAttemptModel model = new EmailNotifyFailedLoginAttemptModel()
            {
                SiteName = siteName,
                SiteUrl  = siteUrl,
                ToEmail  = account.Email,
            };

            UserMailer mailer = new UserMailer();

            mailer.NotifyFailedLoginAttemptMessage(model).Send();
            return(RedirectToAction("RequestChangePasswordSuccess", "Account"));
        }
        public ActionResult Contact(ContactVM contact)
        {
            var membership = (SimpleMembershipProvider)Membership.Provider;
            var userID     = membership.GetUserId(Membership.GetUser().UserName);
            var employee   = db.Employees.First(u => u.UserID == userID);

            contact.Name  = employee.ComercialName;
            contact.CPF   = employee.CPF;
            contact.Email = employee.Email;

            var mailer = new UserMailer();

            mailer.Contact(contact.Name, contact.CPF, contact.Email, contact.Title, contact.Message, Server.MapPath("~/Content/images/logo-with-products-smaller.png")).Send();
            Success("Mensagem enviada com sucesso! Em breve entraremos em contato com você.");
            return(RedirectToAction("Contact"));
        }
Beispiel #24
0
        private static void SendCanceledEmail(TicketOrder ticketOrder, string projectName)
        {
            TicketOrderCanceledViewModel ticketOrderCanceledViewModel = new TicketOrderCanceledViewModel()
            {
                Email          = ticketOrder.Email,
                ProjectName    = projectName,
                VariableSymbol = ticketOrder.VariableSymbol,
                ReserverdUntil = ticketOrder.ReservedUntil.Value.ToShortDateString(),
                ProjectID      = ticketOrder.ProjectID
            };

            IUserMailer userMailer = new UserMailer();
            var         email      = userMailer.SendTicketOrderCanceled(ticketOrderCanceledViewModel);

            email.Send();
        }
 public ActionResult AddEnquiry(EnquiryFormEntry enquiryFormEntry)
 {
     if (ModelState.IsValid)
     {
         var enquiryForm = new EnquiryFormEntry();
         enquiryForm.Name        = HttpUtility.HtmlEncode(enquiryFormEntry.Name);
         enquiryForm.Email       = enquiryFormEntry.Email;
         enquiryForm.Message     = HttpUtility.HtmlEncode(enquiryFormEntry.Message);
         enquiryForm.PhoneNumber = enquiryFormEntry.PhoneNumber;
         db.EnquiryFormEntries.Add(enquiryForm);
         db.SaveChanges();
         var userMailer = new UserMailer();
         userMailer.VerifyEmail(enquiryForm).Send();
         return(RedirectToAction("Index"));
     }
     return(View("Index"));
 }
        public HttpResponseMessage Contact(MailModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            if (Request.Headers.Authorization.ToString() != ConfigurationManager.AppSettings["AuthorizationHeader"])
            {
                return(Request.CreateResponse(HttpStatusCode.Unauthorized));
            }

            var mailer = new UserMailer();

            mailer.Contact(model).Send();

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
        protected async Task SendDailyAsync(UserMailer user_mailer, SubscriptionViewModel subscription, List <ListArticleViewModel> articles)
        {
            try
            {
                await user_mailer.SendEmail(subscription.Email, "DailyEmail", articles, subscription.UnsubscriptionToken).SendAsync();

                servicesManager.AccountService.EmailSent(subscription.Email, DailyEmailCampagin);

                //log this sent
                servicesManager.AccountService.LogSubscription(subscription.UserName, subscription.UserId.ToString(), subscription.Email, Server.MapPath("~/newsletter-log/"));
            }catch (Exception e)
            {
                logService.WriteError(e.Message, e.Message, e.StackTrace, e.Source);
                servicesManager.AccountService.LogSubscription(e.Message, e.StackTrace.ToString(), subscription.Email, Server.MapPath("~/newsletter-log/"));
                ModelState.AddModelError("", "Issue sending email: " + e.Message);
                servicesManager.AccountService.Unsubscribe(subscription.Email, DailyEmailCampagin);
            }
        }
        private void SendVisitNotification(UserProfile user, Visit Visit)
        {
            if (Visit.Refund == null || Visit.Refund.RefundItems == null || Visit.Refund.RefundItems.Count <= 0)
            {
                return;
            }
            var mailer = new UserMailer();

            foreach (var manager in user.RefundProfile.Freelancer.Managers)
            {
                mailer.SendVisitNotification(
                    manager.RefundProfile.User.ContactInfo.Email,
                    Url.Action("VisitDetail", "Manager", new { @id = Visit.VisitID }),
                    user.PersonalInfo.ArtisticName ?? user.PersonalInfo.Name,
                    Visit.Date.ToString("dd/MM/yyyy"),
                    Server.MapPath("~/Content/images/logo-wella.png")
                    ).Send();
            }
        }
        public ActionResult SendAccountConfirmationEmail(string username, string token)
        {
            Account account = AccountRepos.Get(username);
            EmailConfirmationModel model = new EmailConfirmationModel()
            {
                SiteName          = siteName,
                SiteUrl           = siteUrl,
                UserName          = account.UserName,
                FirstName         = account.FirstName,
                ToEmail           = account.Email,
                ConfirmationToken = token,
                ConfirmationUrl   = siteUrl + "/Account/ConfirmAccount?u=" + account.UserName + @"&t" + token
            };

            UserMailer mailer = new UserMailer();

            mailer.ConfirmationTokenMessage(model).Send();
            return(RedirectToAction("RegistrationSuccess", "Account"));
        }
        public ActionResult SendPasswordResetEmail(string username, string token)
        {
            Account account = AccountRepos.Get(username);
            EmailPasswordResetModel model = new EmailPasswordResetModel()
            {
                SiteName           = siteName,
                SiteUrl            = siteUrl,
                FirstName          = account.FirstName,
                UserName           = account.UserName,
                ToEmail            = account.Email,
                PasswordResetToken = token,
                PasswordResetUrl   = siteUrl + "/Account/ChangePassword?u=" + account.UserName + @"&t=" + token
            };

            UserMailer mailer = new UserMailer();

            mailer.PasswordResetMessage(model).Send();
            return(RedirectToAction("RequestChangePasswordSuccess", "Account"));
        }