Exemple #1
0
    //===============================================================
    // Function: imagesRepeater_ItemCommand
    //===============================================================
    protected void imagesRepeater_ItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);
        int eventPictureID = int.Parse(e.CommandArgument.ToString());

        if (e.CommandName == "deleteButton")
        {
            SedogoEvent sedogoEvent = new SedogoEvent((string)Session["loggedInUserFullName"], eventID);
            sedogoEvent.Update();

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

            eventPic.Delete();

            Response.Redirect("editEventPics.aspx?EID=" + eventID.ToString());
        }
        if (e.CommandName == "saveButton")
        {
            SedogoEvent sedogoEvent = new SedogoEvent((string)Session["loggedInUserFullName"], eventID);
            sedogoEvent.Update();

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

            TextBox imageCaptionTextBox = e.Item.FindControl("imageCaptionTextBox") as TextBox;
            eventPic.caption = imageCaptionTextBox.Text;
            eventPic.Update();

            Response.Redirect("editEventPics.aspx?EID=" + eventID.ToString());
        }
    }
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);
        int messageUserID = -1;
        if (Request.QueryString["UID"] != null)
        {
            messageUserID = int.Parse(Request.QueryString["UID"]);
        }

        if (!IsPostBack)
        {
            SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);

            eventNameLabel.Text = sedogoEvent.eventName;

            SetFocus(messageTextBox);

            if (Session["SendMessageCaptcha"] == null || (string)Session["SendMessageCaptcha"] == "N")
            {
                registerCaptcha.Visible = true;
            }
            else
            {
                registerCaptcha.Visible = false;
            }
        }
        PopulateTrackingList(eventID, messageUserID);
    }
Exemple #3
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int eventID = int.Parse(Request.QueryString["EID"]);
            int userID = int.Parse(Session["loggedInUserID"].ToString());

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

            eventNameLabel.Text = sedogoEvent.eventName;

            SedogoUser eventOwner = new SedogoUser(Session["loggedInUserFullName"].ToString(), sedogoEvent.userID);

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

            messageToLabel.Text = eventOwner.firstName + " " + eventOwner.lastName;
            eventDateLabel.Text = dateString;
            eventVenueLabel.Text = sedogoEvent.eventVenue.Replace("\n", "<br/>");

            SetFocus(messageTextBox);

            if (Session["SendMessageCaptcha"] == null || (string)Session["SendMessageCaptcha"] == "N")
            {
                registerCaptcha.Visible = true;
            }
            else
            {
                registerCaptcha.Visible = false;
            }
        }
    }
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int eventID = int.Parse(Request.QueryString["EID"]);

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

            eventNameLabel.Text = sedogoEvent.eventName;

            SedogoUser eventOwner = new SedogoUser(Session["loggedInUserFullName"].ToString(), sedogoEvent.userID);
            string dateString = "";
            DateTime startDate = sedogoEvent.startDate;
            MiscUtils.GetDateStringStartDate(eventOwner, sedogoEvent.dateType, sedogoEvent.rangeStartDate,
                sedogoEvent.rangeEndDate, sedogoEvent.beforeBirthday, ref dateString, ref startDate);

            eventDateLabel.Text = dateString;
            eventVenueLabel.Text = sedogoEvent.eventVenue.Replace("\n", "<br/>");

            deleteImageButton.Attributes.Add("onclick", "if(confirm('Are you sure you want to delete this picture?')){}else{return false}");

            if (sedogoEvent.eventPicFilename == "")
            {
                deleteImageButton.Visible = false;
            }

            SetFocus(eventPicFileUpload);
        }
    }
Exemple #5
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            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"]);
            }

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

            if( eventID > 0 )
            {
                goalNameDiv.Visible = true;
                try
                {
                    SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);
                    eventNameLabel.Text = sedogoEvent.eventName;
                }
                catch
                {
                    eventNameLabel.Text = "";
                }
            }
            else
            {
                goalNameDiv.Visible = false;
            }
            SedogoUser messageToUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), messageToUserID);

            messageToLabel.Text = messageToUser.firstName + " " + messageToUser.lastName;

            SetFocus(messageTextBox);

            if (Session["SendMessageCaptcha"] == null || (string)Session["SendMessageCaptcha"] == "N")
            {
                registerCaptcha.Visible = true;
            }
            else
            {
                registerCaptcha.Visible = false;
            }
        }
    }
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);

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

        eventNameLabel.Text = sedogoEvent.eventName;
    }
Exemple #7
0
    //===============================================================
    // Function: saveButton_Click
    //===============================================================
    protected void saveButton_Click(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);

        SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInAdministratorName"].ToString(),
            eventID);
        sedogoEvent.showOnDefaultPage = showOnDefaultPageCheckbox.Checked;
        sedogoEvent.Update();
    }
Exemple #8
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int eventID = int.Parse(Request.QueryString["EID"]);

            SedogoEvent sedogoEvent = new SedogoEvent("", eventID);
            SedogoUser eventOwner = new SedogoUser("", sedogoEvent.userID);

            int userID = -1;
            if (Session["loggedInUserID"] != null)
            {
                userID = int.Parse(Session["loggedInUserID"].ToString());
            }
            sidebarControl.userID = userID;
            string currentUserFullName = "";
            if (userID > 0)
            {
                SedogoUser user = new SedogoUser("", userID);
                sidebarControl.user = user;
                bannerAddFindControl.userID = userID;
                currentUserFullName = user.firstName + " " + user.lastName;

                addressBookLink1.Visible = true;
                addressBookLink2.Visible = true;
                addressBookLink3.Visible = true;
                addressBookLink4.Visible = true;
                addressBookLink5.Visible = true;
            }
            else
            {
                addressBookLink1.Visible = false;
                addressBookLink2.Visible = false;
                addressBookLink3.Visible = false;
                addressBookLink4.Visible = false;
                addressBookLink5.Visible = false;
            }

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

            additionalInviteTextTextBox.Text = currentUserFullName + " thought you might be interested in this.";

            eventTitleLabel.Text = sedogoEvent.eventName;
            eventOwnersNameLabel.Text = eventOwner.firstName + " " + eventOwner.lastName;
            eventDateLabel.Text = dateString;
            eventDescriptionLabel.Text = sedogoEvent.eventDescription.Replace("\n", "<br/>");
            eventNameLabel.Text = sedogoEvent.eventName;
            goalNameLabel.Text = sedogoEvent.eventName;
            goalVenueLabel.Text = sedogoEvent.eventVenue;
            editedDateLabel.Text = sedogoEvent.lastUpdatedDate.ToString("dd MMMM yyyy");
        }
    }
    //===============================================================
    // Function: deleteImageButton_click
    //===============================================================
    protected void deleteImageButton_click(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);

        SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);
        sedogoEvent.eventPicFilename = "";
        sedogoEvent.eventPicPreview = "";
        sedogoEvent.eventPicThumbnail = "";
        sedogoEvent.UpdateEventPic();

        Response.Redirect("viewEvent.aspx?EID=" + eventID.ToString());
    }
Exemple #10
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int eventID = int.Parse(Request.QueryString["EID"]);

            SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInAdministratorName"].ToString(),
                eventID);
            eventNameLabel.Text = sedogoEvent.eventName;
            showOnDefaultPageCheckbox.Checked = sedogoEvent.showOnDefaultPage;
        }
    }
Exemple #11
0
    //===============================================================
    // Function: achievedEventsRepeater_ItemDataBound
    //===============================================================
    protected void achievedEventsRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.DataItem != null &&
            (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem))
        {
            DataRowView row = e.Item.DataItem as DataRowView;

            int eventID = int.Parse(row["EventID"].ToString());
            SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);
            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);

            HyperLink eventNameLabel = e.Item.FindControl("eventNameLabel") as HyperLink;
            eventNameLabel.NavigateUrl = "viewEvent.aspx?EID=" + row["EventID"].ToString();
            eventNameLabel.Text = row["EventName"].ToString();

            Label eventDateLabel = e.Item.FindControl("eventDateLabel") as Label;
            eventDateLabel.Text = dateString;

            Label dateAchievedLabel = e.Item.FindControl("dateAchievedLabel") as Label;
            if (sedogoEvent.eventAchievedDate > DateTime.MinValue)
            {
                dateAchievedLabel.Text = sedogoEvent.eventAchievedDate.ToString("dd MMM yyyy");
            }
            else
            {
                dateAchievedLabel.Text = "";
            }

            //HyperLink userNameLabel = e.Item.FindControl("userNameLabel") as HyperLink;
            //userNameLabel.Text = row["FirstName"].ToString() + " " + row["LastName"].ToString();
            //userNameLabel.NavigateUrl = "userTimeline.aspx?UID=" + sedogoEvent.userID.ToString();

            Image eventImage = e.Item.FindControl("eventImage") as Image;
            string eventPicThumbnail = row["EventPicThumbnail"].ToString();
            if (eventPicThumbnail == "")
            {
                eventImage.ImageUrl = "~/images/eventThumbnailBlank.png";
            }
            else
            {
                var _event = new SedogoEvent(string.Empty, eventID);
                eventImage.ImageUrl = ResolveUrl(ImageHelper.GetRelativeImagePath(_event.eventID, _event.eventGUID, ImageType.EventThumbnail));
            }
        }
    }
Exemple #12
0
    //===============================================================
    // Function: click_achievedEventLink
    //===============================================================
    protected void click_achievedEventLink(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);

        SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);
        sedogoEvent.eventAchieved = !sedogoEvent.eventAchieved;
        if (sedogoEvent.eventAchieved == true)
        {
            sedogoEvent.eventAchievedDate = DateTime.Now;
        }
        else
        {
            sedogoEvent.eventAchievedDate = DateTime.MinValue;
        }
        sedogoEvent.Update();

        //sedogoEvent.SendEventUpdateEmail();
        if (sedogoEvent.eventAchieved == true)
        {
            Session["AcheievedEventID"] = eventID;
        }
        Response.Redirect("profileRedirect.aspx");
    }
Exemple #13
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);
            }
        }
    }
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);

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

        eventNameLabel.Text = sedogoEvent.eventName;

        CalendarAlertDate.SelectedDate = DateTime.Now;
        PickerAlertDate.SelectedDate = DateTime.Now;
    }
Exemple #15
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;
    }
Exemple #16
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int eventID = int.Parse(Request.QueryString["EID"]);
            int eventPID = int.Parse(Request.QueryString["EPID"]);
            int userID = -1;
            string loggedInUserName = "";
            if (Session["loggedInUserID"] != null)
            {
                userID = int.Parse(Session["loggedInUserID"].ToString());
                loggedInUserName = Session["loggedInUserFullName"].ToString();
            }

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

            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);

            int imageCount = 0;
            SqlConnection conn = new SqlConnection((string)Application["connectionString"]);
            try
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand("", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "spSelectEventPictureList";
                cmd.Parameters.Add("@EventID", SqlDbType.Int).Value = eventID;
                DbDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    int eventPictureID = int.Parse(rdr["EventPictureID"].ToString());
                    int postedByUserID = int.Parse(rdr["PostedByUserID"].ToString());
                    string imageFilename = "";
                    if (!rdr.IsDBNull(rdr.GetOrdinal("ImageFilename")))
                    {
                        imageFilename = (string)rdr["ImageFilename"];
                    }
                    string imagePreview = "";
                    if (!rdr.IsDBNull(rdr.GetOrdinal("ImagePreview")))
                    {
                        imagePreview = (string)rdr["ImagePreview"];
                    }
                    string imageThumbnail = "";
                    if (!rdr.IsDBNull(rdr.GetOrdinal("ImageThumbnail")))
                    {
                        imageThumbnail = (string)rdr["ImageThumbnail"];
                    }
                    string caption = "";
                    if (!rdr.IsDBNull(rdr.GetOrdinal("Caption")))
                    {
                        caption = (string)rdr["Caption"];
                    }

                    var @event = new SedogoEvent(string.Empty, eventID);

                    imagePreview = ResolveUrl(ImageHelper.GetRelativeImagePath(eventPictureID, @event.eventGUID,ImageType.EventPictureThumbnailSlideShow));//  ImageType.EventPicturePreview));

                    sliderImagesLiteral.Text += "slidesX[" + imageCount.ToString() + "] = [\"" + imagePreview + "\", \"" + caption.Replace('"',' ') + "\"];\n";
                imageCount++;
         //                   if(eventPictureID==eventPID)     sliderImagesLiteral.Text += "slidesX.jumpto="+imageCount+";\n";

                }
                rdr.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }
    }
Exemple #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());
        }
    }
Exemple #18
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int eventID = int.Parse(Request.QueryString["EID"]);
            string action = "";
            int eventAlertID = -1;
            if (Request.QueryString["A"] != null && Request.QueryString["EAID"] != null)
            {
                action = Request.QueryString["A"].ToString();
                eventAlertID = int.Parse(Request.QueryString["EAID"]);

                if (action == "Delete")
                {
                    try
                    {
                        EventAlert alertToDelete = new EventAlert(Session["loggedInUserFullName"].ToString(), eventAlertID);
                        alertToDelete.Delete();
                    }
                    catch (Exception ex)
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
                            "alert(\"Error: " + ex.Message + "\");", true);
                    }
                }
            }

            SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);
            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);

            eventTitleLabel.Text = sedogoEvent.eventName;
            eventOwnersNameLabel.Text = eventOwner.firstName + " " + eventOwner.lastName;
            eventDateLabel.Text = dateString;
            eventDescriptionLabel.Text = sedogoEvent.eventDescription.Replace("\n", "<br/>");

            CalendarAlertDate.SelectedDate = DateTime.Now;
            PickerAlertDate.SelectedDate = DateTime.Now;

            PopulateAlerts(eventID);
        }
    }
        //===============================================================
        // 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();
                }
            }
        }
Exemple #20
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);

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

        string dateString = "";
        if (sedogoEvent.dateType == "D")
        {
            // Event occurs on a specific date
            dateString = sedogoEvent.startDate.ToString("ddd d MMMM yyyy");
        }
        if (sedogoEvent.dateType == "R")
        {
            // Event occurs in a date range - use the start date
            dateString = sedogoEvent.rangeStartDate.ToString("ddd d MMMM yyyy") + " to " + sedogoEvent.rangeEndDate.ToString("ddd d MMMM yyyy");
        }
        if (sedogoEvent.dateType == "A")
        {
            // Event occurs before birthday
            string dateSuffix = "";
            switch (sedogoEvent.beforeBirthday)
            {
                case 1: case 21: case 31: case 41: case 51: case 61: case 71: case 81: case 91: case 101:
                    dateSuffix = "st";
                    break;
                case 2: case 22: case 32: case 42: case 52: case 62: case 72: case 82: case 92: case 102:
                    dateSuffix = "nd";
                    break;
                case 3: case 23: case 33: case 43: case 53: case 63: case 73: case 83: case 93: case 103:
                    dateSuffix = "rd";
                    break;
                case 4: case 5: case 6: case 7: case 8: case 9: case 10:
                case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20:
                case 24: case 25: case 26: case 27: case 28: case 29: case 30:
                case 34: case 35: case 36: case 37: case 38: case 39: case 40:
                case 44: case 45: case 46: case 47: case 48: case 49: case 50:
                case 54: case 55: case 56: case 57: case 58: case 59: case 60:
                case 64: case 65: case 66: case 67: case 68: case 69: case 70:
                case 74: case 75: case 76: case 77: case 78: case 79: case 80:
                case 84: case 85: case 86: case 87: case 88: case 89: case 90:
                case 94: case 95: case 96: case 97: case 98: case 99: case 100:
                case 104: case 105: case 106: case 107: case 108: case 109: case 110:
                    dateSuffix = "th";
                    break;
                default:
                    break;
            }
            dateString = "Before " + sedogoEvent.beforeBirthday.ToString() + dateSuffix + " birthday";
        }
        int inviteCount = EventInvite.GetInviteCount(eventID);

        eventNameLabel.Text = sedogoEvent.eventName;
        whoLabel.Text = eventOwner.firstName + " " + eventOwner.lastName;
        goalNameLabel.Text = sedogoEvent.eventName;
        if (sedogoEvent.eventDescription == "")
        {
            descriptionLabel.Text = "&nbsp;";
        }
        else
        {
            descriptionLabel.Text = sedogoEvent.eventDescription.Replace("\n", "<br/>");
        }
        venueLabel.Text = sedogoEvent.eventVenue;
        dateLabel.Text = dateString;
        reminderLabel.Text = GetAlertsText(eventID);
        invitesLabel.Text = inviteCount.ToString() + " pending";

        if (sedogoEvent.eventPicPreview == "")
        {
            eventImage.ImageUrl = "~/images/eventImageBlank.png";
        }
        else
        {
            eventImage.ImageUrl = "~/assets/eventPics/" + sedogoEvent.eventPicPreview;
        }
    }
Exemple #21
0
    //===============================================================
    // Function: PopulateEvents
    //===============================================================
    protected void PopulateEvents()
    {
        int userID = int.Parse(Session["loggedInUserID"].ToString());

        if (Session["ViewArchivedEvents"] != null)
        {
            viewArchivedEvents = (Boolean)Session["ViewArchivedEvents"];
        }

        DateTime todayStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day,
            0, 0, 0);
        DateTime todayPlus1Day = todayStart.AddDays(1);
        DateTime todayPlus7Days = todayStart.AddDays(7);
        DateTime todayPlus1Month = todayStart.AddMonths(1);
        DateTime todayPlus1Year = todayStart.AddYears(1);
        DateTime todayPlus2Years = todayStart.AddYears(2);
        DateTime todayPlus3Years = todayStart.AddYears(3);
        DateTime todayPlus4Years = todayStart.AddYears(4);
        DateTime todayPlus5Years = todayStart.AddYears(5);
        DateTime todayPlus10Years = todayStart.AddYears(10);
        DateTime todayPlus20Years = todayStart.AddYears(20);
        DateTime todayPlus100Years = todayStart.AddYears(100);

        todaysDateLabel.Text = "Today: " + todayStart.ToString("ddd d MMMM yyyy");

        int numOverdueEvents = 0;
        int numTodayEvents = 0;
        int numThisWeekEvents = 0;
        int numThisMonthEvents = 0;
        int numThisYearEvents = 0;
        int numNext2YearsEvents = 0;
        int numNext3YearsEvents = 0;
        int numNext4YearsEvents = 0;
        int numNext5YearsEvents = 0;
        int numNext10YearsEvents = 0;
        int numNext20YearsEvents = 0;
        int numNext100YearsEvents = 0;
        int numNotScheduledEvents = 0;

        SearchHistory searchHistory = new SearchHistory("");
        searchHistory.searchDate = DateTime.Now;
        searchHistory.searchText = "";
        searchHistory.userID = userID;
        int rowCount = 0;

        StringBuilder stateString = new StringBuilder();

        SqlConnection conn = new SqlConnection((string)Application["connectionString"]);
        try
        {
            conn.Open();

            SqlCommand cmd = new SqlCommand("", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            if (viewArchivedEvents == true)
            {
                cmd.CommandText = "spSelectFullEventListIncludingAchievedByCategory";
            }
            else
            {
                cmd.CommandText = "spSelectFullEventListByCategory";
            }
            cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = userID;
            cmd.Parameters.Add("@ShowPrivate", SqlDbType.Bit).Value = true;
            //cmd.CommandText = "spSearchEvents";
            //cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = userID;
            //cmd.Parameters.Add("@SearchText", SqlDbType.NVarChar, 1000).Value = searchText;
            DbDataReader rdr = cmd.ExecuteReader();
            if (rdr.HasRows == true)
            {
                while (rdr.Read())
                {
                    int categoryID = 1;
                    string dateType = "D";
                    DateTime startDate = DateTime.MinValue;
                    DateTime rangeStartDate = DateTime.MinValue;
                    DateTime rangeEndDate = DateTime.MinValue;
                    int beforeBirthday = -1;
                    Boolean privateEvent = false;
                    Boolean eventAchieved = false;
                    string eventPicThumbnail = "";

                    int eventID = int.Parse(rdr["EventID"].ToString());
                    int eventUserID = int.Parse(rdr["UserID"].ToString());
                    string eventName = (string)rdr["EventName"];
                    if (!rdr.IsDBNull(rdr.GetOrdinal("DateType")))
                    {
                        dateType = (string)rdr["DateType"];
                    }
                    if (!rdr.IsDBNull(rdr.GetOrdinal("StartDate")))
                    {
                        startDate = (DateTime)rdr["StartDate"];
                    }
                    if (!rdr.IsDBNull(rdr.GetOrdinal("RangeStartDate")))
                    {
                        rangeStartDate = (DateTime)rdr["RangeStartDate"];
                    }
                    if (!rdr.IsDBNull(rdr.GetOrdinal("RangeEndDate")))
                    {
                        rangeEndDate = (DateTime)rdr["RangeEndDate"];
                    }
                    eventAchieved = (Boolean)rdr["EventAchieved"];
                    if (!rdr.IsDBNull(rdr.GetOrdinal("CategoryID")))
                    {
                        categoryID = int.Parse(rdr["CategoryID"].ToString());
                    }
                    if (!rdr.IsDBNull(rdr.GetOrdinal("BeforeBirthday")))
                    {
                        beforeBirthday = int.Parse(rdr["BeforeBirthday"].ToString());
                    }
                    privateEvent = (Boolean)rdr["PrivateEvent"];
                    if (!rdr.IsDBNull(rdr.GetOrdinal("EventPicThumbnail")))
                    {
                        eventPicThumbnail = (string)rdr["EventPicThumbnail"];
                    }

                    string dateString = "";
                    if (dateType == "D")
                    {
                        // Event occurs on a specific date
                        dateString = startDate.ToString("ddd d MMMM yyyy");
                    }
                    if (dateType == "R")
                    {
                        // Event occurs in a date range - use the start date
                        dateString = rangeStartDate.ToString("ddd d MMMM yyyy") + " to " + rangeEndDate.ToString("ddd d MMMM yyyy");

                        startDate = rangeEndDate;
                        //startDate = rangeStartDate;
                    }
                    if (dateType == "A")
                    {
                        // Event occurs before birthday
                        string dateSuffix = "";
                        switch (beforeBirthday)
                        {
                            case 1: case 21: case 31: case 41: case 51: case 61: case 71: case 81: case 91: case 101:
                                dateSuffix = "st";
                                break;
                            case 2: case 22: case 32: case 42: case 52: case 62: case 72: case 82: case 92: case 102:
                                dateSuffix = "nd";
                                break;
                            case 3: case 23: case 33: case 43: case 53: case 63: case 73: case 83: case 93: case 103:
                                dateSuffix = "rd";
                                break;
                            case 4: case 5: case 6: case 7: case 8: case 9: case 10:
                            case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20:
                            case 24: case 25: case 26: case 27: case 28: case 29: case 30:
                            case 34: case 35: case 36: case 37: case 38: case 39: case 40:
                            case 44: case 45: case 46: case 47: case 48: case 49: case 50:
                            case 54: case 55: case 56: case 57: case 58: case 59: case 60:
                            case 64: case 65: case 66: case 67: case 68: case 69: case 70:
                            case 74: case 75: case 76: case 77: case 78: case 79: case 80:
                            case 84: case 85: case 86: case 87: case 88: case 89: case 90:
                            case 94: case 95: case 96: case 97: case 98: case 99: case 100:
                            case 104: case 105: case 106: case 107: case 108: case 109: case 110:
                                dateSuffix = "th";
                                break;
                            default:
                                break;
                        }
                        dateString = "Before " + beforeBirthday.ToString() + dateSuffix + " birthday";

                        startDate = DateTime.Now;
                        if (userID != eventUserID)
                        {
                            // Use the event users birthday
                            SedogoUser eventUser = new SedogoUser("", eventUserID);
                            if (eventUser.birthday > DateTime.MinValue)
                            {
                                startDate = eventUser.birthday.AddYears(beforeBirthday);
                            }
                        }
                        else
                        {
                            // My event/my birthday
                            if (user.birthday > DateTime.MinValue)
                            {
                                startDate = user.birthday.AddYears(beforeBirthday);
                            }
                        }
                    }

                    string timelineColour = "#cd3301";
                    switch (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;
                    }

                    int eventAlertCount = EventAlert.GetEventAlertCountPending(eventID);
                    int trackingUserCount = SedogoEvent.GetTrackingUserCount(eventID);
                    int joinedUserCount = SedogoEvent.GetMemberUserCount(eventID);

                    StringBuilder eventString = new StringBuilder();
                    eventString.Append("<div class=\"event");
                    //if( categoryID > 0 )  // Show border colour on event
                    //{
                    //    eventString.Append(" highlight-group-" + categoryID.ToString());
                    //}
                    eventString.AppendLine("\">");
                    eventString.AppendLine("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" ");
                    eventString.AppendLine("onMouseOver=\"setColor('colourBar_" + eventID.ToString() + "','" + timelineColour + "');\" ");
                    eventString.AppendLine("onMouseOut=\"setColor('colourBar_" + eventID.ToString() + "','#FFFFFF');\" ");
                    eventString.AppendLine("onclick=\"showhideGoal('goalDiv_" + eventID.ToString() + "');\" ");
                    eventString.AppendLine(">");
                    eventString.AppendLine("<tr style=\"background-color:#EEEEEE\" >");
                    eventString.AppendLine("<td>");
                        eventString.AppendLine("<p class=\"eventListText\"><b>");
                        //if (eventAchieved == true)
                        //{
                        //    eventString.AppendLine(" <img src=\"./images/acceptachieve.gif\" alt=\"Achieved\" />");
                        //}
                        eventString.Append(eventName);
                        eventString.Append("</b></p>");
                    eventString.AppendLine("</td>");
                    eventString.AppendLine("<td align=\"right\">");
                        if (eventAchieved == true)
                        {
                            eventString.AppendLine(" <img src=\"./images/acceptachieve.gif\" alt=\"Achieved\" />");
                        }
                        if (privateEvent == true)
                        {
                            eventString.AppendLine("<img src=\"./images/private.gif\" alt=\"Private event\" />");
                        }
                        if (eventAlertCount > 0)
                        {
                            eventString.AppendLine("<img src=\"./images/reminder.gif\" alt=\"Alert\" />");
                        }
                    eventString.AppendLine("</td>");
                    eventString.AppendLine("</tr>");
                    eventString.AppendLine("<tr height=\"6px\"><td colspan=\"2\" bgcolor=\"#FFFFFF\" id=\"colourBar_" + eventID.ToString() + "\" >");
                    eventString.AppendLine("<img src=\"/images/1x1trans.gif\" height=\"6px\" >");
                    eventString.AppendLine("</td></tr>");
                    eventString.AppendLine("</table>");
                    eventString.AppendLine("<div id=\"goalDiv_" + eventID.ToString() + "\" style=\"display:none\">");
                    eventString.AppendLine("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" >");
                    eventString.AppendLine("<tr>");
                    eventString.AppendLine("<td>");

                    eventString.AppendLine("<p>" + dateString + "</p>");
                    eventString.AppendLine("<p>");
                    if (joinedUserCount > 0)
                    {
                        eventString.AppendLine(joinedUserCount.ToString());
                        if (joinedUserCount == 1)
                        {
                            eventString.AppendLine(" member");
                        }
                        else
                        {
                            eventString.AppendLine(" members");
                        }
                    }
                    if (trackingUserCount > 0)
                    {
                        if (joinedUserCount > 0)
                        {
                            eventString.AppendLine("<br/>");
                        }
                        eventString.AppendLine(trackingUserCount.ToString());
                        eventString.AppendLine(" following");
                    }
                    eventString.AppendLine("</p>");
                    eventString.AppendLine("<a href=\"viewEvent.aspx?EID=" + eventID.ToString()
                        + "\" title=\"\">View</a>");

                    eventString.AppendLine("</td>");
                    eventString.AppendLine("<td align=\"right\" style=\"padding-top:5px\">");
                    if (eventPicThumbnail == "")
                    {
                        eventString.AppendLine("<img src=\"./images/eventThumbnailBlank.png\" />");
                    }
                    else
                    {
                        var _event = new SedogoEvent(string.Empty, eventID);

                        eventString.AppendLine("<img src=\"" + ImageHelper.GetRelativeImagePath(_event.eventID, _event.eventGUID, ImageType.EventThumbnail).Replace("~", ".") + "\" />");
                    }
                    eventString.AppendLine("</td>");
                    eventString.AppendLine("</tr></table>");
                    eventString.AppendLine("</div>");
                    eventString.AppendLine("</div>");

                    // Use the timeline start date as this has been adjusted above
                    if (startDate < todayStart && startDate != DateTime.MinValue)
                    {
                        overdueEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numOverdueEvents++;
                    }
                    if (startDate >= todayStart && startDate < todayPlus1Day)
                    {
                        todayEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numTodayEvents++;
                    }
                    if (startDate >= todayPlus1Day && startDate < todayPlus7Days)
                    {
                        thisWeekEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numThisWeekEvents++;
                    }
                    if (startDate >= todayPlus7Days && startDate < todayPlus1Month)
                    {
                        thisMonthEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numThisMonthEvents++;
                    }
                    if (startDate >= todayPlus1Month && startDate < todayPlus1Year)
                    {
                        nextYearEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numThisYearEvents++;
                    }
                    if (startDate >= todayPlus1Year && startDate < todayPlus2Years)
                    {
                        next2YearsEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numNext2YearsEvents++;
                    }
                    if (startDate >= todayPlus2Years && startDate < todayPlus3Years)
                    {
                        next3YearsEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numNext3YearsEvents++;
                    }
                    if (startDate >= todayPlus3Years && startDate < todayPlus4Years)
                    {
                        next4YearsEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numNext4YearsEvents++;
                    }
                    if (startDate >= todayPlus4Years && startDate < todayPlus5Years)
                    {
                        next5YearsEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numNext5YearsEvents++;
                    }
                    if (startDate >= todayPlus5Years && startDate < todayPlus10Years)
                    {
                        next10YearsEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numNext10YearsEvents++;
                    }
                    if (startDate >= todayPlus10Years && startDate < todayPlus20Years)
                    {
                        next20YearsEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numNext20YearsEvents++;
                    }
                    if (startDate >= todayPlus20Years && startDate < todayPlus100Years)
                    {
                        next100YearsEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numNext100YearsEvents++;
                    }
                    if (startDate == DateTime.MinValue)
                    {
                        notScheduledEventsPlaceHolder.Controls.Add(new LiteralControl(eventString.ToString()));
                        numNotScheduledEvents++;
                    }
                }
                rdr.Close();
            }

            searchHistory.searchHits = rowCount;
            searchHistory.Add();

            overdueTitleLabel.Visible = true;
            todaysDateLabel.Visible = true;
            thisWeekTitleLabel.Visible = true;
            thisMonthTitleLabel.Visible = true;
            thisYearTitleLabel.Visible = true;
            next2YearsTitleLabel.Visible = true;
            next3YearsTitleLabel.Visible = true;
            next4YearsTitleLabel.Visible = true;
            next5YearsTitleLabel.Visible = true;
            fiveToTenYearsTitleLabel.Visible = true;
            tenToTwentyYearsTitleLabel.Visible = true;
            twentyPlusYearsTitleLabel.Visible = true;
            unknownDateTitleLabel.Visible = true;

            if (numOverdueEvents == 0)
            {
                overdueTitleLabel.Visible = false;
            }
            if (numTodayEvents == 0)
            {
                todaysDateLabel.Visible = false;
            }
            if (numThisWeekEvents == 0)
            {
                thisWeekTitleLabel.Visible = false;
            }
            if (numThisMonthEvents == 0)
            {
                thisMonthTitleLabel.Visible = false;
            }
            if (numThisYearEvents == 0)
            {
                thisYearTitleLabel.Visible = false;
            }
            if (numNext2YearsEvents == 0)
            {
                next2YearsTitleLabel.Visible = false;
            }
            if (numNext3YearsEvents == 0)
            {
                next3YearsTitleLabel.Visible = false;
            }
            if (numNext4YearsEvents == 0)
            {
                next4YearsTitleLabel.Visible = false;
            }
            if (numNext5YearsEvents == 0)
            {
                next5YearsTitleLabel.Visible = false;
            }
            if (numNext10YearsEvents == 0)
            {
                fiveToTenYearsTitleLabel.Visible = false;
            }
            if (numNext20YearsEvents == 0)
            {
                tenToTwentyYearsTitleLabel.Visible = false;
            }
            if (numNext100YearsEvents == 0)
            {
                twentyPlusYearsTitleLabel.Visible = false;
            }
            if (numNotScheduledEvents == 0)
            {
                unknownDateTitleLabel.Visible = false;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            conn.Close();
        }
    }
Exemple #22
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());
    }
Exemple #23
0
    //===============================================================
    // Function: sendInvitesLink_click
    //===============================================================
    protected void sendInvitesLink_click(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);
        StringBuilder invalidEmailAddresses = new StringBuilder();
        string errorMessage = "";
        StringBuilder successfullyInvitedEmailAddresses = new StringBuilder();
        Boolean allInvitesSentOK = true;

        string invite1EmailAddress = inviteTextBox1.Text;
        string invite2EmailAddress = inviteTextBox2.Text;
        string invite3EmailAddress = inviteTextBox3.Text;
        string invite4EmailAddress = inviteTextBox4.Text;
        string invite5EmailAddress = inviteTextBox5.Text;
        string invite6EmailAddress = inviteTextBox6.Text;
        string invite7EmailAddress = inviteTextBox7.Text;
        string invite8EmailAddress = inviteTextBox8.Text;
        string invite9EmailAddress = inviteTextBox9.Text;
        string invite10EmailAddress = inviteTextBox10.Text;
        string invite11EmailAddress = inviteTextBox11.Text;
        string invite12EmailAddress = inviteTextBox12.Text;
        string invite13EmailAddress = inviteTextBox13.Text;
        string invite14EmailAddress = inviteTextBox14.Text;
        string invite15EmailAddress = inviteTextBox15.Text;
        string invite16EmailAddress = inviteTextBox16.Text;
        string invite17EmailAddress = inviteTextBox17.Text;
        string invite18EmailAddress = inviteTextBox18.Text;
        string invite19EmailAddress = inviteTextBox19.Text;
        string invite20EmailAddress = inviteTextBox20.Text;

        string additionalInviteText = additionalInviteTextTextBox.Text;

        int currentUserID = int.Parse(Session["loggedInUserID"].ToString());
        SedogoUser currentUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), currentUserID);
        SedogoEvent currentEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);
        string dateString = "";
        if (currentEvent.dateType == "D")
        {
            // Date
            dateString = "on " + currentEvent.startDate.ToString("ddd d MMMM yyyy");
        }
        if (currentEvent.dateType == "R")
        {
            // Range
            dateString = "between " + currentEvent.rangeStartDate.ToString("ddd d MMMM yyyy");
            dateString += "and " + currentEvent.rangeEndDate.ToString("ddd d MMMM yyyy");
        }
        if (currentEvent.dateType == "A")
        {
            // Birthday
            dateString = "before ";
            if (currentUser.gender == "M")
            {
                dateString += "his ";
            }
            else
            {
                dateString += "her ";
            }
            string dateSuffix = "";
            switch (currentEvent.beforeBirthday)
            {
                case 1: case 21: case 31: case 41: case 51: case 61: case 71: case 81: case 91: case 101:
                    dateSuffix = "st";
                    break;
                case 2: case 22: case 32: case 42: case 52: case 62: case 72: case 82: case 92: case 102:
                    dateSuffix = "nd";
                    break;
                case 3: case 23: case 33: case 43: case 53: case 63: case 73: case 83: case 93: case 103:
                    dateSuffix = "rd";
                    break;
                case 4: case 5: case 6: case 7: case 8: case 9: case 10:
                case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20:
                case 24: case 25: case 26: case 27: case 28: case 29: case 30:
                case 34: case 35: case 36: case 37: case 38: case 39: case 40:
                case 44: case 45: case 46: case 47: case 48: case 49: case 50:
                case 54: case 55: case 56: case 57: case 58: case 59: case 60:
                case 64: case 65: case 66: case 67: case 68: case 69: case 70:
                case 74: case 75: case 76: case 77: case 78: case 79: case 80:
                case 84: case 85: case 86: case 87: case 88: case 89: case 90:
                case 94: case 95: case 96: case 97: case 98: case 99: case 100:
                case 104: case 105: case 106: case 107: case 108: case 109: case 110:
                    dateSuffix = "th";
                    break;
                default:
                    break;
            }
            dateString += currentEvent.beforeBirthday + dateSuffix + " birthday";
        }

        if (invite1EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite1EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite1EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite1EmailAddress);
            }
        }
        if (invite2EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite2EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite2EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite2EmailAddress);
            }
        }
        if (invite3EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite3EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite3EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite3EmailAddress);
            }
        }
        if (invite4EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite4EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite4EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite4EmailAddress);
            }
        }
        if (invite5EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite5EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite5EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite5EmailAddress);
            }
        }
        if (invite6EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite6EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite6EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite6EmailAddress);
            }
        }
        if (invite7EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite7EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite7EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite7EmailAddress);
            }
        }
        if (invite8EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite8EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite8EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite8EmailAddress);
            }
        }
        if (invite9EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite9EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite9EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite9EmailAddress);
            }
        }
        if (invite10EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite10EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite10EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite10EmailAddress);
            }
        }
        if (invite11EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite11EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite11EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite11EmailAddress);
            }
        }
        if (invite12EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite12EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite12EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite12EmailAddress);
            }
        }
        if (invite13EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite13EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite13EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite13EmailAddress);
            }
        }
        if (invite14EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite14EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite14EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite14EmailAddress);
            }
        }
        if (invite15EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite15EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite15EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite15EmailAddress);
            }
        }
        if (invite16EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite16EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite16EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite16EmailAddress);
            }
        }
        if (invite17EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite17EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite17EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite17EmailAddress);
            }
        }
        if (invite18EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite18EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite18EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite18EmailAddress);
            }
        }
        if (invite19EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite19EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite19EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite19EmailAddress);
            }
        }
        if (invite20EmailAddress.Trim() != "")
        {
            if (SendInviteEmail(eventID, invite20EmailAddress, additionalInviteText, dateString,
                currentEvent, currentUser, out errorMessage) == false)
            {
                allInvitesSentOK = false;
                invalidEmailAddresses.AppendLine(invite20EmailAddress + ": " + errorMessage);
            }
            else
            {
                successfullyInvitedEmailAddresses.AppendLine(invite20EmailAddress);
            }
        }

        if (allInvitesSentOK == true)
        {
            Response.Redirect("addEventSummary.aspx?EID=" + eventID.ToString());
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
                "alert(\"Invitations to the following addresses could not be sent: "
                + invalidEmailAddresses.ToString().Replace("\n", ", ").Replace("\r", "") + "\");", true);

            inviteTextBox1.Text = "";
            inviteTextBox2.Text = "";
            inviteTextBox3.Text = "";
            inviteTextBox4.Text = "";
            inviteTextBox5.Text = "";
            inviteTextBox6.Text = "";
            inviteTextBox7.Text = "";
            inviteTextBox8.Text = "";
            inviteTextBox9.Text = "";
            inviteTextBox10.Text = "";
            inviteTextBox11.Text = "";
            inviteTextBox12.Text = "";
            inviteTextBox13.Text = "";
            inviteTextBox14.Text = "";
            inviteTextBox15.Text = "";
            inviteTextBox16.Text = "";
            inviteTextBox17.Text = "";
            inviteTextBox18.Text = "";
            inviteTextBox19.Text = "";
            inviteTextBox20.Text = "";
        }
    }
    //===============================================================
    // Function: CreateXMLContent
    //===============================================================
    private void CreateXMLContent(XmlTextWriter writer, string searchText)
    {
        SqlConnection conn = new SqlConnection((string)Application["connectionString"]);
        try
        {
            conn.Open();

            SqlCommand cmd = new SqlCommand("", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "spSelectHomePageEvents";
            DbDataReader rdr = cmd.ExecuteReader();
            while (rdr.Read())
            {
                int categoryID = 1;
                string dateType = "D";
                DateTime startDate = DateTime.MinValue;
                DateTime rangeStartDate = DateTime.MinValue;
                DateTime rangeEndDate = DateTime.MinValue;
                int beforeBirthday = -1;
                Boolean privateEvent = false;
                Boolean eventAchieved = false;
                int userID = -1;

                DateTime timelineStartDate = DateTime.MinValue;
                DateTime timelineEndDate = DateTime.MinValue;

                //*New
                string eventPicThumbnail = "";
                //

                int eventID = int.Parse(rdr["EventID"].ToString());
                string eventName = (string)rdr["EventName"];
                if (!rdr.IsDBNull(rdr.GetOrdinal("DateType")))
                {
                    dateType = (string)rdr["DateType"];
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal("StartDate")))
                {
                    startDate = (DateTime)rdr["StartDate"];
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal("RangeStartDate")))
                {
                    rangeStartDate = (DateTime)rdr["RangeStartDate"];
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal("RangeEndDate")))
                {
                    rangeEndDate = (DateTime)rdr["RangeEndDate"];
                }
                eventAchieved = (Boolean)rdr["EventAchieved"];
                if (!rdr.IsDBNull(rdr.GetOrdinal("CategoryID")))
                {
                    categoryID = int.Parse(rdr["CategoryID"].ToString());
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal("BeforeBirthday")))
                {
                    beforeBirthday = int.Parse(rdr["BeforeBirthday"].ToString());
                }
                privateEvent = (Boolean)rdr["PrivateEvent"];
                if (!rdr.IsDBNull(rdr.GetOrdinal("UserID")))
                {
                    userID = int.Parse(rdr["UserID"].ToString());
                }

                //*New
                if (!rdr.IsDBNull(rdr.GetOrdinal("EventPicThumbnail")))
                {
                    eventPicThumbnail = (string)rdr["EventPicThumbnail"];
                }

                string EUserName = string.Empty;
                if (!rdr.IsDBNull(rdr.GetOrdinal("FirstName")))
                {
                    EUserName = (string)rdr["FirstName"];
                    if (!rdr.IsDBNull(rdr.GetOrdinal("LastName")))
                    {
                        EUserName = EUserName + " " + (string)rdr["LastName"];
                    }
                }
                //

                if (dateType == "D")
                {
                    // Event occurs on a specific date

                    timelineStartDate = startDate;
                    timelineEndDate = startDate.AddDays(28);        // Add 28 days so it shows up
                }
                if (dateType == "R")
                {
                    // Event occurs in a date range - use the start date

                    timelineStartDate = rangeStartDate;
                    timelineEndDate = rangeEndDate;

                    TimeSpan ts = timelineEndDate - timelineStartDate;
                    if (ts.Days < 28)
                    {
                        timelineEndDate = timelineStartDate.AddDays(28);        // Add 28 days so it shows up
                    }

                    startDate = rangeStartDate;
                }
                if (dateType == "A")
                {
                    // Event occurs before birthday
                    timelineStartDate = DateTime.Now;
                    if (userID > 0)
                    {
                        SedogoUser user = new SedogoUser("", userID);

                        if (user.birthday > DateTime.MinValue)
                        {
                            timelineEndDate = user.birthday.AddYears(beforeBirthday);

                            TimeSpan ts = timelineEndDate - DateTime.Now;   // timelineStartDate.AddYears(beforeBirthday);
                            if (ts.Days < 0)
                            {
                                // Birthday was in the past
                                timelineStartDate = DateTime.Now;
                                timelineEndDate = timelineStartDate.AddDays(28);        // Add 28 days so it shows up

                                // Set start date so event is correctly placed below
                                startDate = DateTime.Now.AddDays(ts.Days);
                            }
                            else if (ts.Days >= 0 && ts.Days < 28)
                            {
                                // Birthday is within 28 days - extend the timeline a bit
                                timelineEndDate = timelineStartDate.AddDays(28);        // Add 28 days so it shows up

                                startDate = timelineStartDate;
                            }
                            else
                            {
                                startDate = timelineStartDate;
                            }
                        }
                        else
                        {
                            timelineEndDate = DateTime.Now.AddDays(28);
                        }
                    }
                    else
                    {
                        // If the userID is not set for any reason
                        timelineEndDate = timelineStartDate.AddMonths(1);
                    }
                }

                string timelineColour = "#cd3301";
                string category = "";
                switch (categoryID)
                {
                    case 1:
                        timelineColour = "#cd3301";
                        category = "Personal";
                        break;
                    case 2:
                        timelineColour = "#ff0b0b";
                        category = "Travel";
                        break;
                    case 3:
                        timelineColour = "#ff6801";
                        category = "Friends";
                        break;
                    case 4:
                        timelineColour = "#ff8500";
                        category = "Family";
                        break;
                    case 5:
                        timelineColour = "#d5b21a";
                        category = "General";
                        break;
                    case 6:
                        timelineColour = "#8dc406";
                        category = "Health";
                        break;
                    case 7:
                        timelineColour = "#5b980c";
                        category = "Money";
                        break;
                    case 8:
                        timelineColour = "#079abc";
                        category = "Education";
                        break;
                    case 9:
                        timelineColour = "#5ab6cd";
                        category = "Hobbies";
                        break;
                    case 10:
                        timelineColour = "#8A67C1";
                        category = "Work";
                        break;
                    case 11:
                        timelineColour = "#E54ECF";
                        category = "Culture";
                        break;
                    case 12:
                        timelineColour = "#A5369C";
                        category = "Charity";
                        break;
                    case 13:
                        timelineColour = "#A32672";
                        category = "Green";
                        break;
                    case 14:
                        timelineColour = "#669";
                        category = "Misc";
                        break;
                }
                int messageCount = SedogoEvent.GetCommentCount(eventID);
                int trackingUserCount = SedogoEvent.GetTrackingUserCount(eventID);
                int memberUserCount = SedogoEvent.GetMemberUserCount(eventID);

                //string linkURL = "&lt;a href=\"viewEvent.aspx?EID=" + eventID.ToString() + "\" class=\"modal\" title=\"\"&gt;Full details&lt;/a&gt;";

                //string linkURL = trackingUserCount.ToString() + " following this goal<br/>";
                //linkURL = linkURL + memberUserCount.ToString() + " members<br/>";
                //linkURL = linkURL + messageCount.ToString() + " comments<br/>";
                //linkURL = linkURL + "&lt;a href=\"javascript:openEvent(" + eventID.ToString() + ")\" title=\"\"&gt;Full details&lt;/a&gt;";

                //* New
                string linkURL = timelineStartDate.ToString("ddd dd MMM yyyy") + "<br/><br/>";
                linkURL = linkURL + memberUserCount.ToString() + " Members<br/>";
                linkURL = linkURL + trackingUserCount.ToString() + " Followers<br/>";
                linkURL = linkURL + messageCount.ToString() + " Comments<br/>";
                linkURL = linkURL + "&lt;a style=\"text-decoration:underline;\" href=\"javascript:openEvent(" + eventID.ToString() + ")\" title=\"\"&gt;Goal details&lt;/a&gt;";
                linkURL = linkURL + "  &lt;a style=\"text-decoration:underline;\" href=\"javascript:viewUserTimeline(" + userID.ToString() + ")\" title=\"\"&gt;Timeline&lt;/a&gt;";
                linkURL = linkURL + "  &lt;a style=\"text-decoration:underline;\" href=\"javascript:viewProfile(" + userID.ToString() + ")\" title=\"\"&gt;Profile&lt;/a&gt;";

                string ImgLink = "|" + EUserName + " &lt;a href=\"javascript:doSendMessage(" + userID.ToString() + ")\"&gt;&lt;img src=\"images/ico_messages.gif\" title=\"Send Message\" alt=\"Send Message\" /&gt;&lt;/a&gt;";
                //string ImgLink = "|" + EUserName;

                //*

                writer.WriteStartElement("event");      // Time format: Feb 27 2009 09:00:00 GMT
                writer.WriteAttributeString("start", timelineStartDate.ToString("MMM dd yyyy HH:mm:ss 'GMT'"));
                writer.WriteAttributeString("end", timelineEndDate.ToString("MMM dd yyyy HH:mm:ss 'GMT'"));
                writer.WriteAttributeString("isDuration", "true");
                writer.WriteAttributeString("title", eventName);

                var _event = new SedogoEvent(string.Empty, eventID);

                //* New
                if (eventPicThumbnail == "")
                {
                    writer.WriteAttributeString("image", "./images/eventThumbnailBlank.png");
                }
                else
                {
                    writer.WriteAttributeString("image", ResolveUrl(ImageHelper.GetRelativeImagePath(_event.eventID, _event.eventGUID, ImageType.EventThumbnail)));
                }

                //writer.WriteAttributeString("image", "http://simile.mit.edu/images/csail-logo.gif");
                //*
                writer.WriteAttributeString("color", timelineColour);
                writer.WriteAttributeString("category", category);
                writer.WriteString(linkURL + " &lt;br /&gt;" + ImgLink);
                writer.WriteEndElement();
            }
            rdr.Close();
        }
        catch (Exception ex)
        {
            ErrorLog errorLog = new ErrorLog();
            errorLog.WriteLog("timelineHomePageXML", "Page_Load", ex.Message, logMessageLevel.errorMessage);
            //throw ex;
        }
        finally
        {
            conn.Close();
        }
    }
Exemple #25
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();
            }

            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);

            uploadEventImage.Visible = false;
            if (userID > 0)
            {
                if (sedogoEvent.userID != userID)
                {
                    // Viewing someone elses event
                    SedogoUser eventUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), sedogoEvent.userID);
                    goalOwnerNameLabel.Text = eventUser.firstName + " " + eventUser.lastName + "'s goal albums";
                }
                else
                {
                    // Viewing own event
                    addPictureLiteral.Text = "var url = 'addGoalPicture.aspx?EID=" + eventID.ToString() + "';";
                    uploadEventImage.Visible = true;
                    editPicsButton.Visible = true;
                    goalOwnerNameLabel.Text = "My goal albums";
                }
            }
            else
            {
                // Setup the window for a user who is not registered/logged in
                if (sedogoEvent.privateEvent == true)
                {
                    // Viewing private events is not permitted
                    Response.Redirect("profile.aspx");
                }
                goalOwnerNameLabel.Text = "My goal albums";
            }

            PopulateImages(eventID, sedogoEvent.userID);
        }
    }
Exemple #26
0
    //===============================================================
    // Function: PopulateImages
    //===============================================================
    private void PopulateImages(int eventID, int userID)
    {
        DateTime loopDate = DateTime.MinValue;
        Boolean firstRow = true;
        int columnNumber = 1;

        SqlConnection conn = new SqlConnection((string)Application["connectionString"]);
        try
        {
            conn.Open();

            SqlCommand cmd = new SqlCommand("", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "spSelectEventPictureList";
            cmd.Parameters.Add("@EventID", SqlDbType.Int).Value = eventID;
            DbDataReader rdr = cmd.ExecuteReader();
            while (rdr.Read())
            {
                int eventPictureID = int.Parse(rdr["EventPictureID"].ToString());
                int postedByUserID = int.Parse(rdr["PostedByUserID"].ToString());
                string imageFilename = "";
                if (!rdr.IsDBNull(rdr.GetOrdinal("ImageFilename")))
                {
                    imageFilename = (string)rdr["ImageFilename"];
                }
                string imagePreview = "";
                if (!rdr.IsDBNull(rdr.GetOrdinal("ImagePreview")))
                {
                    imagePreview = (string)rdr["ImagePreview"];
                }
                string imageThumbnail = "";
                if (!rdr.IsDBNull(rdr.GetOrdinal("ImageThumbnail")))
                {
                    imageThumbnail = (string)rdr["ImageThumbnail"];
                }
                string caption = "";
                if (!rdr.IsDBNull(rdr.GetOrdinal("Caption")))
                {
                    caption = (string)rdr["Caption"];
                }
                DateTime createdDate = (DateTime)rdr["CreatedDate"];

                if (createdDate.DayOfYear != loopDate.DayOfYear)
                {
                    if (firstRow == false)
                    {
                        imagesPlaceHolder.Controls.Add(new LiteralControl("<div style=\"clear: both;\" />"));
                    }
                    imagesPlaceHolder.Controls.Add(new LiteralControl("<i><span style=\"font-size:80%\">" + createdDate.ToString("ddd d MMMM yyyy") + "</span></i><br/>"));
                    firstRow = false;
                }
                loopDate = createdDate;

                imagesPlaceHolder.Controls.Add(new LiteralControl("<div style=\"width:110px; float:left; margin:0 10px 20px 0\">"));
                imagesPlaceHolder.Controls.Add(new LiteralControl("<a href=\"eventPicDetails.aspx?EID=" + eventID.ToString()
                    + "&EPID=" + eventPictureID.ToString() + "\"><img src=\"/assets/eventPics/" + imageThumbnail + "\"/></a>"));
                if( caption != "" )
                {
                    if (caption.Length > 30)
                    {
                        caption = caption.Substring(0, 30) + "...";
                    }
                    imagesPlaceHolder.Controls.Add(new LiteralControl("<br/>" + caption));
                }
                imagesPlaceHolder.Controls.Add(new LiteralControl("</div>"));

                if ((columnNumber % 6) == 0)
                {
                    imagesPlaceHolder.Controls.Add(new LiteralControl("<div style=\"clear: both;\" />"));
                }
                columnNumber++;
            }
            rdr.Close();

            if( userID > 0 )
            {
                columnNumber = 1;

                SqlCommand cmdEventsWithPics = new SqlCommand("", conn);
                cmdEventsWithPics.CommandType = CommandType.StoredProcedure;
                cmdEventsWithPics.CommandText = "spSelectEventsWithPicturesList";
                cmdEventsWithPics.Parameters.Add("@UserID", SqlDbType.Int).Value = userID;
                DbDataReader rdrEventsWithPics = cmdEventsWithPics.ExecuteReader();
                while (rdrEventsWithPics.Read())
                {
                    int loopEventID = int.Parse(rdrEventsWithPics["EventID"].ToString());

                    SedogoEvent loopEvent = new SedogoEvent("", loopEventID);

                    string timelineColour = "#cd3301";
                    switch (loopEvent.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;
                    }

                    albumnsPlaceHolder.Controls.Add(new LiteralControl("<div style=\"width:150px; float:left; margin:0 10px 10px 0\" "));
                    albumnsPlaceHolder.Controls.Add(new LiteralControl("onMouseOver=\"setColor('colourBar_" + loopEventID.ToString() + "','" + timelineColour + "'); "
                        + "setColor('colourBar2_" + loopEventID.ToString() + "','#EEEEEE');\" "));
                    albumnsPlaceHolder.Controls.Add(new LiteralControl("onMouseOut=\"setColor('colourBar_" + loopEventID.ToString() + "','#FFFFFF');"
                        + "setColor('colourBar2_" + loopEventID.ToString() + "','#FFFFFF');\" "));
                    albumnsPlaceHolder.Controls.Add(new LiteralControl("> "));
                    string displayName = loopEvent.eventName;
                    if (displayName != "")
                    {
                        if (displayName.Length > 30)
                        {
                            displayName = displayName.Substring(0, 30) + "...";
                        }
                    }
                    albumnsPlaceHolder.Controls.Add(new LiteralControl("<div id=\"colourBar2_" + loopEventID.ToString() + "\" width=\"150px\">"));
                    albumnsPlaceHolder.Controls.Add(new LiteralControl("<a href=\"morePictures.aspx?EID=" + loopEventID.ToString() + "\">" + displayName + "</a>"));
                    albumnsPlaceHolder.Controls.Add(new LiteralControl("</div>"));
                    albumnsPlaceHolder.Controls.Add(new LiteralControl("<a href=\"morePictures.aspx?EID=" + loopEventID.ToString()
                        + "\"><img width=\"100\" src=\"/assets/eventPics/" + loopEvent.eventPicPreview + "\"/></a>"));
                    albumnsPlaceHolder.Controls.Add(new LiteralControl("<span id=\"colourBar_" + loopEventID.ToString() + "\"><img src=\"/images/1x1trans.gif\" height=\"6px\" width=\"100px\" ></span> "));
                    if (loopEvent.eventAchieved == true)
                    {
                        albumnsPlaceHolder.Controls.Add(new LiteralControl("<a href=\"morePictures.aspx?EID=" + loopEventID.ToString()
                            + "\">Achieved <img src=\"images/acceptachieve.gif\" /></a>"));
                    }
                    albumnsPlaceHolder.Controls.Add(new LiteralControl("</div>"));

                    if ((columnNumber % 4) == 0)
                    {
                        albumnsPlaceHolder.Controls.Add(new LiteralControl("<div style=\"clear: both;\" />"));
                    }
                    columnNumber++;
                }
                rdrEventsWithPics.Close();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            conn.Close();
        }
    }
Exemple #27
0
    //===============================================================
    // Function: PopulateGoalNames
    //===============================================================
    private void PopulateGoalNames(string letterFilter)
    {
        SqlConnection conn = new SqlConnection((string)Application["connectionString"]);
        try
        {
            conn.Open();

            SqlCommand cmd = new SqlCommand("", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "spSelectEventListByFirstLetter";
            cmd.Parameters.Add("@LetterFilter", SqlDbType.Char, 1).Value = letterFilter;
            DbDataReader rdr = cmd.ExecuteReader();
            if (rdr.HasRows == true)
            {
                while (rdr.Read())
                {
                    string eventName = "";

                    int eventID = int.Parse(rdr["EventID"].ToString());
                    if (!rdr.IsDBNull(rdr.GetOrdinal("EventName")))
                    {
                        eventName = (string)rdr["EventName"];
                    }
                    string eventPicThumbnail = "";
                    if (!rdr.IsDBNull(rdr.GetOrdinal("EventPicThumbnail")))
                    {
                        eventPicThumbnail = (string)rdr["EventPicThumbnail"];
                    }

                    //SELECT , , DateType, StartDate, RangeStartDate, RangeEndDate,
                    //BeforeBirthday, CategoryID, TimezoneID, EventAchieved, PrivateEvent, CreatedFromEventID,
                    //EventDescription, EventVenue, MustDo,
                    //EventPicFilename, , EventPicPreview,
                    //CreatedDate, CreatedByFullName, LastUpdatedDate, LastUpdatedByFullName

                    Literal userLink = new Literal();
                    userLink.Text = "<table><tr><td width=\"50\">";    // <div class=\"directory\">
                    if (eventPicThumbnail == "")
                    {
                        userLink.Text += "<img src=\"../images/1x1trans.gif\" width=\"50\"  />";
                        //userLink.Text += "<img src=\"../images/goalimage_small.jpg\" />";
                    }
                    else
                    {
                        var _event = new SedogoEvent(string.Empty, eventID);
                        eventPicThumbnail = ResolveUrl(ImageHelper.GetRelativeImagePath(_event.eventID, _event.eventGUID, ImageType.EventThumbnail));
                        userLink.Text += "<div ><img src=\"" + eventPicThumbnail + "\" width=\"50\" /></div>";
                    }
                    userLink.Text += "</td><td>&nbsp;<a class=\"event\" href=\"/viewEvent.aspx?EID=" + eventID + "\">" + eventName + "</a></td>";
                    userLink.Text += "</tr></table>";

                    goalPlaceHolder.Controls.Add(userLink);
                }
                noGoalsWithThisLetterDiv.Visible = false;
            }
            else
            {
                noGoalsWithThisLetterDiv.Visible = true;
            }
            rdr.Close();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            conn.Close();
        }
    }
Exemple #28
0
    //===============================================================
    // Function: trackedEventsRepeater_ItemDataBound
    //===============================================================
    protected void trackedEventsRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.DataItem != null &&
            (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem))
        {
            DataRowView row = e.Item.DataItem as DataRowView;

            int eventID = int.Parse(row["EventID"].ToString());
            SedogoEvent sedogoEvent = new SedogoEvent(Session["loggedInUserFullName"].ToString(), eventID);

            HyperLink eventNameLabel = e.Item.FindControl("eventNameLabel") as HyperLink;
            eventNameLabel.NavigateUrl = "viewEvent.aspx?EID=" + row["EventID"].ToString();
            eventNameLabel.Text = row["EventName"].ToString();

            HyperLink userNameLabel = e.Item.FindControl("userNameLabel") as HyperLink;
            userNameLabel.Text = row["FirstName"].ToString() + " " + row["LastName"].ToString();
            userNameLabel.NavigateUrl = "userTimeline.aspx?UID=" + sedogoEvent.userID.ToString();

            Image eventImage = e.Item.FindControl("eventImage") as Image;
            string eventPicThumbnail = row["EventPicThumbnail"].ToString();
            if (eventPicThumbnail == "")
            {
                eventImage.ImageUrl = "~/images/eventThumbnailBlank.png";
            }
            else
            {
                var _event = new SedogoEvent(string.Empty, eventID);
                eventImage.ImageUrl = ImageHelper.GetRelativeImagePath(_event.eventID, _event.eventGUID, ImageType.EventThumbnail);
            }
        }
    }
Exemple #29
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int eventID = int.Parse(Request.QueryString["EID"]);

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

            eventNameLabel.Text = sedogoEvent.eventName;
            eventNameLabel2.Text = sedogoEvent.eventName;

            SedogoUser eventOwner = new SedogoUser(Session["loggedInUserFullName"].ToString(), sedogoEvent.userID);
            string dateString = "";
            DateTime startDate = sedogoEvent.startDate;
            MiscUtils.GetDateStringStartDate(eventOwner, sedogoEvent.dateType, sedogoEvent.rangeStartDate,
                sedogoEvent.rangeEndDate, sedogoEvent.beforeBirthday, ref dateString, ref startDate);

            CalendarAlertDate.SelectedDate = DateTime.Now;
            PickerAlertDate.SelectedDate = DateTime.Now;

            alertDatePickList.Attributes.Add("onchange", "setReminderDate()");
            DateTime d = DateTime.Now.AddDays(1);
            Date1DValue1.Text = d.Year.ToString() + "," + (d.Month-1).ToString() + "," + d.Day.ToString();
            Date1DValue2.Text = d.Year.ToString() + "," + (d.Month - 1).ToString() + "," + d.Day.ToString();
            d = DateTime.Now.AddDays(7);
            Date1WValue1.Text = d.Year.ToString() + "," + (d.Month - 1).ToString() + "," + d.Day.ToString();
            Date1WValue2.Text = d.Year.ToString() + "," + (d.Month - 1).ToString() + "," + d.Day.ToString();
            d = DateTime.Now.AddMonths(1);
            Date1MValue1.Text = d.Year.ToString() + "," + (d.Month - 1).ToString() + "," + d.Day.ToString();
            Date1MValue2.Text = d.Year.ToString() + "," + (d.Month - 1).ToString() + "," + d.Day.ToString();
            d = DateTime.Now.AddMonths(3);
            Date3MValue1.Text = d.Year.ToString() + "," + (d.Month - 1).ToString() + "," + d.Day.ToString();
            Date3MValue2.Text = d.Year.ToString() + "," + (d.Month - 1).ToString() + "," + d.Day.ToString();
            d = DateTime.Now.AddMonths(6);
            Date6MValue1.Text = d.Year.ToString() + "," + (d.Month - 1).ToString() + "," + d.Day.ToString();
            Date6MValue2.Text = d.Year.ToString() + "," + (d.Month - 1).ToString() + "," + d.Day.ToString();
            d = DateTime.Now.AddYears(1);
            Date1YValue1.Text = d.Year.ToString() + "," + (d.Month - 1).ToString() + "," + d.Day.ToString();
            Date1YValue2.Text = d.Year.ToString() + "," + (d.Month - 1).ToString() + "," + d.Day.ToString();

            SetFocus(eventPicFileUpload);
        }
    }
Exemple #30
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();
            }

            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);

            PopulateImages(eventID, userID);
        }
    }