Ejemplo n.º 1
0
        public async Task <ActionResult> ForgotPassword(ForgotPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindByNameAsync(model.Email);

                if (user == null || !(await UserManager.IsEmailConfirmedAsync(user.Id)))
                {
                    // Don't reveal that the user does not exist or is not confirmed
                    return(View("ForgotPasswordConfirmation"));
                }

                // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                // Send an email with this link
                string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);

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

                // send mail
                var emailUtility = new EmailUtility();
                var emailParams  = new Dictionary <String, String>();
                emailParams.Add("UserName", model.Email);
                emailParams.Add("ResetPasswordLink", callbackUrl);
                await emailUtility.SendEmail("ResetPasswordEmail", model.Email, emailParams);

                // await DomingoUserManager.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>");
                return(RedirectToAction("ForgotPasswordConfirmation", "Account"));
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Ejemplo n.º 2
0
 private void sendButton_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(nameTextBox.Text) || string.IsNullOrEmpty(emailTextBox.Text) || string.IsNullOrEmpty(problemTextBox.Text) || !RegexUtilities.IsValidEmail(emailTextBox.Text))
     {
         int    errorIndex  = 1;
         string errorString = string.Empty;
         if (string.IsNullOrEmpty(nameTextBox.Text))
         {
             errorString += errorIndex + ". Please enter your first and last name in the box next to \"Your Name\".\n"; errorIndex++;
         }
         if (string.IsNullOrEmpty(emailTextBox.Text))
         {
             errorString += errorIndex + ". Please enter your preferred email address in the box next to \"Your Email\".\n"; errorIndex++;
         }
         if (string.IsNullOrEmpty(problemTextBox.Text))
         {
             errorString += errorIndex + ". Please describe your problem in the box next to \"Your Problem\".\n"; errorIndex++;
         }
         if (!RegexUtilities.IsValidEmail(problemTextBox.Text))
         {
             errorString += errorIndex + ". The provided email address is invalid.\n"; errorIndex++;
         }
         MessageBox.Show("One or more form section has not been filled out correctly, see below.\n\n" + errorString, "Form Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         EmailUtility.SendRequest(emailTextBox.Text, nameTextBox.Text, problemTextBox.Text);
     }
 }
Ejemplo n.º 3
0
        public async Task <ActionResult> GenerateVerifyCode()
        {
            string code = await UserManager.GenerateEmailConfirmationTokenAsync(User.Identity.GetUserId());

            var _regViewModel = new RegisterViewModel()
            {
                Email = User.Identity.GetUserName()
            };
            var user = UserManager.FindByEmail(_regViewModel.Email);

            var callbackUrl  = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
            var emailUtility = new EmailUtility();
            var emailParams  = new Dictionary <String, String>();

            emailParams.Add("UserName", _regViewModel.Email);
            emailParams.Add("ActivationLink", callbackUrl);
            await emailUtility.SendEmail("VerifiyEmail2", _regViewModel.Email, emailParams);

            var model = new VerifyEmailViewModel()
            {
                Mode = "codegenerated"
            };

            return(View("Verify", model));
        }
    private string SendMail(string emailid, string mailsubject, string mailcontent)
    {
        string Response = string.Empty;

        if (!string.IsNullOrEmpty(emailid))
        {
            ArrayList alistEmailAddress = new ArrayList();
            alistEmailAddress.Add(emailid);
            if (alistEmailAddress.Count > 0)
            {
                bool IsSendSuccess = EmailUtility.SendEmail(alistEmailAddress, mailsubject, mailcontent);
                if (IsSendSuccess)
                {
                    Response = "Send email successfully.";
                }
                else
                {
                    Response = "Send email failed.";
                }
            }
        }
        else
        {
            Response = "Send email failed.[Email address is empty]";
        }
        return(Response);
    }
Ejemplo n.º 5
0
 public Task SendAsync(IdentityMessage message)
 {
     EmailUtility.SendMessage(message.Destination, ConfigurationManager.AppSettings["FromEmailAddress"],
                              ConfigurationManager.AppSettings["FromEmailName"],
                              message.Subject, message.Body);
     return(Task.FromResult(0));
 }
Ejemplo n.º 6
0
        public async Task <ActionResult> RegisterManager(int id, RegisterViewModel model)
        {
            if (model.isOwner || model.RestaurantId != id)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            model.Password        = GeneratePassword();
            model.ConfirmPassword = model.Password;
            var user = await CreateUser(model);

            if (user != null)
            {
                string path   = Url.Action("Login");
                string domain = Url.RequestContext.HttpContext.Request.Url.GetLeftPart(UriPartial.Authority);
                string url    = domain + path;
                string body   = "You have been registered for the 68 application.  Your temporary password is as follows:\n\n";
                body += model.Password;
                body += "\n\nThe following is a link to the login page:\n\n" + url;
                EmailUtility.sendMail(model.Email, body, "68 Manager Registration: Confirm Password");
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(View(model));
            }
        }
Ejemplo n.º 7
0
        private void PrepareEmail(List <TaskDTO> emaillist)
        {
            try
            {
                foreach (var item in emaillist)
                {
                    if (item.ToEmail != string.Empty)
                    {
                        string status = StringUtility.StatusAlive;

                        if (item.PreviousState == (int)TaskStatusEnum.Dead)
                        {
                            status = StringUtility.StatusDead;
                        }

                        string subject = string.Format(StringUtility.EmailSubject, item.Entity, status, DateTime.UtcNow.ToString());

                        Task.Run(() =>
                        {
                            EmailUtility.SendEmail(item.ToEmail, subject, StringUtility.EmailBody, _configuration);
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 8
0
        public int SendPassword(string sUsername, string sAppPath)
        {
            var ds = Dal.GetUserByUsername(sUsername);

            if (ds == null || ds.Tables[0].Rows.Count == 0 || ds.Tables[0].Rows[0]["Password"] == DBNull.Value)
            {
                return(0);
            }
            else
            {
                var password = ds.Tables[0].Rows[0]["Password"].ToString();

                var file_name   = sAppPath + Settings.Default.ForgotPswdFile;
                var str_subject = Utility.GetFileText(file_name, "SUBJECT");
                var str_body    = Utility.GetFileText(file_name, "BODY");
                str_body = str_body.Replace("[p_pswd]", password);
                var to = new string[1];
                to[0] = sUsername + "@gsa.gov";

                var email = new EmailUtility();
                email.Subject     = str_subject;
                email.MessageBody = str_body;
                email.To          = to;
                email.SendEmail();

                return(1);
            }
        }
Ejemplo n.º 9
0
        public ActionResult Create([Bind(Include = "product_ID,Amount")] Bid bid)
        {
            if (ModelState.IsValid)
            {
                Product prod   = db.Products.Find(bid.product_ID);
                var     userid = User.Identity.GetUserId();
                var     user   = db.Users.Find(userid);
                bid.User_ID = userid;
                bid.Time    = DateTime.Now;
                db.Bids.Add(bid);
                db.SaveChanges();
                EmailUtility.sendMail(user.EmailAddress, "This is to confirm your bid on " + prod.productName + " for the amount of " + bid.Amount);
                ViewBag.confirmMsg = "A confirmation email for your bid has been sent to you.";

                return(View("EmailConfirmation"));



                return(RedirectToAction("Index"));
            }

            ViewBag.product_ID = new SelectList(db.Products, "product_ID", "Auction1", bid.product_ID);
            ViewBag.User_ID    = new SelectList(db.Users, "User_ID", "LastName", bid.User_ID);
            return(View(bid));
        }
Ejemplo n.º 10
0
        public void ProcessValidEmail(Chilkat.Email email)
        {
            //Raise event
            var emailEventArgs = new MyEmailEventArgs();

            emailEventArgs.From    = EmailUtility.CleanEmailAddress(email.From);
            emailEventArgs.Subject = email.Subject;
            emailEventArgs.Uidl    = email.Uidl;
            emailEventArgs.Content = email.Body;
            OnFoundEmail(emailEventArgs);



            //int numAttached;
            //bool success;

            //numAttached = email.NumAttachments;
            //if (numAttached > 0)
            //{
            //    success = email.SaveAllAttachments(email.Uidl + "myAttachments");
            //    if (success != true)
            //    {
            //        Console.WriteLine(email.LastErrorText);
            //    }
            //}
        }
        protected void btnUpdateStatus_Click(object sender, EventArgs e)
        {
            DataTable dtUsers;

            if (CurrentUser.RoleID == (int)Constants.Role.TruongBoPhanKhoiHoTro || CurrentUser.RoleID == (int)Constants.Role.TruongBoPhanKhoiKinhDoanh)
            {
                dtUsers = UserController.GetUsersByNguoiDanhGiaTheoThang(txtKeyword.Text, dropSearchBy.SelectedValue, ConvertUtility.ToString(ViewState["Alphabet"]), CurrentUser.UserID, CurrentUser.IDTrungTam, idDotDanhGia, CurrentUser.RoleID, ConvertUtility.ToInt32(dropChucVu.SelectedValue));
            }
            else
            {
                dtUsers = UserController.GetUsersByNguoiDanhGiaTheoThang(txtKeyword.Text, dropSearchBy.SelectedValue, ConvertUtility.ToString(ViewState["Alphabet"]), CurrentUser.UserID, CurrentUser.IDTrungTam, idDotDanhGia, (int)Constants.Role.TruongPhong, ConvertUtility.ToInt32(dropChucVu.SelectedValue));
            }

            foreach (DataRow item in dtUsers.Rows)
            {
                if (ConvertUtility.ToInt32(item["TrangThai"]) == 6 || ConvertUtility.ToInt32(item["TrangThai"]) == 7 || ConvertUtility.ToInt32(item["TrangThai"]) == 8)
                {
                    DotDanhGiaController.GuiDanhGiaThang(idDotDanhGia, ConvertUtility.ToInt32(item["UserID"]), (int)Constants.TrangThaiDanhGiaNhanVien.ThongNhat);

                    EmailUtility.DoSendMail(item["Email"].ToString(), "", "Trưởng bộ phận đã thống nhất bảng đánh giá tháng", "Người phụ trách trực tiếp đã đánh giá công việc tháng của bạn. Đề nghị bạn đăng nhập phần mềm để xem kết quả đánh giá.");
                }
            }

            lblUpdateStatus.Text = "Bạn vừa thống nhất kết quả thành công";
        }
Ejemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="FIRST_NAME"></param>
        /// <param name="LAST_NAME"></param>
        /// <param name="EMAIL"></param>
        /// <param name="PHONE"></param>
        /// <param name="TRIP_REQUEST"></param>
        /// <returns></returns>
        public static async Task <DomingoBlError> CreateCrmLeadExternal(string FIRST_NAME, string LAST_NAME, string EMAIL, string PHONE, string TRIP_REQUEST)
        {
            try
            {
                // send a mail to the customer
                var emailUtility = new EmailUtility();
                var emailParams  = new Dictionary <String, String>();
                emailParams.Add("UserName", FIRST_NAME);
                await emailUtility.SendEmail("ContactUs", EMAIL, emailParams);

                // create a lead in the capsule CRM
                var gateway     = new CapsupleCrmGateway();
                var crmResponse = await gateway.CreateCapsuleLead(FIRST_NAME, LAST_NAME, EMAIL, PHONE, TRIP_REQUEST);

                return(new DomingoBlError()
                {
                    ErrorCode = 0, ErrorMessage = ""
                });
            }
            catch (Exception ex)
            {
                return(new DomingoBlError()
                {
                    ErrorCode = 100, ErrorMessage = ex.Message
                });
            }
        }
Ejemplo n.º 13
0
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                try
                {
                    var validationGuid = Guid.NewGuid();

                    WebSecurity.CreateUserAndAccount(
                        model.UserName,
                        model.Password,
                        new { DisplayName = model.DisplayName, ValidationToken = validationGuid, IsValid = false });

                    EmailUtility.SendEmail(
                        model.UserName,
                        model.DisplayName,
                        "Thank you for signing up for BookSpade!",
                        string.Format("Confirm your registration by clicking <a href=\"http://localhost:26793/Account/validate/{0}\" > here </a>", validationGuid)
                        );

                    return(View("ValidateRequest"));
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
 public JsonResult VisitorNotify(DAL.db.Appointment appointment)
 {
     appointment.ReachTime        = DateTime.Now;
     emailUtility                 = new EmailUtility();
     unScheduleAppointmentFactory = new UnScheduleAppointmentFactorys();
     result = unScheduleAppointmentFactory.SaveAppointment(appointment);
     if (result.isSucess)
     {
         //if (emailUtility.IsInternetConnected())
         //{
         //    var email = db.Employees.Where(x => x.EmployeeID == appointment.EmployeeID).FirstOrDefault();
         //    if (email != null && email.Email != null)
         //    {
         //        bool isMail = emailUtility.SentMail(email.Email, appointment.CompanyName, appointment.VisitorName, "", "");
         //        if (isMail)
         //        {
         //            result.message = "Notify And Email Successful.";
         //        }
         //        return Json(result, JsonRequestBehavior.AllowGet);
         //    }
         //}
         result.message = "Notify Successful.";
     }
     return(Json(result, JsonRequestBehavior.AllowGet));
 }
    protected void btnSendInteraction_click(object sender, EventArgs e)
    {
        foreach (ListViewItem item in lvstudent.Items)
        {
            string    InteractionDate = string.Empty;
            string    InteractionTime = string.Empty;
            string    AdmissionID     = string.Empty;
            string    MailFrom        = string.Empty;
            string    MailTo          = string.Empty;
            string    MailSubject     = string.Empty;
            string    MailBody        = string.Empty;
            string    FailiurReason   = string.Empty;
            ArrayList ArrMailTo       = new ArrayList();

            HtmlInputCheckBox interactioncheck = (HtmlInputCheckBox)item.FindControl("interactioncheck");
            if (interactioncheck.Checked)
            {
                TextBox interactiondate = (TextBox)item.FindControl("interactiondate");
                InteractionDate = interactiondate.Text;
                TextBox interactiontime = (TextBox)item.FindControl("interactiontime");
                InteractionTime = interactiontime.Text;
                Label       communicationemail = (Label)item.FindControl("communicationemail");
                HiddenField hdnAdmissionID     = (HiddenField)item.FindControl("hdnAdmissionID");

                AdmissionID = hdnAdmissionID.Value;
                MailFrom    = EmailUtility.SMTPEmailAddress;
                MailTo      = communicationemail.Text;
                MailSubject = GetMailSubject();
                MailBody    = GetMailBody(InteractionDate, InteractionTime);

                if (!string.IsNullOrEmpty(InteractionDate) && !string.IsNullOrEmpty(InteractionTime) && !string.IsNullOrEmpty(MailTo) && !string.IsNullOrEmpty(AdmissionID))
                {
                    ArrMailTo.Add(MailTo);
                    bool IsSendSuccess = EmailUtility.SendEmail(ArrMailTo, MailSubject, MailBody, out FailiurReason);

                    BAL_Admission        oBAL_Admission        = new BAL_Admission();
                    AdmissionInteraction oAdmissionInteraction = new AdmissionInteraction();

                    oAdmissionInteraction.AdmissionId     = AdmissionID;
                    oAdmissionInteraction.InteractionDate = InteractionDate;
                    oAdmissionInteraction.InteractionTime = InteractionTime;
                    oAdmissionInteraction.MailFrom        = MailFrom;
                    oAdmissionInteraction.MailTo          = MailTo;
                    oAdmissionInteraction.MailSubject     = MailSubject;
                    oAdmissionInteraction.MailBody        = MailBody;
                    oAdmissionInteraction.IsSendSuccess   = IsSendSuccess;
                    oAdmissionInteraction.FailureReasons  = GetValue(FailiurReason);
                    oAdmissionInteraction.CreatedBy       = Convert.ToString(AppSessions.EmpolyeeID);

                    oBAL_Admission.AdmissionInteraction_Insert(oAdmissionInteraction);
                }
            }
        }
        BindGrid();

        mainpopup.Attributes["class"] = "overlayone";
        msg.InnerHtml = "Your operation has been successfully completed.";
    }
Ejemplo n.º 16
0
 protected void BttnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         DataSet ds = new DataSet();
         OEmployee          = new Employee();
         BAL_Forgetpassword = new Teacher_Dashboard_BLogic();
         OEmployee.emailid  = uctxtEmail.Text;
         ArrayList arrParameter = new ArrayList();
         string    subjectEmail = "Login Information";
         arrParameter.Add(uctxtEmail.Text);
         ds = BAL_Forgetpassword.BAL_Emailid_Select(OEmployee);
         ViewState["PasswordData"] = ds;
         if (ds.Tables.Count > 0 & ds != null)
         {
             if (ds.Tables[0].Rows.Count > 0)
             {
                 if (EmailUtility.SendEmail(arrParameter, subjectEmail, GenerateMailBodyForgetPassword()))
                 {
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Password has been sent to your email successfully.');window.location ='Login.aspx';", true);
                     ClearControls();
                 }
                 else
                 {
                     WebMsg.Show("Email Failed");
                     ClearControls();
                 }
             }
             else if (ds.Tables[1].Rows.Count > 0)
             {
                 if (EmailUtility.SendEmail(arrParameter, subjectEmail, GenerateEmailBody()))
                 {
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Password has been sent to your email successfully.');window.location ='Login.aspx';", true);
                     ClearControls();
                 }
                 else
                 {
                     WebMsg.Show("Email Failed");
                     ClearControls();
                 }
             }
             else
             {
                 WebMsg.Show("Invalid Email");
                 ClearControls();
             }
         }
         else
         {
             WebMsg.Show("Invalid Email");
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Ejemplo n.º 17
0
 public void IsValid()
 {
     Assert.IsTrue(EmailUtility.IsValid("*****@*****.**"));
     Assert.IsTrue(EmailUtility.IsValid("*****@*****.**"));
     Assert.IsTrue(EmailUtility.IsValid("*****@*****.**"));
     Assert.IsFalse(EmailUtility.IsValid("nodot@mailcom"));
     Assert.IsFalse(EmailUtility.IsValid("no.dot@mail"));
     Assert.IsFalse(EmailUtility.IsValid("no.no.no.no.dot@mydomain"));
 }
Ejemplo n.º 18
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                EmailUtility.sendMail(model.Email, "Welcome to An Apple A Day. Thank you " + model.firstName + "for Registering. This is a place where teachers can get hello from the community. We are happy that have joined us.");

                //User Role code
                var roleStore   = new RoleStore <IdentityRole>(context);
                var roleManager = new RoleManager <IdentityRole>(roleStore);
                var userStore   = new UserStore <ApplicationUser>(context);
                var userManager = new UserManager <ApplicationUser>(userStore);

                ////user role code --end


                if (result.Succeeded)
                {
                    var teacher = new Teacher
                    {
                        firstName = model.firstName,
                        lastName  = model.lastName,
                        gender    = model.gender.ToString(),
                        state     = model.state,
                        city      = model.city,
                        dob       = model.dob,
                        zip       = model.zip,
                        teachId   = user.Id
                    };

                    using (var db = new AnAppleADay_01Entities())
                    {
                        db.Teachers.Add(teacher);
                        db.SaveChanges();
                    }

                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    userManager.AddToRole(user.Id, "User");
                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Ejemplo n.º 19
0
        public ActionResult TestEmail()
        {
            var to = new List <string>();

            to.Add("*****@*****.**");
            EmailUtility.SendEmail(this, "TEST NEW EMAIL SERVER3", to, "Hello World3");
            new System.Threading.ManualResetEvent(false).WaitOne(500);
            return(View("All"));
        }
Ejemplo n.º 20
0
 public ActionResult SendEmail([Bind(Include = "emailID,name,email,subject,category,message")] Email emailModel)
 {
     if (ModelState.IsValid)
     {
         db.Emails.Add(emailModel);
         db.SaveChanges();
     }
     EmailUtility.sendMail(emailModel.email, emailModel.message, emailModel.subject);
     return(View("Index"));
 }
Ejemplo n.º 21
0
        public async Task <ActionResult> Send(string to, string subject, string message)
        {
            var userTo = await _userRepository.Get(to);

            var userFrom = await _userRepository.GetUser(User.Identity.Name);

            EmailUtility.SendMsg("*****@*****.**", userTo.Email, subject, message, userFrom.Email);

            return(View());
        }
Ejemplo n.º 22
0
 public ActionResult AddComment(CommentIDs commentform)
 {
     try
     {
         MvcApplication.CraftsPrincipal user = (MvcApplication.CraftsPrincipal) base.HttpContext.User;
         if (base.ModelState.IsValid)
         {
             if (string.IsNullOrEmpty(commentform.myComment))
             {
                 return this.redirect("error=1");
             }
             if (user.UserName == null)
             {
                 return this.redirect("error");
             }
             string safeHtmlFragment = Sanitizer.GetSafeHtmlFragment(commentform.myComment.Replace("\r\n", " "));
             int commentCount = this._commentrepository.GetCommentCount(commentform.ComponentID);
             string data = this._commentrepository.AddComment(safeHtmlFragment, commentform.ComponentID, user.UserName, user.DISPLAYNAME);
             if (!data.Equals("0"))
             {
                 try
                 {
                     IComponent componentInfo = this.GetComponentInfo(commentform.ComponentID);
                     Models.CommentEmail model = new Models.CommentEmail
                     {
                         ComponentName = ((TridionItem) componentInfo).Title,
                         ComponentID = commentform.ComponentID,
                         User = user.UserName
                     };
                     EmailUtility utility = new EmailUtility();
                     string toEmailAddress = ConfigurationManager.AppSettings["CommentModerationAdminEmail"];
                     string fromEmailAddress = ConfigurationManager.AppSettings["PasswordReminderEmailFrom"];
                     string emailTemplate = ConfigurationManager.AppSettings["CommentModerationAdminEmailTemplate"];
                     string str6 = utility.SendEmail(model, emailTemplate, fromEmailAddress, toEmailAddress);
                     this.Logger.DebugFormat("CommnetsController : Comments received Email > result {0}", new object[] { str6 });
                 }
                 catch (Exception)
                 {
                     this.Logger.Debug("Unable to send comments received Email to CountryAdmin.");
                 }
             }
             if (base.Request.IsAjaxRequest())
             {
                 return base.Json(data, JsonRequestBehavior.AllowGet);
             }
             return this.redirect("commented");
         }
         return this.redirect("error=1");
     }
     catch (Exception exception2)
     {
         this.Logger.DebugFormat("CommentsController > AddComment exception {0}", new object[] { exception2.Message });
         return this.redirect("error");
     }
 }
        public JsonResult sendEmailLogin(string email)
        {
            EmailUtility _emaUtility = new EmailUtility(_appSettings, _emailSettings);
            string       emailBody   = @"<p>Please login toIn-Service Compliance Application to start you test with following link</p>
                                    <br />
                                  <p><a href='" + _appSettings.Value.WebBaseURL + "/Account/Login'>" + _appSettings.Value.WebBaseURL + "/Login</a></p>";


            _emaUtility.SendEmail("", "Registration link for In-Service Compliance", emailBody, email.Split(","));
            return(Json("Email sent successfully"));
        }
Ejemplo n.º 24
0
        /// <summary>
        /// M3 User mail sends
        /// </summary>
        /// <param name="userLogin"></param>
        /// <returns></returns>
        private bool SendLoginSuccessMail(string emailAddress, string userFullName)
        {
            Infra.EmailDTO emailDTO = new Infra.EmailDTO();
            emailDTO.ToMail      = emailAddress;
            emailDTO.MailSubject = Infra.BusinessConstants.MAIL_M3USER_SUBJECT;
            string navigationLink = string.Format(Infra.BusinessConstants.M3USER_REDIRECTION, Helper.GetConfigurationKey(BusinessConstants.SERVER_BASE_ADDRESS));

            emailDTO.Body       = string.Format(Infra.BusinessConstants.MAIL_M3USER_BODY, userFullName, navigationLink);
            emailDTO.IsBodyHtml = true;
            return(EmailUtility.SendEmail(emailDTO));
        }
Ejemplo n.º 25
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Page.Title   = "Bulk Email Delete";
         H1.InnerHtml = "Bulk Email Delete";
         Master.MasterForm.Attributes.Add("enctype", "multipart/form-data");
     }
     else
     {
         _Messages = new List <string>();
         for (var i = 0; i < Request.Files.Count; i++)
         {
             var file = Request.Files[i];
             if (file.ContentLength == 0)
             {
                 continue;
             }
             try
             {
                 var address =
                     EmailUtility.ExtractUndeliverableEmailAddressFromMsg(file.InputStream);
                 if (DeleteCheckBox.Checked)
                 {
                     DoDeletions(address);
                 }
                 else
                 {
                     AnalyzeDeletions(address);
                 }
             }
             catch (Exception ex)
             {
                 _Messages.Add(
                     $"<p class=\"error\">Error processing file: {file.FileName}, {ex.Message}</p>");
             }
         }
         foreach (var address in ExtraAddresses.Text.Split(new[] { '\n' },
                                                           StringSplitOptions.RemoveEmptyEntries)
                  .Select(a => a.Trim()))
         {
             if (DeleteCheckBox.Checked)
             {
                 DoDeletions(address);
             }
             else
             {
                 AnalyzeDeletions(address);
             }
         }
         SummaryPlaceHolder.Controls.Add(new LiteralControl(string.Join(string.Empty, _Messages)));
         SummaryContainer.RemoveCssClass("hidden");
     }
 }
Ejemplo n.º 26
0
        public ActionResult EmailGroceryList()
        {
            HttpClient client       = new HttpClient();
            var        response     = client.GetAsync(Request.Url.GetLeftPart(UriPartial.Authority) + Url.Action("GroceryListPartial", new { id = User.Identity.GetUserId() })).Result;
            var        responseBody = response.Content.ReadAsStringAsync().Result;
            var        message      = @"<!DOCTYPE html>
<html><head><link rel=""stylesheet"" type=""text/css"" href=""https://localhost:44370/Content/Site.css""></head><body>" + responseBody + "</body></html>";

            EmailUtility.SendConfirmation(User.Identity.GetUserName(), message, $"eat smrt: Shopping List For {DateTime.Now.ToString("dddd, dd MMMM yyyy")}", true);
            return(new HttpStatusCodeResult(HttpStatusCode.NoContent));
        }
Ejemplo n.º 27
0
        private async Task _SendWelcomeEmail(string firstName, string lastName, string email)
        {
            var emailUtility = new EmailUtility();
            var emailParams  = new Dictionary <String, String>();

            emailParams.Add("FirstName", firstName);
            emailParams.Add("LastName", lastName);

            // create a task for sending the verification mail
            var blEmail = await emailUtility.SendEmail("WelcomeEmail", email, emailParams);
        }
Ejemplo n.º 28
0
        protected void btnYeuCauLamLaiDanhGia_Click(object sender, EventArgs e)
        {
            UserInfo info = UserController.GetUser(idNhanVien);

            if (info != null)
            {
                DotDanhGiaController.GuiDanhGiaThang(idDotDanhGia, idNhanVien, (int)Constants.TrangThaiDanhGiaNhanVien.DangDanhGia);

                EmailUtility.DoSendMail(info.EmailVNG, "", "Yêu cầu lập lại đánh giá tháng " + dropDotDanhGia.SelectedItem.Text, "TBP/TBP thấy bạn lập đánh giá tháng chưa hợp lý. Đề nghị bạn đăng nhập phần mềm để làm lại kế hoạch.");
            }
        }
        protected void btnMail_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow gv in dtgUsers.Rows)
            {
                Label lblMail      = (Label)gv.FindControl("lblMail");
                Label lblTrangThai = (Label)gv.FindControl("lblTrangThaiDG");

                bool value = EmailUtility.DoSendMail(lblMail.Text, "", "Mail nhắc nhở đánh giá checkpoint", GetNoiDungTheoTrangThai(ConvertUtility.ToInt32(lblTrangThai.Text)));
            }
            lblUpdateStatus.Text = "Bạn đã gửi mail thành công";
        }
Ejemplo n.º 30
0
        public static XmlDocument CreateXmlDocument()
        {
            var xmlDoc = new XmlDocument();

            try
            {
                using (var sqlConnection = SqlDBUtil.GetConnection())
                {
                    sqlConnection.Open();
                    var sqlcmd = new SqlCommand("[maint].[__UpdateManagers]", sqlConnection);
                    sqlcmd.CommandTimeout = 240;
                    sqlcmd.CommandType    = System.Data.CommandType.StoredProcedure;

                    Logger.LogEvent(" Executing stored procedure...");
                    using (XmlReader reader = sqlcmd.ExecuteXmlReader())
                    {
                        while (reader.Read())
                        {
                            xmlDoc.Load(reader);
                        }
                        xmlDoc.Save(file);

                        XmlDeclaration xmldecl;
                        xmldecl = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null);

                        XmlElement root = xmlDoc.DocumentElement;
                        xmlDoc.InsertBefore(xmldecl, root);

                        Logger.LogEvent(" File created!");
                        Logger.Log.Append(DateUtility.getTime() + " Path: " + file + "\r\n");
                    }

                    Logger.LogEvent(" Finished executing sp on server!");
                    Logger.WriteLogToFile();
                }
                return(xmlDoc);
            }
            catch (SqlException sqlEx)
            {
                EmailUtility.SendEmail("ORMIS DB/SQL EXCEPTION: " + "\r\n" + sqlEx.Message, "Import Failed!");
                Logger.LogException(sqlEx.Message);
                Logger.WriteLogToFile();
                throw;
            }

            catch (Exception ex)
            {
                EmailUtility.SendEmail("Other ORMIS DB/SQL EXCEPTION while executing stored procedure: " + "\r\n" + ex.Message, "Import Failed!");
                Logger.LogException(ex.Message);
                Logger.WriteLogToFile();
                throw;
            }
        }
Ejemplo n.º 31
0
 public bool SendEmail(CommonEmailVM commonEmailVM)
 {
     try
     {
         commonEmailVM.ApiKey = _config.GetSection("SEND_GRID_KEY").Value;
         var response = EmailUtility.SendEmail(commonEmailVM).Result;
         return(response.StatusCode == System.Net.HttpStatusCode.Accepted ? true : false);
     } catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 32
0
 public bool SendShoppingListEmail(ShoppingListEmail email)
 {
     bool flag = false;
     EmailUtility utility = new EmailUtility();
     try
     {
         utility.SendEmail(email, this._settings.ShoppingListEmailTemplate, this._settings.ShoppingListEmailFrom, email.EmailAddress);
         flag = true;
     }
     catch
     {
         throw;
     }
     return flag;
 }
 public ActionResult Index(PasswordReminder passwordreminder)
 {
     bool flag = base.Request.IsAjaxRequest();
     bool flag2 = false;
     bool flag3 = false;
     string resource = string.Empty;
     string str2 = string.Empty;
     this.Logger.Debug("PasswordReminderController > Index ");
     bool isValid = base.ModelState.IsValid;
     this.Logger.DebugFormat("PasswordReminderController > isValid {0}", new object[] { isValid });
     if (isValid)
     {
         if (passwordreminder.ReminderEmailAddress != null)
         {
             try
             {
                 MembershipUser user = Membership.GetUser(passwordreminder.ReminderEmailAddress, false);
                 this.Logger.DebugFormat("PasswordReminderController > user {0}", new object[] { user == null });
                 if (user != null)
                 {
                     CoatsUserProfile profile = CoatsUserProfile.GetProfile(user.Email);
                     this.Logger.DebugFormat("PasswordReminderController > coatsUserProfile {0}", new object[] { profile == null });
                     string fromEmailAddress = ConfigurationManager.AppSettings["PasswordReminderEmailFrom"];
                     string emailTemplate = ConfigurationManager.AppSettings["PasswordReminderEmailTemplate"];
                     EmailUtility utility = new EmailUtility();
                     if (profile != null)
                     {
                         string str5;
                         flag3 = true;
                         resource = Helper.GetResource("PasswordReminderSuccess");
                         if (base.Request.Url != null)
                         {
                             str5 = base.Request.Url.Scheme + "://" + base.Request.Url.Host + base.Url.Content(WebConfiguration.Current.Registration.AddApplicationRoot());
                         }
                         else
                         {
                             str5 = ConfigurationManager.AppSettings["SiteUrl"] + base.Url.Content(WebConfiguration.Current.Registration.AddApplicationRoot());
                         }
                         ResetPassword model = new ResetPassword {
                             Password = profile.PASSWORD,
                             SiteUrl = str5
                         };
                         string str6 = utility.SendEmail(model, emailTemplate, fromEmailAddress, user.Email);
                         this.Logger.DebugFormat("PasswordReminderController > result {0}", new object[] { str6 });
                         if (!(!string.IsNullOrEmpty(str6) && str6.Equals("true")))
                         {
                             flag3 = false;
                             resource = Helper.GetResource("ResetPasswordFailure");
                             base.ModelState.AddModelError("EmailAddress", "Errors.SendEmailError");
                         }
                     }
                 }
                 flag3 = true;
                 resource = Helper.GetResource("PasswordReminderSuccess");
                 ((dynamic) base.ViewBag).MessageSent = "true";
             }
             catch (Exception)
             {
                 flag3 = false;
                 resource = Helper.GetResource("ResetPasswordFailure");
             }
         }
         else
         {
             flag3 = false;
             resource = Helper.GetResource("ValidEmail");
         }
     }
     if (!isValid)
     {
         this.Logger.Debug("PasswordReminderController > isValid was false");
         var typeArray = (from x in base.ModelState
             where x.Value.Errors.Count > 0
             select new { 
                 Key = x.Key,
                 Errors = x.Value.Errors
             }).ToArray();
         flag3 = false;
         resource = Helper.GetResource("ValidEmail");
     }
     if (flag)
     {
         return base.Json(new { 
             success = flag3,
             allowRedirect = flag2,
             redirect = str2,
             message = resource
         });
     }
     return base.View();
 }
Ejemplo n.º 34
0
        public ActionResult Index(ComponentPresentation componentPresentation, Registration model, string Stage)
        {
            bool flag = base.Request.IsAjaxRequest();
            bool flag2 = false;
            bool flag3 = false;
            string errorMessage = string.Empty;
            string returnUrl = string.Empty;
            LoginForm loginForm = model.LoginForm;
            RegistrationForm registrationForm = model.RegistrationForm;
            string str3 = !string.IsNullOrWhiteSpace(base.Request["source"]) ? base.Request["source"] : string.Empty;
            if (loginForm != null)
            {
                if (!string.IsNullOrEmpty(loginForm.ReturnUrl))
                {
                    returnUrl = loginForm.ReturnUrl;
                }
                if (!string.IsNullOrEmpty(str3))
                {
                    returnUrl = str3;
                }
                errorMessage = Helper.GetResource("LoginFailed");
                if (this.Login(loginForm))
                {
                    errorMessage = Helper.GetResource("LoginSuccess");
                    flag3 = true;
                    flag2 = true;
                }
                else
                {
                    ((dynamic) base.ViewBag).Stage = "register";
                    base.ModelState.AddModelError("LoginFailed", errorMessage);
                }
                if (flag)
                {
                    return base.Json(new { 
                        success = flag3,
                        allowRedirect = flag2,
                        redirect = returnUrl,
                        message = errorMessage
                    });
                }
            }
            if (registrationForm != null)
            {
                EmailUtility utility;
                string str4;
                string str5;
                string str6;
                Exception exception;
                if (!string.IsNullOrEmpty(registrationForm.returnUrl))
                {
                    returnUrl = registrationForm.returnUrl;
                }
                if (!string.IsNullOrEmpty(str3))
                {
                    returnUrl = str3;
                }
                errorMessage = Helper.GetResource("RegistrationFailed");
                PublicasterServiceRequest request = new PublicasterServiceRequest();
                switch (Stage)
                {
                    case "register":
                        errorMessage = Helper.GetResource("RegistrationFailed");
                        if (!this.IsProfileValid(registrationForm))
                        {
                            ((dynamic) base.ViewBag).Stage = "register";
                            flag3 = false;
                            errorMessage = Helper.GetResource("RegistrationFailed");
                            base.ModelState.AddModelError("UnableToCreateNewUser", Helper.GetResource("UnableToCreateNewUser"));
                            break;
                        }
                        if (this.Register(registrationForm))
                        {
                            ((dynamic) base.ViewBag).Stage = "preferences";
                            flag3 = true;
                            errorMessage = Helper.GetResource("RegisteredSuccessfully");
                            this.Logger.InfoFormat("RegistrationController : User created: {0} - {1}", new object[] { registrationForm.CustomerDetails.DisplayName, registrationForm.CustomerDetails.EmailAddress });
                            try
                            {
                                if (!WebConfiguration.Current.CheckEmailNewsletterOption)
                                {
                                    utility = new EmailUtility();
                                    str4 = ConfigurationManager.AppSettings["PasswordReminderEmailFrom"];
                                    str5 = ConfigurationManager.AppSettings["RegisterConfirmationEmailTemplate"];
                                    str6 = utility.SendEmail(registrationForm.CustomerDetails, str5, str4, registrationForm.CustomerDetails.EmailAddress);
                                    this.Logger.DebugFormat("RegistrationController : Register Confirmation Email > result {0}", new object[] { str6 });
                                }
                            }
                            catch (Exception exception1)
                            {
                                exception = exception1;
                                this.Logger.Debug("Unable to send confirmation email to user.");
                            }
                        }
                        else
                        {
                            ((dynamic) base.ViewBag).Stage = "register";
                            flag3 = false;
                            errorMessage = Helper.GetResource("UnableToCreateNewUser");
                            base.ModelState.AddModelError("UnableToCreateNewUser", Helper.GetResource("UnableToCreateNewUser"));
                        }
                        break;

                    case "preferences":
                        errorMessage = Helper.GetResource("PreferencesFailed");
                        model.RegistrationForm.returnUrl = this._settings.RegisterWelcome;
                        if (this.Preferences(registrationForm))
                        {
                            ((dynamic) base.ViewBag).Stage = "profile";
                            flag3 = true;
                            errorMessage = Helper.GetResource("PreferencesSaved");
                            try
                            {
                                MvcApplication.CraftsPrincipal user = (MvcApplication.CraftsPrincipal) base.HttpContext.User;
                                CoatsUserProfile profile = CoatsUserProfile.GetProfile(base.User.Identity.Name);
                                utility = new EmailUtility();
                                str4 = ConfigurationManager.AppSettings["PasswordReminderEmailFrom"];
                                str5 = ConfigurationManager.AppSettings["RegisterConfirmationEmailTemplate"];
                                string newsletter = "No";
                                string interests = string.Empty;
                                foreach (KeyValuePair<string, string> pair in registrationForm.Keywords)
                                {
                                    interests = interests + pair.Key + ",";
                                }
                                if (interests.Length > 0)
                                {
                                    interests = interests.Substring(0, interests.LastIndexOf(",") - 1);
                                }
                                KeyValuePair<string, string> pair2 = registrationForm.Keywords.SingleOrDefault<KeyValuePair<string, string>>(e => e.Key == WebConfiguration.Current.EmailNewsletterYes);
                                if (pair2.Key != null)
                                {
                                    newsletter = "yes";
                                }
                                if (WebConfiguration.Current.CheckEmailNewsletterOption && (pair2.Key != null))
                                {
                                    newsletter = "yes";
                                    string str9 = string.Empty;
                                    if (base.Request.Url != null)
                                    {
                                        str9 = base.Request.Url.Scheme + "://" + base.Request.Url.Host;
                                    }
                                    else
                                    {
                                        str9 = ConfigurationManager.AppSettings["SiteUrl"];
                                    }
                                    string registerThankYou = this._settings.RegisterThankYou;
                                    string str11 = HttpUtility.UrlEncode(General.Encrypt(profile.MAIL.Trim()));
                                    str9 = registerThankYou + "?UserEmail=" + str11;
                                    registrationForm.CustomerDetails.SiteUrl = str9;
                                    registrationForm.CustomerDetails.DisplayName = profile.DISPLAYNAME;
                                    registrationForm.CustomerDetails.LastName = profile.SURNAME;
                                    registrationForm.CustomerDetails.FirstName = profile.NAME;
                                    registrationForm.CustomerDetails.EmailAddress = profile.MAIL;
                                    str6 = utility.SendEmail(registrationForm.CustomerDetails, str5, str4, profile.MAIL);
                                    this.Logger.DebugFormat("RegistrationController : Register Confirmation Email > result {0}", new object[] { str6 });
                                    string clientIP = this.GetClientIP();
                                    this._registrationrepository.SaveRegisterData(registrationForm.CustomerDetails.EmailAddress, clientIP, "");
                                    request.createJsonPublicasterRequest(registrationForm.CustomerDetails.EmailAddress, registrationForm.CustomerDetails.FirstName, registrationForm.CustomerDetails.LastName, interests, registrationForm.CustomerDetails.DisplayName, newsletter);
                                }
                            }
                            catch (Exception exception2)
                            {
                                exception = exception2;
                                this.Logger.Debug("Unable to send confirmation email to user.");
                            }
                        }
                        else
                        {
                            ((dynamic) base.ViewBag).Stage = "preferences";
                            flag3 = false;
                        }
                        break;

                    case "profile":
                        errorMessage = Helper.GetResource("PreferencesSaved");
                        model.RegistrationForm.returnUrl = this._settings.RegisterWelcome;
                        if (this.Preferences(registrationForm))
                        {
                            flag3 = true;
                            errorMessage = Helper.GetResource("ProfileSaved");
                            base.HttpContext.Session["registrationStatus"] = "";
                            returnUrl = this._settings.RegisterWelcome;
                            flag2 = true;
                        }
                        else
                        {
                            ((dynamic) base.ViewBag).Stage = "profile";
                            flag3 = false;
                        }
                        break;
                }
            }
            if (flag2)
            {
                returnUrl = !string.IsNullOrEmpty(returnUrl) ? returnUrl : base.Url.Content(WebConfiguration.Current.MyProfile);
                if (flag)
                {
                    return base.Json(new { 
                        success = flag3,
                        allowRedirect = flag2,
                        redirect = returnUrl,
                        message = errorMessage
                    });
                }
                base.HttpContext.Response.Redirect(returnUrl);
            }
            model.RegistrationForm = (registrationForm != null) ? registrationForm : new RegistrationForm();
            model.LoginForm = (loginForm != null) ? loginForm : new LoginForm();
            model.RegistrationForm.returnUrl = returnUrl;
            model.LoginForm.ReturnUrl = returnUrl;
            this.GetModelData(model.RegistrationForm);
            return base.View(model);
        }
Ejemplo n.º 35
0
 public ActionResult Index(ComponentPresentation componentPresentation, UserProfile model)
 {
     this.Logger.DebugFormat("Called Update Profile >>>> ", new object[0]);
     try
     {
         ((dynamic) base.ViewBag).Title = componentPresentation.Component.Fields["title"].Value;
     }
     catch (Exception)
     {
     }
     string email = string.Empty;
     if (base.User.Identity.IsAuthenticated)
     {
         email = base.User.Identity.Name;
     }
     bool flag = this.IsEditModelValid(model);
     if (flag)
     {
         try
         {
             MembershipUser user = Membership.GetUser();
             if (user == null)
             {
                 flag = false;
                 this.Logger.DebugFormat("Update Profile mUser null", new object[0]);
             }
             if (model.AddressDetails.Postcode != null)
             {
                 this.FindPostcode(model);
             }
             if (model.RegistrationStatus == "postcode invalid")
             {
                 flag = false;
             }
             if (flag)
             {
                 this.Logger.DebugFormat("User profile start  >>>>", new object[0]);
                 CoatsUserProfile userProfile = CoatsUserProfile.GetProfile(user.Email);
                 if (userProfile != null)
                 {
                     string selectedKeywords = base.Request["CraftType"];
                     string str3 = base.Request["email-newsletter"];
                     string str4 = base.Request["visibile-profile"];
                     PublicasterServiceRequest request = new PublicasterServiceRequest();
                     string newsletter = "No";
                     if (str3.Trim() == WebConfiguration.Current.EmailNewsletterYes.Trim())
                     {
                         newsletter = "yes";
                     }
                     if (((selectedKeywords != null) || (str3 != null)) || (str4 != null))
                     {
                         List<TridionTcmUri> keywordsSelectListItems = GetKeywordsSelectListItems(selectedKeywords);
                         List<TridionTcmUri> second = GetKeywordsSelectListItems(str3);
                         List<TridionTcmUri> list3 = GetKeywordsSelectListItems(str4);
                         IEnumerable<TridionTcmUri> enumerable = keywordsSelectListItems.Union<TridionTcmUri>(second).Union<TridionTcmUri>(list3);
                         Dictionary<string, string> dictionary = new Dictionary<string, string>();
                         foreach (TridionTcmUri uri in enumerable)
                         {
                             dictionary.Add(uri.TcmId, "tcm");
                         }
                         userProfile.Keywords = dictionary;
                         model.Keywords = dictionary;
                     }
                     if (!string.IsNullOrEmpty(model.NewPassword))
                     {
                         if (model.NewPassword == model.VerifyNewPassword)
                         {
                             if (!string.IsNullOrEmpty(model.CurrentPassword))
                             {
                                 CoatsUserProfile profile = CoatsUserProfile.GetProfile(email);
                                 if (model.CurrentPassword == profile.PASSWORD)
                                 {
                                     model.CustomerDetails.Password = model.NewPassword;
                                 }
                                 else
                                 {
                                     flag = false;
                                     base.ModelState.AddModelError("CurrentPasswordIncorrect", Helper.GetResource("CurrentPasswordIncorrect"));
                                 }
                             }
                             else
                             {
                                 flag = false;
                             }
                         }
                         else
                         {
                             flag = false;
                             base.ModelState.AddModelError("NewPasswordsNotMatch", Helper.GetResource("NewPasswordsNotMatch"));
                         }
                     }
                     if (flag)
                     {
                         this.MapUserProfileForUpdate(model, userProfile);
                         userProfile.Save();
                         if ((str3 != null) && WebConfiguration.Current.CheckEmailNewsletterOption)
                         {
                             if (str3.Trim() == WebConfiguration.Current.EmailNewsletterYes.Trim())
                             {
                                 EmailUtility utility = new EmailUtility();
                                 string fromEmailAddress = ConfigurationManager.AppSettings["PasswordReminderEmailFrom"];
                                 string emailTemplate = ConfigurationManager.AppSettings["RegisterConfirmationEmailTemplate"];
                                 string registerThankYou = this._settings.RegisterThankYou;
                                 string str9 = HttpUtility.UrlEncode(General.Encrypt(userProfile.MAIL.Trim()));
                                 registerThankYou = registerThankYou + "?UserEmail=" + str9;
                                 model.CustomerDetails.SiteUrl = registerThankYou;
                                 model.CustomerDetails.DisplayName = userProfile.DISPLAYNAME;
                                 model.CustomerDetails.EmailAddress = userProfile.MAIL;
                                 string str10 = utility.SendEmail(model.CustomerDetails, emailTemplate, fromEmailAddress, userProfile.MAIL);
                                 this.Logger.DebugFormat("ProfileController : Register Confirmation Email > result {0}", new object[] { str10 });
                                 request.createJsonPublicasterRequest(userProfile.MAIL, userProfile.NAME, userProfile.SURNAME, selectedKeywords, userProfile.DISPLAYNAME, newsletter);
                             }
                             else
                             {
                                 request.UnSubscripePublicaster(userProfile.MAIL);
                             }
                         }
                         CoatsUserProfile profile3 = CoatsUserProfile.GetProfile(userProfile.MAIL);
                         CookieHelper.WriteFormsCookie(userProfile.MAIL, userProfile.DISPLAYNAME, userProfile.NAME, userProfile.SURNAME, userProfile.LONG, userProfile.LAT, "");
                         ((dynamic) base.ViewBag).profileStatus = "saved";
                         if (profile3 == null)
                         {
                             flag = false;
                             base.ModelState.AddModelError(string.Empty, "");
                             this.Logger.DebugFormat("Update Profile newUser null", new object[0]);
                         }
                     }
                 }
             }
         }
         catch (Exception exception)
         {
             this.Logger.DebugFormat("Update Profile exception {0} {1}", new object[] { exception.Message, exception.InnerException });
             flag = false;
         }
     }
     if (base.ModelState.ContainsKey("CustomerDetails.DisplayName"))
     {
         base.ModelState["CustomerDetails.DisplayName"].Errors.Clear();
     }
     if (base.ModelState.ContainsKey("CustomerDetails.EmailAddress"))
     {
         base.ModelState["CustomerDetails.EmailAddress"].Errors.Clear();
     }
     if (!flag)
     {
         UserProfile profile4 = this.GetModel();
         base.ModelState.AddModelError(string.Empty, "");
         var typeArray = (from x in base.ModelState
             where x.Value.Errors.Count > 0
             select new { 
                 Key = x.Key,
                 Errors = x.Value.Errors
             }).ToArray();
         foreach (var type in typeArray)
         {
             this.Logger.DebugFormat("Update Profile error {0}", new object[] { type });
         }
         this.GetModelData(profile4);
         base.Session["feedback"] = Helper.GetResource("ProfileError");
         ((dynamic) base.ViewBag).profileStatus = "error";
         return base.View(profile4);
     }
     UserProfile profile5 = this.GetModel();
     base.Session["feedback"] = Helper.GetResource("ProfileChangesSaved");
     return base.View(profile5);
 }