Beispiel #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());
        }
    }
Beispiel #2
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();
    }
Beispiel #3
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");
    }
Beispiel #4
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);
            }
        }
    }
Beispiel #5
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());
    }
Beispiel #6
0
    //===============================================================
    // Function: postCommentButton_click
    //===============================================================
    protected void postCommentButton_click(object sender, EventArgs e)
    {
        if (Session["loggedInUserID"] == null)
        {
            Response.Redirect("~/profile.aspx");
        }

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

        string commentText = commentTextBox.Text;

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

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

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

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

                        eventPicFileUpload.PostedFile.SaveAs(destPath);

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

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

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

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

            Response.Redirect("viewEvent.aspx?EID=" + eventID.ToString());
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
                "alert(\"Invalid content detected in the comment\");", true);
        }
    }
Beispiel #7
0
    //===============================================================
    // Function: saveChangesButton_click
    //===============================================================
    protected void saveChangesButton_click(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);

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

        string eventName = eventNameTextBox.Text;

        //sedogoEvent.userID = int.Parse(Session["loggedInUserID"].ToString());
        sedogoEvent.eventName = eventName;
        sedogoEvent.eventDescription = eventDescriptionTextBox.Text;
        sedogoEvent.eventVenue = eventVenueTextBox.Text;

        if (dateTypeDropDownList.SelectedValue == "D")
        {
            sedogoEvent.startDate = CalendarStartDate.SelectedDate;
        }
        if (dateTypeDropDownList.SelectedValue == "R")
        {
            sedogoEvent.rangeStartDate = CalendarRangeStartDate.SelectedDate;
            sedogoEvent.rangeEndDate = CalendarRangeEndDate.SelectedDate;
        }
        if (dateTypeDropDownList.SelectedValue == "A")
        {
            sedogoEvent.beforeBirthday = int.Parse(birthdayDropDownList.SelectedValue);
        }
        sedogoEvent.dateType = dateTypeDropDownList.SelectedValue;
        sedogoEvent.categoryID = int.Parse(categoryDropDownList.SelectedValue);
        sedogoEvent.privateEvent = privateEventCheckbox.Checked;
        sedogoEvent.mustDo = false;
        sedogoEvent.timezoneID = int.Parse(timezoneDropDownList.SelectedValue);
        sedogoEvent.Update();

        sedogoEvent.SendEventUpdateEmail(loggedInUserID);

        //Response.Redirect("profileRedirect.aspx");
        Response.Redirect("viewEvent.aspx?EID=" + eventID.ToString());
    }
Beispiel #8
0
    //===============================================================
    // Function: uploadEventPicButton_click
    //===============================================================
    protected void uploadEventPicButton_click(object sender, EventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);

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

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

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

            eventPicFileUpload.PostedFile.SaveAs(destPath);

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

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

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

            Response.Redirect("viewEvent.aspx?EID=" + eventID.ToString());
        }
    }