protected void btnSaveNewCourse_Click(object sender, EventArgs e)
        {
            customValidator validator = new customValidator();
            validator.addValidationRule(new customValidationRule(txtNewName, validator.required, null, "Gelieve een naam in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewDescription, validator.required, null, "Gelieve een omschrijving in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewStartDate, validator.required, null, "Gelieve een startdatum in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewStartDate, validator.validDate, null, "Gelieve een geldige startdatum in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewEndDateInclusive, validator.required, null, "Gelieve een einddatum in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewEndDateInclusive, validator.validDate, null, "Gelieve een geldige einddatum in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewStartHour, validator.required, null, "Gelieve een startuur in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewStartHour, validator.hour, null, "Gelieve een geldig startuur in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewEndHour, validator.required, null, "Gelieve een einduur in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewEndHour, validator.hour, null, "Gelieve een geldig einduur in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewMaxSubscriptions, validator.required, null, "Gelieve het maximum aantal inschrijvingen in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewMaxSubscriptions, validator.numeric, null, "Gelieve het maximum aantal inschrijvingen in te vullen als geheel getal"));
            validator.addValidationRule(new customValidationRule(txtNewPrice, validator.required, null, "Gelieve een prijs in te vullen"));
            validator.addValidationRule(new customValidationRule(txtNewPrice, validator.numeric, null, "Gelieve een prijs in te vullen als geheel getal"));

            List<string> errors = validator.validate();
            StringBuilder messageText = new StringBuilder();
            if (errors.Count > 0) {
                foreach (string error in errors) {
                    messageText.Append(error + "<br>");
                }

                ((NinaSubscriptionsMaster) this.Master).setMessage(messageClasses.messageError, messageText.ToString());

                return;
            }

            if (selectedCourseType == null || selectedLocation == null) {
                ((NinaSubscriptionsMaster) this.Master).setMessage(messageClasses.messageError, "Gelieve een cursustype en locatie te selecteren");
                return;
            }

            crud crud = new crud();

            course course = new course() {
                name = txtNewName.Text,
                description = txtNewDescription.Text,
                courseType = selectedCourseType,
                location = selectedLocation,
                startDate = Convert.ToDateTime(txtNewStartDate.Text),
                endDateInclusive = Convert.ToDateTime(txtNewEndDateInclusive.Text),
                startHour = txtNewStartHour.Text,
                endHour = txtNewEndHour.Text,
                maxSubscriptions = Convert.ToInt32(txtNewMaxSubscriptions.Text),
                price = Convert.ToInt32(txtNewPrice.Text)
            };

            crud.insertCourse(course);

            clearNewCourseForm();
            fillCoursesList(crud);
        }
        // initializers
        protected void Page_Load(object sender, EventArgs e)
        {
            NinaSubscriptionsMaster master = this.Master as NinaSubscriptionsMaster;
            master.setHeaderTitle(settingsHelper.get("title_bekijk_inschrijvingen"));

            userProfile user = master.getLoggedInUserProfile();
            if (user == null || user.isAdmin == false) { Response.Redirect("~/Pages/Public/bekijkAanbod.aspx"); };

            if (!IsPostBack) {
                crud crud = new crud();

                // fill course dropdown
                List<course> allCourses = crud.getAllCourses();
                course emptyCourse = new course() { id = 0 };
                allCourses.Insert(0, emptyCourse);
                ddCourseNames.DataSource = allCourses;
                ddCourseNames.DataTextField = "name";
                ddCourseNames.DataValueField = "id";
                ddCourseNames.DataBind();

                List<userProfile> allUserProfiles = crud.getAllUserProfiles();
                userProfile emptyProfile = new userProfile() { id = 0 };
                allUserProfiles.Insert(0, emptyProfile);
                ddUserProfiles.DataSource = allUserProfiles;
                ddUserProfiles.DataTextField = "fullname";
                ddUserProfiles.DataValueField = "id";
                ddUserProfiles.DataBind();

                cldrDates.SelectedDate = DateTime.Now;
            }
        }
 // HELPERS
 private void fillCourseData(course course)
 {
     lblName.Text = course.name;
     lblDescription.Text = course.description;
     lblAgeFrom.Text = course.courseType.ageFrom.ToString();
     lblAgeTo.Text = course.courseType.ageToInclusive.ToString();
     lblDateFrom.Text = course.startDate.ToString(settingsHelper.get("format_date"));
     lblDateTo.Text = course.endDateInclusive.ToString(settingsHelper.get("format_date"));
     lblLocationName.Text = course.location.name;
     lblLocationAddress.Text = course.location.street + " " + course.location.number + ", " +
                               course.location.postalCode + " " + course.location.place;
     lblSubscriptionsLeft.Text = course.openSubscriptions.ToString() + settingsHelper.get("places_free");
     lblPrice.Text = settingsHelper.get("currency_symbol") + course.price;
 }