protected void UpdateBtn_Click(object sender, EventArgs e) { CSS RequestDirector = new CSS(); Event currentEvent = new Event(); currentEvent.EventID = ((Event)Session["Event"]).EventID; bool success; currentEvent = RequestDirector.GetEvent(currentEvent); currentEvent.Performer = tbPerformer.Text; currentEvent.Description = tbDesc.Text; currentEvent.Location = tbLocation.Text; currentEvent.OpenMsg = tbOpen.Text; currentEvent.CloseMsg = tbClose.Text; currentEvent.Date = DateTime.Today; string crit = ""; if (allCritLB.Items.Count > 0) { foreach (ListItem i in allCritLB.Items) { crit += (i.Text + '|'); } crit.TrimEnd('|'); } else { crit = "Overall Quality"; } currentEvent.VotingCrit = crit; success = RequestDirector.UpdateEventInfo(currentEvent); if (success) { List <Question> questions = new List <Question>(); questions = RequestDirector.GetQuestions(currentEvent.EventID); foreach (Question q in questions) { RequestDirector.DeleteQuestion(q); } Question qu; foreach (ListItem li in allQsLB.Items) { qu = new Question(); qu.EventID = currentEvent.EventID; qu.QuestionText = li.Text; RequestDirector.AddQuestion(qu); } } }
protected void RepeatBtn_Click(object sender, EventArgs e) { CSS RequestDirector = new CSS(); Event currentEvent = new Event(); currentEvent.EventID = ((Event)Session["Event"]).EventID; currentEvent = RequestDirector.GetEvent(currentEvent); currentEvent.CustomQuestions = RequestDirector.GetQuestions(currentEvent.EventID); Event repeatEvent = new Event(); //default value for event start and end times DateTime defaultTime = Convert.ToDateTime("1800-01-01 12:00:00 PM"); //get facilitator info and event info input CustomPrincipal cp = HttpContext.Current.User as CustomPrincipal; repeatEvent.EventKey = "AAAA"; repeatEvent.FacilitatorID = Convert.ToInt32(cp.Identity.Name); repeatEvent.Performer = currentEvent.Performer; repeatEvent.Location = currentEvent.Location; repeatEvent.Description = currentEvent.Description; repeatEvent.Date = DateTime.Today; repeatEvent.OpenMsg = currentEvent.OpenMsg; repeatEvent.CloseMsg = currentEvent.CloseMsg; repeatEvent.VotingCrit = currentEvent.VotingCrit; //attept event creation Event newEvent = RequestDirector.CreateEvent(repeatEvent); //if successful, add event to session and redirect to view event if (newEvent.EventID != -1) { Question q; foreach (Question que in currentEvent.CustomQuestions) { q = new Question(); q.EventID = newEvent.EventID; q.QuestionText = que.QuestionText; RequestDirector.AddQuestion(q); } Session["Event"] = newEvent; Response.Redirect("ViewEvent.aspx"); } }
protected void btnCreateEvent_Click(object sender, EventArgs e) { CSS RequestDirector = new CSS(); Event cEvent = new Event(); bool success; //create key for event //string EventKey; //EventKey = RequestDirector.GenKey(3); //default value for event start and end times DateTime defaultTime = Convert.ToDateTime("1800-01-01 12:00:00 PM"); //get facilitator info and event info input CustomPrincipal cp = HttpContext.Current.User as CustomPrincipal; cEvent.EventKey = "AAAA"; cEvent.FacilitatorID = Convert.ToInt32(cp.Identity.Name); cEvent.Performer = tbPerformer.Text; cEvent.Location = tbLocation.Text; cEvent.Description = tbNatureOfPerformance.Text; cEvent.Date = DateTime.Today; cEvent.OpenMsg = OpenTxt.Text; cEvent.CloseMsg = CloseTxt.Text; string crit = ""; if (allCritLB.Items.Count > 0) { foreach (ListItem i in allCritLB.Items) { crit += (i.Text + '|'); } crit.TrimEnd('|'); } else { crit = "Overall Quality"; } cEvent.VotingCrit = crit; //attept event creation Event newEvent = RequestDirector.CreateEvent(cEvent); newEvent.Evaluators = new List <Evaluator>(); //if successful, add event to session and redirect to view event if (newEvent.EventID != -1) { Question q; foreach (ListItem li in allQsLB.Items) { q = new Question(); q.EventID = newEvent.EventID; q.QuestionText = li.Text; RequestDirector.AddQuestion(q); } Session["Event"] = newEvent; Response.Redirect("ViewEvent.aspx"); } else { lbstatus.Text = "There was an Error creating your event"; } }