Exemplo n.º 1
0
 //===============================================================
 // Function: Page_Load
 //===============================================================
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);
         emailContentTextBox.Text = gd.GetStringValue("BroadcastEmailContent");
         emailSubjectTextBox.Text = gd.GetStringValue("BroadcastEmailSubject");
     }
 }
Exemplo n.º 2
0
 //===============================================================
 // Function: Page_Load
 //===============================================================
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);
         popularSearchString1TextBox.Text = gd.GetStringValue("PopularSearchString1");
         popularSearchString2TextBox.Text = gd.GetStringValue("PopularSearchString2");
         popularSearchString3TextBox.Text = gd.GetStringValue("PopularSearchString3");
         popularSearchString4TextBox.Text = gd.GetStringValue("PopularSearchString4");
         popularSearchString5TextBox.Text = gd.GetStringValue("PopularSearchString5");
     }
 }
Exemplo n.º 3
0
    //===============================================================
    // Function: uploadProfilePicButton_click
    //===============================================================
    protected void uploadProfilePicButton_click(object sender, EventArgs e)
    {
        if (profilePicFileUpload.PostedFile.ContentLength != 0)
        {
            int fileSizeBytes = profilePicFileUpload.PostedFile.ContentLength;

            GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);
            string fileStoreFolder = gd.GetStringValue("FileStoreFolder") + @"\temp";

            string originalFileName = Path.GetFileName(profilePicFileUpload.PostedFile.FileName);
            string destPath = Path.Combine(fileStoreFolder, originalFileName);
            destPath = destPath.Replace(" ", "_");
            destPath = MiscUtils.GetUniqueFileName(destPath);
            string savedFilename = Path.GetFileName(destPath);

            profilePicFileUpload.PostedFile.SaveAs(destPath);

            int status = MiscUtils.CreatePreviews(Path.GetFileName(destPath),
                int.Parse(Session["loggedInUserID"].ToString()));

            if (status >= 0)
            {
                Response.Redirect("profileRedirect.aspx");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert(\"This type of image is not supported, please choose another.\");", true);
            }
        }
    }
Exemplo n.º 4
0
    //===============================================================
    // Function: uploadProfilePicButton_click
    //===============================================================
    protected void uploadProfilePicButton_click(object sender, EventArgs e)
    {
        if (profilePicFileUpload.PostedFile.ContentLength != 0)
        {
            int fileSizeBytes = profilePicFileUpload.PostedFile.ContentLength;

            GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);
            string fileStoreFolder = gd.GetStringValue("FileStoreFolder") + @"\temp";

            string originalFileName = Path.GetFileName(profilePicFileUpload.PostedFile.FileName);
            string destPath = Path.Combine(fileStoreFolder, originalFileName);
            destPath = destPath.Replace(" ", "_");
            destPath = MiscUtils.GetUniqueFileName(destPath);
            string savedFilename = Path.GetFileName(destPath);

            int status = -1;

            if ( ( profilePicFileUpload.PostedFile.ContentType == "image/jpeg"
                || profilePicFileUpload.PostedFile.ContentType == "image/pjpeg"
                || profilePicFileUpload.PostedFile.ContentType == "image/gif"
                || profilePicFileUpload.PostedFile.ContentType == "image/png" )
                && Path.GetExtension(destPath) != ""
                )
            {
                if (!Directory.Exists(Path.GetDirectoryName(destPath)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(destPath));
                }
                profilePicFileUpload.PostedFile.SaveAs(destPath);

                status = MiscUtils.CreatePreviews(Path.GetFileName(destPath), int.Parse(Session["loggedInUserID"].ToString()));

                // PD 3/12/10 - Removed due to server error on file upload
                var user = new SedogoUser(string.Empty, int.Parse(Session["loggedInUserID"].ToString()));
                ImageHelper.GetRelativeImagePath(user.userID, user.GUID, ImageType.UserPreview, true);
                ImageHelper.GetRelativeImagePath(user.userID, user.GUID, ImageType.UserThumbnail, true);
            }

            if (status >= 0)
            {
                Response.Redirect("profileRedirect.aspx");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert(\"This type of image is not supported or the file extension is missing, please choose another.\");", true);
            }
        }
    }
Exemplo n.º 5
0
    //===============================================================
    // Function: saveButton_Click
    //===============================================================
    public void saveButton_Click(object sender, EventArgs e)
    {
        SedogoUser user = new SedogoUser(Session["loggedInUserFullName"].ToString(),
            int.Parse(Session["loggedInUserID"].ToString()));

        if (profilePicFileUpload.PostedFile.ContentLength != 0)
        {
            int fileSizeBytes = profilePicFileUpload.PostedFile.ContentLength;

            GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);
            string fileStoreFolder = gd.GetStringValue("FileStoreFolder") + @"\temp";

            string originalFileName = Path.GetFileName(profilePicFileUpload.PostedFile.FileName);
            string destPath = Path.Combine(fileStoreFolder, originalFileName);
            int status = -1;
            if ((profilePicFileUpload.PostedFile.ContentType == "image/jpeg"
                || profilePicFileUpload.PostedFile.ContentType == "image/gif"
                || profilePicFileUpload.PostedFile.ContentType == "image/png")
                && Path.GetExtension(destPath) != ""
                )
            {
                destPath = destPath.Replace(" ", "_");
                destPath = MiscUtils.GetUniqueFileName(destPath);
                string savedFilename = Path.GetFileName(destPath);

                profilePicFileUpload.PostedFile.SaveAs(destPath);

                status = MiscUtils.CreatePreviews(Path.GetFileName(destPath),
                    int.Parse(Session["loggedInUserID"].ToString()));
            }

            if (status >= 0)
            {
                Response.Redirect("profileRedirect.aspx");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert(\"This type of image is not supported, please choose another.\");", true);
            }
        }
        else
        {
            user.avatarNumber = int.Parse(avatarComboBox.SelectedValue);
            user.Update();

            Response.Redirect("profileRedirect.aspx");
        }
    }
Exemplo n.º 6
0
        //===============================================================
        // Function: BuildBroadcastEmail
        //===============================================================
        public static string BuildBroadcastEmail(string broadcastEmailContent)
        {
            string emailBody = "";

            GlobalData gd = new GlobalData("");
            string linkURL = gd.GetStringValue("SiteBaseURL");

            StringBuilder emailBodyCopy = new StringBuilder();

            emailBodyCopy.AppendLine("<html>");
            emailBodyCopy.AppendLine("<head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
            emailBodyCopy.AppendLine("<style type=\"text/css\">");
            emailBodyCopy.AppendLine("	body, td, p { font-size: 15px; color: #9B9885; font-family: Arial, Helvetica, Sans-Serif }");
            emailBodyCopy.AppendLine("	p { margin: 0 }");
            emailBodyCopy.AppendLine("	h1 { color: #00ccff; font-size: 18px; font-weight: bold; }");
            emailBodyCopy.AppendLine("	a, .blue { color: #00ccff; text-decoration: none; }");
            emailBodyCopy.AppendLine("	img { border: 0; }");
            emailBodyCopy.AppendLine("</style></head>");
            emailBodyCopy.AppendLine("<body bgcolor=\"#f0f1ec\">");
            emailBodyCopy.AppendLine("  <table width=\"692\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
            //emailBodyCopy.AppendLine("	<tr><td colspan=\"3\"><img src=\"http://www.sedogo.com/email-template/images/email-template_01.png\" width=\"692\" height=\"32\" alt=\"\"></td></tr>");
            emailBodyCopy.AppendLine("	<tr><td style=\"background: #fff\" width=\"30\"></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"632\">");

            emailBodyCopy.AppendLine("			<p>" + broadcastEmailContent.Replace("\n", "<br/>") + "</p>");

            emailBodyCopy.AppendLine("			<p>To log into Sedogo, <a href=\"" + linkURL + "\"><u>click here</u></a>.</p>");
            emailBodyCopy.AppendLine("			<br /><br />");
            emailBodyCopy.AppendLine("			<p>Regards</p><a href=\"http://www.sedogo.com\" class=\"blue\"><strong>The Sedogo Team.</strong></a><br />");
            emailBodyCopy.AppendLine("			<br /><br /><br /><a href=\"http://www.sedogo.com\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/logo.gif\" />");
            emailBodyCopy.AppendLine("			</a></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr><tr><td colspan=\"3\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/email-template_05.png\" width=\"692\" height=\"32\" alt=\"\">");
            emailBodyCopy.AppendLine("		</td></tr><tr><td colspan=\"3\"><small>This message was intended for <<RECIPIENT>>. To stop receiving these emails, go to your profile and uncheck the 'Enable email notifications' option.<br/>Sedogo offices are located at Sedogo Ltd, The Studio, 17 Blossom St, London E1 6PL.</small></td></tr>");
            emailBodyCopy.AppendLine("		</td></tr></table></body></html>");

            emailBody = emailBodyCopy.ToString();

            return emailBody;
        }
Exemplo n.º 7
0
    //===============================================================
    // Function: uploadProfilePicButton_click
    //===============================================================
    protected void uploadProfilePicButton_click(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);
        int userID = int.Parse(Session["loggedInUserID"].ToString());

        if (goalPicFileUpload.PostedFile.ContentLength != 0)
        {
            SedogoEvent sedogoEvent = new SedogoEvent((string)Session["loggedInUserFullName"], eventID);
            sedogoEvent.Update();

            int fileSizeBytes = goalPicFileUpload.PostedFile.ContentLength;

            GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);
            string fileStoreFolder = gd.GetStringValue("FileStoreFolder") + @"\temp";

            string originalFileName = Path.GetFileName(goalPicFileUpload.PostedFile.FileName);
            string destPath = Path.Combine(fileStoreFolder, originalFileName);
            destPath = destPath.Replace(" ", "_");
            destPath = MiscUtils.GetUniqueFileName(destPath);
            string savedFilename = Path.GetFileName(destPath);

            goalPicFileUpload.PostedFile.SaveAs(destPath);

            int status = MiscUtils.CreateGoalPicPreviews(Path.GetFileName(destPath),
                eventID, (string)Session["loggedInUserFullName"], userID, captionTextBox.Text);

            if (status >= 0)
            {
                Response.Redirect("morePictures.aspx?EID=" + eventID.ToString());
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert(\"This type of image is not supported, please choose another.\");", true);
            }
        }
    }
Exemplo n.º 8
0
    //===============================================================
    // Function: sendFeedbackButton_click
    //===============================================================
    protected void sendFeedbackButton_click(object sender, EventArgs e)
    {
        int currentUserID = -1;
        SedogoUser currentUser = null;
        string userEmailAddress = "";
        if (Session["loggedInUserID"] != null)
        {
            currentUserID = int.Parse(Session["loggedInUserID"].ToString());
            currentUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), currentUserID);
            userEmailAddress = currentUser.emailAddress;
        }
        else
        {
            userEmailAddress = emailAddressTextBox.Text;
        }

        string feedbackText = feedbackTextBox.Text;

        GlobalData gd = new GlobalData("");
        string SMTPServer = gd.GetStringValue("SMTPServer");
        string mailFromAddress = gd.GetStringValue("MailFromAddress");
        string mailFromUsername = gd.GetStringValue("MailFromUsername");
        string mailFromPassword = gd.GetStringValue("MailFromPassword");

        //MailMessage message = new MailMessage(mailFromAddress, "*****@*****.**");
        MailMessage message = new MailMessage(mailFromAddress, "*****@*****.**");
        message.ReplyTo = new MailAddress("*****@*****.**");

        StringBuilder emailBody = new StringBuilder();
        emailBody.AppendLine("<html><body>");
        emailBody.AppendLine("Help:<br/>");
        emailBody.AppendLine(userEmailAddress + "<br/>");
        emailBody.AppendLine(feedbackText.Replace("\n", "<br/>") + "<br/>");
        emailBody.AppendLine("</body></html>");

        message.Subject = "Sedogo help";
        message.Body = emailBody.ToString();
        message.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient();
        smtp.Host = SMTPServer;
        if (mailFromPassword != "")
        {
            // If the password is blank, assume mail relay is permitted
            smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
        }
        try
        {
            smtp.Send(message);

            SentEmailHistory emailHistory = new SentEmailHistory("");
            emailHistory.subject = "Sedogo help";
            emailHistory.body = emailBody.ToString();
            emailHistory.sentFrom = mailFromAddress;
            emailHistory.sentTo = "*****@*****.**";
            emailHistory.Add();
        }
        catch (Exception ex)
        {
            SentEmailHistory emailHistory = new SentEmailHistory("");
            emailHistory.subject = "Sedogo help";
            emailHistory.body = ex.Message + " -------- " + emailBody.ToString();
            emailHistory.sentFrom = mailFromAddress;
            emailHistory.sentTo = "*****@*****.**";
            emailHistory.Add();
        }

        Response.Redirect("profileRedirect.aspx");
    }
Exemplo n.º 9
0
    //===============================================================
    // Function: uploadEventPicButton_click
    //===============================================================
    protected void uploadEventPicButton_click(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);

        if (eventPicFileUpload.PostedFile.ContentLength != 0)
        {
            int fileSizeBytes = eventPicFileUpload.PostedFile.ContentLength;

            GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);
            string fileStoreFolder = gd.GetStringValue("FileStoreFolder") + @"\temp";

            string originalFileName = Path.GetFileName(eventPicFileUpload.PostedFile.FileName);
            string destPath = Path.Combine(fileStoreFolder, originalFileName);
            destPath = destPath.Replace(" ", "_");
            destPath = MiscUtils.GetUniqueFileName(destPath);
            string savedFilename = Path.GetFileName(destPath);

            eventPicFileUpload.PostedFile.SaveAs(destPath);

            MiscUtils.CreateEventPicPreviews(Path.GetFileName(destPath), eventID);

            // Update event to set last updated date
            SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);

            ImageHelper.GetRelativeImagePath(sedogoEvent.eventID, sedogoEvent.eventGUID, ImageType.EventPreview, true);
            ImageHelper.GetRelativeImagePath(sedogoEvent.eventID, sedogoEvent.eventGUID, ImageType.EventThumbnail, true);
            sedogoEvent.Update();

            Response.Redirect("viewEvent.aspx?EID=" + eventID.ToString());
        }
    }
Exemplo n.º 10
0
    //===============================================================
    // Function: forgotPasswordButton_click
    //===============================================================
    protected void forgotPasswordButton_click(object sender, EventArgs e)
    {
        string loginEmailAddress = emailAddressTextBox.Text;

        SedogoUser user = new SedogoUser("");
        string newPassword = "";
        Boolean resetStatus = user.ResetUserPassword(loginEmailAddress, ref newPassword);
        if (resetStatus == true)
        {
            // Send the user an email with the new password
            // Email the password to the user
            GlobalData gd = new GlobalData("");
            string SMTPServer = gd.GetStringValue("SMTPServer");
            string mailFromAddress = gd.GetStringValue("MailFromAddress");
            string mailFromUsername = gd.GetStringValue("MailFromUsername");
            string mailFromPassword = gd.GetStringValue("MailFromPassword");

            MailMessage message = new MailMessage(mailFromAddress, loginEmailAddress);
            message.ReplyTo = new MailAddress("*****@*****.**");

            StringBuilder emailBodyCopy = new StringBuilder();

            emailBodyCopy.AppendLine("<html>");
            emailBodyCopy.AppendLine("<head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
            emailBodyCopy.AppendLine("<style type=\"text/css\">");
            emailBodyCopy.AppendLine("	body, td, p { font-size: 15px; color: #9B9885; font-family: Arial, Helvetica, Sans-Serif }");
            emailBodyCopy.AppendLine("	p { margin: 0 }");
            emailBodyCopy.AppendLine("	h1 { color: #00ccff; font-size: 18px; font-weight: bold; }");
            emailBodyCopy.AppendLine("	a, .blue { color: #00ccff; text-decoration: none; }");
            emailBodyCopy.AppendLine("	img { border: 0; }");
            emailBodyCopy.AppendLine("</style></head>");
            emailBodyCopy.AppendLine("<body bgcolor=\"#f0f1ec\">");
            emailBodyCopy.AppendLine("  <table width=\"692\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
            //emailBodyCopy.AppendLine("	<tr><td colspan=\"3\"><img src=\"http://www.sedogo.com/email-template/images/email-template_01.png\" width=\"692\" height=\"32\" alt=\"\"></td></tr>");
            emailBodyCopy.AppendLine("	<tr><td style=\"background: #fff\" width=\"30\"></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"632\">");
            emailBodyCopy.AppendLine("			<h1>Your new sedogo.com password</h1>");
            emailBodyCopy.AppendLine("			<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td width=\"60\">Password:</td>");
            emailBodyCopy.AppendLine("					<td width=\"10\">&nbsp;</td>");
            emailBodyCopy.AppendLine("					<td width=\"530\">" + newPassword + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("			</table>");
            emailBodyCopy.AppendLine("			<br /><br />");
            emailBodyCopy.AppendLine("			<p>Regards</p><a href=\"http://www.sedogo.com\" class=\"blue\"><strong>The Sedogo Team.</strong></a><br />");
            emailBodyCopy.AppendLine("			<br /><br /><br /><a href=\"http://www.sedogo.com\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/logo.gif\" />");
            emailBodyCopy.AppendLine("			</a></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr><tr><td colspan=\"3\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/email-template_05.png\" width=\"692\" height=\"32\" alt=\"\">");
            emailBodyCopy.AppendLine("		</td></tr><tr><td colspan=\"3\"><small>This message was intended for " + loginEmailAddress + ". To stop receiving these emails, go to your profile and uncheck the 'Enable email notifications' option.<br/>Sedogo offices are located at Sedogo Ltd, The Studio, 17 Blossom St, London E1 6PL.</small></td></tr>");
            emailBodyCopy.AppendLine("		</td></tr></table></body></html>");

            message.Subject = "Sedogo password reset";
            message.Body = emailBodyCopy.ToString();
            message.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = SMTPServer;
            if (mailFromPassword != "")
            {
                // If the password is blank, assume mail relay is permitted
                smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
            }
            try
            {
                smtp.Send(message);

                SentEmailHistory emailHistory = new SentEmailHistory("");
                emailHistory.subject = "Sedogo password reset";
                emailHistory.body = emailBodyCopy.ToString();
                emailHistory.sentFrom = mailFromAddress;
                emailHistory.sentTo = loginEmailAddress;
                emailHistory.Add();
            }
            catch (Exception ex)
            {
                SentEmailHistory emailHistory = new SentEmailHistory("");
                emailHistory.subject = "Sedogo password reset";
                emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString();
                emailHistory.sentFrom = mailFromAddress;
                emailHistory.sentTo = loginEmailAddress;
                emailHistory.Add();
            }

            Session["ResetPassword"] = "******";
            Response.Redirect("default.aspx");
        }
        else
        {
            Response.Redirect("noSuchUser.aspx");
        }
    }
Exemplo n.º 11
0
        //===============================================================
        // Function: SendEventUpdateEmail
        //===============================================================
        public void SendEventUpdateEmail(int updatingUserID)
        {
            StringBuilder emailBodyCopy = new StringBuilder();
            GlobalData gd = new GlobalData("");

            string dateString = "";
            DateTime startDate = m_startDate;
            SedogoUser eventOwner = new SedogoUser(m_loggedInUser, m_userID);
            SedogoUser updatingUser = new SedogoUser(m_loggedInUser, updatingUserID);
            MiscUtils.GetDateStringStartDate(eventOwner, m_dateType, m_rangeStartDate,
                m_rangeEndDate, m_beforeBirthday, ref dateString, ref startDate);

            string inviteURL = gd.GetStringValue("SiteBaseURL");
            inviteURL = inviteURL + "/viewEvent.aspx?EID=" + m_eventID.ToString();

            emailBodyCopy.AppendLine("<html>");
            emailBodyCopy.AppendLine("<head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
            emailBodyCopy.AppendLine("<style type=\"text/css\">");
            emailBodyCopy.AppendLine("	body, td, p { font-size: 15px; color: #9B9885; font-family: Arial, Helvetica, Sans-Serif }");
            emailBodyCopy.AppendLine("	p { margin: 0 }");
            emailBodyCopy.AppendLine("	h1 { color: #00ccff; font-size: 18px; font-weight: bold; }");
            emailBodyCopy.AppendLine("	a, .blue { color: #00ccff; text-decoration: none; }");
            emailBodyCopy.AppendLine("	img { border: 0; }");
            emailBodyCopy.AppendLine("</style></head>");
            emailBodyCopy.AppendLine("<body bgcolor=\"#f0f1ec\">");
            emailBodyCopy.AppendLine("  <table width=\"692\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
            //emailBodyCopy.AppendLine("	<tr><td colspan=\"3\"><img src=\"http://www.sedogo.com/email-template/images/email-template_01.png\" width=\"692\" height=\"32\" alt=\"\"></td></tr>");
            emailBodyCopy.AppendLine("	<tr><td style=\"background: #fff\" width=\"30\"></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"632\">");
            emailBodyCopy.AppendLine("			<h1>" + updatingUser.firstName + " " + updatingUser.lastName + " has updated the following goal:</h1>");
            emailBodyCopy.AppendLine("			<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td width=\"60\">What:</td>");
            emailBodyCopy.AppendLine("					<td width=\"10\" rowspan=\"4\">&nbsp;</td>");
            emailBodyCopy.AppendLine("					<td width=\"530\">" + m_eventName + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">Owner:</td>");
            emailBodyCopy.AppendLine("					<td>" + eventOwner.firstName + " " + eventOwner.lastName + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">Where:</td>");
            emailBodyCopy.AppendLine("					<td>" + m_eventVenue + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">When:</td>");
            emailBodyCopy.AppendLine("					<td>" + dateString + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("			</table>");
            emailBodyCopy.AppendLine("			<p>To view this event, <a href=\"" + inviteURL + "\"><u>click here</u></a>.</p>");
            emailBodyCopy.AppendLine("			<br /><br />");
            emailBodyCopy.AppendLine("			<p>Regards</p><a href=\"http://www.sedogo.com\" class=\"blue\"><strong>The Sedogo Team.</strong></a><br />");
            emailBodyCopy.AppendLine("			<br /><br /><br /><a href=\"http://www.sedogo.com\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/logo.gif\" />");
            emailBodyCopy.AppendLine("			</a></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr><tr><td colspan=\"3\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/email-template_05.png\" width=\"692\" height=\"32\" alt=\"\">");
            emailBodyCopy.AppendLine("		</td></tr><tr><td colspan=\"3\"><small>This message was intended for <<RECIPIENT>>. To stop receiving these emails, go to your profile and uncheck the 'Enable email notifications' option.<br/>Sedogo offices are located at Sedogo Ltd, The Studio, 17 Blossom St, London E1 6PL.</small></td></tr>");
            emailBodyCopy.AppendLine("		</td></tr></table></body></html>");

            string emailSubject = m_eventName + " on " + dateString + " has been updated";

            string SMTPServer = gd.GetStringValue("SMTPServer");
            string mailFromAddress = gd.GetStringValue("MailFromAddress");
            string mailFromUsername = gd.GetStringValue("MailFromUsername");
            string mailFromPassword = gd.GetStringValue("MailFromPassword");

            // Sent the message to the event owner as well as the trackers
            if (updatingUserID != m_userID)
            {
                if (eventOwner.enableSendEmails == true)
                {
                    try
                    {
                        MailMessage message = new MailMessage(mailFromAddress, eventOwner.emailAddress);
                        message.ReplyTo = new MailAddress("*****@*****.**");

                        message.Subject = emailSubject;
                        message.Body = emailBodyCopy.ToString().Replace("<<RECIPIENT>>", eventOwner.emailAddress);
                        message.IsBodyHtml = true;
                        SmtpClient smtp = new SmtpClient();
                        smtp.Host = SMTPServer;
                        if (mailFromPassword != "")
                        {
                            // If the password is blank, assume mail relay is permitted
                            smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
                        }
                        smtp.Send(message);

                        SentEmailHistory emailHistory = new SentEmailHistory("");
                        emailHistory.subject = emailSubject;
                        emailHistory.body = emailBodyCopy.ToString().Replace("<<RECIPIENT>>", eventOwner.emailAddress);
                        emailHistory.sentFrom = mailFromAddress;
                        emailHistory.sentTo = eventOwner.emailAddress;
                        emailHistory.Add();
                    }
                    catch (Exception ex)
                    {
                        SentEmailHistory emailHistory = new SentEmailHistory("");
                        emailHistory.subject = emailSubject;
                        emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString().Replace("<<RECIPIENT>>", eventOwner.emailAddress);
                        emailHistory.sentFrom = mailFromAddress;
                        emailHistory.sentTo = eventOwner.emailAddress;
                        emailHistory.Add();
                    }
                }
            }

            SqlConnection conn = new SqlConnection(GlobalSettings.connectionString);
            try
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand("", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "spSelectTrackingUsersByEventID";
                cmd.Parameters.Add("@EventID", SqlDbType.Int).Value = m_eventID;
                DbDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    //int trackedEventID = int.Parse(rdr["TrackedEventID"].ToString());
                    int userID = int.Parse(rdr["UserID"].ToString());
                    string firstName = (string)rdr["FirstName"];
                    string lastName = (string)rdr["LastName"];
                    //string gender = (string)rdr["Gender"];
                    //string homeTown = (string)rdr["HomeTown"];
                    string emailAddress = (string)rdr["EmailAddress"];

                    if (updatingUserID != userID)
                    {
                        SedogoUser user = new SedogoUser(m_loggedInUser, userID);
                        if (user.enableSendEmails == true)
                        {
                            try
                            {
                                MailMessage message = new MailMessage(mailFromAddress, emailAddress);
                                message.ReplyTo = new MailAddress("*****@*****.**");

                                message.Subject = emailSubject;
                                message.Body = emailBodyCopy.ToString().Replace("<<RECIPIENT>>", emailAddress);
                                message.IsBodyHtml = true;
                                SmtpClient smtp = new SmtpClient();
                                smtp.Host = SMTPServer;
                                if (mailFromPassword != "")
                                {
                                    // If the password is blank, assume mail relay is permitted
                                    smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
                                }
                                smtp.Send(message);

                                SentEmailHistory emailHistory = new SentEmailHistory("");
                                emailHistory.subject = emailSubject;
                                emailHistory.body = emailBodyCopy.ToString().Replace("<<RECIPIENT>>", emailAddress);
                                emailHistory.sentFrom = mailFromAddress;
                                emailHistory.sentTo = emailAddress;
                                emailHistory.Add();
                            }
                            catch (Exception ex)
                            {
                                SentEmailHistory emailHistory = new SentEmailHistory("");
                                emailHistory.subject = emailSubject;
                                emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString().Replace("<<RECIPIENT>>", emailAddress);
                                emailHistory.sentFrom = mailFromAddress;
                                emailHistory.sentTo = emailAddress;
                                emailHistory.Add();
                            }
                        }
                    }
                }
                rdr.Close();
            }
            catch (Exception ex)
            {
                ErrorLog errorLog = new ErrorLog();
                errorLog.WriteLog("SedogoEvent", "SendEventUpdateEmail", ex.Message, logMessageLevel.errorMessage);
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }
Exemplo n.º 12
0
    //===============================================================
    // Function: postCommentButton_click
    //===============================================================
    protected void postCommentButton_click(object sender, EventArgs e)
    {
        if (Session["loggedInUserID"] == null)
        {
            Response.Redirect("~/profile.aspx");
        }

        int eventID = int.Parse(Request.QueryString["EID"]);
        int loggedInUserID = int.Parse(Session["loggedInUserID"].ToString());

        string commentText = commentTextBox.Text;

        Boolean checkFailed = false;
        if (commentText.Contains("<script") == true)
        {
            checkFailed = true;
        }

        if (checkFailed == false)
        {
            SedogoEventComment comment = new SedogoEventComment(Session["loggedInUserFullName"].ToString());
            if (eventPicFileUpload.PostedFile != null)
            {
                if (eventPicFileUpload.PostedFile.ContentLength != 0)
                {
                    int fileSizeBytes = eventPicFileUpload.PostedFile.ContentLength;

                    GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);
                    string fileStoreFolder = gd.GetStringValue("FileStoreFolder") + @"\temp";

                    string originalFileName = Path.GetFileName(eventPicFileUpload.PostedFile.FileName);
                    string destPath = Path.Combine(fileStoreFolder, originalFileName);
                    int status = -1;
                    if ((eventPicFileUpload.PostedFile.ContentType == "image/jpeg"
                        || eventPicFileUpload.PostedFile.ContentType == "image/pjpeg"
                        || eventPicFileUpload.PostedFile.ContentType == "image/gif"
                        || eventPicFileUpload.PostedFile.ContentType == "image/png")
                        && Path.GetExtension(destPath) != ""
                        )
                    {
                        destPath = destPath.Replace(" ", "_");
                        destPath = MiscUtils.GetUniqueFileName(destPath);
                        string savedFilename = Path.GetFileName(destPath);

                        eventPicFileUpload.PostedFile.SaveAs(destPath);

                        string savedFileName = "";
                        string destFilename = "";
                        string destPreviewFilename = "";
                        MiscUtils.CreateEventCommentImagePreviews(Path.GetFileName(destPath),
                            out savedFileName, out destFilename, out destPreviewFilename);

                        comment.eventImageFilename = Path.GetFileName(savedFileName);
                        comment.eventImagePreview = Path.GetFileName(destPreviewFilename);
                    }
                }
            }
            if (videoLinkText.Text != "")
            {
                comment.eventVideoLink = videoLinkText.Text;
            }
            if (linkTextBox.Text != "" && linkTextBox.Text != "http://")
            {
                comment.eventLink = linkTextBox.Text;
            }
            comment.eventID = eventID;
            comment.postedByUserID = loggedInUserID;
            comment.commentText = commentText;
            comment.Add();

            SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);
            sedogoEvent.SendEventUpdateEmail(loggedInUserID);

            // Update event to change lasst updated by date/name
            sedogoEvent.Update();

            Response.Redirect("viewEvent.aspx?EID=" + eventID.ToString());
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
                "alert(\"Invalid content detected in the comment\");", true);
        }
    }
Exemplo n.º 13
0
    //===============================================================
    // Function: SendInviteEmail
    //===============================================================
    private Boolean SendInviteEmail(int eventID, string emailAddress, string additionalInviteText,
        out string errorMessageDescription)
    {
        Boolean sentOK = false;
        GlobalData gd = new GlobalData("");
        errorMessageDescription = "";

        if (MiscUtils.IsValidEmailAddress(emailAddress) == true)
        {
            int userID = -1;
            if (Session["loggedInUserID"] != null)
            {
                userID = int.Parse(Session["loggedInUserID"].ToString());
            }

            string currentUserFullName = "";
            SedogoEvent sedogoEvent = new SedogoEvent("", eventID);
            if (userID > 0)
            {
                SedogoUser currentUser = new SedogoUser("", userID);
                currentUserFullName = currentUser.firstName + " " + currentUser.lastName;
            }
            SedogoUser eventOwner = new SedogoUser("", sedogoEvent.userID);

            string dateString = "";
            DateTime startDate = sedogoEvent.startDate;
            MiscUtils.GetDateStringStartDate(eventOwner, sedogoEvent.dateType, sedogoEvent.rangeStartDate,
                sedogoEvent.rangeEndDate, sedogoEvent.beforeBirthday, ref dateString, ref startDate);

            StringBuilder emailBodyCopy = new StringBuilder();

            string eventURL = gd.GetStringValue("SiteBaseURL");
            eventURL = eventURL + "?EID=" + eventID.ToString();

            emailBodyCopy.AppendLine("<html>");
            emailBodyCopy.AppendLine("<head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
            emailBodyCopy.AppendLine("<style type=\"text/css\">");
            emailBodyCopy.AppendLine("	body, td, p { font-size: 15px; color: #9B9885; font-family: Arial, Helvetica, Sans-Serif }");
            emailBodyCopy.AppendLine("	p { margin: 0 }");
            emailBodyCopy.AppendLine("	h1 { color: #00ccff; font-size: 18px; font-weight: bold; }");
            emailBodyCopy.AppendLine("	a, .blue { color: #00ccff; text-decoration: none; }");
            emailBodyCopy.AppendLine("</style></head>");
            emailBodyCopy.AppendLine("<body bgcolor=\"#f0f1ec\">");
            emailBodyCopy.AppendLine("  <table width=\"692\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
            //emailBodyCopy.AppendLine("	<tr><td colspan=\"3\"><img src=\"http://www.sedogo.com/email-template/images/email-template_01.png\" width=\"692\" height=\"32\" alt=\"\"></td></tr>");
            emailBodyCopy.AppendLine("	<tr><td style=\"background: #fff\" width=\"30\"></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"632\">");
            //emailBodyCopy.AppendLine("			<h1>sedogo.com message</h1>");
            emailBodyCopy.AppendLine("			<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">Goal:</td>");
            emailBodyCopy.AppendLine("					<td><a href=\"" + eventURL + "\">" + sedogoEvent.eventName + "</a></td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">When:</td>");
            emailBodyCopy.AppendLine("					<td>" + dateString + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">Where:</td>");
            emailBodyCopy.AppendLine("					<td>" + sedogoEvent.eventVenue + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">Message:</td>");
            emailBodyCopy.AppendLine("					<td><p style=\"color:black\">" + additionalInviteText.Replace("\n", "<br/>") + "</p></td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("			</table>");
            emailBodyCopy.AppendLine("			<br /><br />");
            emailBodyCopy.AppendLine("			<p>Regards</p><a href=\"http://www.sedogo.com\" class=\"blue\"><strong>The Sedogo Team.</strong></a><br />");
            emailBodyCopy.AppendLine("			<br /><br /><br /><a href=\"http://www.sedogo.com\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/logo.gif\" />");
            emailBodyCopy.AppendLine("			</a></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr><tr><td colspan=\"3\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/email-template_05.png\" width=\"692\" height=\"32\" alt=\"\">");
            emailBodyCopy.AppendLine("		</td></tr><tr><td colspan=\"3\"><small>This message was intended for " + emailAddress + ". To stop receiving these emails, go to your profile and uncheck the 'Enable email notifications' option.<br/>Sedogo offices are located at Sedogo Ltd, The Studio, 17 Blossom St, London E1 6PL.</small></td></tr>");
            emailBodyCopy.AppendLine("		</td></tr></table></body></html>");

            string emailSubject = currentUserFullName + " wants to tell you about " + sedogoEvent.eventName;

            string SMTPServer = gd.GetStringValue("SMTPServer");
            string mailFromAddress = gd.GetStringValue("MailFromAddress");
            string mailFromUsername = gd.GetStringValue("MailFromUsername");
            string mailFromPassword = gd.GetStringValue("MailFromPassword");

            sentOK = true;

            try
            {
                MailMessage mailMessage = new MailMessage(mailFromAddress, emailAddress);
                mailMessage.ReplyTo = new MailAddress("*****@*****.**");

                mailMessage.Subject = emailSubject;
                mailMessage.Body = emailBodyCopy.ToString();
                mailMessage.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = SMTPServer;
                if (mailFromPassword != "")
                {
                    // If the password is blank, assume mail relay is permitted
                    smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
                }
                smtp.Send(mailMessage);

                SentEmailHistory emailHistory = new SentEmailHistory("");
                emailHistory.subject = emailSubject;
                emailHistory.body = emailBodyCopy.ToString();
                emailHistory.sentFrom = mailFromAddress;
                emailHistory.sentTo = emailAddress;
                emailHistory.Add();
            }
            catch (Exception ex)
            {
                sentOK = false;
                errorMessageDescription = emailAddress + " - invalid email address";

                SentEmailHistory emailHistory = new SentEmailHistory("");
                emailHistory.subject = emailSubject;
                emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString();
                emailHistory.sentFrom = mailFromAddress;
                emailHistory.sentTo = emailAddress;
                emailHistory.Add();
            }
        }
        else
        {
            errorMessageDescription = emailAddress + " - invalid email address";
        }

        return sentOK;
    }
Exemplo n.º 14
0
    //===============================================================
    // Function: uploadEventPicButton_click
    //===============================================================
    protected void uploadEventPicButton_click(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);

        if (eventPicFileUpload.PostedFile.ContentLength != 0)
        {
            int fileSizeBytes = eventPicFileUpload.PostedFile.ContentLength;

            GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);
            string fileStoreFolder = gd.GetStringValue("FileStoreFolder") + @"\temp";

            string originalFileName = Path.GetFileName(eventPicFileUpload.PostedFile.FileName);
            string destPath = Path.Combine(fileStoreFolder, originalFileName);
            destPath = destPath.Replace(" ", "_");
            destPath = MiscUtils.GetUniqueFileName(destPath);
            string savedFilename = Path.GetFileName(destPath);

            eventPicFileUpload.PostedFile.SaveAs(destPath);

            MiscUtils.CreateEventPicPreviews(Path.GetFileName(destPath), eventID);

            Response.Redirect("viewEvent.aspx?EID=" + eventID.ToString());
        }
    }
Exemplo n.º 15
0
        //===============================================================
        // Function: CreateEventCommentImagePreviews
        // Description:
        //===============================================================
        public static int CreateEventCommentImagePreviews(string filename,
            out string savedFileName, out string thumbnailFileName, out string previewFileName)
        {
            int returnStatus = -1;

            GlobalData gd = new GlobalData("");
            int thumbnailSize = gd.GetIntegerValue("ThumbnailSize");
            int previewSize = 500;  // gd.GetIntegerValue("PreviewSize");
            string fileStoreFolder = gd.GetStringValue("FileStoreFolder");
            string fileStoreFolderTemp = fileStoreFolder + "\\temp";
            string fileStoreFolderProfilePics = fileStoreFolder + "\\eventPics";
            savedFileName = "";
            thumbnailFileName = "";
            previewFileName = "";

            // Just for the goal comments, if the image is smaller than 500, leave it at its
            // original size
            System.Drawing.Image sourceImagePreview = System.Drawing.Image.FromFile(fileStoreFolderTemp + @"\" + filename);
            if (sourceImagePreview.Width < previewSize)
            {
                previewSize = sourceImagePreview.Width;
            }
            sourceImagePreview.Dispose();

            int thumbnailStatus = GenerateThumbnail(fileStoreFolderTemp,
                filename, thumbnailSize, thumbnailSize, previewSize, previewSize,
                out thumbnailFileName, out previewFileName);

            if (thumbnailStatus > 0)
            {
                // Move the thumbnails to the /profilePics folder and update the user
                string destFilename = MiscUtils.GetUniqueFileName(Path.Combine(fileStoreFolderProfilePics, filename));
                string destThumbnailFilename = MiscUtils.GetUniqueFileName(Path.Combine(fileStoreFolderProfilePics, thumbnailFileName));
                string destPreviewFilename = MiscUtils.GetUniqueFileName(Path.Combine(fileStoreFolderProfilePics, previewFileName));

                File.Move(Path.Combine(fileStoreFolderTemp, filename),
                    destFilename);
                File.Move(Path.Combine(fileStoreFolderTemp, thumbnailFileName),
                    destThumbnailFilename);
                File.Move(Path.Combine(fileStoreFolderTemp, previewFileName),
                    destPreviewFilename);

                savedFileName = destFilename;
                thumbnailFileName = destThumbnailFilename;
                previewFileName = destPreviewFilename;

                returnStatus = 0;
            }

            return returnStatus;
        }
Exemplo n.º 16
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int eventID = int.Parse(Request.QueryString["EID"]);
            int userID = -1;
            string loggedInUserName = "";
            if (Session["loggedInUserID"] != null)
            {
                userID = int.Parse(Session["loggedInUserID"].ToString());
                loggedInUserName = Session["loggedInUserFullName"].ToString();
            }
            int eventPictureID = int.Parse(Request.QueryString["EPID"].ToString());

            sidebarControl.userID = userID;
            if (userID > 0)
            {
                SedogoUser user = new SedogoUser(Session["loggedInUserFullName"].ToString(), userID);
                sidebarControl.user = user;
                bannerAddFindControl.userID = userID;
            }
            else
            {
            }

            SedogoEvent sedogoEvent = new SedogoEvent(loggedInUserName, eventID);
            eventTitleLabel.Text = sedogoEvent.eventName;

            if (sedogoEvent.privateEvent == true)
            {
                privateIcon.Visible = true;
            }

            if (sedogoEvent.deleted == true)
            {
                Response.Redirect("~/profile.aspx");
            }

            pageTitleUserName.Text = sedogoEvent.eventName + " pictures : Sedogo : Create your future and connect with others to make it happen";
            string timelineColour = "#cd3301";
            switch (sedogoEvent.categoryID)
            {
                case 1:
                    timelineColour = "#cd3301";
                    break;
                case 2:
                    timelineColour = "#ff0b0b";
                    break;
                case 3:
                    timelineColour = "#ff6801";
                    break;
                case 4:
                    timelineColour = "#ff8500";
                    break;
                case 5:
                    timelineColour = "#d5b21a";
                    break;
                case 6:
                    timelineColour = "#8dc406";
                    break;
                case 7:
                    timelineColour = "#5b980c";
                    break;
                case 8:
                    timelineColour = "#079abc";
                    break;
                case 9:
                    timelineColour = "#5ab6cd";
                    break;
                case 10:
                    timelineColour = "#8a67c1";
                    break;
                case 11:
                    timelineColour = "#e54ecf";
                    break;
                case 12:
                    timelineColour = "#a5369c";
                    break;
                case 13:
                    timelineColour = "#a32672";
                    break;
            }
            pageBannerBarDiv.Style.Add("background-color", timelineColour);

            SedogoEventPicture eventPic = new SedogoEventPicture((string)Application["connectionString"], eventPictureID);

            eventImage.ImageUrl = "~/assets/eventPics/" + eventPic.eventImagePreview;

            GlobalData gd = new GlobalData("");
            string imageFile = gd.GetStringValue("FileStoreFolder") + @"\eventPics\" + eventPic.eventImagePreview;
            //FileInfo imageFileInfo = new FileInfo(imageFile);
            System.Drawing.Image sourceImage = System.Drawing.Image.FromFile(imageFile);
            if (sourceImage.Height > 370)
            {
                eventImage.Height = 370;
            }
            captionLabel.Text = eventPic.caption;

            /*
            if (userID > 0)
            {
                SedogoEvent sedogoEvent = new SedogoEvent("", eventID);
                if (sedogoEvent.userID != userID)
                {
                    // Viewing someone elses event
                    captionTextBox.Visible = false;
                    saveButton.Visible = false;
                    deleteButton.Visible = false;
                }
                else
                {
                    // Viewing own event
                    captionLabel.Text = "Caption: ";
                    captionTextBox.Visible = true;
                    captionTextBox.Text = eventPic.caption;
                    saveButton.Visible = true;
                    deleteButton.Visible = true;

                    deleteButton.Attributes.Add("onclick", "if(confirm('Are you sure you want to delete this picture?')){document.forms[0].target = '_top';return true;}else{return false}");
                }
            }
            else
            {
                // Not logged in
                captionLabel.Text = eventPic.caption;
                captionTextBox.Visible = false;
                saveButton.Visible = false;
                deleteButton.Visible = false;
            }
            */
        }
    }
Exemplo n.º 17
0
    //===============================================================
    // Function: saveChangesButton_click
    //===============================================================
    protected void saveChangesButton_click(object sender, EventArgs e)
    {
        Boolean continueSending = false;
        if (Session["SendMessageCaptcha"] == null || (string)Session["SendMessageCaptcha"] == "N")
        {
            if (registerCaptcha.IsValid == true)
            {
                Session["SendMessageCaptcha"] = "Y";
                continueSending = true;
            }
        }
        else
        {
            // Captcha has already been done in this session
            continueSending = true;
        }
        if (continueSending == true)
        {
            int eventID = int.Parse(Request.QueryString["EID"]);

            SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);
            SedogoUser currentUser = new SedogoUser(Session["loggedInUserFullName"].ToString(),
                int.Parse(Session["loggedInUserID"].ToString()));
            SedogoUser eventOwner = new SedogoUser(Session["loggedInUserFullName"].ToString(),
                sedogoEvent.userID);

            string messageText = messageTextBox.Text;

            Message message = new Message(Session["loggedInUserFullName"].ToString());
            message.userID = sedogoEvent.userID;
            message.eventID = eventID;
            message.postedByUserID = int.Parse(Session["loggedInUserID"].ToString());
            message.messageText = messageText;
            message.Add();

            StringBuilder emailBodyCopy = new StringBuilder();

            GlobalData gd = new GlobalData("");
            string eventURL = gd.GetStringValue("SiteBaseURL");
            eventURL = eventURL + "/viewEvent.aspx?EID=" + eventID.ToString();

            string replyURL = gd.GetStringValue("SiteBaseURL");
            replyURL = replyURL + "?Redir=Messages&MessageID=" + message.messageID.ToString();

            emailBodyCopy.AppendLine("<html>");
            emailBodyCopy.AppendLine("<head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
            emailBodyCopy.AppendLine("<style type=\"text/css\">");
            emailBodyCopy.AppendLine("	body, td, p { font-size: 15px; color: #9B9885; font-family: Arial, Helvetica, Sans-Serif }");
            emailBodyCopy.AppendLine("	p { margin: 0 }");
            emailBodyCopy.AppendLine("	h1 { color: #00ccff; font-size: 18px; font-weight: bold; }");
            emailBodyCopy.AppendLine("	a, .blue { color: #00ccff; text-decoration: none; }");
            emailBodyCopy.AppendLine("</style></head>");
            emailBodyCopy.AppendLine("<body bgcolor=\"#f0f1ec\">");
            emailBodyCopy.AppendLine("  <table width=\"692\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
            //emailBodyCopy.AppendLine("	<tr><td colspan=\"3\"><img src=\"http://www.sedogo.com/email-template/images/email-template_01.png\" width=\"692\" height=\"32\" alt=\"\"></td></tr>");
            emailBodyCopy.AppendLine("	<tr><td style=\"background: #fff\" width=\"30\"></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"632\">");
            //emailBodyCopy.AppendLine("			<h1>sedogo.com message</h1>");
            emailBodyCopy.AppendLine("			<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td width=\"60\">From:</td>");
            emailBodyCopy.AppendLine("					<td width=\"10\" rowspan=\"5\">&nbsp;</td>");
            emailBodyCopy.AppendLine("					<td width=\"530\">" + currentUser.firstName + " " + currentUser.lastName + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">Goal:</td>");
            emailBodyCopy.AppendLine("					<td><a href=\"" + eventURL + "\">" + sedogoEvent.eventName + "</a></td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">Where:</td>");
            emailBodyCopy.AppendLine("					<td>" + sedogoEvent.eventVenue + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">Message:</td>");
            emailBodyCopy.AppendLine("					<td><p style=\"color:black\">" + messageText.Replace("\n", "<br/>") + "</p></td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\"></td>");
            emailBodyCopy.AppendLine("					<td><a class=\"blue\" href=\"" + replyURL + "\">Click here to reply to this message</a></td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("			</table>");
            emailBodyCopy.AppendLine("			<br /><br />");
            emailBodyCopy.AppendLine("			<p>Regards</p><a href=\"http://www.sedogo.com\" class=\"blue\"><strong>The Sedogo Team.</strong></a><br />");
            emailBodyCopy.AppendLine("			<br /><br /><br /><a href=\"http://www.sedogo.com\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/logo.gif\" />");
            emailBodyCopy.AppendLine("			</a></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr><tr><td colspan=\"3\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/email-template_05.png\" width=\"692\" height=\"32\" alt=\"\">");
            emailBodyCopy.AppendLine("		</td></tr><tr><td colspan=\"3\"><small>This message was intended for " + eventOwner.emailAddress + ". To stop receiving these emails, go to your profile and uncheck the 'Enable email notifications' option.<br/>Sedogo offices are located at Sedogo Ltd, The Studio, 17 Blossom St, London E1 6PL.</small></td></tr>");
            emailBodyCopy.AppendLine("		</td></tr></table></body></html>");

            string emailSubject = "Sedogo message from " + currentUser.firstName + " regarding " + sedogoEvent.eventName;

            string SMTPServer = gd.GetStringValue("SMTPServer");
            string mailFromAddress = gd.GetStringValue("MailFromAddress");
            string mailFromUsername = gd.GetStringValue("MailFromUsername");
            string mailFromPassword = gd.GetStringValue("MailFromPassword");

            if (eventOwner.enableSendEmails == true)
            {
                try
                {
                    MailMessage mailMessage = new MailMessage(mailFromAddress, eventOwner.emailAddress);
                    mailMessage.ReplyTo = new MailAddress("*****@*****.**");

                    mailMessage.Subject = emailSubject;
                    mailMessage.Body = emailBodyCopy.ToString();
                    mailMessage.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host = SMTPServer;
                    if (mailFromPassword != "")
                    {
                        // If the password is blank, assume mail relay is permitted
                        smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
                    }
                    smtp.Send(mailMessage);

                    SentEmailHistory emailHistory = new SentEmailHistory(Session["loggedInUserFullName"].ToString());
                    emailHistory.subject = emailSubject;
                    emailHistory.body = emailBodyCopy.ToString();
                    emailHistory.sentFrom = mailFromAddress;
                    emailHistory.sentTo = eventOwner.emailAddress;
                    emailHistory.Add();
                }
                catch (Exception ex)
                {
                    SentEmailHistory emailHistory = new SentEmailHistory(Session["loggedInUserFullName"].ToString());
                    emailHistory.subject = emailSubject;
                    emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString();
                    emailHistory.sentFrom = mailFromAddress;
                    emailHistory.sentTo = eventOwner.emailAddress;
                    emailHistory.Add();
                }
            }

            Response.Redirect("viewEvent.aspx?EID=" + eventID.ToString());
        }
    }
Exemplo n.º 18
0
    //===============================================================
    // Function: SendInviteEmail
    //===============================================================
    private Boolean SendInviteEmail(int eventID, string emailAddress, string additionalInviteText,
        string dateString, SedogoEvent currentEvent, SedogoUser currentUser,
        out string errorMessageDescription)
    {
        Boolean sentOK = false;
        GlobalData gd = new GlobalData("");
        errorMessageDescription = "";

        if (MiscUtils.IsValidEmailAddress(emailAddress) == true)
        {
            try
            {
                // Check if they have already been invited
                int inviteCount = EventInvite.GetInviteCountForEmailAddress(eventID, emailAddress);
                if (inviteCount == 0)
                {
                    StringBuilder emailBodyCopy = new StringBuilder();

                    // Check if they are a Sedogo account holder
                    int sedogoUserID = SedogoUser.GetUserIDFromEmailAddress(emailAddress);
                    Boolean enableSendEmails = true;

                    if( sedogoUserID != currentUser.userID )
                    {
                        EventInvite newInvite = new EventInvite(Session["loggedInUserFullName"].ToString());
                        newInvite.eventID = eventID;
                        newInvite.emailAddress = emailAddress;
                        newInvite.inviteAdditionalText = additionalInviteText;
                        newInvite.userID = sedogoUserID;
                        newInvite.Add();

                        string inviteURL = gd.GetStringValue("SiteBaseURL");
                        inviteURL = inviteURL + "?EIG=" + newInvite.eventInviteGUID;
                        string eventURL = gd.GetStringValue("SiteBaseURL");
                        eventURL = eventURL + "?EID=" + currentEvent.eventID.ToString();

                        emailBodyCopy.AppendLine("<html>");
                        emailBodyCopy.AppendLine("<head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
                        emailBodyCopy.AppendLine("<style type=\"text/css\">");
                        emailBodyCopy.AppendLine("	body, td, p { font-size: 15px; color: #9B9885; font-family: Arial, Helvetica, Sans-Serif }");
                        emailBodyCopy.AppendLine("	p { margin: 0 }");
                        emailBodyCopy.AppendLine("	h1 { color: #00ccff; font-size: 18px; font-weight: bold; }");
                        emailBodyCopy.AppendLine("	a, .blue { color: #00ccff; text-decoration: none; }");
                        emailBodyCopy.AppendLine("	img { border: 0; }");
                        emailBodyCopy.AppendLine("</style></head>");
                        emailBodyCopy.AppendLine("<body bgcolor=\"#f0f1ec\">");
                        emailBodyCopy.AppendLine("  <table width=\"692\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
                        //emailBodyCopy.AppendLine("	<tr><td colspan=\"3\"><img src=\"http://www.sedogo.com/email-template/images/email-template_01.png\" width=\"692\" height=\"32\" alt=\"\"></td></tr>");
                        emailBodyCopy.AppendLine("	<tr><td style=\"background: #fff\" width=\"30\"></td>");
                        emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"632\">");
                        if (sedogoUserID > 0)
                        {
                            SedogoUser inviteUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), sedogoUserID);
                            if (inviteUser.enableSendEmails == false)
                            {
                                enableSendEmails = false;
                            }

                            inviteURL = inviteURL + "&UID=" + sedogoUserID.ToString();

                            emailBodyCopy.AppendLine("			<h1>You are invited to join the following goal:</h1>");
                            emailBodyCopy.AppendLine("			<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">");
                            emailBodyCopy.AppendLine("				<tr>");
                            emailBodyCopy.AppendLine("					<td width=\"60\">What:</td>");
                            emailBodyCopy.AppendLine("					<td width=\"10\">&nbsp;</td>");
                            emailBodyCopy.AppendLine("					<td width=\"530\">" + currentEvent.eventName + "</td>");
                            emailBodyCopy.AppendLine("				</tr>");
                            emailBodyCopy.AppendLine("				<tr>");
                            emailBodyCopy.AppendLine("					<td valign=\"top\">Where:</td>");
                            emailBodyCopy.AppendLine("					<td width=\"10\">&nbsp;</td>");
                            emailBodyCopy.AppendLine("					<td>" + currentEvent.eventVenue + "</td>");
                            emailBodyCopy.AppendLine("				</tr>");
                            emailBodyCopy.AppendLine("				<tr>");
                            emailBodyCopy.AppendLine("					<td valign=\"top\">When:</td>");
                            emailBodyCopy.AppendLine("					<td width=\"10\">&nbsp;</td>");
                            emailBodyCopy.AppendLine("					<td>" + dateString + "</td>");
                            emailBodyCopy.AppendLine("				</tr>");
                            emailBodyCopy.AppendLine("			</table>");
                            emailBodyCopy.AppendLine("			<p><span class=\"blue\">" + currentUser.firstName + "</span> has created this future goal on <a href=\"http://www.sedogo.com\">sedogo.com</a> and wants you to join in.</p>");
                            emailBodyCopy.AppendLine("			<p>To be part of this event, <a href=\"" + inviteURL + "\"><u>click here</u></a>.</p>");
                            emailBodyCopy.AppendLine("			<p>To see who else is part of making this goal happen, <a href=\"" + eventURL + "\"><u>click here</u></a>.</p>");
                            emailBodyCopy.AppendLine("			<p>To view this goal, <a href=\"" + eventURL + "\"><u>click here</u></a>.</p>");
                        }
                        else
                        {
                            emailBodyCopy.AppendLine("			<h1>You are invited to join the following goal:</h1>");
                            emailBodyCopy.AppendLine("			<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">");
                            emailBodyCopy.AppendLine("				<tr>");
                            emailBodyCopy.AppendLine("					<td width=\"60\">What:</td>");
                            emailBodyCopy.AppendLine("					<td width=\"10\">&nbsp;</td>");
                            emailBodyCopy.AppendLine("					<td width=\"530\">" + currentEvent.eventName + "</td>");
                            emailBodyCopy.AppendLine("				</tr>");
                            emailBodyCopy.AppendLine("				<tr>");
                            emailBodyCopy.AppendLine("					<td valign=\"top\">Where:</td>");
                            emailBodyCopy.AppendLine("					<td width=\"10\">&nbsp;</td>");
                            emailBodyCopy.AppendLine("					<td>" + currentEvent.eventVenue + "</td>");
                            emailBodyCopy.AppendLine("				</tr>");
                            emailBodyCopy.AppendLine("				<tr>");
                            emailBodyCopy.AppendLine("					<td valign=\"top\">When:</td>");
                            emailBodyCopy.AppendLine("					<td width=\"10\">&nbsp;</td>");
                            emailBodyCopy.AppendLine("					<td>" + dateString + "</td>");
                            emailBodyCopy.AppendLine("				</tr>");
                            emailBodyCopy.AppendLine("			</table>");
                            emailBodyCopy.AppendLine("			<p><span class=\"blue\">" + currentUser.firstName + "</span> has created this future goal on <a href=\"http://www.sedogo.com\">sedogo.com</a> and wants you to join in.</p>");
                            emailBodyCopy.AppendLine("			<p>To be part of this event, <a href=\"" + inviteURL + "\">sign up</a> for a free sedogo account now.");
                            emailBodyCopy.AppendLine("			<p>When you have completed the registration process, <a href=\"" + eventURL + "\">click here</a> to view this event.");
                        }
                        emailBodyCopy.AppendLine("			<br /><br />");
                        emailBodyCopy.AppendLine("			<p>Regards</p><a href=\"http://www.sedogo.com\" class=\"blue\"><strong>The Sedogo Team.</strong></a><br />");
                        emailBodyCopy.AppendLine("			<br /><br /><br /><a href=\"http://www.sedogo.com\">");
                        //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/logo.gif\" />");
                        emailBodyCopy.AppendLine("			</a></td>");
                        emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr><tr><td colspan=\"3\">");
                        //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/email-template_05.png\" width=\"692\" height=\"32\" alt=\"\">");
                        emailBodyCopy.AppendLine("		</td></tr><tr><td colspan=\"3\"><small>This message was intended for " + emailAddress + ". To stop receiving these emails, go to your profile and uncheck the 'Enable email notifications' option.<br/>Sedogo offices are located at Sedogo Ltd, The Studio, 17 Blossom St, London E1 6PL.</small></td></tr>");
                        emailBodyCopy.AppendLine("		</td></tr></table></body></html>");

                        string emailSubject = currentUser.firstName + " wants you to be a part of " + currentEvent.eventName + " " + dateString + "!";

                        string SMTPServer = gd.GetStringValue("SMTPServer");
                        string mailFromAddress = gd.GetStringValue("MailFromAddress");
                        string mailFromUsername = gd.GetStringValue("MailFromUsername");
                        string mailFromPassword = gd.GetStringValue("MailFromPassword");

                        if (enableSendEmails == true)
                        {
                            try
                            {
                                MailMessage message = new MailMessage(mailFromAddress, emailAddress);
                                message.ReplyTo = new MailAddress("*****@*****.**");

                                message.Subject = emailSubject;
                                message.Body = emailBodyCopy.ToString();
                                message.IsBodyHtml = true;
                                SmtpClient smtp = new SmtpClient();
                                smtp.Host = SMTPServer;
                                if (mailFromPassword != "")
                                {
                                    // If the password is blank, assume mail relay is permitted
                                    smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
                                }
                                smtp.Send(message);

                                newInvite.inviteEmailSent = true;
                                newInvite.inviteEmailSentDate = DateTime.Now;
                                newInvite.inviteEmailSentEmailAddress = emailAddress;
                                newInvite.Update();

                                SentEmailHistory emailHistory = new SentEmailHistory(Session["loggedInUserFullName"].ToString());
                                emailHistory.subject = emailSubject;
                                emailHistory.body = emailBodyCopy.ToString();
                                emailHistory.sentFrom = mailFromAddress;
                                emailHistory.sentTo = emailAddress;
                                emailHistory.Add();
                            }
                            catch (Exception ex)
                            {
                                SentEmailHistory emailHistory = new SentEmailHistory(Session["loggedInUserFullName"].ToString());
                                emailHistory.subject = emailSubject;
                                emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString();
                                emailHistory.sentFrom = mailFromAddress;
                                emailHistory.sentTo = emailAddress;
                                emailHistory.Add();
                            }
                        }
                        sentOK = true;
                    }
                    else
                    {
                        errorMessageDescription = emailAddress + " - you cannot invite yourself";
                    }
                }
                else
                {
                    errorMessageDescription = emailAddress + " - already invited";
                }
            }
            catch (Exception ex)
            {
                errorMessageDescription = emailAddress + " - " + ex.Message;
            }
        }
        else
        {
            errorMessageDescription = emailAddress + " - invalid email address";
        }

        return sentOK;
    }
Exemplo n.º 19
0
    //===============================================================
    // Function: saveChangesButton_click
    //===============================================================
    protected void saveChangesButton_click(object sender, EventArgs e)
    {
        Boolean continueSending = false;
        if (Session["SendMessageCaptcha"] == null || (string)Session["SendMessageCaptcha"] == "N")
        {
            if (registerCaptcha.IsValid == true)
            {
                Session["SendMessageCaptcha"] = "Y";
                continueSending = true;
            }
        }
        else
        {
            // Captcha has already been done in this session
            continueSending = true;
        }
        if (continueSending == true)
        {
            int eventID = -1;
            if (Request.QueryString["EID"] != null)
            {
                eventID = int.Parse(Request.QueryString["EID"]);
            }
            int messageToUserID = int.Parse(Request.QueryString["UID"]);
            int parentMessageID = -1;
            if( Request.QueryString["PMID"] != null )
            {
                parentMessageID = int.Parse(Request.QueryString["PMID"]);
            }
            int messageID = -1;
            if( Request.QueryString["MID"] != null )
            {
                messageID = int.Parse(Request.QueryString["MID"]);
            }
            string redir = "";
            if( Request.QueryString["Redir"] != null )
            {
                redir = (string)Request.QueryString["Redir"];
            }

            if (int.Parse(Session["loggedInUserID"].ToString()) == messageToUserID)
            {
                messageToUserID = Message.GetAltEmailUserID(parentMessageID, messageToUserID);
            }

            string messageText = messageTextBox.Text;

            Message message = new Message(Session["loggedInUserFullName"].ToString());
            message.userID = messageToUserID;
            message.eventID = eventID;
            message.postedByUserID = int.Parse(Session["loggedInUserID"].ToString());
            message.messageText = messageText;
            if (parentMessageID > 0)
            {
                // Do not do this - it makes it read for the original recipient not the recipient of the threaded message
                //Message parentMessage = new Message(Session["loggedInUserFullName"].ToString());
                //parentMessage.messageRead = false;
                //parentMessage.Update();

                message.parentMessageID = parentMessageID;
            }
            else if (messageID > 0)
            {
                message.parentMessageID = messageID;
            }
            message.Add();

            SedogoUser currentUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), int.Parse(Session["loggedInUserID"].ToString()));
            SedogoUser messageToUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), messageToUserID);
            GlobalData gd = new GlobalData("");

            StringBuilder emailBodyCopy = new StringBuilder();

            string linkURL = gd.GetStringValue("SiteBaseURL");
            //if (message.parentMessageID > 0)
            //{
            //    linkURL = linkURL + "?Redir=Messages&MID=" + message.parentMessageID.ToString();
            //}
            //else
            //{
                linkURL = linkURL + "?Redir=Messages&MID=" + message.messageID.ToString();
            //}

            emailBodyCopy.AppendLine("<html>");
            emailBodyCopy.AppendLine("<head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
            emailBodyCopy.AppendLine("<style type=\"text/css\">");
            emailBodyCopy.AppendLine("	body, td, p { font-size: 15px; color: #9B9885; font-family: Arial, Helvetica, Sans-Serif }");
            emailBodyCopy.AppendLine("	p { margin: 0 }");
            emailBodyCopy.AppendLine("	h1 { color: #00ccff; font-size: 18px; font-weight: bold; }");
            emailBodyCopy.AppendLine("	a, .blue { color: #00ccff; text-decoration: none; }");
            emailBodyCopy.AppendLine("	img { border: 0; }");
            emailBodyCopy.AppendLine("</style></head>");
            emailBodyCopy.AppendLine("<body bgcolor=\"#f0f1ec\">");
            emailBodyCopy.AppendLine("  <table width=\"692\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
            //emailBodyCopy.AppendLine("	<tr><td colspan=\"3\"><img src=\"http://www.sedogo.com/email-template/images/email-template_01.png\" width=\"692\" height=\"32\" alt=\"\"></td></tr>");
            emailBodyCopy.AppendLine("	<tr><td style=\"background: #fff\" width=\"30\"></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"632\">");
            emailBodyCopy.AppendLine("			<h1>sedogo.com message</h1>");
            emailBodyCopy.AppendLine("			<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td width=\"60\">From:</td>");
            emailBodyCopy.AppendLine("					<td width=\"10\" rowspan=\"3\">&nbsp;</td>");
            emailBodyCopy.AppendLine("					<td width=\"530\">" + currentUser.firstName + " " + currentUser.lastName + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">To:</td>");
            emailBodyCopy.AppendLine("					<td>" + messageToUser.firstName + " " + messageToUser.lastName + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">Message:</td>");
            emailBodyCopy.AppendLine("					<td><p style=\"color:black\">" + messageText.Replace("\n", "<br/>") + "</p></td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("			</table>");
            emailBodyCopy.AppendLine("			<p>To reply to this message, <a class=\"blue\" href=\"" + linkURL + "\">click here</a>.</p>");
            emailBodyCopy.AppendLine("			<br /><br />");
            emailBodyCopy.AppendLine("			<p>Regards</p><a href=\"http://www.sedogo.com\" class=\"blue\"><strong>The Sedogo Team.</strong></a><br />");
            emailBodyCopy.AppendLine("			<br /><br /><br /><a href=\"http://www.sedogo.com\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/logo.gif\" />");
            emailBodyCopy.AppendLine("			</a></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr><tr><td colspan=\"3\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/email-template_05.png\" width=\"692\" height=\"32\" alt=\"\">");
            emailBodyCopy.AppendLine("		</td></tr><tr><td colspan=\"3\"><small>This message was intended for " + messageToUser.emailAddress + ". To stop receiving these emails, go to your profile and uncheck the 'Enable email notifications' option.<br/>Sedogo offices are located at Sedogo Ltd, The Studio, 17 Blossom St, London E1 6PL.</small></td></tr>");
            emailBodyCopy.AppendLine("		</td></tr></table></body></html>");

            string emailSubject = "You have a new Sedogo message from: " + currentUser.firstName + " " + currentUser.lastName;

            string SMTPServer = gd.GetStringValue("SMTPServer");
            string mailFromAddress = gd.GetStringValue("MailFromAddress");
            string mailFromUsername = gd.GetStringValue("MailFromUsername");
            string mailFromPassword = gd.GetStringValue("MailFromPassword");

            SedogoUser inviteUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), messageToUserID);
            if (inviteUser.enableSendEmails == true)
            {
                try
                {
                    MailMessage emailMessage = new MailMessage(mailFromAddress, messageToUser.emailAddress);
                    emailMessage.ReplyTo = new MailAddress("*****@*****.**");

                    emailMessage.Subject = emailSubject;
                    emailMessage.Body = emailBodyCopy.ToString();
                    emailMessage.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host = SMTPServer;
                    if (mailFromPassword != "")
                    {
                        // If the password is blank, assume mail relay is permitted
                        smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
                    }
                    smtp.Send(emailMessage);

                    SentEmailHistory emailHistory = new SentEmailHistory(Session["loggedInUserFullName"].ToString());
                    emailHistory.subject = emailSubject;
                    emailHistory.body = emailBodyCopy.ToString();
                    emailHistory.sentFrom = mailFromAddress;
                    emailHistory.sentTo = messageToUser.emailAddress;
                    emailHistory.Add();
                }
                catch (Exception ex)
                {
                    SentEmailHistory emailHistory = new SentEmailHistory(Session["loggedInUserFullName"].ToString());
                    emailHistory.subject = emailSubject;
                    emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString();
                    emailHistory.sentFrom = mailFromAddress;
                    emailHistory.sentTo = messageToUser.emailAddress;
                    emailHistory.Add();
                }

                Session["SentUserMessage"] = "Y";
                if (redir == "Messages")
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect",
                        "parent.window.location='message.aspx';", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect",
                        "parent.window.location='userTimeline.aspx?UID=" + messageToUserID.ToString() + "';", true);
                }
            }
            else
            {
            }
        }
    }
Exemplo n.º 20
0
        //===============================================================
        // Function: SendBroadcastEmail
        //===============================================================
        public static void SendBroadcastEmail()
        {
            GlobalData gd = new GlobalData("");
            string broadcastEmailWaiting = gd.GetStringValue("BroadcastEmailWaiting");
            if (broadcastEmailWaiting == "Y")
            {
                // update this straight away - if the broadcast fails then it will not send again to all users
                gd.UpdateStringValue("BroadcastEmailWaiting", "N");

                string broadcastEmailSubject = gd.GetStringValue("BroadcastEmailSubject");
                string broadcastEmailContent = gd.GetStringValue("BroadcastEmailContent");

                string emailBodyCopy = BuildBroadcastEmail(broadcastEmailContent);

                string SMTPServer = gd.GetStringValue("SMTPServer");
                string mailFromAddress = gd.GetStringValue("MailFromAddress");
                string mailFromUsername = gd.GetStringValue("MailFromUsername");
                string mailFromPassword = gd.GetStringValue("MailFromPassword");

                // Get a list of all users
                SqlConnection conn = new SqlConnection(GlobalSettings.connectionString);
                try
                {
                    conn.Open();

                    SqlCommand cmd = new SqlCommand("", conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "spSelectUserList";
                    DbDataReader rdr = cmd.ExecuteReader();
                    while (rdr.Read())
                    {
                        string emailAddress = "";
                        string firstName = "";
                        string lastName = "";

                        int userID = int.Parse(rdr["UserID"].ToString());
                        if (!rdr.IsDBNull(rdr.GetOrdinal("EmailAddress")))
                        {
                            emailAddress = (string)rdr["EmailAddress"];
                        }
                        if (!rdr.IsDBNull(rdr.GetOrdinal("FirstName")))
                        {
                            firstName = (string)rdr["FirstName"];
                        }
                        if (!rdr.IsDBNull(rdr.GetOrdinal("LastName")))
                        {
                            lastName = (string)rdr["LastName"];
                        }
                        Boolean enableSendEmails = (Boolean)rdr["EnableSendEmails"];

                        if (enableSendEmails == true)
                        {
                            try
                            {
                                //MailMessage message = new MailMessage(mailFromAddress, "*****@*****.**");
                                MailMessage message = new MailMessage(mailFromAddress, emailAddress);
                                message.ReplyTo = new MailAddress("*****@*****.**");

                                message.Subject = broadcastEmailSubject;
                                message.Body = emailBodyCopy.Replace("<<RECIPIENT>>", emailAddress);
                                message.IsBodyHtml = true;
                                SmtpClient smtp = new SmtpClient();
                                smtp.Host = SMTPServer;
                                if (mailFromPassword != "")
                                {
                                    // If the password is blank, assume mail relay is permitted
                                    smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
                                }
                                smtp.Send(message);

                                SentEmailHistory emailHistory = new SentEmailHistory("");
                                emailHistory.subject = broadcastEmailSubject;
                                emailHistory.body = emailBodyCopy.ToString().Replace("<<RECIPIENT>>", emailAddress);
                                emailHistory.sentFrom = mailFromAddress;
                                emailHistory.sentTo = emailAddress;
                                emailHistory.Add();
                            }
                            catch (Exception ex)
                            {
                                SentEmailHistory emailHistory = new SentEmailHistory("");
                                emailHistory.subject = broadcastEmailSubject;
                                emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString().Replace("<<RECIPIENT>>", emailAddress);
                                emailHistory.sentFrom = mailFromAddress;
                                emailHistory.sentTo = emailAddress;
                                emailHistory.Add();
                            }
                        }
                    }
                    rdr.Close();
                }
                catch (Exception ex)
                {
                    ErrorLog errorLog = new ErrorLog();
                    errorLog.WriteLog("MiscUtils", "SendBroadcastEmail", ex.Message, logMessageLevel.errorMessage);
                    throw ex;
                }
                finally
                {
                    conn.Close();
                }
            }
        }
Exemplo n.º 21
0
        //===============================================================
        // Function: CreatePreviews
        // Description:
        //===============================================================
        public static int CreatePreviews(string fullFileName)
        {
            int returnStatus = -1;
            string filename = Path.GetFileName(fullFileName);
            string filePath = Path.GetFullPath(fullFileName);
            GlobalData gd = new GlobalData("");
            int thumbnailSize = gd.GetIntegerValue("ThumbnailSize");
            int previewSize = gd.GetIntegerValue("PreviewSize");
            string fileStoreFolder = gd.GetStringValue("FileStoreFolder");
            string fileStoreFolderTemp = fileStoreFolder + "\\temp";
            string fileStoreFolderProfilePics = fileStoreFolder + "\\profilePics";
            string thumbnailFileName = "";
            string previewFileName = "";
             //           File.Copy(fullFileName, Path.Combine(fileStoreFolderTemp, filename));
            int thumbnailStatus = GenerateThumbnail(filePath,
                filename, thumbnailSize, thumbnailSize, previewSize, previewSize,
                out thumbnailFileName, out previewFileName);

            if (thumbnailStatus > 0)
            {
                // Move the thumbnails to the /profilePics folder and update the user
                string destFilename = MiscUtils.GetUniqueFileName(Path.Combine(fileStoreFolderProfilePics, filename));
                string destThumbnailFilename = MiscUtils.GetUniqueFileName(Path.Combine(filePath, thumbnailFileName));
                string destPreviewFilename = MiscUtils.GetUniqueFileName(Path.Combine(filePath, previewFileName));

                //File.Move(Path.Combine(fileStoreFolderTemp, filename), destFilename);
                File.Move(Path.Combine(fileStoreFolderTemp, thumbnailFileName),
                    destThumbnailFilename);
                File.Move(Path.Combine(fileStoreFolderTemp, previewFileName),
                    destPreviewFilename);
                returnStatus = 0;
            }

            return returnStatus;
        }
Exemplo n.º 22
0
        //===============================================================
        // Function: CreatePreviews
        // Description:
        //===============================================================
        public static int CreatePreviews(string filename, int userID)
        {
            int returnStatus = -1;

            GlobalData gd = new GlobalData("");
            int thumbnailSize = gd.GetIntegerValue("ThumbnailSize");
            int previewSize = gd.GetIntegerValue("PreviewSize");
            string fileStoreFolder = gd.GetStringValue("FileStoreFolder");
            string fileStoreFolderTemp = fileStoreFolder + "\\temp";
            string fileStoreFolderProfilePics = fileStoreFolder + "\\profilePics";
            string thumbnailFileName = "";
            string previewFileName = "";

            int thumbnailStatus = GenerateThumbnail(fileStoreFolderTemp,
                filename, thumbnailSize, thumbnailSize, previewSize, previewSize,
                out thumbnailFileName, out previewFileName);

            if (thumbnailStatus > 0)
            {
                // Move the thumbnails to the /profilePics folder and update the user
                string destFilename = MiscUtils.GetUniqueFileName(Path.Combine(fileStoreFolderProfilePics, filename));
                string destThumbnailFilename = MiscUtils.GetUniqueFileName(Path.Combine(fileStoreFolderProfilePics, thumbnailFileName));
                string destPreviewFilename = MiscUtils.GetUniqueFileName(Path.Combine(fileStoreFolderProfilePics, previewFileName));

                File.Move(Path.Combine(fileStoreFolderTemp, filename),
                    destFilename);
                File.Move(Path.Combine(fileStoreFolderTemp, thumbnailFileName),
                    destThumbnailFilename);
                File.Move(Path.Combine(fileStoreFolderTemp, previewFileName),
                    destPreviewFilename);

                SedogoUser user = new SedogoUser("", userID);
                user.profilePicFilename = filename;
                user.profilePicPreview = previewFileName;
                user.profilePicThumbnail = thumbnailFileName;
                user.UpdateUserProfilePic();

                returnStatus = 0;
            }

            return returnStatus;
        }
Exemplo n.º 23
0
        //===============================================================
        // Function: CreateGoalPicPreviews
        // Description:
        //===============================================================
        public static int CreateGoalPicPreviews(string filename, int eventID, string loggedInContactName,
            int postedByUserID, string caption)
        {
            int returnStatus = -1;

            GlobalData gd = new GlobalData("");
            int thumbnailSize =  gd.GetIntegerValue("ThumbnailSize");//100;
            int previewSize =  gd.GetIntegerValue("PreviewSize");//500;
            string fileStoreFolder = gd.GetStringValue("FileStoreFolder");
            string fileStoreFolderTemp = fileStoreFolder + "\\temp";
            string fileStoreFolderProfilePics = fileStoreFolder + "\\eventPics";

            string thumbnailFileName = "";
            string previewFileName = "";
            int thumbnailStatus = GenerateThumbnail(fileStoreFolderTemp,
                filename, thumbnailSize, thumbnailSize, previewSize, previewSize,
                out thumbnailFileName, out previewFileName);

            if (thumbnailStatus > 0)
            {
                // Move the thumbnails to the /profilePics folder and update the user
                string destFilename = MiscUtils.GetUniqueFileName(Path.Combine(fileStoreFolderProfilePics, filename));
                string destThumbnailFilename = MiscUtils.GetUniqueFileName(Path.Combine(fileStoreFolderProfilePics, thumbnailFileName));
                string destPreviewFilename = MiscUtils.GetUniqueFileName(Path.Combine(fileStoreFolderProfilePics, previewFileName));

                File.Move(Path.Combine(fileStoreFolderTemp, filename),
                    destFilename);
                File.Move(Path.Combine(fileStoreFolderTemp, thumbnailFileName),
                    destThumbnailFilename);
                File.Move(Path.Combine(fileStoreFolderTemp, previewFileName),
                    destPreviewFilename);

                SedogoEventPicture pic = new SedogoEventPicture(loggedInContactName);
                pic.eventID = eventID;
                pic.postedByUserID = postedByUserID;
                pic.eventImageFilename = Path.GetFileName(destFilename);
                pic.eventImagePreview = Path.GetFileName(destPreviewFilename);
                pic.eventImageThumbnail = Path.GetFileName(destThumbnailFilename);
                pic.caption = caption;
                pic.Add();

                returnStatus = pic.eventPictureID;
            }

            return returnStatus;
        }
Exemplo n.º 24
0
        //===============================================================
        // Function: GetInviteCount
        //===============================================================
        public void SendInviteAcceptedEmail()
        {
            GlobalData gd = new GlobalData("");
            string SMTPServer = gd.GetStringValue("SMTPServer");
            string mailFromAddress = gd.GetStringValue("MailFromAddress");
            string mailFromUsername = gd.GetStringValue("MailFromUsername");
            string mailFromPassword = gd.GetStringValue("MailFromPassword");

            string invitedUserFullName = m_emailAddress;
            if( m_userID > 0 )
            {
                SedogoUser invitedUser = new SedogoUser(m_loggedInUser, m_userID);
                invitedUserFullName = invitedUser.fullName;
            }
            SedogoEvent sedogoEvent = new SedogoEvent(m_loggedInUser, m_eventID);
            SedogoUser eventOwner = new SedogoUser(m_loggedInUser, sedogoEvent.userID);

            string emailSubject = "Sedogo invitation to " + sedogoEvent.eventName + " has been accepted by "
                + invitedUserFullName;

            string dateString = "";
            DateTime startDate = sedogoEvent.startDate;
            MiscUtils.GetDateStringStartDate(eventOwner, sedogoEvent.dateType, sedogoEvent.rangeStartDate,
                sedogoEvent.rangeEndDate, sedogoEvent.beforeBirthday, ref dateString, ref startDate);

            string inviteURL = gd.GetStringValue("SiteBaseURL");
            inviteURL = inviteURL + "/viewEvent.aspx?EID=" + m_eventID.ToString();

            StringBuilder emailBodyCopy = new StringBuilder();
            emailBodyCopy.AppendLine("<html>");
            emailBodyCopy.AppendLine("<head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
            emailBodyCopy.AppendLine("<style type=\"text/css\">");
            emailBodyCopy.AppendLine("	body, td, p { font-size: 15px; color: #9B9885; font-family: Arial, Helvetica, Sans-Serif }");
            emailBodyCopy.AppendLine("	p { margin: 0 }");
            emailBodyCopy.AppendLine("	h1 { color: #00ccff; font-size: 18px; font-weight: bold; }");
            emailBodyCopy.AppendLine("	a, .blue { color: #00ccff; text-decoration: none; }");
            emailBodyCopy.AppendLine("	img { border: 0; }");
            emailBodyCopy.AppendLine("</style></head>");
            emailBodyCopy.AppendLine("<body bgcolor=\"#f0f1ec\">");
            emailBodyCopy.AppendLine("  <table width=\"692\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
            //emailBodyCopy.AppendLine("	<tr><td colspan=\"3\"><img src=\"http://www.sedogo.com/email-template/images/email-template_01.png\" width=\"692\" height=\"32\" alt=\"\"></td></tr>");
            emailBodyCopy.AppendLine("	<tr><td style=\"background: #fff\" width=\"30\"></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"632\">");
            emailBodyCopy.AppendLine("			<h1>" + invitedUserFullName + " has accepted your invitation:</h1>");
            emailBodyCopy.AppendLine("			<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td width=\"60\">What:</td>");
            emailBodyCopy.AppendLine("					<td width=\"10\" rowspan=\"4\">&nbsp;</td>");
            emailBodyCopy.AppendLine("					<td width=\"530\"><a href=\"" + inviteURL + "\">" + sedogoEvent.eventName + "</a></td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">Where:</td>");
            emailBodyCopy.AppendLine("					<td>" + sedogoEvent.eventVenue + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">Who:</td>");
            emailBodyCopy.AppendLine("					<td>" + eventOwner.firstName + " " + eventOwner.lastName + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("				<tr>");
            emailBodyCopy.AppendLine("					<td valign=\"top\">When:</td>");
            emailBodyCopy.AppendLine("					<td>" + dateString + "</td>");
            emailBodyCopy.AppendLine("				</tr>");
            emailBodyCopy.AppendLine("			</table>");
            emailBodyCopy.AppendLine("			<p>To view this event, <a href=\"" + inviteURL + "\"><u>click here</u></a>.</p>");
            emailBodyCopy.AppendLine("			<br /><br />");
            emailBodyCopy.AppendLine("			<p>Regards</p><a href=\"http://www.sedogo.com\" class=\"blue\"><strong>The Sedogo Team.</strong></a><br />");
            emailBodyCopy.AppendLine("			<br /><br /><br /><a href=\"http://www.sedogo.com\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/logo.gif\" />");
            emailBodyCopy.AppendLine("			</a></td>");
            emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr><tr><td colspan=\"3\">");
            //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/email-template_05.png\" width=\"692\" height=\"32\" alt=\"\">");
            emailBodyCopy.AppendLine("		</td></tr><tr><td colspan=\"3\"><small>This message was intended for " + eventOwner.emailAddress + ". To stop receiving these emails, go to your profile and uncheck the 'Enable email notifications' option.<br/>Sedogo offices are located at Sedogo Ltd, The Studio, 17 Blossom St, London E1 6PL.</small></td></tr>");
            emailBodyCopy.AppendLine("		</td></tr></table></body></html>");

            if (eventOwner.enableSendEmails == true)
            {
                try
                {
                    MailMessage message = new MailMessage(mailFromAddress, eventOwner.emailAddress);
                    message.ReplyTo = new MailAddress("*****@*****.**");

                    message.Subject = emailSubject;
                    message.Body = emailBodyCopy.ToString();
                    message.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host = SMTPServer;
                    if (mailFromPassword != "")
                    {
                        // If the password is blank, assume mail relay is permitted
                        smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
                    }
                    smtp.Send(message);

                    SentEmailHistory emailHistory = new SentEmailHistory("");
                    emailHistory.subject = emailSubject;
                    emailHistory.body = emailBodyCopy.ToString();
                    emailHistory.sentFrom = mailFromAddress;
                    emailHistory.sentTo = eventOwner.emailAddress;
                    emailHistory.Add();
                }
                catch (Exception ex)
                {
                    SentEmailHistory emailHistory = new SentEmailHistory("");
                    emailHistory.subject = emailSubject;
                    emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString();
                    emailHistory.sentFrom = mailFromAddress;
                    emailHistory.sentTo = eventOwner.emailAddress;
                    emailHistory.Add();
                }
            }
        }
Exemplo n.º 25
0
        //===============================================================
        // Function: SendBroadcastTestEmail
        //===============================================================
        public static void SendBroadcastTestEmail(string recipientEmailAddress)
        {
            GlobalData gd = new GlobalData("");

            string broadcastEmailSubject = gd.GetStringValue("BroadcastEmailSubject");
            string broadcastEmailContent = gd.GetStringValue("BroadcastEmailContent");

            string emailBodyCopy = BuildBroadcastEmail(broadcastEmailContent);

            string SMTPServer = gd.GetStringValue("SMTPServer");
            string mailFromAddress = gd.GetStringValue("MailFromAddress");
            string mailFromUsername = gd.GetStringValue("MailFromUsername");
            string mailFromPassword = gd.GetStringValue("MailFromPassword");

            try
            {
                MailMessage message = new MailMessage(mailFromAddress, recipientEmailAddress);
                message.ReplyTo = new MailAddress("*****@*****.**");

                message.Subject = broadcastEmailSubject;
                message.Body = emailBodyCopy.Replace("<<RECIPIENT>>", recipientEmailAddress);
                message.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = SMTPServer;
                if (mailFromPassword != "")
                {
                    // If the password is blank, assume mail relay is permitted
                    smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
                }
                smtp.Send(message);

                SentEmailHistory emailHistory = new SentEmailHistory("");
                emailHistory.subject = broadcastEmailSubject;
                emailHistory.body = emailBodyCopy.ToString().Replace("<<RECIPIENT>>", recipientEmailAddress);
                emailHistory.sentFrom = mailFromAddress;
                emailHistory.sentTo = recipientEmailAddress;
                emailHistory.Add();
            }
            catch (Exception ex)
            {
                SentEmailHistory emailHistory = new SentEmailHistory("");
                emailHistory.subject = broadcastEmailSubject;
                emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString().Replace("<<RECIPIENT>>", recipientEmailAddress);
                emailHistory.sentFrom = mailFromAddress;
                emailHistory.sentTo = recipientEmailAddress;
                emailHistory.Add();
            }
        }
Exemplo n.º 26
0
        //===============================================================
        // Function: CheckChangePassword
        //
        // This function checks the password is valid for this contact
        // It does NOT change the password in the database
        // The following rules can be checked depending on system settings
        // - Min password length
        // - Max password length
        // - Mixed case
        // - Force alphanumeric (password must have letters and numbers)
        // - Force non-alphanumerix (password must have punctuation characters in it)
        // - Password history check, cannot re-use any of the last x passwords
        //===============================================================
        public Boolean CheckChangePassword(string password, out Byte reason)
        {
            // passwordChangeResults { passwordOK, passwordTooShort, passwordTooLong, passwordMixedCase,
            // passwordNeedsDigit, passwordSpecialCharacter, passwordReused }
            Boolean returnStatus = true;
            reason = 0;

            string pwdCheckMinLengthEnabled = "N";
            int pwdCheckMinLength = 1;
            string pwdCheckMaxLengthEnabled = "N";
            int pwdCheckMaxLength = 999;
            string pwdCheckMixedCaseEnabled = "N";
            string pwdCheckNeedsDigitEnabled = "N";
            string pwdCheckSpecialCharacterEnabled = "N";
            string pwdCheckNeedsReusedEnabled = "N";
            int pwdCheckReusedNumber = 1;

            const string lower = "abcdefghijklmnopqrstuvwxyz";
            const string upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            const string digits = "0123456789";
            string allChars = lower + upper + digits;

            try
            {
                GlobalData globalData = new GlobalData(m_loggedInUser);
                pwdCheckMinLengthEnabled = globalData.GetStringValue("PwdCheckMinLengthEnabled");
                pwdCheckMinLength = globalData.GetIntegerValue("PwdCheckMinLength");
                pwdCheckMaxLengthEnabled = globalData.GetStringValue("PwdCheckMaxLengthEnabled");
                pwdCheckMaxLength = globalData.GetIntegerValue("PwdCheckMaxLength");
                pwdCheckMixedCaseEnabled = globalData.GetStringValue("PwdCheckMixedCaseEnabled");
                pwdCheckNeedsDigitEnabled = globalData.GetStringValue("PwdCheckNeedsDigitEnabled");
                pwdCheckSpecialCharacterEnabled = globalData.GetStringValue("PwdCheckSpecialCharacterEnabled");
                pwdCheckNeedsReusedEnabled = globalData.GetStringValue("PwdCheckNeedsReusedEnabled");
                pwdCheckReusedNumber = globalData.GetIntegerValue("PwdCheckReusedNumber");
            }
            catch (Exception)
            {
                throw (new Exception("Error getting global data values for password checks"));
            }

            if (pwdCheckMinLengthEnabled == "Y")
            {
                if (password.Length < pwdCheckMinLength)
                {
                    reason = reason |= (int)passwordChangeResults.passwordTooShort;
                    returnStatus = false;
                }
            }
            if (pwdCheckMaxLengthEnabled == "Y")
            {
                if (password.Length > pwdCheckMaxLength)
                {
                    reason = reason |= (int)passwordChangeResults.passwordTooLong;
                    returnStatus = false;
                }
            }
            if (pwdCheckMixedCaseEnabled == "Y")
            {
                if (!((password.IndexOfAny(lower.ToCharArray()) >= 0) && (password.IndexOfAny(upper.ToCharArray()) >= 0)))
                {
                    reason = reason |= (int)passwordChangeResults.passwordMixedCase;
                    returnStatus = false;
                }
            }
            if (pwdCheckNeedsDigitEnabled == "Y")
            {
                if (!(password.IndexOfAny(digits.ToCharArray()) >= 0))
                {
                    reason = reason |= (int)passwordChangeResults.passwordNeedsDigit;
                    returnStatus = false;
                }
            }
            if (pwdCheckSpecialCharacterEnabled == "Y")
            {
                if (!(password.Trim(allChars.ToCharArray()).Length > 0))
                {
                    reason = reason |= (int)passwordChangeResults.passwordSpecialCharacter;
                    returnStatus = false;
                }
            }
            if (pwdCheckNeedsReusedEnabled == "Y")
            {
                // pwdCheckReusedNumber
            }

            return returnStatus;
        }
Exemplo n.º 27
0
    //===============================================================
    // Function: registerUserButton_click
    //===============================================================
    protected void registerUserButton_click(object sender, EventArgs e)
    {
        if (registerCaptcha.IsValid == true)
        {
            string emailAddress = emailAddressTextBox.Text;
            emailAddress = emailAddress.Trim().ToLower();
            string userPassword = passwordTextBox1.Text.Trim();

            // Verify this email has not been used before
            int testUserID = SedogoUser.GetUserIDFromEmailAddress(emailAddress);

            if (testUserID > 0)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert(\"This email address is already registered, please log in, or click on the forgot your password link on the home page.\");", true);
            }
            else
            {
                // Create the user
                SedogoUser newUser = new SedogoUser("");

                DateTime dateOfBirth;
                if (dateOfBirthYear.SelectedIndex > 0 && dateOfBirthMonth.SelectedIndex > 0
                    && dateOfBirthDay.SelectedIndex > 0)
                {
                    dateOfBirth = new DateTime(int.Parse(dateOfBirthYear.SelectedValue),
                        int.Parse(dateOfBirthMonth.SelectedValue), int.Parse(dateOfBirthDay.SelectedValue));
                }
                else
                {
                    dateOfBirth = DateTime.MinValue;
                }

                newUser.firstName = firstNameTextBox.Text;
                newUser.lastName = lastNameTextBox.Text;
                newUser.emailAddress = emailAddress;
                if (genderMaleRadioButton.Checked == true)
                {
                    newUser.gender = "M";
                }
                else
                {
                    newUser.gender = "F";
                }
                newUser.homeTown = homeTownTextBox.Text;
                if (dateOfBirth > DateTime.MinValue)
                {
                    newUser.birthday = dateOfBirth;
                }
                newUser.timezoneID = int.Parse(timezoneDropDownList.SelectedValue);
                //Nikita Knyazev. Facebook Authentication. Start
                try
                {
                    if (Session["facebookUserID"] != null)
                        newUser.facebookUserID = (long)Session["facebookUserID"];
                }
                catch (Exception ex)
                {
                }
                //Nikita Knyazev. Facebook Authentication. Finish
                newUser.avatarNumber = int.Parse(avatarComboBox.SelectedValue);
                newUser.Add();

                newUser.UpdatePassword(userPassword);

                // Send registration email
                GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);

                string siteBaseURL = gd.GetStringValue("SiteBaseURL");

                StringBuilder emailBodyCopy = new StringBuilder();

                emailBodyCopy.AppendLine("<html>");
                emailBodyCopy.AppendLine("<head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
                emailBodyCopy.AppendLine("<style type=\"text/css\">");
                emailBodyCopy.AppendLine("	body, td, p { font-size: 15px; color: #9B9885; font-family: Arial, Helvetica, Sans-Serif }");
                emailBodyCopy.AppendLine("	p { margin: 0 }");
                emailBodyCopy.AppendLine("	h1 { color: #00ccff; font-size: 18px; font-weight: bold; }");
                emailBodyCopy.AppendLine("	a, .blue { color: #00ccff; text-decoration: none; }");
                emailBodyCopy.AppendLine("	img { border: 0; }");
                emailBodyCopy.AppendLine("</style></head>");
                emailBodyCopy.AppendLine("<body bgcolor=\"#f0f1ec\">");
                emailBodyCopy.AppendLine("  <table width=\"692\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
                //emailBodyCopy.AppendLine("	<tr><td colspan=\"3\"><img src=\"http://www.sedogo.com/email-template/images/email-template_01.png\" width=\"692\" height=\"32\" alt=\"\"></td></tr>");
                emailBodyCopy.AppendLine("	<tr><td style=\"background: #fff\" width=\"30\"></td>");
                emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"632\">");
                emailBodyCopy.AppendLine("			<h1>Thanks for registering with Sedogo</h1>");
                emailBodyCopy.AppendLine("			<p>Please click on the link below to confirm your email.</p>");
                emailBodyCopy.AppendLine("			<p><a href=\"" + siteBaseURL + "/e/?G=" + newUser.GUID + "\"><u>click here</u></a>.</p>");
                emailBodyCopy.AppendLine("			<br /><br />");
                emailBodyCopy.AppendLine("			<p>Regards</p><a href=\"http://www.sedogo.com\" class=\"blue\"><strong>The Sedogo Team.</strong></a><br />");
                emailBodyCopy.AppendLine("			<br /></td>");
                emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr></table></body></html>");

                // Old version, removed because of spam filters
                //emailBodyCopy.AppendLine("			<br /><br /><br /><a href=\"http://www.sedogo.com\"><img src=\"http://www.sedogo.com/email-template/images/logo.gif\" /></a></td>");
                //emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr><tr><td colspan=\"3\">");
                //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/email-template_05.png\" width=\"692\" height=\"32\" alt=\"\">");
                //emailBodyCopy.AppendLine("		</td></tr></table></body></html>");

                string SMTPServer = gd.GetStringValue("SMTPServer");
                string mailFromAddress = gd.GetStringValue("MailFromAddress");
                string mailFromUsername = gd.GetStringValue("MailFromUsername");
                string mailFromPassword = gd.GetStringValue("MailFromPassword");

                string mailToEmailAddress = emailAddress;

                MailMessage message = new MailMessage(mailFromAddress, mailToEmailAddress);
                message.ReplyTo = new MailAddress("*****@*****.**");

                message.Subject = "Sedogo registration";
                message.Body = emailBodyCopy.ToString();
                message.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = SMTPServer;
                if (mailFromPassword != "")
                {
                    // If the password is blank, assume mail relay is permitted
                    smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
                }

                try
                {
                    smtp.Send(message);

                    SentEmailHistory emailHistory = new SentEmailHistory("");
                    emailHistory.subject = "Sedogo registration";
                    emailHistory.body = emailBodyCopy.ToString();
                    emailHistory.sentFrom = mailFromAddress;
                    emailHistory.sentTo = emailAddress;
                    emailHistory.Add();
                }
                catch (Exception ex)
                {
                    SentEmailHistory emailHistory = new SentEmailHistory("");
                    emailHistory.subject = "Sedogo registration";
                    emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString();
                    emailHistory.sentFrom = mailFromAddress;
                    emailHistory.sentTo = emailAddress;
                    emailHistory.Add();
                }

                Response.Redirect("registerWait.aspx");
            }
        }
    }
Exemplo n.º 28
0
    //===============================================================
    // Function: saveChangesButton_click
    //===============================================================
    protected void saveChangesButton_click(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);

        if (eventPicFileUpload.PostedFile.ContentLength != 0)
        {
            int fileSizeBytes = eventPicFileUpload.PostedFile.ContentLength;

            GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);
            string fileStoreFolder = gd.GetStringValue("FileStoreFolder") + @"\temp";

            string originalFileName = Path.GetFileName(eventPicFileUpload.PostedFile.FileName);
            string destPath = Path.Combine(fileStoreFolder, originalFileName);
            if ((eventPicFileUpload.PostedFile.ContentType == "image/jpeg"
                || eventPicFileUpload.PostedFile.ContentType == "image/gif"
                || eventPicFileUpload.PostedFile.ContentType == "image/png")
                && Path.GetExtension(destPath) != ""
                )
            {
                destPath = destPath.Replace(" ", "_");
                destPath = MiscUtils.GetUniqueFileName(destPath);
                string savedFilename = Path.GetFileName(destPath);

                eventPicFileUpload.PostedFile.SaveAs(destPath);

                MiscUtils.CreateEventPicPreviews(Path.GetFileName(destPath), eventID);
            }
        }

        DateTime alertDate = CalendarAlertDate.SelectedDate;
        string alertText = newAlertTextBox.Text.Trim();

        if (alertText != "")
        {
            EventAlert eventAlert = new EventAlert((string)Application["connectionString"]);
            eventAlert.alertDate = alertDate;
            eventAlert.eventID = eventID;
            eventAlert.alertText = alertText;
            eventAlert.Add();

            newAlertTextBox.Text = "";
            CalendarAlertDate.SelectedDate = DateTime.Now;
            PickerAlertDate.SelectedDate = DateTime.Now;
        }

        SedogoEvent sedogoEvent = new SedogoEvent((string)Session["loggedInUserFullName"], eventID);
        sedogoEvent.Update();

        Response.Redirect("addEventInvites.aspx?EID=" + eventID.ToString());
    }
Exemplo n.º 29
0
    //===============================================================
    // Function: resendActivationButton_click
    //===============================================================
    protected void resendActivationButton_click(object sender, EventArgs e)
    {
        string loginEmailAddress = emailAddressTextBox.Text;

        int userID = SedogoUser.GetUserIDFromEmailAddress(loginEmailAddress);
        if (userID > 0)
        {
            SedogoUser user = new SedogoUser("", userID);
            if (user.loginEnabled == false)
            {
                // Send registration email
                GlobalData gd = new GlobalData((string)Session["loggedInUserFullName"]);

                string siteBaseURL = gd.GetStringValue("SiteBaseURL");

                StringBuilder emailBodyCopy = new StringBuilder();

                emailBodyCopy.AppendLine("<html>");
                emailBodyCopy.AppendLine("<head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
                emailBodyCopy.AppendLine("<style type=\"text/css\">");
                emailBodyCopy.AppendLine("	body, td, p { font-size: 15px; color: #9B9885; font-family: Arial, Helvetica, Sans-Serif }");
                emailBodyCopy.AppendLine("	p { margin: 0 }");
                emailBodyCopy.AppendLine("	h1 { color: #00ccff; font-size: 18px; font-weight: bold; }");
                emailBodyCopy.AppendLine("	a, .blue { color: #00ccff; text-decoration: none; }");
                emailBodyCopy.AppendLine("	img { border: 0; }");
                emailBodyCopy.AppendLine("</style></head>");
                emailBodyCopy.AppendLine("<body bgcolor=\"#f0f1ec\">");
                emailBodyCopy.AppendLine("  <table width=\"692\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
                //emailBodyCopy.AppendLine("	<tr><td colspan=\"3\"><img src=\"http://www.sedogo.com/email-template/images/email-template_01.png\" width=\"692\" height=\"32\" alt=\"\"></td></tr>");
                emailBodyCopy.AppendLine("	<tr><td style=\"background: #fff\" width=\"30\"></td>");
                emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"632\">");
                emailBodyCopy.AppendLine("			<h1>Thanks for registering with Sedogo</h1>");
                emailBodyCopy.AppendLine("			<p>Please click on the link below to confirm your email.</p>");
                emailBodyCopy.AppendLine("			<p><a href=\"" + siteBaseURL + "/e/?G=" + user.GUID + "\"><u>click here</u></a>.</p>");
                emailBodyCopy.AppendLine("			<br /><br />");
                emailBodyCopy.AppendLine("			<p>Regards</p><a href=\"http://www.sedogo.com\" class=\"blue\"><strong>The Sedogo Team.</strong></a><br />");
                emailBodyCopy.AppendLine("			<br /></td>");
                emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr></table></body></html>");

                // Old version, removed because of spam filters
                //emailBodyCopy.AppendLine("			<br /><br /><br /><a href=\"http://www.sedogo.com\"><img src=\"http://www.sedogo.com/email-template/images/logo.gif\" /></a></td>");
                //emailBodyCopy.AppendLine("		<td style=\"background: #fff\" width=\"30\"></td></tr><tr><td colspan=\"3\">");
                //emailBodyCopy.AppendLine("			<img src=\"http://www.sedogo.com/email-template/images/email-template_05.png\" width=\"692\" height=\"32\" alt=\"\">");
                //emailBodyCopy.AppendLine("		</td></tr></table></body></html>");

                string SMTPServer = gd.GetStringValue("SMTPServer");
                string mailFromAddress = gd.GetStringValue("MailFromAddress");
                string mailFromUsername = gd.GetStringValue("MailFromUsername");
                string mailFromPassword = gd.GetStringValue("MailFromPassword");

                string mailToEmailAddress = user.emailAddress;

                MailMessage message = new MailMessage(mailFromAddress, mailToEmailAddress);
                message.ReplyTo = new MailAddress("*****@*****.**");

                message.Subject = "Sedogo registration";
                message.Body = emailBodyCopy.ToString();
                message.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = SMTPServer;
                if (mailFromPassword != "")
                {
                    // If the password is blank, assume mail relay is permitted
                    smtp.Credentials = new System.Net.NetworkCredential(mailFromAddress, mailFromPassword);
                }

                try
                {
                    smtp.Send(message);

                    SentEmailHistory emailHistory = new SentEmailHistory("");
                    emailHistory.subject = "Sedogo registration";
                    emailHistory.body = emailBodyCopy.ToString();
                    emailHistory.sentFrom = mailFromAddress;
                    emailHistory.sentTo = user.emailAddress;
                    emailHistory.Add();
                }
                catch (Exception ex)
                {
                    SentEmailHistory emailHistory = new SentEmailHistory("");
                    emailHistory.subject = "Sedogo registration";
                    emailHistory.body = ex.Message + " -------- " + emailBodyCopy.ToString();
                    emailHistory.sentFrom = mailFromAddress;
                    emailHistory.sentTo = user.emailAddress;
                    emailHistory.Add();
                }

                Response.Redirect("default.aspx");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Reset password", "alert(\"This account has already been activated.\");", true);
            }
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Reset password", "alert(\"No account with this email address was found.\");", true);
        }
    }