protected void PwdReactivate_SendingMail(object sender, EventArgs e)
        {
            try
            {
                MembershipUser mu = Membership.GetUser(UserName.Text.Trim());
                Roles.GetRolesForUser(UserName.Text.Trim());

                StringBuilder emailMessage = new StringBuilder();

                emailMessage.Append(String.Format("Dear {0},<br /><br />", UserName.Text));
                emailMessage.Append("You’ve just request for TeachinVietnam account reactivation mail.<br />Here are the login details:<br />");
                emailMessage.Append(String.Format("<table style='margin-left:25px;'><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>User ID:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{0}</td></tr></table><br />", UserName.Text.Trim()));
                emailMessage.Append(String.Format("To reactivate your account, please <a href='{2}/publicArea/ActivateUser.aspx?userName={0}&Id={1}&lang=en'>click here</a>.<br />", UserName.Text.Trim(), mu.ProviderUserKey.ToString(), Request.Url.GetLeftPart(UriPartial.Authority)));
                emailMessage.Append(String.Format("Please <a href='{0}/ContactUs.aspx'>contact us</a> if you have any problem with the website.", Request.Url.GetLeftPart(UriPartial.Authority)));

                StringBuilder strBuilder = new StringBuilder();
                MailUtils mailUtil = new MailUtils(Request);
                strBuilder.Append(mailUtil.MailHeader());
                strBuilder.Append(mailUtil.Body(emailMessage.ToString(), null, false, null, null, "en-US"));
                strBuilder.Append(mailUtil.MailFooter());

                TeachingJob.Data.Utils.SendMail(UserName.Text.Trim(), "TeachinVietnam account activation.", strBuilder.ToString());

                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('An activation email has been sent to your email address.\\nPlease follow the instruction to activate your account.');window.location.href='login.aspx';</script>");
            }
            catch (Exception)
            {
                FailureText.Text = "Your account does not exist. Please check it again!";
                //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('" + ex.Message + "');</script>");
            }
        }
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            recaptcha.Validate();
            if (recaptcha.IsValid)
            {
                if (Page.IsValid && recaptcha.IsValid)
                {
                    try
                    {
                        StringBuilder emailMessage = new StringBuilder();

                        emailMessage.Append(String.Format("Dear {0} {1} {2},<br /><br />", ddlTitle.SelectedValue, txtFirstName.Text, txtLastName.Text));
                        emailMessage.Append("There is new request for Teach in Vietnam Guide.<br />Here are the details:<br />");
                        emailMessage.Append(String.Format("<table style='margin-left:25px;'><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Name:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{0}</td></tr><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Email:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{1}</td></tr><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Country:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{2}</td></tr><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Phone Number:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{3}</td></tr></table><br />", ddlTitle.SelectedValue + " " + txtFirstName.Text.Trim() + " " + txtLastName.Text.Trim(), txtEmailAddress.Text.Trim(), ddlCountry.SelectedValue, txtPhoneNumber.Text.Trim()));

                        StringBuilder strBuilder = new StringBuilder();

                        TeachingJob.Data.MailUtils mailUtils = new TeachingJob.Data.MailUtils(Request);
                        strBuilder.Append(mailUtils.MailHeader());
                        strBuilder.Append(mailUtils.Body(emailMessage.ToString(), null, false, null, null, "en-US"));
                        strBuilder.Append(mailUtils.MailFooter());

                        // Send the email
                        TeachingJob.Data.Utils.SendMail(General.WEB_MAIL_INTERNSHIP, "TeachinVietnam Internship Guide.", strBuilder.ToString(), "smtp.gmail.com", true);
                        BusinessLogic.Facade.Intership.InternshipGuide.Insert(ddlTitle.SelectedValue, txtFirstName.Text.Trim(), txtLastName.Text.Trim(), txtEmailAddress.Text.Trim(), ddlCountry.SelectedValue, txtPhoneNumber.Text.Trim());

                        Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert('Request internship guide successfully.');</script>");
                    }
                    catch (Exception)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert('" + General.AlertErrorJS + "');</script>");
                    }
                }
            }
            else
            {
                Assembly ass = Assembly.Load("App_GlobalResources");
                ResourceManager rm = new ResourceManager("Resources.Resource", ass);
                lbl_captStt.Text = rm.GetString("Pleaseentercorrectcaptcha");
            }
        }
Esempio n. 3
0
        public String GetBody()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Hi Admin,<br /><br /> ");
            sb.Append("You have got a feed back.<br /><br />");
            sb.Append(String.Format("<table><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Reason for contact:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{0}</td></tr><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Name:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{1}</td></tr><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Email:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{2}</td></tr><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Telephone:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{3}</td></tr><tr><td valign='top' style='padding: 8px; border-bottom: 1px solid #fff;border-top: 1px solid transparent;'><b>Message:</b></td><td style='padding: 8px; border-bottom: 1px solid #fff;border-top: 1px solid transparent;'>{4}</td></tr></table><br /><br />", ddl_Subject.SelectedValue, txt_name.Text.Trim(), txt_email.Text.Trim(), txt_Phone.Text.Trim(), HttpUtility.HtmlDecode(txt_Message.Text.Trim().Replace(Environment.NewLine, "<br />"))));

            //sb.Append("<hr /><i>This e-mail is generated automatically. Please do not reply to it.</i><br />");
            //sb.Append("Best regards,<br /><br />Customer Care Department<br />TeachinVietnam");
            //sb.AppendLine();

            StringBuilder strBuilder = new StringBuilder();
            MailUtils mailUtils = new MailUtils(Request);

            strBuilder.Append(mailUtils.MailHeader());
            strBuilder.Append(mailUtils.Body(sb.ToString(), null, false, null, null, "en-US"));
            strBuilder.Append(mailUtils.MailFooter());

            return sb.ToString();
        }
        protected void SendMail_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                MailUtils mailUtils = new MailUtils(Request);

                //--- Employer side
                StringBuilder sr = new StringBuilder();
                sr.Append(mailUtils.MailHeader());

                String title = string.Format("Dear {0},<br />You have an application for <b>{1}</b><br />", Dj.Contact, lbl_JobTitle.Text);
                title += string.Format("This message was sent on {0:ddd, MMM dd, yyyy} at {1}.<hr />", DateTime.Now, DateTime.Now.ToShortTimeString());

                String body = HttpUtility.HtmlDecode(txtMessage.Text.Replace(Environment.NewLine, "<br />"));
                sr.Append(mailUtils.Body(title, body, false));
                sr.Append(mailUtils.MailFooter());

                try
                {
                    //notify recruiter that this userid has applied for his job. Build the table like app managemt like candidate.
                    SendMail(Dj.EmailForEmployer, sr.ToString(), true);

                    //Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "<script>window.location.href='finish-apply.aspx?org="+Dj.OrgName+"';</script>");
                    if (sent)
                    {
                        Response.Redirect("finish-apply.aspx?org=" + Dj.OrgName);
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('Your application is not sent.\nPlease try again.');</script>");
                    }
                }
                catch (SmtpException)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('Your email is not existed or there would be problem with your internet connection.\nPlease try again.');</script>");
                }
                catch (Exception ex)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('" + ex.Message + "');</script>");
                }
                finally
                {
                    string[] filePaths = Directory.GetFiles(Server.MapPath("~/temp/anonymous/"), "*.*",
                                            SearchOption.AllDirectories);
                    foreach (string path in filePaths)
                    {
                        File.Delete(path);
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            mailUtils = new MailUtils(Request);

            if (ddl_body.SelectedValue == "1")
            {
                if (ddl_lang.SelectedValue == "1")
                {
                    panel_quote_en.Visible = false;
                    panel_content_vi.Visible = false;
                    panel_quote_vi.Visible = false;
                    mark = "1body1lang";
                }
                else if (ddl_lang.SelectedValue == "2")
                {
                    panel_quote_en.Visible = false;
                    panel_content_vi.Visible = true;
                    panel_quote_vi.Visible = false;
                    mark = "1body2lang";
                }
            }
            else if (ddl_body.SelectedValue == "2")
            {
                if (ddl_lang.SelectedValue == "1")
                {
                    panel_quote_en.Visible = true;
                    panel_content_vi.Visible = false;
                    panel_quote_vi.Visible = false;
                    mark = "2bodyquote1lang";
                }
                else if (ddl_lang.SelectedValue == "2")
                {
                    panel_quote_en.Visible = true;
                    panel_content_vi.Visible = true;
                    panel_quote_vi.Visible = true;
                    mark = "2bodyquote2lang";
                }
            }
            if (!IsPostBack)
            {
                if (Request.Params["mailto"] != null)
                {
                    txt_mailto.Text = Request.Params["mailto"];
                }
                else if (Request.Params["t"] != null)
                {
                    string strMail = "";
                    string[] userList = Roles.GetUsersInRole(Request.Params["t"]);
                    foreach (string str in userList)
                    {
                        if (strMail == "")
                        {
                            strMail = str;
                        }
                        else
                        {
                            strMail =strMail+"," +str;
                        }
                    }
                    txt_bcc.Text = strMail;
                }
            }
        }
Esempio n. 6
0
        protected void SendContact_Click(object sender, EventArgs e)
        {
            try
            {
                String myConn = System.Configuration.ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
                BusinessFacade facade = new BusinessFacade(myConn);
                string latestJobId = "";

                if (Page.User.Identity.IsAuthenticated)
                {
                    if (User.IsInRole("Organization"))
                    {
                        MembershipUser mu = Membership.GetUser();
                        //Neu ma co job.
                        if (facade.GetLastestJobIdByGuid(mu.ProviderUserKey.ToString()) != null)
                        {
                            latestJobId = facade.GetLastestJobIdByGuid(mu.ProviderUserKey.ToString());
                        }
                    }
                }

                StringBuilder sb = new StringBuilder();
                string subject = txt_OrgName.Text.Trim() + " " + txt_Subject.Text.Trim();

                if (lbl_CandidateName.Text == null || lbl_CandidateName.Text == "")
                {
                    lbl_CandidateName.Text = "candidate";
                }
                MailUtils mailUtils = new MailUtils(Request);
                //header
                sb.Append(mailUtils.MailHeader());

                String title = "Dear " + lbl_CandidateName.Text + ",<br />A new message has just come from " + txt_OrgName.Text.Trim() + " via TeachinVietnam.org:";
                String body = txt_Message.Text.Trim();
                String href = "publicArea/JobDetails.aspx?jId=" + latestJobId + "&lang=en";
                String linkLabel = "Click here to examine your online resume before responding!";
                //body_en
                if (latestJobId != "")
                {
                    sb.Append(mailUtils.Body(title, body, true, href, linkLabel, "en-US"));
                }
                else
                {
                    sb.Append(mailUtils.Body(title, body, false, href, linkLabel, "en-US"));
                }
                sb.Append(mailUtils.Seperator());
                string ntd = "";
                if (User.IsInRole("Organization"))
                {
                    ntd = " nhà tuyển dụng ";
                }
                title = "Chào " + lbl_CandidateName.Text + ",<br />Bạn có thư từ " + ntd + txt_OrgName.Text.Trim() + " thông qua hệ thống TeachinVietnam:";
                href = "publicArea/JobDetails.aspx?jId=" + latestJobId + "&lang=vi";
                linkLabel = "Click vào đây để kiểm tra Hồ sơ của bạn trước khi ứng tuyển!";
                //body vi
                if (latestJobId != "")
                {
                    sb.Append(mailUtils.Body(title, body, true, href, linkLabel, "vi-VN"));
                }
                else
                {
                    sb.Append(mailUtils.Body(title, body, false, href, linkLabel, "vi-VN"));
                }

                //footer
                sb.Append(mailUtils.MailFooter());
                Guid userProviderKey = new Guid(Request.Params["cvname"].ToString());
                MembershipUser candidateMembership = Membership.GetUser(userProviderKey);

                Utils.SendMail(candidateMembership.Email, subject, sb.ToString());

                Response.Redirect("~/publicArea/CV/RequestSuccess.aspx", false);
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('" + ex.Message + "');</script>");
            }
        }
        protected void PwdRecovery_SendingMail(object sender, EventArgs e)
        {
            try
            {
                MembershipUser mu = Membership.GetUser(PasswordRecovery1.UserName);
                //string resetPwd = mu.ResetPassword();
                string emailAddress = mu.Email;
                // Lets get the user's id
                Guid userId = (Guid)Membership.GetUser(PasswordRecovery1.UserName).ProviderUserKey;

                MailUtils mailUtils = new MailUtils(Request);
                StringBuilder strBuilder = new StringBuilder();

                // Now lets create an email message
                StringBuilder emailMessage = new StringBuilder();

                if (User.IsInRole("Employee"))
                {
                    emailMessage.Append(String.Format("Dear {0},", Context.Profile.GetPropertyValue("Employee.FirstName") + " " + Context.Profile.GetPropertyValue("Employee.LastName")));
                }
                else if (User.IsInRole("Organization"))
                {
                    emailMessage.Append(String.Format("Dear {0},", Context.Profile.GetPropertyValue("Employer.FirstName") + " " + Context.Profile.GetPropertyValue("Employer.LastName")));
                }
                else
                {
                    emailMessage.Append(String.Format("Dear {0},",PasswordRecovery1.UserName));
                }
                emailMessage.Append("<br /><br />");
                emailMessage.Append(string.Format("You have recently requested to reset your password on <b>teachinVietnam.org</b>.<br /> Please click <a href='{1}/Account/RecoveryPwd.aspx?userName={0}&lang=en'>here</a> to reset your password.<br />", PasswordRecovery1.UserName, Request.Url.GetLeftPart(UriPartial.Authority)));
                emailMessage.Append("If you did not require a new password, just disregard this message and continue using your current one.");

                strBuilder.Append(mailUtils.MailHeader());
                strBuilder.Append(mailUtils.Body(emailMessage.ToString(), null, false, null, null, "en-US"));
                strBuilder.Append(mailUtils.Seperator());

                emailMessage.Clear();
                if (User.IsInRole("Employee"))
                {
                    emailMessage.Append(String.Format("Xin chào {0},", Context.Profile.GetPropertyValue("Employee.FirstName") + " " + Context.Profile.GetPropertyValue("Employee.LastName")));
                }
                else if (User.IsInRole("Organization"))
                {
                    emailMessage.Append(String.Format("Xin chào {0},", Context.Profile.GetPropertyValue("Employer.FirstName") + " " + Context.Profile.GetPropertyValue("Employer.LastName")));
                }
                else
                {
                    emailMessage.Append(String.Format("Xin chào {0},", PasswordRecovery1.UserName));
                }

                emailMessage.Append("<br /><br />");
                emailMessage.Append(string.Format("Bạn đã yêu cầu khôi phục mật khẩu trên <b>teachinVietnam.org</b>.<br /> Mời click vào <a href='{1}/Account/RecoveryPwd.aspx?userName={0}&lang=vi'>đây</a> để khôi phục lại mật khẩu.<br />", PasswordRecovery1.UserName, Request.Url.GetLeftPart(UriPartial.Authority)));
                emailMessage.Append("Nếu bạn không yêu cầu khôi phục mật khẩu, hãy bỏ qua thư này và tiếp tục sử dụng mật khẩu cũ của bạn.");

                strBuilder.Append(mailUtils.Body(emailMessage.ToString(), null, false, null, null, "vi-VN"));
                strBuilder.Append(mailUtils.MailFooter());

                Utils.SendMail(emailAddress, "TeachinVietnam - Recovery Password Confirmation", strBuilder.ToString());
            }
            catch (Exception ex)
            {
                //Response.Redirect("~/publicArea/errorpages/ErrorNetworkNotFound.aspx");
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('" + ex.Message + "');</script>");
            }
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('Please go to your email and follow the directions to get back your password!');</script>");
        }
Esempio n. 8
0
        /// <summary>
        /// Gửi mail cho Emp khi có công việc mới
        /// </summary>
        public void SendNewJob()
        {
            MailUtils mailUtils = new MailUtils();
            string[] userList = Roles.GetUsersInRole("Employee");
            string strMail = "";
            foreach (string str in userList)
            {
                strMail = "*****@*****.**";

            }
            StringBuilder sb = new StringBuilder();
            sb.Append(mailUtils.MailHeader());
            sb.Append("<br/> Hello Q, <br/>");
            sb.Append("Listed below are recent opportunities and information that match your search- Teaching job in Vietnam!<br/>");
            sb.Append(GetNewJobList());
            sb.Append("<br/>Wish you a great career ahead!");
            sb.Append(mailUtils.MailFooter());
            SendMail("*****@*****.**", "Teacher position", sb.ToString(), "", strMail);
        }
Esempio n. 9
0
        /// <summary>
        /// Gửi mail cho Job khi có CV mới
        /// </summary>
        public void SendNewCV()
        {
            MailUtils mailUtils = new MailUtils();
            string[] userList = Roles.GetUsersInRole("Employee");
            string strMail = "";
            foreach (string str in userList)
            {
                strMail = "*****@*****.**";

            }
            StringBuilder sb = new StringBuilder();
            sb.Append(mailUtils.MailHeader());
            sb.Append("<br/> Dear Recruiter, <br/>");
            sb.Append("Listed below are recent candidates and information that match your search- Native English Teachers!<br/>");
            sb.Append("Please take a moment to review the information below. <br/>");
            sb.Append(GetCVList());
            sb.Append("<br/>Thank you for using teachinvietnam.org!");
            sb.Append(mailUtils.MailFooter());
            SendMail("*****@*****.**", "Qualified Native Teachers!", sb.ToString(), "", strMail);
        }
        protected void SendMail_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                //String builder is the body
                StringBuilder sb = new StringBuilder();

                MailUtils mailUtils = new MailUtils(Request);
                StringBuilder strBuilder = new StringBuilder();
                strBuilder.Append(mailUtils.MailHeader());

                //english content
                String href = "publicarea/JobDetails.aspx?jid=" + Dj.Id + "&lang=en";
                String linkLabel = "Click here to view this job's details";
                sb.Append("Hi " + Context.Profile.GetPropertyValue("Employee.FirstName").ToString() + " " + Context.Profile.GetPropertyValue("Employee.LastName").ToString() + ",<br /><br /> ");
                sb.Append("You have successfully applied for the job.<br />");
                sb.Append(String.Format("<table style='margin-left:25px;'><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Job Title:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{0}</td></tr><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Organization:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{1}</td></tr><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Job Details:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'><a style='text-decoration: none; color: #86ac3d;' href='{2}/{3}'> &raquo; {4}</a></td></tr></table>", Dj.Title, Dj.OrgName, Request.Url.GetLeftPart(UriPartial.Authority), href, linkLabel));

                strBuilder.Append(mailUtils.Body(sb.ToString(), null, false, href, linkLabel, "en-US"));
                strBuilder.Append(mailUtils.Seperator());
                //Vietnamese content.
                href = "publicarea/JobDetails.aspx?jid=" + Dj.Id + "&lang=vi";
                linkLabel = "Mời bạn click vào đây để xem thông tin công việc.";
                sb.Clear();
                sb.Append("Chào " + Context.Profile.GetPropertyValue("Employee.FirstName").ToString() + " " + Context.Profile.GetPropertyValue("Employee.LastName").ToString() + ",<br /><br /> ");
                sb.Append("Bạn vừa ứng tuyển thành công! <br />");
                sb.Append(String.Format("<table style='margin-left:25px;'><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Vị trí:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{0}</td></tr><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Tổ chức:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>{1}</td></tr><tr><td style='padding: 8px;background: #d0dafd; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'>Job Details:</td><td style='padding: 8px;background: #e8edff; border-bottom: 1px solid #fff;color: #669;border-top: 1px solid transparent;'><a style='text-decoration: none; color: #86ac3d;' href='{2}/{3}'> &raquo; {4}</a></td></tr></table>", Dj.Title, Dj.OrgName, Request.Url.GetLeftPart(UriPartial.Authority), href, linkLabel));

                strBuilder.Append(mailUtils.Body(sb.ToString(), null, false, href, linkLabel, "vi-VN"));

                strBuilder.Append(mailUtils.MailFooter());

                //--- Employer side
                StringBuilder sr = new StringBuilder();
                sr.Append(mailUtils.MailHeader());

                String title = string.Format("Hi {0},<br />Here is {1}'s application for <b>{2}</b><br />", Dj.Contact, txt_FullName.Text, lbl_JobTitle.Text);
                title += string.Format("On {0:ddd, MMM dd, yyyy} at {1}, {2} &lt;{3}&gt; wrote:<hr />", DateTime.Now, DateTime.Now.ToShortTimeString(), txt_FullName.Text, lbl_YourMail.Text);

                String body = HttpUtility.HtmlDecode(txtMessage.Text.Replace(Environment.NewLine, "<br />"));
                sr.Append(mailUtils.Body(title, body, false));
                sr.Append(mailUtils.MailFooter());

                try
                {
                    //notify recruiter that this userid has applied for his job. Build the table like app managemt like candidate.
                    SendMail(Dj.EmailForEmployer, sr.ToString(), true);

                    //To the candidate
                    SendMail(lbl_YourMail.Text, strBuilder.ToString(), false);
                    facade.SaveAJob(UserId, JId, txt_FullName.Text);

                    //Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "<script>window.location.href='finish-apply.aspx?org="+Dj.OrgName+"';</script>");
                    if (sent)
                    {
                        Response.Redirect("finish-apply.aspx?org=" + Dj.OrgName);
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('Your application is not sent.\nPlease try again.');</script>");
                    }
                }
                catch (SmtpException)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('Your email is not existed or there would be problem with your internet connection.\nPlease try again.');</script>");
                }
                catch (Exception ex)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('" + ex.Message + "');</script>");
                }
                finally
                {
                    string[] filePaths = Directory.GetFiles(Server.MapPath("~/temp/" + UserId + "/"), "*.*",
                                            SearchOption.AllDirectories);
                    foreach (string path in filePaths)
                    {
                        File.Delete(path);
                    }
                }
            }
        }
Esempio n. 11
0
        protected void btnPostJob_Click(object sender, EventArgs e)
        {
            Boolean salaryType;
            string _salarytype = Request.Form["salaryType"].ToString();
            if (_salarytype == "Negotiable")
            {
                salaryType = false;
            }
            else
            {
                salaryType = true;
            }
            Boolean executiveJob = false;
            if (cb_ExecutiveJob.Checked)
            {
                executiveJob = true;
            }

            if (txt_SalaryFrom.Text == "") { txt_SalaryFrom.Text = "0"; }  //2 thang salary khi insert no la decimal nen phai
            if (txt_SalaryTo.Text == "") { txt_SalaryTo.Text = "0"; }   // gan gia tri cho no =0 moi run dc
            if (txtJobClosingDate.Text == "") { txtJobClosingDate.Text = string.Empty; }

            DetailJob dj = new DetailJob(txtJobTitle.Text.Trim(), txtJobDescription.Text.Trim(), mu.ProviderUserKey.ToString(), Category.SelectedValue, Category2.SelectedValue, Category3.SelectedValue, ddlCitizenship.SelectedValue, ddlJobLevel.SelectedValue, ddl_EducationRequirement.SelectedValue, ddlJobEmploymentType.SelectedValue, ddlJobLocation.SelectedValue, ddlJobLocation2.SelectedValue, ddlJobLocation3.SelectedValue, salaryType, Convert.ToDecimal(txt_SalaryFrom.Text.Trim()), Convert.ToDecimal(txt_SalaryTo.Text.Trim()), ddl_SalaryCurrency.SelectedValue, ddl_SalaryPaidType.SelectedValue, Convert.ToDateTime(txtJobClosingDate.Text.Trim()), executiveJob, Contact.Text.Trim(), txt_Email.Text.Trim());
            string stt = facade.InsertNewJob(dj);
            if (stt == "done")
            {
                string bodyMail = "";
                bodyMail += "Dear HR Manager";
                bodyMail += "("+dj.OrgName+")";
                bodyMail += "We deeply appreciate your placement of advertisement in the job vacancies with Teachinvietnam.org. Your ad was published and is available at this link: ";
                bodyMail += "This job will be deleted automatically in " + dj.ClosingDate.ToString("MM/dd/YYYY") + ".<br/>";
                bodyMail += "We look forward to sharing your success in the near future.";
                StringBuilder sb = new StringBuilder();
                MailUtils mailUtils = new MailUtils(Request);
                sb.Append(mailUtils.MailHeader());
                sb.Append(bodyMail );
                sb.Append(mailUtils.MailFooter());
                Utils.SendMail(dj.EmailForEmployer,"New job", sb.ToString(), "", "");
                Response.Redirect("~/memberArea/PostJobSuccess.aspx");
            }
        }