예제 #1
0
        // Check For Starting Events For This Curent User
        public void checkForStartingEvent()
        {
            Organiser o = new Organiser(this);
            Participant p = new Participant(this);
            Facilitator f = new Facilitator(this);
            List<EventEntity> listOfOrganizedEvents = o.getOrganisedEvents();
            List<EventEntity> listOfRegisteredEvents = p.getRegisteredEvents();
            List<EventEntity> listOfFacilitatingEvents = f.getFacilitatedEvents();
            EventEntity eve = new EventEntity();
            TimeSpan difference = new TimeSpan(1, 0, 0, 0);

            foreach (EventEntity events in listOfOrganizedEvents)
            {
                if ((events.getEventStartTime().Subtract(System.DateTime.Now)) <= difference)
                    events.setEventStartFlag(events.getEventId());
            }

            foreach (EventEntity events in listOfRegisteredEvents)
            {
                if ((events.getEventStartTime().Subtract(System.DateTime.Now)) <= difference)
                    events.setEventStartFlag(events.getEventId());
            }

            foreach (EventEntity events in listOfFacilitatingEvents)
            {
                if ((events.getEventStartTime().Subtract(System.DateTime.Now)) <= difference)
                    events.setEventStartFlag(events.getEventId());
            }
        }
예제 #2
0
        private void displayFacilitatorList()
        {
            //Clear List
            attendanceListView.Items.Clear();

            //change Label
            label1.Text = "Facilitator List";

            List<Facilitator> listOfFacilitator = new List<Facilitator>();
            EventEntity currentEvent = EventEntity.getEventFromEventId(currentEventID);
            Organiser org = new Organiser(currentUser);
            listOfFacilitator = org.viewListOfFacilitator(currentEvent);

            if (listOfFacilitator.Count != 0)
            {
                for (int i = 0; i < listOfFacilitator.Count; i++)
                {
                    ListViewItem newFacilitator = new ListViewItem((i + 1).ToString());
                    newFacilitator.SubItems.Add(listOfFacilitator[i].getName());
                    newFacilitator.SubItems.Add(listOfFacilitator[i].getEmail());
                    newFacilitator.SubItems.Add(listOfFacilitator[i].getContactHP().ToString());

                    attendanceListView.Items.Add(newFacilitator);
                }
            }
            else
            {
                ListViewItem newFacilitator = new ListViewItem("No Facilitator");
            }
        }
예제 #3
0
 private void addBudgetItem_Click(object sender, EventArgs e)
 {
     if (costTextBox.Text.Equals(String.Empty) || budgetItemTextBox.Text.Equals(String.Empty) || dpTextBox.Text.Equals(String.Empty))
     {
         MessageBox.Show("The item or price is empty. Please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Organiser org = new Organiser(currentUser);
         float totalPrice = float.Parse(totalPriceTextBox.Text);
         ListViewItem newItem = new ListViewItem(budgetItemTextBox.Text);
         float price = float.Parse(costTextBox.Text) + float.Parse(dpTextBox.Text) / 100.0f;
         newItem.SubItems.Add(price.ToString("N2"));
         if (addflag == 0)
         {
             newItemID = org.getNewItemID();
             newItem.SubItems.Add(newItemID.ToString());
         }
         else
         {
             newItemID++;
             newItem.SubItems.Add(newItemID.ToString());
         }
         budgetListListView.Items.Add(newItem);
         totalPriceTextBox.Text = (totalPrice + price).ToString("N2");
         addflag = 1;
     }
 }
예제 #4
0
        private void dateCombobox_SelectedIndexChanged(object sender, EventArgs e)
        {
            Activity currentActivity;
            for (int i = 0; i < listOfActivity.Count; i++)
            {
                currentActivity = listOfActivity[i];
                if (Convert.ToDateTime(dateCombobox.Text).Year == previousScheudleDate.Year && Convert.ToDateTime(dateCombobox.Text).Month == previousScheudleDate.Month && Convert.ToDateTime(dateCombobox.Text).Day == previousScheudleDate.Day)
                    previousScheudleDate = Convert.ToDateTime(dateCombobox.Text);
                if (currentActivity.getDate().Year == previousScheudleDate.Year && currentActivity.getDate().Month == previousScheudleDate.Month && currentActivity.getDate().Day == previousScheudleDate.Day)
                {
                    listOfActivity.Remove(currentActivity);
                    i--;
                }
            }

            DateTime time;
            Activity newAct;
            Organiser org = new Organiser(currentUser);
            Venue ven;

            for (int i = 0; i < scheduleEventView.Items.Count; i++)
            {
                time = returnTime(scheduleEventView.Items[i].SubItems[0].Text, previousScheudleDate);
                int newVenueID = org.getCheckVenueId(scheduleEventView.Items[i].SubItems[2].Text);
                ven = new Venue(newVenueID, scheduleEventView.Items[i].SubItems[2].Text, Venue.getVenueCapacityfromID(newVenueID));
                if (listOfActivity.Count == 0)
                    newActivityID = org.getNewActivityId();
                else
                    newActivityID = getNewActIDFromActList(listOfActivity);
                newAct = new Activity(newActivityID, time, scheduleEventView.Items[i].SubItems[1].Text, ven);
                listOfActivity.Add(newAct);
            }
            scheduleEventView.Clear();
            initMainEventList();

            foreach (Activity currAct in listOfActivity)
            {
                DateTime currTime = currAct.getDate();
                if (currAct.getDate().Year == Convert.ToDateTime(dateCombobox.SelectedItem.ToString()).Year && currAct.getDate().Month == Convert.ToDateTime(dateCombobox.SelectedItem.ToString()).Month && currAct.getDate().Day == Convert.ToDateTime(dateCombobox.SelectedItem.ToString()).Day)
                {
                    if (listOfActivity.Count != 0)
                    {
                        ListViewItem newevent = new ListViewItem(String.Format("{0:t}", currAct.getDate()));
                        newevent.SubItems.Add(currAct.getDescription().ToString());
                        newevent.SubItems.Add(currAct.getVenue().getlocation());
                        scheduleEventView.Items.Add(newevent);
                    }
                }
            }
        }
예제 #5
0
        private void createButton_Click(object sender, EventArgs e)
        {
            if (eventNameTextBox.Text == "" && sizeTextBox.Text == "")
            {
                MessageBox.Show("Please fill in the event details. Thank you.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (eventNameTextBox.Text == "")
            {
                MessageBox.Show("Please enter an event name. Thank you.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (sizeTextBox.Text == "")
            {
                MessageBox.Show("Please enter the particpatiant size. Thank you.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (startTimePicker.Value > endTimePicker.Value)
            {
                MessageBox.Show("The event's start date cannot be after its end date.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (startTimePicker.Value == endTimePicker.Value)
            {
                MessageBox.Show("The event cannot have the same start and end time.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (int.Parse(sizeTextBox.Text) < 1)
            {
                MessageBox.Show("You cannot create an event with 0 participant size.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (listOfActivity.Count == 0 && scheduleEventView.Items.Count == 0)
            {
                MessageBox.Show("Please add your schedule. Thank you.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                string path = "events.xml";
                int neweventId = 1;
                int newscheduleId = 1;
                if (File.Exists(path))
                {
                    neweventId = Organiser.getNewEventId();
                    newscheduleId = Organiser.getNewScheduleId();
                }
                List<Participant> participantList = new List<Participant>();
                List<int> facilitatorList = new List<int>();
                Organiser org = new Organiser(currentUser);

                // Delete event
                Activity currentActivity;
                for (int i = 0; i < listOfActivity.Count; i++)
                {
                    currentActivity = listOfActivity[i];
                    if (currentActivity.getDate().Year == Convert.ToDateTime(dateCombobox.Text).Year && currentActivity.getDate().Month == Convert.ToDateTime(dateCombobox.Text).Month && currentActivity.getDate().Day == Convert.ToDateTime(dateCombobox.Text).Day)
                    {
                        listOfActivity.Remove(currentActivity);
                        i--;
                    }
                }

                //Readd the current date event
                Activity currAct; Venue ven; DateTime time;
                for (int i = 0; i < scheduleEventView.Items.Count; i++)
                {
                    time = returnTime(scheduleEventView.Items[i].SubItems[0].Text, Convert.ToDateTime(dateCombobox.Text));
                    int newVenueID = org.getCheckVenueId(scheduleEventView.Items[i].SubItems[2].Text);
                    ven = new Venue(newVenueID, scheduleEventView.Items[i].SubItems[2].Text, Venue.getVenueCapacityfromID(newVenueID));
                    if (listOfActivity.Count == 0)
                        newActivityID = org.getNewActivityId();
                    else
                        newActivityID = getNewActIDFromActList(listOfActivity);
                    currAct = new Activity(newActivityID, time, scheduleEventView.Items[i].SubItems[1].Text, ven);
                    listOfActivity.Add(currAct);
                }
                listOfActivity = sortActivityList(listOfActivity);
                foreach (Activity newAct in listOfActivity)
                {
                    org.addNewActivity(newAct);
                }
                List<string> listOfItems = new List<string>();
                Schedule newSchedule = new Schedule(newscheduleId, listOfItems, listOfActivity);
                int newItemID = 0;
                List<int> listOfBudgetID = new List<int>();
                List<Budget> listOfBudget = new List<Budget>();
                Budget currBudget;
                for (int i = 0; i < budgetListListView.Items.Count; i++)
                {
                    if (i == 0)
                        newItemID = org.getNewItemID();
                    else
                        newItemID++;
                    listOfBudgetID.Add(newItemID);
                    currBudget = new Budget(newItemID, double.Parse(budgetListListView.Items[i].SubItems[1].Text), budgetListListView.Items[i].SubItems[0].Text);
                    listOfBudget.Add(currBudget);
                }
                org.addSchedule(newSchedule);
                org.addBudget(listOfBudget);
                EventEntity events = new EventEntity(neweventId, eventNameTextBox.Text, startTimePicker.Value, endTimePicker.Value, newscheduleId, int.Parse(sizeTextBox.Text), participantList, facilitatorList, listOfBudgetID, double.Parse(totalPriceTextBox.Text), currentUser.getUserId(), false, false, false, false);
                org.createEvent(events);
                if (MessageBox.Show(events.getEventName() + " has been created. Do you want to advertise?", "Registration", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Advertise newAdvForm = new Advertise(this.eventNameTextBox.Text.ToString());
                    newAdvForm.Show();
                }
                this.Close();
            }
        }
예제 #6
0
        private void organiserCancel_Click(object sender, EventArgs e)
        {
            int organiserCancellingEventId = -1;

            try
            {

                ListViewItem sideListItem = this.listSideEventView.SelectedItems[0];
                organiserCancellingEventId = int.Parse(sideListItem.SubItems[0].Text);

                Organiser organiser = new Organiser(currentUser);

                if (organiserCancellingEventId != -1)
                {
                    if (Organiser_Cancel_SideBar_Dialog())
                    {
                        organiser.cancelEvent(organiserCancellingEventId);
                    }
                }
            }
            catch (ArgumentOutOfRangeException arg_ex)
            {
                AdviseUserToMakeASelection();
            }

            // Set Event Delete Flag
            EventEntity eve = new EventEntity();
            eve.setEventDeletedFlag(currentEventID);

            //Refresh the Side Bar
            initSideEventBar();
        }
예제 #7
0
        public void initSideEventBar()
        {
            this.listSideEventView.Hide();

            this.listSideEventView.Alignment = ListViewAlignment.Top;

            //Clear Side ListBox Columns and Items
            this.listSideEventView.Columns.Clear();
            this.listSideEventView.Items.Clear();

            //Insert Date and EventId Column
            this.listSideEventView.Columns.Insert(0, "Id", 0, HorizontalAlignment.Left);
            this.listSideEventView.Columns.Insert(1, "Date", 80, HorizontalAlignment.Center);
            this.listSideEventView.Columns.Insert(2, "Event", 200, HorizontalAlignment.Left);

            List<EventEntity> sideBarEventListing;

            //Get the value of the DDL selected value
            switch (eventCatComboBox.SelectedIndex)
            {
                case 0:
                    //Participant Action
                    Participant currentParticipant = new Participant(currentUser);
                    sideBarEventListing = currentParticipant.getRegisteredEvents();
                    break;
                case 1:
                    Organiser currentOrganiser = new Organiser(currentUser);
                    sideBarEventListing = currentOrganiser.getOrganisedEvents();
                    break;
                case 2:
                    Facilitator currentFacilitator = new Facilitator(currentUser);
                    sideBarEventListing = currentFacilitator.getFacilitatedEvents();
                    break;
                default:
                    sideBarEventListing = new List<EventEntity>(0);
                    break;
            }

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

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

                listSideEventView.Items.Add(newEvent);
            }

            this.listSideEventView.Show();
        }
예제 #8
0
        public Analytic(User incomingUser)
        {
            currentUser = new Organiser(incomingUser);

            InitializeComponent();
        }
예제 #9
0
        // Alert Search
        public int scoutAlert()
        {
            int numOfAlerts = 0;
            userAlerts.Clear();
            Participant p = new Participant(this);
            Facilitator f = new Facilitator(this);
            Organiser o = new Organiser(this);
            List<EventEntity> listOfRegisteredEvents = new List<EventEntity>();
            List<EventEntity> listOfFacilitatingEvents = new List<EventEntity>();
            List<EventEntity> listOfOrganizingEvents = new List<EventEntity>();
            EventEntity eve = new EventEntity();
            listOfFacilitatingEvents = f.getFacilitatedEvents();
            listOfOrganizingEvents = o.getOrganisedEvents();
            listOfRegisteredEvents = p.getRegisteredEvents();

            // Alert if User is PARTICIPANT of this updated event
            foreach (EventEntity e in listOfRegisteredEvents)
            {
                if (e.getEventUpdatedFlag(e.getEventId()) == true)
                {
                    userAlerts.Add(eve.createAlert(e.getEventId(), 1));
                    numOfAlerts++;
                }
            }

            // Alert if User if FACILITATOR of this updated event
            foreach (EventEntity e in listOfFacilitatingEvents)
            {
                if (e.getEventUpdatedFlag(e.getEventId()) == true)
                {
                    userAlerts.Add(eve.createAlert(e.getEventId(), 1));
                    numOfAlerts++;
                }
            }

            // Alert if User is PARTICIPANT of this starting event
            foreach (EventEntity e in listOfRegisteredEvents)
            {
                if (e.getEventStartFlag(e.getEventId()) == true)
                {
                    userAlerts.Add(eve.createAlert(e.getEventId(), 3));
                    numOfAlerts++;
                }
            }

            // Alert if User is FACILITATOR of this starting event
            foreach (EventEntity e in listOfFacilitatingEvents)
            {
                if (e.getEventStartFlag(e.getEventId()) == true)
                {
                    userAlerts.Add(eve.createAlert(e.getEventId(), 3));
                    numOfAlerts++;
                }
            }

            // Alert if User is ORGANIZER of this starting event
            foreach (EventEntity e in listOfOrganizingEvents)
            {
                if (e.getEventStartFlag(e.getEventId()) == true)
                {
                    userAlerts.Add(eve.createAlert(e.getEventId(), 3));
                    numOfAlerts++;
                }
            }

            return numOfAlerts;
        }
예제 #10
0
        private void updateForm_Load(object sender, EventArgs e)
        {
            EventEntity newEve = Facilitator.getEventEntity(currentEventID);
            titleLabel.Text = newEve.getEventName();
            int organiserID = newEve.getOrganiserID();
            organiserTextBox.Text = User.getNamefromID(organiserID);
            participantTextbox.Text = EventEntity.getParticipantSize(currentEventID).ToString();
            DateTime dateValue = EventEntity.getStartTime(currentEventID);
            dateTextBox.Text = String.Format("{0:f}", dateValue);
            listOfDateTime = EventEntity.getListOfTimeFromEventID(currentEventID);
            listofDescription = EventEntity.getListOfDescriptionFromEventID(currentEventID);
            listOfVenue = EventEntity.getListOfVenueFromEventID(currentEventID);
            venueTextBox.Text = listOfVenue.Peek();
            Activity currentAct; Venue ven;

            Organiser pub = new Organiser(currentUser);
            int newActID = pub.getNewActivityId();
            newActID++;
            while (listOfDateTime.Count != 0)
            {

                string curlocation = listOfVenue.Dequeue();
                ven = new Venue(Venue.getVenueIdfromLocation(curlocation), curlocation, Venue.getVenueCapacityfromID(Venue.getVenueIdfromLocation(curlocation)));
                currentAct = new Activity(newActID, listOfDateTime.Dequeue(), listofDescription.Dequeue(), ven);
                listOfActivity.Add(currentAct);
                newActID++;
            }
            setScheduleDay(dateValue, endTime);
            dateCombobox.Text = dateValue.ToLongDateString();
        }
예제 #11
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            int numParticipant = int.Parse(participantTextbox.Text);

            if (numParticipant < EventEntity.getParticipantSize(currentEventID))  // Prohibit decrease in participant size
            {
                MessageBox.Show("You are not allowed to decrease the participant size", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (timeListBox.Items.Count != descriptionListBox.Items.Count || timeListBox.Items.Count != venueListBox.Items.Count)
            {
                MessageBox.Show("At least one activity is missing in the schedule!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                EventEntity.setParticipantNumFromEventID(currentEventID, numParticipant);

                // delete schedule
                Activity currentActivity;
                for (int i = 0; i < listOfActivity.Count; i++)
                {
                    currentActivity = listOfActivity[i];
                    if (currentActivity.getDate().Year == Convert.ToDateTime(dateCombobox.Text).Year && currentActivity.getDate().Month == Convert.ToDateTime(dateCombobox.Text).Month && currentActivity.getDate().Day == Convert.ToDateTime(dateCombobox.Text).Day)
                    {
                        listOfActivity.Remove(currentActivity);
                        i--;
                    }
                }

                //set schedule
                Organiser org = new Organiser(currentUser);
                Activity currAct; Venue ven; DateTime time;
                for (int i = 0; i < timeListBox.Items.Count; i++)
                {
                    time = returnTime(timeListBox.Items[i].ToString(), Convert.ToDateTime(dateCombobox.Text));
                    int newVenueID = org.getCheckVenueId(venueListBox.Items[i].ToString());
                    ven = new Venue(newVenueID, venueListBox.Items[i].ToString(), Venue.getVenueCapacityfromID(newVenueID));
                    if (listOfActivity.Count == 0)
                        newActivityID = org.getNewActivityId();
                    else
                        newActivityID = getNewActIDFromActList(listOfActivity);
                    currAct = new Activity(newActivityID, time, descriptionListBox.Items[i].ToString(), ven);
                    listOfActivity.Add(currAct);
                }
                listOfActivity = sortActivityListByID(listOfActivity);

                foreach(Activity act in listOfActivity)
                    org.addNewActivity(act);
                listOfActivity = sortActivityListByTime(listOfActivity);

            //    EventEntity.setSchedule(currentEventID, listOfDateTime, listOfdescription, listOfVenue);
                EventEntity.replaceSchedule(currentEventID, listOfActivity);
                //Set Alert Flag
                EventEntity eve = new EventEntity();
                eve.setEventUpdatedFlag(currentEventID);
                //

                MessageBox.Show("Save successfully.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }
예제 #12
0
 private void saveChangeButton_Click(object sender, EventArgs e)
 {
     Organiser org = new Organiser(currentUser);
     List<string> listItem = new List<string>();
     List<double> listPrice = new List<double>();
     List<int> listID = new List<int>();
     for (int i = 0; i < budgetListListView.Items.Count; i++)
     {
         listItem.Add(budgetListListView.Items[i].SubItems[0].Text);
         listPrice.Add(double.Parse(budgetListListView.Items[i].SubItems[1].Text));
         listID.Add(int.Parse(budgetListListView.Items[i].SubItems[2].Text));
     }
     org.saveBudget(listItem, listPrice, listID, double.Parse(totalPriceTextBox.Text), currentEventID);
     MessageBox.Show("You have successfully save your new budget", "Save successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }