private void seeDetailsButton_Click(object sender, EventArgs e) { EventDetailsManager eventDetailsManager = new EventDetailsManager(this.server); SeeEventDetailsPage seeDetailsPage; ListViewItem campEvent = eventListView.SelectedItems[0]; int campID = Convert.ToInt32(campEvent.SubItems[3].Text); string eventName = eventDetailsManager.GetEventName(campID); string eventStartDate = eventDetailsManager.GetEventStartDate(campID); string eventEndDate = eventDetailsManager.GetEventEndDate(campID); string eventDescription = eventDetailsManager.GetEventDescription(campID); // check if student is already inside the event Event selectedEvent = server.GetEvent(campID); if (selectedEvent.SearchStudent(matric, 1) || selectedEvent.SearchStudent(matric, 2) || selectedEvent.SearchStudent(matric, 3)) { seeDetailsPage = new SeeEventDetailsPage(eventName, eventStartDate, eventStartDate, eventDescription, true); seeDetailsPage.ShowDialog(); } else { seeDetailsPage = new SeeEventDetailsPage(eventName, eventStartDate, eventEndDate, eventDescription); seeDetailsPage.ShowDialog(); if (seeDetailsPage.isJoin == true) { eventDetailsManager.StudentJoinEvent(this.matric, campID, seeDetailsPage.role); seeDetailsPage.Close(); } } myEventListView.Items.Clear(); myTaskListView.Items.Clear(); studentEventManager.GetStudentEventsTasks(this.myEventListView, this.myTaskListView, matric); dashBoardButtonDisable(); }
private void createEvent() { dashBoardButtonDisable(); StudentEventManager studentEventManager = new StudentEventManager(this.server); AddEventPage addPage = new AddEventPage(); addPage.ShowDialog(); if (addPage.isConfirm == true) { string campName = addPage.name; DateTime startDate = addPage.startDate; DateTime endDate = addPage.endDate; string description = addPage.description; decimal campFee = addPage.campFee; int campID = studentEventManager.AddEvents(campName, startDate, endDate, description, campFee); // add list view ListViewItem newEvent = new ListViewItem(new[] { campName, "Organiser", campID.ToString() }); myEventListView.Items.Add(newEvent); // use student to add this event // set this student as organiser for this event Student student = server.GetStudent(this.matric); student.AddEvents(this.server, campID, 1); addPage.Close(); EventControllerPage eventControllerPage = new EventControllerPage(this.server, campID, this.matric); this.Hide(); eventControllerPage.ShowDialog(); this.Show(); myEventListView.Items.Clear(); myTaskListView.Items.Clear(); studentEventManager.GetStudentEventsTasks(this.myEventListView, this.myTaskListView, matric); eventListView.Items.Clear(); studentEventManager.GetEvents(this.eventListView); toolStripStatusLabel1.Text = "You have added <" + campName + "> to My Events."; } }
public DashBoardPage(string matric, Server server) { InitializeComponent(); this.server = server; this.matric = matric; studentEventManager = new StudentEventManager(server); this.nameLabel.Text = studentEventManager.GetName(matric); this.matricLabel.Text = matric; dateManager = new DateTimeManager(); DateTime today = DateTime.Today; this.dateLabel.Text = today.ToString("d") + " |"; this.weekLabel.Text = dateManager.CurrentAcademicWeek(); this.academicYearSemLabel.Text = dateManager.CurrentAcademicYear(); studentEventManager.GetStudentEventsTasks(this.myEventListView, this.myTaskListView, matric); studentEventManager.GetEvents(this.eventListView); }