Ejemplo n.º 1
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;

            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);
        }
    }
Ejemplo n.º 2
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        int userID = int.Parse(Request.QueryString["UID"].ToString());
        int loggedInUserID = int.Parse(Session["loggedInUserID"].ToString());

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

        SedogoUser loggedInUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), loggedInUserID);
        sidebarControl.userID = loggedInUserID;
        sidebarControl.user = loggedInUser;

        userProfileControl.loggedInUserID = loggedInUserID;
        userProfileControl.userID = userID;
        userProfileControl.user = user;

        eventsListControl.userID = userID;
        eventsListControl.user = user;

        if( userID == loggedInUserID )
        {
            //sendMessageToUserLink.Visible = false;
        }

        //sendMessageToUserLink.NavigateUrl = "sendUserMessage.aspx?EID=-1&UID=" + userID.ToString();
    }
Ejemplo n.º 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;
            }
        }
    }
Ejemplo n.º 4
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;
            }
        }
    }
Ejemplo n.º 5
0
    //===============================================================
    // Function: deleteButton_Click
    //===============================================================
    protected void deleteButton_Click(object sender, EventArgs e)
    {
        int userID = int.Parse(Request.QueryString["UID"]);

        SedogoUser sedogoUser = new SedogoUser(Session["loggedInAdministratorName"].ToString(),
            userID);
        sedogoUser.Delete();

        Response.Redirect("usersList.aspx");
    }
Ejemplo n.º 6
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");
        }
    }
Ejemplo n.º 7
0
    //===============================================================
    // Function: saveButton_Click
    //===============================================================
    protected void saveButton_Click(object sender, EventArgs e)
    {
        SedogoUser sedogoUser = new SedogoUser(Session["loggedInAdministratorName"].ToString());
        sedogoUser.firstName = firstNameTextBox.Text;
        sedogoUser.lastName = lastNameTextBox.Text;
        sedogoUser.emailAddress = emailAddress.Text;
        sedogoUser.Add();

        sedogoUser.UpdatePassword(userPassword.Text);

        Response.Redirect("editUser.aspx?UID=" + sedogoUser.userID.ToString());
    }
Ejemplo n.º 8
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        int userID = -1;
        if (Session["loggedInUserID"] != null)
        {
            userID = int.Parse(Session["loggedInUserID"].ToString());

            SedogoUser user = new SedogoUser(Session["loggedInUserFullName"].ToString(), userID);
            sidebarControl.user = user;
        }
        sidebarControl.userID = userID;
    }
Ejemplo n.º 9
0
    //===============================================================
    // Function: messagesRepeater_ItemDataBound
    //===============================================================
    protected void messagesRepeater_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 eventUserID = -1;
            if (row["UserID"].ToString() != "")
            {
                eventUserID = int.Parse(row["UserID"].ToString());
            }

            Literal eventNameLabel = e.Item.FindControl("eventNameLabel") as Literal;
            Literal userNameLabel = e.Item.FindControl("userNameLabel") as Literal;
            if (eventUserID < 0)
            {
                int userID = int.Parse(row["UserID"].ToString());
                SedogoUser messageToUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), userID);
                userNameLabel.Text = "To: <a href=\"userTimeline.aspx?UID=" + userID + "\" target=\"_top\">"
                    + messageToUser.firstName + " " + messageToUser.lastName + "</a> ";
                eventNameLabel.Text = "";
            }
            else
            {
                userNameLabel.Text = "To: <a href=\"userTimeline.aspx?UID=" + eventUserID + "\" target=\"_top\">"
                    + row["FirstName"] + " " + row["LastName"] + "</a> ";
                eventNameLabel.Text = "Goal: <a href=\"viewEvent.aspx?EID=" + row["EventID"] + "\">"
                    + row["EventName"] + "</a>";
            }

            Image eventPicThumbnailImage = e.Item.FindControl("eventPicThumbnailImage") as Image;
            string eventPicThumbnail = row["eventPicThumbnail"].ToString();
            if (eventPicThumbnail == "")
            {
                eventPicThumbnailImage.ImageUrl = "./images/eventThumbnailBlank.png";
            }
            else
            {
                var eventID = int.Parse(row["EventID"].ToString());
                var sedogoEvent = new SedogoEvent(string.Empty, eventID);
                eventPicThumbnailImage.ImageUrl =
                    ResolveUrl(ImageHelper.GetRelativeImagePath(sedogoEvent.eventID, sedogoEvent.eventGUID,
                                                                ImageType.EventThumbnail));
                //eventPicThumbnailImage.ImageUrl = "./assets/eventPics/" + eventPicThumbnail;
            }

            Literal messageLabel = e.Item.FindControl("messageLabel") as Literal;
            messageLabel.Text = row["MessageText"].ToString();
        }
    }
Ejemplo n.º 10
0
    protected void dlMember_ItemDataBound(Object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item ||
            e.Item.ItemType == ListItemType.AlternatingItem)
        {
            // Retrieve the Label control in the current DataListItem.
            Image profilePicImage = (Image)e.Item.FindControl("profilePicImage");

            string profilePicThumbnail = ((DataRowView)e.Item.DataItem).Row.ItemArray[13].ToString();
            //string profilePicThumbnail = ((DataRowView)e.Item.DataItem).Row.ItemArray[12].ToString();
            int userID = int.Parse(((DataRowView)e.Item.DataItem).Row.ItemArray[0].ToString());

            if (profilePicThumbnail != "")
            {
                profilePicImage.ImageUrl = "assets/profilePics/" + profilePicThumbnail;
            }
            else
            {
                SedogoUser user = new SedogoUser("", userID);
                if (user.gender == "M")
                {
                    // 1,2,5
                    int avatarID = 5;
                    switch ((userID % 6))
                    {
                        case 0: case 1: avatarID = 1; break;
                        case 2: case 3: avatarID = 2; break;
                    }
                    profilePicImage.ImageUrl = "~/images/avatars/avatar" + avatarID.ToString() + "sm.gif";
                }
                else
                {
                    // 3,4,6
                    int avatarID = 6;
                    switch ((userID % 6))
                    {
                        case 0: case 1: avatarID = 3; break;
                        case 2: case 3: avatarID = 4; break;
                    }
                    profilePicImage.ImageUrl = "~/images/avatars/avatar" + avatarID.ToString() + "sm.gif";
                }
            }
            profilePicImage.Height = 33;
            profilePicImage.Width = 33;
            profilePicImage.Style.Add("cursor", "pointer");
            profilePicImage.Style.Add("padding-bottom", "6px");
            profilePicImage.Style.Add("padding-right", "6px");
            profilePicImage.Attributes.Add("onmouseover", "ShowHideDiv(" + userID.ToString() + ")");
        }
    }
Ejemplo n.º 11
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int userID = int.Parse(Session["loggedInUserID"].ToString());

            sidebarControl.userID = userID;
            SedogoUser user = new SedogoUser(Session["loggedInUserFullName"].ToString(), userID);
            sidebarControl.user = user;
            bannerAddFindControl.userID = userID;

            PopulateTrackedEventsList(userID);
        }
    }
Ejemplo n.º 12
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));
            }
        }
    }
Ejemplo n.º 13
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int userID = int.Parse(Request.QueryString["UID"]);

            SedogoUser sedogoUser = new SedogoUser(Session["loggedInAdministratorName"].ToString(),
                userID);
            firstNameTextBox.Text = sedogoUser.firstName;
            lastNameTextBox.Text = sedogoUser.lastName;
            emailAddress.Text = sedogoUser.emailAddress;

            deleteButton.Attributes.Add("onclick", "if(confirm('Are you sure you want to delete this user?')){document.forms[0].target = '_top';return true;}else{return false}");
        }
    }
Ejemplo n.º 14
0
    //===============================================================
    // Function: saveButton_Click
    //===============================================================
    public void saveButton_Click(object sender, EventArgs e)
    {
        SedogoUser user = new SedogoUser(Session["loggedInUserFullName"].ToString(),
            int.Parse(Session["loggedInUserID"].ToString()));

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

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

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

                profilePicFileUpload.PostedFile.SaveAs(destPath);

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

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

            Response.Redirect("profileRedirect.aspx");
        }
    }
Ejemplo n.º 15
0
    //===============================================================
    // Function: saveButton_Click
    //===============================================================
    protected void saveButton_Click(object sender, EventArgs e)
    {
        int userID = int.Parse(Request.QueryString["UID"]);

        SedogoUser sedogoUser = new SedogoUser(Session["loggedInAdministratorName"].ToString(),
            userID);
        sedogoUser.firstName = firstNameTextBox.Text;
        sedogoUser.lastName = lastNameTextBox.Text;
        sedogoUser.emailAddress = emailAddress.Text;
        sedogoUser.Update();

        string newPassword = userPassword.Text.Trim();
        if (newPassword != "")
        {
            sedogoUser.UpdatePassword(userPassword.Text);
        }
        userPassword.Text = "";
    }
Ejemplo n.º 16
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int currentUserID = -1;
            SedogoUser currentUser = null;
            if (Session["loggedInUserID"] != null)
            {
                currentUserID = int.Parse(Session["loggedInUserID"].ToString());
                currentUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), currentUserID);

                emailAddressTextBox.Text = currentUser.emailAddress;
            }
            else
            {
                emailAddressTextBox.Text = "";
            }
        }
    }
Ejemplo n.º 17
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int currentUserID = -1;
            if (Session["loggedInUserID"] != null)
            {
                currentUserID = int.Parse(Session["loggedInUserID"].ToString());
                SedogoUser currentUser = new SedogoUser(Session["loggedInUserFullName"].ToString(), currentUserID);

                sidebarControl.user = currentUser;

                yourEmailAddressLabel.Text = currentUser.emailAddress;
                emailAddressTextBoxValidator.Enabled = false;
                emailAddressTextBox.Visible = false;
            }
            sidebarControl.userID = currentUserID;
        }
    }
Ejemplo n.º 18
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int userID = int.Parse(Session["loggedInUserID"].ToString());

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

            if (user.profilePicThumbnail != "")
            {
                profileImage.ImageUrl = "~/assets/profilePics/" + user.profilePicPreview;
            }
            else
            {
                profileImage.ImageUrl = "~/images/profile/blankProfilePreview.jpg";
            }
            profileImage.ToolTip = user.fullName + "'s profile picture";

            SetFocus(profilePicFileUpload);
        }
    }
Ejemplo n.º 19
0
    //===============================================================
    // Function: saveChangesButton_click
    //===============================================================
    protected void saveChangesButton_click(object sender, EventArgs e)
    {
        string currentPassword = currentPasswordTextBox.Text.Trim();
        string userPassword = passwordTextBox1.Text.Trim();

        SedogoUser user = new SedogoUser(Session["loggedInUserFullName"].ToString(),
            int.Parse(Session["loggedInUserID"].ToString()));
        loginResults checkResult;
        checkResult = user.VerifyLogin((string)Session["loggedInUserEmailAddress"], currentPassword, false, true, "changePassword.aspx");
        if ((checkResult == loginResults.loginSuccess) || (checkResult == loginResults.passwordExpired))
        {
            user.UpdatePassword(userPassword);

            Response.Redirect("profileRedirect.aspx");
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert(\"The current password is not correct.\");", true);
            SetFocus(currentPasswordTextBox);
        }
    }
Ejemplo n.º 20
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int userID = int.Parse(Session["loggedInUserID"].ToString());

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

            if (user.profilePicThumbnail != "")
            {
                // PD 3/12/10 - Removed this because it shows the wrong image
                profileImage.ImageUrl = ImageHelper.GetRelativeImagePath(user.userID, user.GUID, ImageType.UserThumbnail);
                //profileImage.ImageUrl = "~/assets/profilePics/" + user.profilePicThumbnail;
            }
            else
            {
                profileImage.ImageUrl = "~/images/profile/blankProfilePreview.jpg";
            }
            profileImage.ToolTip = user.fullName + "'s profile picture";

            SetFocus(profilePicFileUpload);
        }
    }
Ejemplo n.º 21
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!IsPostBack)
        //{
            int userID = int.Parse(Request.QueryString["UID"].ToString());

            SedogoUser user = new SedogoUser("", userID);

            pageTitleUserName.Text = user.firstName + " " + user.lastName + " - Sedogo profile";

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

            bannerAddFindControl.userID = userID;

            userProfileControl.loggedInUserID = loggedInUserID;
            userProfileControl.userID = userID;
            userProfileControl.user = user;
        //}
    }
Ejemplo n.º 22
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string GUID = "";
            if (Request.QueryString["G"] != null)
            {
                GUID = (string)Request.QueryString["G"];
            }

            int userID = -1;
            if (GUID != "")
            {
                userID = SedogoUser.GetUserIDFromGUID(GUID);
            }

            if (userID > 0)
            {
                SedogoUser newUser = new SedogoUser("", userID);
                if (newUser.loginEnabled == true)
                {
                    Session["SedogoConfirmError"] = "AlreadyActivated";
                    Response.Redirect("confirmError.aspx");
                }
                else
                {
                    newUser.loginEnabled = true;
                    newUser.Update();
                }
            }
            else
            {
                Session["SedogoConfirmError"] = "InvalidUser";
                Response.Redirect("confirmError.aspx");
            }
        }
    }
Ejemplo n.º 23
0
    //===============================================================
    // Function: CreateXMLContent
    //===============================================================
    private void CreateXMLContent(XmlTextWriter writer, int userID)
    {
        SedogoUser user = new SedogoUser(Session["loggedInUserFullName"].ToString(), userID);

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

            SqlCommand cmd = new SqlCommand("", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "spSelectFullEventListByCategory";
            cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = userID;
            cmd.Parameters.Add("@ShowPrivate", SqlDbType.Bit).Value = false;

            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;

                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"];

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

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

                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 = startDate.AddDays(28);        // Add 28 days so it shows up
                    }

                    startDate = rangeStartDate;
                }
                if (dateType == "A")
                {
                    // Event occurs before birthday

                    timelineStartDate = DateTime.Now;
                    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);
                    }
                }

                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 + trackingUserCount.ToString() + " Followers<br/>";
                linkURL = linkURL + memberUserCount.ToString() + " Members<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: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);

                //* New
                if (eventPicThumbnail == "")
                {
                    writer.WriteAttributeString("image", "./images/eventThumbnailBlank.png");
                }
                else
                {
                    writer.WriteAttributeString("image", "./assets/eventPics/" + eventPicThumbnail);
                }
                //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("timelineUserXML", "Page_Load", ex.Message, logMessageLevel.errorMessage);
            //throw ex;
        }
        finally
        {
            conn.Close();
        }
    }
Ejemplo n.º 24
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);
        }
    }
Ejemplo n.º 25
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string letterFilter = "A";
            if( Request.QueryString["L"] != null )
            {
                letterFilter = Request.QueryString["L"].ToString();
            }

            if (letterFilter != "")
            {
                PopulateGoalNames(letterFilter);
            }
            #region switch (letterFilter)
            switch (letterFilter)
            {
                case "A":
                    letterALink.CssClass = "publicPageSelectedLetter";
                    break;
                case "B":
                    letterBLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "C":
                    letterCLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "D":
                    letterDLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "E":
                    letterELink.CssClass = "publicPageSelectedLetter";
                    break;
                case "F":
                    letterFLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "G":
                    letterGLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "H":
                    letterHLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "I":
                    letterILink.CssClass = "publicPageSelectedLetter";
                    break;
                case "J":
                    letterJLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "K":
                    letterKLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "L":
                    letterLLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "M":
                    letterMLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "N":
                    letterNLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "O":
                    letterOLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "P":
                    letterPLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "Q":
                    letterQLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "R":
                    letterRLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "S":
                    letterSLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "T":
                    letterTLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "U":
                    letterULink.CssClass = "publicPageSelectedLetter";
                    break;
                case "V":
                    letterVLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "W":
                    letterWLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "X":
                    letterXLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "Y":
                    letterYLink.CssClass = "publicPageSelectedLetter";
                    break;
                case "Z":
                    letterZLink.CssClass = "publicPageSelectedLetter";
                    break;
            }
            #endregion
            if (Session["loggedInUserID"] != null)
            {
                int userID = int.Parse(Session["loggedInUserID"].ToString());

                sidebarControl.userID = userID;
                SedogoUser user = new SedogoUser(Session["loggedInUserFullName"].ToString(), userID);
                sidebarControl.user = user;
            }
            else
            {
            }
        }
    }
Ejemplo n.º 26
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());
        }
    }
Ejemplo n.º 27
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 = "";
        }
    }
Ejemplo n.º 28
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;
    }
Ejemplo n.º 29
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();
            }
        }
    }
Ejemplo n.º 30
0
    //===============================================================
    // Function: PopulateInviteList
    //===============================================================
    private void PopulateInviteList(int userID)
    {
        int pendingInviteCount = EventInvite.GetPendingInviteCountForUser(userID);

        if (pendingInviteCount > 0)
        {
            noInvitesDiv.Visible = false;
            invitesDiv.Visible = true;
        }
        else
        {
            noInvitesDiv.Visible = true;
            invitesDiv.Visible = false;
        }

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

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

            SqlCommand cmd = new SqlCommand("spSelectPendingInviteListForUser", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = userID;
            cmd.Parameters.Add("@EmailAddress", SqlDbType.NVarChar, 200).Value = sedogoUser.emailAddress;
            cmd.CommandTimeout = 90;
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = cmd;
            DataSet ds = new DataSet();
            da.Fill(ds);
            invitesRepeater.DataSource = ds;
            invitesRepeater.DataBind();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }