Example #1
0
        private void fillActivitiesListBox()
        {
            hoursLabel.Text = "Total hours: " + ManageDB.myPerson.hours;
            activitiesListBox.Items.Clear();
            offeredActivities = ManageDB.getPublishedActivities();
            foreach (Activity a in offeredActivities)
            {
                String professional = ManageDB.findPerson(a.userProducer).userName;
                String item         = "Professional: " + professional + "; Description: " + a.activityName;

                activitiesListBox.Items.Add(item);
            }
        }
Example #2
0
        private void publishedListBox_MouseClick(object sender, MouseEventArgs e)
        {
            Activity     currentActivity = publishedActivities[publishedListBox.SelectedIndex];
            DialogResult result;

            result = MessageBox.Show(publishedListBox.SelectedItem.ToString(),
                                     "Do you want to delete " + ManageDB.findPerson(currentActivity.userProducer).userName + "?",
                                     MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                ManageDB.removeActivity(currentActivity);
            }

            getAllLists();
        }
Example #3
0
        private void activitiesListBox_MouseClick(object sender, MouseEventArgs e)
        {
            Activity     currentActivity = offeredActivities[activitiesListBox.SelectedIndex];
            DialogResult result;

            result = MessageBox.Show(activitiesListBox.SelectedItem.ToString(),
                                     "Do you want to contract " + ManageDB.findPerson(currentActivity.userProducer).userName + "?",
                                     MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                if (!ManageDB.transferHours(currentActivity))
                {
                    MessageBox.Show("Currently you don't have enough hours, please work a little bit harder...", "You don't have enough hours.", MessageBoxButtons.OK);
                }
            }
            fillActivitiesListBox();
        }
Example #4
0
        private void fillListBoxWithActivities(ListBox listBox, List <Activity> activityList)
        {
            listBox.Items.Clear();
            foreach (Activity a in activityList)
            {
                Person producer = ManageDB.findPerson(a.userProducer);
                Person consumer = ManageDB.findPerson(a.userConsumer);

                String item = "";
                if (producer.userId != ManageDB.myPerson.userId)
                {
                    item = item + "Producer: " + producer.userName;
                }
                if (consumer.userId != ManageDB.myPerson.userId)
                {
                    item = item + " Consumer: " + consumer.userName;
                }

                item = item + " Description: " + a.activityName;

                listBox.Items.Add(item);
            }
        }