示例#1
0
        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);
        }
示例#2
0
        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.";
            }
        }