//=============================================================== // Function:trackedEventsRepeater_ItemCommand //=============================================================== protected void trackedEventsRepeater_ItemCommand(object sender, RepeaterCommandEventArgs e) { if (e.CommandName == "stopTrackingButton") { int trackedEventID = int.Parse(e.CommandArgument.ToString()); TrackedEvent trackedEvent = new TrackedEvent(Session["loggedInUserFullName"].ToString(), trackedEventID); trackedEvent.Delete(); int userID = int.Parse(Session["loggedInUserID"].ToString()); PopulateTrackedEventsList(userID); } }
//=============================================================== // Function: requestsRepeater_ItemCommand //=============================================================== protected void requestsRepeater_ItemCommand(object sender, RepeaterCommandEventArgs e) { int trackedEventID = int.Parse(e.CommandArgument.ToString()); TrackedEvent trackedEvent = new TrackedEvent(Session["loggedInUserFullName"].ToString(), trackedEventID); if (e.CommandName == "acceptButton") { trackedEvent.joinPending = false; trackedEvent.Update(); trackedEvent.SendJoinAcceptedEmail(); } if (e.CommandName == "declineButton") { trackedEvent.Delete(); } int userID = int.Parse(Session["loggedInUserID"].ToString()); PopulateRequestList(userID); }
//=============================================================== // Function: Page_Load //=============================================================== protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int eventID = -1; if( Request.QueryString["EID"] != null ) { try { eventID = int.Parse(Request.QueryString["EID"].ToString()); } catch { } } if (eventID < 0) { Response.Redirect("profile.aspx"); } sidebarControl.EventId = eventID; int superUserID = -1; if (Session["SuperUserID"] != null) { superUserID = int.Parse(Session["SuperUserID"].ToString()); } int userID = -1; string loggedInUserName = ""; if (Session["loggedInUserID"] != null) { userID = int.Parse(Session["loggedInUserID"].ToString()); loggedInUserName = Session["loggedInUserFullName"].ToString(); } string action = ""; if (Request.QueryString["A"] != null) { action = (string)Request.QueryString["A"]; } int eventCommentID = -1; if (Request.QueryString["CID"] != null) { eventCommentID = int.Parse(Request.QueryString["CID"].ToString()); } string deleteCommentLink = "viewEvent.aspx?A=&" + eventCommentID.ToString(); sidebarControl.userID = userID; if (userID > 0) { SedogoUser user = new SedogoUser(Session["loggedInUserFullName"].ToString(), userID); sidebarControl.user = user; bannerAddFindControl.userID = userID; eventCommentBox.Visible = true; eventLinksDiv.Visible = true; eventLinksDiv2.Visible = true; } else { eventCommentBox.Visible = false; eventLinksDiv.Visible = false; eventLinksDiv2.Visible = false; } if (action == "RemoveTracker") { int trackedEventID = int.Parse(Request.QueryString["TEID"].ToString()); TrackedEvent trackedEvent = new TrackedEvent(loggedInUserName, trackedEventID); trackedEvent.Delete(); } if (action == "AcceptRequest") { int trackedEventID = int.Parse(Request.QueryString["TEID"].ToString()); TrackedEvent trackedEvent = new TrackedEvent(loggedInUserName, trackedEventID); trackedEvent.joinPending = false; trackedEvent.Update(); } if (action == "RejectRequest") { int trackedEventID = int.Parse(Request.QueryString["TEID"].ToString()); TrackedEvent trackedEvent = new TrackedEvent(loggedInUserName, trackedEventID); trackedEvent.Delete(); } if (action == "NotifyJoin") { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert(\"Your request to join this goal has been sent to the goal owner.\");", true); } if (action == "NotifyTrack") { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert(\"You are now following this goal.\");", true); } if (action == "DeleteComment") { SedogoEventComment comment = new SedogoEventComment(loggedInUserName, eventCommentID); var _event = new SedogoEvent(string.Empty, eventID); ImageHelper.DeleteImage(eventCommentID, _event.eventGUID, ImageType.EventCommentPreview); comment.Delete(); } SedogoEvent sedogoEvent = new SedogoEvent(loggedInUserName, eventID); eventLabel1.Text = sedogoEvent.eventName; if (sedogoEvent.deleted == true) { Response.Redirect("~/profile.aspx"); } pageTitleUserName.Text = sedogoEvent.eventName + " : 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); addCommentLabel.Text = "Add a comment about " + sedogoEvent.eventName; if (sedogoEvent.privateEvent == true) { privateIcon.Visible = true; shareButton.Visible = false; shareImage.Visible = false; } if (userID > 0) { int trackedEventID = TrackedEvent.GetTrackedEventID(eventID, userID); if (sedogoEvent.userID != userID) { // Viewing someone elses event // For private events, you need to either own the event, be tracking it, // or have been invited to it if (sedogoEvent.privateEvent == true) { int eventInviteCount = EventInvite.CheckUserEventInviteExists(eventID, userID); Boolean showOnTimeline = false; if (trackedEventID > 0) { TrackedEvent trackedEvent = new TrackedEvent(loggedInUserName, trackedEventID); showOnTimeline = trackedEvent.showOnTimeline; } if (eventInviteCount <= 0 && showOnTimeline == false && superUserID < 0) { // Viewing private events is not permitted Response.Redirect("profileRedirect.aspx"); } } messagesHeader.Visible = false; messagesLink.Visible = false; invitesHeader.Visible = false; invitesLink.Visible = false; invitesBox.Visible = false; alertsHeader.Visible = false; alertsPlaceHolder.Visible = false; alertsLink.Visible = false; alertsSeperator.Visible = false; requestsHeader.Visible = false; requestsLinksPlaceholder.Visible = false; requestsSeperator.Visible = false; deleteEventButton.Visible = false; messageTrackingImage.Visible = false; messageTrackingUsersLink.Visible = false; followersTrackingImage.Visible = false; followersTrackingUsersLink.Visible = false; editEventLink.Visible = false; achievedEventLink.Visible = false; uploadEventImage.Visible = false; sendMessageButton.Visible = true; sendMessageDiv.Visible = true; if (trackedEventID < 0) { trackThisEventDiv.Visible = true; joinThisEventDiv.Visible = true; } else { // Event is already being tracked trackThisEventDiv.Visible = false; TrackedEvent trackedEvent = new TrackedEvent(loggedInUserName, trackedEventID); if (trackedEvent.showOnTimeline == true) { if (trackedEvent.joinPending == false) { joinThisEventDiv.Visible = false; } else { joinThisEventDiv.Visible = false; } } else { joinThisEventDiv.Visible = true; } } //createSimilarEventLink.Visible = true; // Get the image count - if zero, hide the link 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()) { imageCount++; //int eventPictureID = int.Parse(rdr["EventPictureID"].ToString()); } rdr.Close(); } catch (Exception ex) { throw ex; } finally { conn.Close(); } if (imageCount > 0) { morePicturesButton.Visible = true; } else { morePicturesButton.Visible = false; } } else { // Viewing own event messagesHeader.Visible = true; messagesLink.Visible = true; invitesHeader.Visible = true; invitesBox.Visible = true; invitesLink.Visible = true; alertsHeader.Visible = true; alertsPlaceHolder.Visible = true; alertsLink.Visible = true; alertsSeperator.Visible = true; requestsHeader.Visible = true; requestsSeperator.Visible = true; requestsLinksPlaceholder.Visible = true; deleteEventButton.Visible = true; deleteEventButton.Attributes.Add("onclick", "if(confirm('Are you sure you want to delete this event?')){}else{return false}"); sendMessageButton.Visible = false; editEventLink.Visible = true; if (sedogoEvent.eventAchieved == true) { achievedEventLink.Visible = false; reOpenEventLink.Visible = true; } else { achievedEventLink.Visible = true; reOpenEventLink.Visible = false; } uploadEventImage.Visible = true; //createSimilarEventLink.Visible = false; sendMessageDiv.Visible = false; int messageCount = Message.GetMessageCountForEvent(eventID); //int inviteCount = EventInvite.GetInviteCount(eventID); int pendingInviteCount = EventInvite.GetPendingInviteCount(eventID); //int alertsCount = EventAlert.GetEventAlertCountPending(eventID); if (messageCount == 1) { messagesLink.Text = "You have " + messageCount.ToString() + " new message"; } else { messagesLink.Text = "You have " + messageCount.ToString() + " new messages"; } inviteCountLabel.Text = " <span class=\"blue\">" + pendingInviteCount.ToString() + "<span> <span class=\"grey\">Pending</span>"; trackThisEventDiv.Visible = false; joinThisEventDiv.Visible = false; // You cannot join your own event } PopulateTrackingList(eventID); PopulateAlertsList(eventID); PopulateRequestsList(eventID); loginRegisterPanel.Visible = false; // See if current user has been invited to this goal if (trackedEventID < 0) { int eventInviteCount = EventInvite.CheckUserEventInviteExists(eventID, userID); if (eventInviteCount > 0) { invitedPanel.Visible = true; } else { invitedPanel.Visible = false; } } else { invitedPanel.Visible = false; } } else { // Setup the window for a user who is not registered/logged in if (sedogoEvent.privateEvent == true && superUserID < 0) { // Viewing private events is not permitted Response.Redirect("profile.aspx"); } messagesHeader.Visible = false; messagesLink.Visible = false; invitesHeader.Visible = false; invitesLink.Visible = false; invitesBox.Visible = false; alertsHeader.Visible = false; alertsPlaceHolder.Visible = false; alertsLink.Visible = false; alertsSeperator.Visible = false; //trackingHeader.Visible = true; //trackingLinksPlaceholder.Visible = true; deleteEventButton.Visible = false; editEventLink.Visible = false; achievedEventLink.Visible = false; reOpenEventLink.Visible = false; uploadEventImage.Visible = false; //createSimilarEventLink.Visible = false; trackThisEventDiv.Visible = false; trackThisEventLink.Visible = false; joinThisEventDiv.Visible = false; joinThisEventLink.Visible = false; invitedPanel.Visible = false; sendMessageDiv.Visible = false; messageTrackingImage.Visible = false; messageTrackingUsersLink.Visible = false; followersTrackingImage.Visible = false; followersTrackingUsersLink.Visible = false; sendMessageButton.Visible = false; postCommentButton.Visible = false; eventOwnersNameLabel.Enabled = false; eventOwnersNameLabel.NavigateUrl = "#"; loginRegisterPanel.Visible = true; loginLink.NavigateUrl = "~/login.aspx?EID=" + eventID.ToString(); HyperLink bannerLoginLink = FindControl("ctl00").FindControl("bannerLogin").FindControl("bannerLoginLink") as HyperLink; bannerLoginLink.NavigateUrl = "~/login.aspx?EID=" + eventID.ToString(); } 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; if (sedogoEvent.userID != userID) { eventOwnersNameLabel.NavigateUrl = "userTimeline.aspx?UID=" + eventOwner.userID.ToString(); } else { // If this is your own event then no link eventOwnersNameLabel.Enabled = false; } eventDateLabel.Text = dateString; eventDescriptionLabel.Text = sedogoEvent.eventDescription.Replace("\n", "<br/>"); eventVenueLabel.Text = sedogoEvent.eventVenue.Replace("\n", "<br/>"); //createdDateLabel.Text = sedogoEvent.createdDate.ToString("dd/MM/yyyy"); lastUpdatedDateLabel.Text = sedogoEvent.lastUpdatedDate.ToString("ddd d MMMM yyyy"); if (sedogoEvent.eventPicPreview == "") { eventImage.ImageUrl = "~/images/eventImageBlank.png"; uploadEventImage.Text = "Add picture"; } else { eventImage.ImageUrl = ImageHelper.GetRelativeImagePath(sedogoEvent.eventID, sedogoEvent.eventGUID, ImageType.EventPreview); uploadEventImage.Text = "Edit picture"; } sendMessageButton.Attributes.Add("style", "text-decoration: underline; display: block; background: url(images/messages.gif) no-repeat left; padding-left: 20px; margin: 4px 0 20px 0"); createSimilarEventLink.Attributes.Add("onclick", "if(confirm('Copy goal will create your own goal like this on your timeline. Continue?')){}else{return false}"); //trackThisEventLink.Attributes.Add("onclick", "if(confirm('Copy goal will create your own goal like this on your timeline. Continue?')){}else{return false}"); //joinThisEventLink.Attributes.Add("onclick", "if(confirm('Copy goal will create your own goal like this on your timeline. Continue?')){}else{return false}"); uploadEventImageLiteral.Text = "var url = 'uploadEventImage.aspx?EID=" + eventID.ToString() + "';"; editEventLiteral.Text = "var url = 'editEvent.aspx?EID=" + eventID.ToString() + "';"; eventAlertsLiteral.Text = "var url = 'eventAlerts.aspx?EID=" + eventID.ToString() + "';"; messageTrackingUsersLiteral.Text = "var url = 'sendMessageToTrackers.aspx?EID=" + eventID.ToString() + "';"; messageFollowingUsersLiteral.Text = "var url = 'sendMessage.aspx?EID=" + eventID.ToString() + "';"; sendMessageLiteral.Text = "var url = 'sendMessage.aspx?EID=" + eventID.ToString() + "';"; //uploadEventCommentImageLink.NavigateUrl = "uploadEventCommentImage.aspx?EID=" + eventID.ToString(); //uploadEventCommentVideoLinkLink.NavigateUrl = "uploadEventCommentVideoLink.aspx?EID=" + eventID.ToString(); facebookLikeURL.Text = "<iframe src=\""; facebookLikeURL.Text += "http://www.facebook.com/plugins/like.php?href=" + HttpUtility.UrlEncode(Request.Url.ToString()) + "&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80"; facebookLikeURL.Text += "\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height:80px;\" allowTransparency=\"true\"></iframe>"; /*Nikita Knyazev: facebook LIKE button. Start*/ AddFacebookMeta("og:title", sedogoEvent.eventName); string type = "activity"; if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["FacebookEventType"])) type = ConfigurationManager.AppSettings["FacebookEventType"]; AddFacebookMeta("og:type", type); AddFacebookMetaNoEncode("og:url", Request.Url.AbsoluteUri); string ImageUrl = ConfigurationManager.AppSettings["FacebookDefaultImageRelativePath"]; if (!string.IsNullOrEmpty(sedogoEvent.eventPicPreview)) { ImageUrl = ImageHelper.GetRelativeImagePath(sedogoEvent.eventID, sedogoEvent.eventGUID, ImageType.EventPreview); } else { ImageUrl = "www.sedogo.com/images/iphoneLogo.jpg"; } AddFacebookMetaNoEncode("og:image", MiscUtils.GetAbsoluteUrl(ImageUrl)); string siteName = "Sedogo"; if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["FacebookSiteName"])) siteName = ConfigurationManager.AppSettings["FacebookSiteName"]; AddFacebookMeta("og:site_name", siteName); string fbAppId = ConfigurationManager.AppSettings["FacebookAppId"]; AddFacebookMeta("fb:app_id", fbAppId); AddFacebookMeta("og:description", sedogoEvent.eventDescription); /*Nikita Knyazev: facebook LIKE button. Finish*/ if (sedogoEvent.dateType == "D") { dateLabel.Text = "On"; } else if (sedogoEvent.dateType == "R") { dateLabel.Text = "Between"; } else { dateLabel.Text = "Before"; } PopulateComments(eventID, sedogoEvent.userID); SqlConnection conn2 = new SqlConnection((string)Application["connectionString"]); try { conn2.Open(); SqlCommand cmd = new SqlCommand("spSelectEventPictureList", conn2); cmd.Parameters.Add("@EventID", SqlDbType.Int).Value = eventID; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 90; SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; DataSet ds = new DataSet(); da.Fill(ds); dlImages.DataSource = ds; dlImages.DataBind(); } catch (Exception ex) { throw ex; } finally { conn2.Close(); } } }