Ejemplo n.º 1
0
    //===============================================================
    // Function: alertsRepeater_ItemCommand
    //===============================================================
    protected void alertsRepeater_ItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        int eventAlertID = int.Parse(e.CommandArgument.ToString());

        EventAlert eventAlert = new EventAlert(Session["loggedInUserFullName"].ToString(), eventAlertID);

        if (e.CommandName == "clearAlertButton")
        {
            EventAlert alertToDelete = new EventAlert(Session["loggedInUserFullName"].ToString(), eventAlertID);
            alertToDelete.Delete();
        }

        int userID = int.Parse(Session["loggedInUserID"].ToString());
        PopulateAlertsList(userID);
    }
Ejemplo n.º 2
0
    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int eventID = int.Parse(Request.QueryString["EID"]);
            string action = "";
            int eventAlertID = -1;
            if (Request.QueryString["A"] != null && Request.QueryString["EAID"] != null)
            {
                action = Request.QueryString["A"].ToString();
                eventAlertID = int.Parse(Request.QueryString["EAID"]);

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

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

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

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

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

            PopulateAlerts(eventID);
        }
    }