Esempio n. 1
0
        public bool viewEventListingByEventNameTest()
        {
            bool testResult = false;

            ActiveUser target = new ActiveUser();

            foreach(string testData in _testData)
            {
                string word = testData; // Test Case HERE
                List<EventEntity> actual = new List<EventEntity>();
                actual = target.viewEventListingByEventName(word);

                //Assert
                // List of names of actual events
                foreach(EventEntity events in actual)
                {
                    if (this._expectedListOfNames.Contains(events.getEventName()))
                    {
                        testResult = true;
                    }
                    else
                    {
                        testResult = false;
                    }
                }
            }

            return testResult;
        }
Esempio n. 2
0
        private void displayAlertList()
        {
            //Clear List
            alertListView.Items.Clear();

            List<Alert> alerts = new List<Alert>();
            EventEntity eve = new EventEntity();
            ActiveUser au = new ActiveUser(currentUser);
            alerts = au.getListOfAlerts();
            int currentEventID;

            if (alerts.Count != 0)
            {
                for (int i = 0; i < alerts.Count; i++)
                {
                    ListViewItem newAlert = new ListViewItem((i + 1).ToString());
                    newAlert.SubItems.Add(alerts[i].getAlertedEventName()); // Name of Event
                    newAlert.SubItems.Add(alerts[i].getAlert()); // Alert String
                    alertListView.Items.Add(newAlert);

                    // Clear Alert Flag
                    currentEventID = eve.getEventIDFromEventName(alerts[i].getAlertedEventName());
                    eve.clearEventUpdatedFlag(currentEventID);
                    eve.clearEventFullFlag(currentEventID);
                    eve.clearEventStartFlag(currentEventID);
                }
            }

            alerts.Clear(); // Erase off OLD alerts
            alertListView.Show();
        }
Esempio n. 3
0
        //Initiatisation
        public mainPage(User incomingUser)
        {
            InitializeComponent();

            currentUser = incomingUser;

            //initialise Timer for AmazonWebService
            pollingTimer = new System.Timers.Timer(AmazonWebServicePollInterval);
            pollingTimer.Enabled = true;
            pollingTimer.Elapsed += new ElapsedEventHandler(pollingTimeReached);
            pollingTimer.AutoReset = true;
            pollingTimer.Start();

            //initialise Timer for Alerts
            alertTimer = new System.Timers.Timer(alertInterval);
            alertTimer.Enabled = true;
            alertTimer.Elapsed += new ElapsedEventHandler(alertTimeReached);
            alertTimer.AutoReset = true;
            alertTimer.Start();

            //Initialised Dynamic Controls
            initAnnouncementList();
            initMainEventList();
            initSideDDL();
            initSideEventBar();

            //Check Internet Connection
            checkInternetConnection();

            // Check For Starting Events concerning this current user
            ActiveUser au = new ActiveUser(currentUser);
            au.checkForStartingEvent();

            // Start Alert Check/Display
            displayAlert();
        }
Esempio n. 4
0
        private void searchEventDateTimePicker_ValueChanged(object sender, EventArgs e)
        {
            this.listMainEventView.Items.Clear();

            ActiveUser au = new ActiveUser(currentUser);

            List<EventEntity> mainEventListing = au.viewEventListingByDate(searchEventDateTimePicker.Value);

            for (int i = 0; i < mainEventListing.Count; i++)
            {
                EventEntity outputEvent = mainEventListing[i];

                ListViewItem newEvent = new ListViewItem((i + 1).ToString());
                newEvent.SubItems.Add(outputEvent.getEventId().ToString());
                newEvent.SubItems.Add(outputEvent.getEventName());
                newEvent.SubItems.Add(outputEvent.getEventDate().ToString("dd/MM/yy"));
                newEvent.SubItems.Add(outputEvent.getEventDate().ToString("t"));

                listMainEventView.Items.Add(newEvent);
            }
            displayEventList();
        }
Esempio n. 5
0
        private void searchEvent()
        {
            searchEventTextBox.Text = searchEventTextBox.Text.Trim();

            ActiveUser userRole = new ActiveUser(currentUser);

            this.listMainEventView.Items.Clear();
            int i;

            if (searchEventTextBox.Text == "" || searchEventTextBox.Text == "Search Your Event Here")
            {
                List<EventEntity> outputEventListing = userRole.viewEventListing();

                for (i = 0; i < outputEventListing.Count; i++)
                {
                    EventEntity outputEvent = outputEventListing[i];

                    ListViewItem newEvent = new ListViewItem((i + 1).ToString());
                    newEvent.SubItems.Add(outputEvent.getEventId().ToString());
                    newEvent.SubItems.Add(outputEvent.getEventName());
                    newEvent.SubItems.Add(outputEvent.getEventDate().ToString("dd/MM/yy"));
                    newEvent.SubItems.Add(outputEvent.getEventDate().ToString("t"));

                    listMainEventView.Items.Add(newEvent);
                }

                displayMainEventList();
            }

            else
            {
                List<EventEntity> outputEventListing = userRole.viewEventListingByEventName(searchEventTextBox.Text);

                for (i = 0; i < outputEventListing.Count; i++)
                {
                    EventEntity outputEvent = outputEventListing[i];

                    ListViewItem newEvent = new ListViewItem((i + 1).ToString());
                    newEvent.SubItems.Add(outputEvent.getEventId().ToString());
                    newEvent.SubItems.Add(outputEvent.getEventName());
                    newEvent.SubItems.Add(outputEvent.getEventDate().ToString("dd/MM/yy"));
                    newEvent.SubItems.Add(outputEvent.getEventDate().ToString("t"));

                    listMainEventView.Items.Add(newEvent);
                }

                displayMainEventList();
            }
        }
Esempio n. 6
0
        public void initMainEventList()
        {
            this.listMainEventView.Hide();

            //Clear ListBox Column and Items
            this.listMainEventView.Columns.Clear();
            this.listMainEventView.Items.Clear();

            this.listMainEventView.Columns.Insert(0, "No", 50, HorizontalAlignment.Left);
            this.listMainEventView.Columns.Insert(1, "Id", 0, HorizontalAlignment.Left);
            this.listMainEventView.Columns.Insert(2, "Event", 220, HorizontalAlignment.Left);
            this.listMainEventView.Columns.Insert(3, "Date", 80, HorizontalAlignment.Center);
            this.listMainEventView.Columns.Insert(4, "Time", 80, HorizontalAlignment.Center);

            //All users can view all current events

            ActiveUser obtainedAccessUser = new ActiveUser(currentUser);

            List<EventEntity> mainEventListing = obtainedAccessUser.viewEventListing();

            for (int i = 0; i < mainEventListing.Count; i++)
            {
                EventEntity outputEvent = mainEventListing[i];

                ListViewItem newEvent = new ListViewItem((i + 1).ToString());
                newEvent.SubItems.Add(outputEvent.getEventId().ToString());
                newEvent.SubItems.Add(outputEvent.getEventName());
                newEvent.SubItems.Add(outputEvent.getEventDate().ToString("dd/MM/yy"));
                newEvent.SubItems.Add(outputEvent.getEventDate().ToString("t"));

                listMainEventView.Items.Add(newEvent);
            }

            listMainEventView.Show();
        }
Esempio n. 7
0
        public void displayAlert()
        {
            ActiveUser au = new ActiveUser(currentUser);
            int num = au.scoutAlert();

            try
            {
                if (num > 0)   // If there is at least ONE alert
                {
                    notifyIcon.Icon = SystemIcons.Application;
                    notifyIcon.BalloonTipText = "You have " + num.ToString() + " new alerts!";
                    notifyIcon.ShowBalloonTip(1500);
                }
            }
            catch (Exception)
            {

            }
        }