Example #1
0
    protected void DeleteEvent_Click(object sender, EventArgs e)
    {
        CSS    RequestDirector = new CSS();
        string EventID         = ((Button)sender).ID;

        EventID = EventID.Replace("EventDelete", "");

        Event selectedEvent = new Event();

        selectedEvent.EventID = Convert.ToInt32(EventID);

        //Delete event data
        bool confirmation;

        List <Question> qs = new List <Question>();

        qs = RequestDirector.GetQuestions(selectedEvent.EventID);

        foreach (Question q in qs)
        {
            confirmation = RequestDirector.DeleteQuestion(q);
        }

        confirmation = RequestDirector.DeleteEventData(selectedEvent);

        //Delete event
        confirmation = RequestDirector.DeleteEvent(selectedEvent);

        //refresh to remove from list
        Response.Redirect("Events.aspx");
    }
Example #2
0
    protected void DeleteBtn_Click(object sender, EventArgs e)
    {
        CSS             RequestDirector = new CSS();
        CustomPrincipal cp = HttpContext.Current.User as CustomPrincipal;
        bool            confirmation;
        Facilitator     activeFac = new Facilitator();

        activeFac.FacilitatorID = Convert.ToInt32(cp.Identity.Name);

        //delete event data
        List <Event> events = RequestDirector.GetFacilitatorEvents(activeFac.FacilitatorID);

        List <Question> eventQs;

        foreach (Event ev in events)
        {
            eventQs = new List <Question>();

            eventQs = RequestDirector.GetQuestions(ev.EventID);

            foreach (Question q in eventQs)
            {
                confirmation = RequestDirector.DeleteQuestion(q);
            }

            confirmation = RequestDirector.DeleteEventData(ev);

            confirmation = RequestDirector.DeleteEvent(ev);
        }

        //delete account
        confirmation = RequestDirector.DeleteFacilitator(activeFac);

        //sign out
        FormsAuthentication.SignOut();
        Response.Redirect("Default.aspx", true);
    }