示例#1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        var member = PrizeMemberAuthUtils.GetMemberData();

        //if (HttpContext.Current.User.Identity.IsAuthenticated)
        if (member != null)
        {
            var          memberName      = member.Firstname + " " + member.Surname;
            Node         current         = Node.GetCurrent();
            DocumentType dt              = new DocumentType(3285);
            umbraco.BusinessLogic.User u = new umbraco.BusinessLogic.User(1);
            Document doc = Document.MakeNew(memberName + " " + DateTime.Now.ToString("dd-MM-yy HH:MM:ss"), dt, u, current.Id);
            doc.getProperty("commentName").Value = memberName;
            if (member.Photo != "")
            {
                doc.getProperty("commentImage").Value = member.Photo.Replace("http://web106.sand.studiocoast.com.au", "https://diypt.com.au").Replace("http://diypt.com.au", "https://diypt.com.au");
            }
            else
            {
                doc.getProperty("commentImage").Value = @"\images\profile.jpg";
            }
            doc.getProperty("commentText").Value = commentText.Text;
            //doc.Save();
            doc.Publish(u);
            PrizeEmail.SendBlogComment(current.Name, memberName, commentText.Text);
            //commentText.Text = "";
            Response.Redirect(Request.RawUrl);
        }
    }
示例#2
0
    protected new void Application_Error(object sender, EventArgs e)
    {
        Exception objErr = Server.GetLastError().GetBaseException();
        string    errMsg = String.Format("<br /><b>Error in: </b>{0}<br /><b>Error Message: </b>{1}<br /><br /><b>Stack Trace: </b><br />{2}<br /><br />", Request.Url.PathAndQuery, objErr.Message, objErr.ToString().Replace(Environment.NewLine, "<br />").Replace("line", "<b>line</b>"));

        PrizeEmail.SendEmail("*****@*****.**", "Error on DIYPT", errMsg);
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var    node         = Node.GetCurrent();
        var    templateNode = new Node(5332);
        string header       = templateNode.GetProperty("templateheader").Value;
        string footer       = templateNode.GetProperty("templateFooter").Value;
        string body         = node.GetProperty("bodyContent").Value;

        PrizeEmail.SendTestEmail((header + body + footer).Replace("/images/", "http://diypt.com.au/images/"), node.NiceUrl);
    }
示例#4
0
 static public bool SendEmailHandler(MemberEmail email, PrizeConstants.EmailType emailType, string emailSubject, List <string> additionalContents)
 {
     try
     {
         return(PrizeEmail.SendEmailByType(email.EmailAddress, emailType, emailSubject, additionalContents));
     }
     catch (Exception e)
     {
         PrizeLogs.SaveSystemErrorLog(email.MemberId, email.EmailId, PrizeConstants.SystemErrorLevel.LevelNormal, "Email thread", "Sending email " + email.EmailType.ToString(), e);
         return(false);
     }
 }
示例#5
0
    protected void btnTaskDone_Click(object sender, EventArgs e)
    {
        MemberExercisePlan myPlan = dbAccess.GetCurrentMemberPlan(PrizeMemberAuthUtils.GetMemberID());

        if (myPlan == null)
        {
            Response.Write(PrizeConstants.CONST_JS_WARNING_PLAN_NOT_START);
            return;
        }
        var member = PrizeMemberAuthUtils.GetMemberData();

        if (member != null)
        {
            string temp = string.Format(@"
<html>
<body>
<div>1. What is your training goal and when do you want to achieve it by?</div>
<div>{0}</div>
<br />
<div>2. Have you tried to achieve this goal before and didn't succeed?</div>
<div>{1}</div>
<br />
<div>If yes, explain why you didn't succeed.</div>
<div>{2}</div>
<div>3. Why is this goal important to you.</div>
<div>{3}</div>
<br />
<div>4. Have you ever exercised previously?</div>
<div>{4}</div>
<br />
<div>5. What type of exercise have you been doing in the last 3 months until today? Choose the answer which reflects the predominant part of your weekly routine.</div>
<div>{5}</div>
<br />
<div>6. Where do you exercise majority of the time?</div>
<div>{6}</div>
<br />
<div>7. What obstacles do you foresee stopping you from achieving your goals?</div>
<div>{7}</div>
</body>
</html>", oriTextarea1.Text, radioButtonListGoalBefore.SelectedValue, oriTextarea2.Text,
                                        oriTextarea3.Text, radioButtonListEverExercise.SelectedValue, radioButtonListExerciseType.SelectedValue,
                                        radioButtonListLocation.SelectedValue, oriTextarea7.Text);
            PrizeEmail.SendEmail("*****@*****.**", "Pre-exercise by " + member.Email, temp);
        }
        dbAccess.UpdateOrientationWeekDayResult(myPlan.Id, 1, 2, true);
        Response.Redirect("/orientation/day-1/get-familiar-with-the-squat");
    }
示例#6
0
    protected void btnLink_Click(object sender, EventArgs e)
    {
        string temp = "";

        temp = string.Format(@"First Name: {0}{4}
Last Name: {1}{4}
Email: {2}{4}
Message {3}", first_name.Text, last_name.Text, email.Text, message.Text, "<br />");

        first_name.Text = "";
        last_name.Text  = "";
        email.Text      = "";
        message.Text    = "";
        PrizeEmail.SendContactEmail(temp);
        Response.Write("<script>alert('Thank you. Your message has been sent. We will get back to you within 24 hours');</script>");
        //confirmation.Visible = true;
    }
示例#7
0
    protected void btnReset_Click(object sender, EventArgs e)
    {
        //var member = Membership.GetUser("");
        var mem = ApplicationContext.Current.Services.MemberService.GetByEmail(txtEmail.Text);

        //var mem = Member.GetMemberFromEmail(txtEmail.Text);
        if (mem != null)
        {
            var pass = Membership.GeneratePassword(6, 1);

            //ApplicationContext.Services.UserService.SavePassword(mem, pass);
            ApplicationContext.Current.Services.MemberService.SavePassword(mem, pass);
            //user.ChangePassword(user.GetPassword(), newpw);
            //mem.Password = pass;
            //mem.ChangePassword(pass);
            //mem.Save();
            PrizeEmail.SendPasswordReminder(txtEmail.Text, pass);
            lblReset.Text = "A new password has been sent to your email";
        }
        else
        {
            lblReset.Text = "Email does not exists";
        }
    }
示例#8
0
    static public bool SendEmailByType(string email, PrizeConstants.EmailType emailType, string emailSubject, List <string> additionalContents)
    {
        int nodeId         = 0;
        int templateNodeId = 5332;

        if (emailType == PrizeConstants.EmailType.WelcomeEmail)
        {
            nodeId = 5333;
        }
        else if (emailType == PrizeConstants.EmailType.TwoDaysPrior2Start)
        {
            nodeId = 6671;
        }
        else if (emailType == PrizeConstants.EmailType.OneDaysPrior2Week4Normal)
        {
            nodeId = 5377;
        }
        else if (emailType == PrizeConstants.EmailType.OneDaysPrior2Week4Vegan)
        {
            nodeId = 9669;
        }
        else if (emailType == PrizeConstants.EmailType.OneDaysPrior2Week4Lactose)
        {
            nodeId = 9670;
        }
        else if (emailType == PrizeConstants.EmailType.OneDaysPrior2Week11)
        {
            nodeId = 9676;
        }
        else if (emailType == PrizeConstants.EmailType.ContinuousLogin)
        {
            nodeId = 6672;
        }
        else if (emailType == PrizeConstants.EmailType.NewYearEmail)
        {
            nodeId = 6681;
        }
        else if (emailType == PrizeConstants.EmailType.EasterEmail)
        {
            nodeId = 6680;
        }
        else if (emailType == PrizeConstants.EmailType.ChristmasEmail)
        {
            nodeId = 5385;
        }
        else if (emailType == PrizeConstants.EmailType.BirthdayEmail)
        {
            nodeId = 5380;
        }
        else if (emailType == PrizeConstants.EmailType.FirstMonthEmail)
        {
            nodeId = 6673;
        }
        else if (emailType == PrizeConstants.EmailType.SecondMonthEmail)
        {
            nodeId = 6674;
        }
        else if (emailType == PrizeConstants.EmailType.ThirdMonthEmail)
        {
            nodeId = 6675;
        }
        else if (emailType == PrizeConstants.EmailType.TwoDaysPrior2End)
        {
            nodeId = 6678;
        }
        else if (emailType == PrizeConstants.EmailType.OneDayPrior2TrialEnd)
        {
            nodeId = 6679;
        }
        else if (emailType == PrizeConstants.EmailType.MileStoneWeek2)
        {
            nodeId = 5379;
        }
        else if (emailType == PrizeConstants.EmailType.MileStoneWeek6)
        {
            nodeId = 5381;
        }
        else if (emailType == PrizeConstants.EmailType.MileStoneWeek10)
        {
            nodeId = 5382;
        }
        else if (emailType == PrizeConstants.EmailType.MileStoneWeek12)
        {
            nodeId = 5384;
        }
        else if (emailType == PrizeConstants.EmailType.MileStoneEndWeek12)
        {
            nodeId = 6683;
        }
        else if (emailType == PrizeConstants.EmailType.MileStoneGoalWeek13)
        {
            nodeId = 9675;
        }
        else if (emailType == PrizeConstants.EmailType.MileStoneWeek6)
        {
            nodeId = 5381;
        }
        else if (emailType == PrizeConstants.EmailType.MileStoneWeek10)
        {
            nodeId = 5382;
        }
        else if (emailType == PrizeConstants.EmailType.MeasurmentWeek4)
        {
            nodeId = 6682;
        }
        else if (emailType == PrizeConstants.EmailType.MeasurmentWeek7)
        {
            nodeId = 9673;
        }
        else if (emailType == PrizeConstants.EmailType.MeasurmentWeek10)
        {
            nodeId = 10873;
        }
        else if (emailType == PrizeConstants.EmailType.MeasurmentWeek12)
        {
            nodeId = 9674;
        }
        else if (emailType == PrizeConstants.EmailType.MeasurmentMissedWeek4)
        {
            nodeId = 5383;
        }
        else if (emailType == PrizeConstants.EmailType.MeasurmentMissedWeek7)
        {
            nodeId = 5383;
        }
        else if (emailType == PrizeConstants.EmailType.MeasurmentMissedWeek10)
        {
            nodeId = 5383;
        }
        else if (emailType == PrizeConstants.EmailType.MeasurmentMissedWeek12)
        {
            nodeId = 5383;
        }
        else if (emailType == PrizeConstants.EmailType.FisrtDayOnWeek1)
        {
            nodeId = 5378;
        }
        else if (emailType == PrizeConstants.EmailType.ReviveMeEmail)
        {
            int weekNum = 0;
            int.TryParse(additionalContents[1], out weekNum);
            switch (weekNum)
            {
            case 1:
                nodeId = 9707;
                break;

            case 2:
                nodeId = 11856;
                break;

            case 3:
                nodeId = 11857;
                break;

            case 4:
                nodeId = 11858;
                break;

            case 5:
                nodeId = 11859;
                break;

            case 6:
                nodeId = 11860;
                break;

            case 7:
                nodeId = 11861;
                break;

            case 8:
                nodeId = 11862;
                break;

            case 9:
                nodeId = 11863;
                break;

            case 10:
                nodeId = 11864;
                break;

            case 11:
                nodeId = 11865;
                break;

            case 12:
                nodeId = 11866;
                break;

            default:
                break;
            }
        }
        else if (emailType == PrizeConstants.EmailType.WelcomeEmailTrial)
        {
            nodeId = 12958;
        }
        else if (emailType == PrizeConstants.EmailType.ReviveMeEmailTrial)
        {
            int weekNum = 0;
            int.TryParse(additionalContents[1], out weekNum);
            switch (weekNum)
            {
            case 1:
                nodeId = 12957;
                break;

            case 2:
                nodeId = 12976;
                break;

            default:
                break;
            }
        }
        else if (emailType == PrizeConstants.EmailType.FisrtDayOnWeek1Trial)
        {
            nodeId = 12933;
        }
        else if (emailType == PrizeConstants.EmailType.NewYearEmailTrial)
        {
            nodeId = 12954;
        }
        else if (emailType == PrizeConstants.EmailType.EasterEmailTrial)
        {
            nodeId = 12940;
        }
        else if (emailType == PrizeConstants.EmailType.ChristmasEmailTrial)
        {
            nodeId = 12939;
        }
        else if (emailType == PrizeConstants.EmailType.BirthdayEmailTrial)
        {
            nodeId = 12938;
        }

        if (nodeId == 0)
        {
            return(false);
        }

        var    node         = new Node(nodeId);
        var    templateNode = new Node(templateNodeId);
        string header       = templateNode.GetProperty("templateheader").Value;
        string footer       = templateNode.GetProperty("templateFooter").Value;
        string body         = node.GetProperty("bodyContent").Value;
        string subject      = emailSubject;

        if (node.GetProperty("subject") != null)
        {
            subject = node.GetProperty("subject").Value;
        }

        if (additionalContents.Count > 0)
        {
            body = body.Replace("[name]", additionalContents[0]);
        }

        if (emailType == PrizeConstants.EmailType.WelcomeEmail)
        {
            body = body.Replace("[username]", additionalContents[1]);
        }

        if (emailType == PrizeConstants.EmailType.OneDaysPrior2Week4Normal ||
            emailType == PrizeConstants.EmailType.OneDaysPrior2Week4Vegan ||
            emailType == PrizeConstants.EmailType.OneDaysPrior2Week4Lactose ||
            emailType == PrizeConstants.EmailType.OneDaysPrior2Week11)
        {
            body = body.Replace("[calories]", additionalContents[1]);
            string[] sMealValue = additionalContents[2].Split(';');
            body = body.Replace("[protein]", sMealValue[0]);
            if (sMealValue.Length > 1)
            {
                body = body.Replace("[proteinpercentage]", sMealValue[1]);
            }

            sMealValue = additionalContents[3].Split(';');
            body       = body.Replace("[carb]", sMealValue[0]);
            if (sMealValue.Length > 1)
            {
                body = body.Replace("[carbpercentage]", sMealValue[1]);
            }

            sMealValue = additionalContents[4].Split(';');
            body       = body.Replace("[fat]", sMealValue[0]);
            if (sMealValue.Length > 1)
            {
                body = body.Replace("[fatpercentage]", sMealValue[1]);
            }
        }
        body = body.Replace("/login", "https://diypt.com.au/login/");

        body = body.Replace("/my-account/", "https://diypt.com.au/my-account/");
        body = body.Replace("/continueplan", "https://diypt.com.au/continueplan");
        body = body.Replace("/revitalise-me", "https://diypt.com.au/revitalise-me");
        try
        {
            body = body.Replace("viewonlineurl", "https://diypt.com.au" + node.NiceUrl);
        }
        catch
        {
            //Do nothing
            /* Known issue in Umbraco where NiceUrl fails */
            body = body.Replace("viewonlineurl", "#");
        }

        /*body = body.Replace("/login", "http://diypt.com.au/login/");
        *  body = body.Replace("/login", "http://diypt.com.au/login/");
        *  body = body.Replace("/login", "http://diypt.com.au/login/");
        *  body = body.Replace("/login", "http://diypt.com.au/login/");
        *  body = body.Replace("/login", "http://diypt.com.au/login/");
        *  body = body.Replace("/login", "http://diypt.com.au/login/");
        *  body = body.Replace("/login", "http://diypt.com.au/login/");
        *  body = body.Replace("/login", "http://diypt.com.au/login/");
        *  body = body.Replace("/login", "http://diypt.com.au/login/");*/
        PrizeEmail.SendEmail(email, subject, (header + body + footer).Replace("/images/", "https://diypt.com.au/images/"));
        return(true);
    }