コード例 #1
0
    protected CourseDetails()
    {
        displayTypes = new Dictionary<string, DisplayMetadata>();
        displayTypes.Add("Course_ID", new DisplayMetadata(DisplayMetadata.FieldTypes.ID, "Course ID"));
        displayTypes.Add("Course_Code", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Course Code"));
        displayTypes.Add("Course_Title", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Course Title"));
        displayTypes.Add("Staff_Name", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Course Coordinator"));
        displayTypes.Add("Course_Type_Name", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Course Type Name"));
        displayTypes.Add("Course_Type_Credit_Points", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Course Type Credit Points"));
        displayTypes.Add("Course_Type_Duration_Months", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Course Type Duration Months"));

        validationTypes = new Dictionary<string, EditMetadata>();
        validationTypes.Add("Course_ID", new EditMetadata(EditMetadata.FieldTypes.ID, "", "Course ID"));
        validationTypes.Add("Course_Code", new EditMetadata("^[A-Z][0-9]{2}$", "A course code must be a capital letter followed by 2 numbers.", "Course Code"));
        validationTypes.Add("Course_Title", new EditMetadata("^[a-zA-Z\\s0-9]{5}([a-zA-Z\\s0-9]*)?$", "You must enter a course title at least 5 characters with only letters, numbers, and spaces.", "Course Title"));
        
        Dictionary<string, string> staff = new Dictionary<string, string>();
        foreach (Dictionary<string, object> staffData in StudentRecordsDAL.Query("SELECT * FROM Staff"))
            staff.Add(staffData["Staff_ID"].ToString(), staffData["Staff_Name"].ToString());
        EditMetadata staf = new EditMetadata(EditMetadata.FieldTypes.Dropdown, "You must add an entry to the staff table.", "Course Coordinator");
        staf.SetDropdownValues(staff);
        validationTypes.Add("Course_Coordinator", staf);


        Dictionary<string, string> courseTypes = new Dictionary<string, string>();
        foreach (Dictionary<string, object> courseTypeData in StudentRecordsDAL.Query("SELECT * FROM Course_Type"))
            courseTypes.Add(courseTypeData["Course_Type_ID"].ToString(), courseTypeData["Course_Type_Name"].ToString());
        EditMetadata course = new EditMetadata(EditMetadata.FieldTypes.Dropdown, "You must add an entry to the course type table.", "Course Type");
        course.SetDropdownValues(courseTypes);
        validationTypes.Add("Course_Type", course);
    }
    protected UnitDetails()
    {
        displayTypes = new Dictionary <string, DisplayMetadata>();
        displayTypes.Add("Unit_ID", new DisplayMetadata(DisplayMetadata.FieldTypes.ID, "Unit ID"));
        displayTypes.Add("Unit_Code", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Unit Code"));
        displayTypes.Add("Unit_Title", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Unit Title"));
        displayTypes.Add("Staff_Name", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Unit Coordinator"));
        displayTypes.Add("Unit_Credit_Points", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Unit Credit Points"));
        displayTypes.Add("Postgrad_Unit", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Postgrad Unit"));

        validationTypes = new Dictionary <string, EditMetadata>();
        validationTypes.Add("Unit_ID", new EditMetadata(EditMetadata.FieldTypes.ID, "", "Unit ID"));
        validationTypes.Add("Unit_Code", new EditMetadata("^[A-Z]{3}[0-9]{4}$", "A course code must be 3 capital letter followed by 4 numbers.", "Unit Code"));
        validationTypes.Add("Unit_Title", new EditMetadata("^[a-zA-Z\\s0-9]{5}([a-zA-Z\\s0-9]*)?$", "You must enter a unit title at least 5 characters with only letters, numbers, and spaces.", "Unit Title"));

        Dictionary <string, string> staff = new Dictionary <string, string>();

        foreach (Dictionary <string, object> staffData in StudentRecordsDAL.Query("SELECT * FROM Staff"))
        {
            staff.Add(staffData["Staff_ID"].ToString(), staffData["Staff_Name"].ToString());
        }
        EditMetadata staf = new EditMetadata(EditMetadata.FieldTypes.Dropdown, "You must add an entry to the staff table.", "Unit Coordinator");

        staf.SetDropdownValues(staff);
        validationTypes.Add("Unit_Coordinator", staf);

        validationTypes.Add("Unit_Credit_Points", new EditMetadata("^(15|20|60)$", "Credit points can be either 15, 20, or 60.", "Credit Points"));
    }
コード例 #3
0
    protected StudentDetails()
    {
        displayTypes = new Dictionary <string, DisplayMetadata>();
        displayTypes.Add("Student_ID", new DisplayMetadata(DisplayMetadata.FieldTypes.ID, "Student ID"));
        displayTypes.Add("Student_Number", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Student Number"));
        displayTypes.Add("Student_Name", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Student Name"));
        displayTypes.Add("Student_Email", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Student Email"));
        displayTypes.Add("Student_Password", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Student Passsword"));
        displayTypes.Add("Gender_Name", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Student Gender"));
        displayTypes.Add("Date_Of_Birth", new DisplayMetadata(DisplayMetadata.FieldTypes.Date, true, "Date of Birth"));
        displayTypes.Add("Phone_Number", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Phone Number"));
        displayTypes.Add("Address_Line_One", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Address Line 1"));
        displayTypes.Add("Address_Line_Two", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Address Line 2"));
        displayTypes.Add("City", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "City"));
        displayTypes.Add("State_Name", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "State"));
        displayTypes.Add("Postcode", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Postcode"));

        validationTypes = new Dictionary <string, EditMetadata>();
        validationTypes.Add("Student_ID", new EditMetadata(EditMetadata.FieldTypes.ID, "", "Student ID"));
        validationTypes.Add("Student_Number", new EditMetadata(EditMetadata.FieldTypes.ReadOnly, "", "Student Number"));
        validationTypes.Add("Student_Name", new EditMetadata("^[a-zA-Z]+ [a-zA-Z]+([a-z\\sA-Z]+)?$", "You must enter a first name and a last name with only letters.", "Student Name"));
        validationTypes.Add("Student_Email", new EditMetadata(EditMetadata.FieldTypes.ReadOnly, "", "Student Email"));
        validationTypes.Add("Student_Password", new EditMetadata("^(?=(.*[A-Z]){2})(?=(.*\\d){2})[a-zA-Z\\d]{8,}$", "You must enter an alphanumeric password that is at least 8 characters, with at least 2 upper case letters and 2 numbers.", "Student Password"));

        Dictionary <string, string> genders = new Dictionary <string, string>();

        foreach (Dictionary <string, object> stateData in StudentRecordsDAL.Query("SELECT * FROM Gender"))
        {
            genders.Add(stateData["Gender_ID"].ToString(), stateData["Gender_Name"].ToString());
        }
        EditMetadata gender = new EditMetadata(EditMetadata.FieldTypes.Dropdown, "You must add an entry to the gender table.", "Student Gender");

        gender.SetDropdownValues(genders);
        validationTypes.Add("Gender", gender);

        validationTypes.Add("Date_Of_Birth", new EditMetadata(EditMetadata.FieldTypes.Date, "You must enter a date in the format DD/MM/YYYY.", "Date of Birth"));
        validationTypes.Add("Phone_Number", new EditMetadata("^[0-9]{10}$", "You must enter a 10 digit phone number (including area code).", "Phone Number"));
        validationTypes.Add("Address_Line_One", new EditMetadata(EditMetadata.FieldTypes.Text, "You must enter an address.", "Address Line 1"));
        validationTypes.Add("Address_Line_Two", new EditMetadata("^[a-zA-Z 0-9]*$", "You must enter only letters numbers and spaces.", "Address Line 2"));
        validationTypes.Add("City", new EditMetadata(EditMetadata.FieldTypes.Text, "You must enter a city.", "City"));

        Dictionary <string, string> states = new Dictionary <string, string>();

        foreach (Dictionary <string, object> stateData in StudentRecordsDAL.Query("SELECT * FROM State"))
        {
            states.Add(stateData["State_ID"].ToString(), stateData["State_Name"].ToString());
        }
        EditMetadata state = new EditMetadata(EditMetadata.FieldTypes.Dropdown, "You must add an entry to the state table.", "State");

        state.SetDropdownValues(states);
        validationTypes.Add("State", state);

        validationTypes.Add("Postcode", new EditMetadata("^[0-9]{4}$", "You must enter a valid postcode.", "Postcode"));
    }
    protected StudentResults()
    {
        displayTypes = new Dictionary <string, DisplayMetadata>();
        displayTypes.Add("Attempt_ID", new DisplayMetadata(DisplayMetadata.FieldTypes.ID, "Attempt ID"));
        displayTypes.Add("Student_Number", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Student Number"));
        displayTypes.Add("Student_Name", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Student Name"));
        displayTypes.Add("Course_Code", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Course Code"));
        displayTypes.Add("Course_Average", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Course Average"));
        displayTypes.Add("Credit_Points", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Credit Points Earned"));
        displayTypes.Add("Credit_Points_Required", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Credit Points Required"));
        displayTypes.Add("Course_Status", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Course Status"));
        displayTypes.Add("Units_Attempted", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Units Attempted"));
        displayTypes.Add("Highest_Mark", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Highest Mark"));
        displayTypes.Add("Lowest_Mark", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Lowest Mark"));

        validationTypes = new Dictionary <string, EditMetadata>();
        validationTypes.Add("Attempt_ID", new EditMetadata(EditMetadata.FieldTypes.ID, "", "Attempt ID"));

        Dictionary <string, string> students = new Dictionary <string, string>();

        foreach (Dictionary <string, object> studentData in StudentRecordsDAL.Query("SELECT * FROM Student"))
        {
            students.Add(studentData["Student_ID"].ToString(), studentData["Student_Name"].ToString());
        }
        EditMetadata student = new EditMetadata(EditMetadata.FieldTypes.Dropdown, "You must add an entry to the student table.", "Student");

        student.SetDropdownValues(students);
        validationTypes.Add("Student_ID", student);

        Dictionary <string, string> courses = new Dictionary <string, string>();

        foreach (Dictionary <string, object> courseData in StudentRecordsDAL.Query("SELECT * FROM Course"))
        {
            courses.Add(courseData["Course_ID"].ToString(), courseData["Course_Title"].ToString());
        }
        EditMetadata course = new EditMetadata(EditMetadata.FieldTypes.Dropdown, "You must add an entry to the course table.", "Course");

        course.SetDropdownValues(courses);
        validationTypes.Add("Course_ID", course);
    }
    protected Students_UnitAttempts()
    {
        displayTypes = new Dictionary <string, DisplayMetadata>();
        displayTypes.Add("Unit_Att_ID", new DisplayMetadata(DisplayMetadata.FieldTypes.ID, "Unit Attempt ID"));
        displayTypes.Add("Student_Number", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Student Number"));
        displayTypes.Add("Student_Name", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Student Name"));
        displayTypes.Add("Course_Code", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Course Code"));
        displayTypes.Add("Unit_Code", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Unit Code"));
        displayTypes.Add("Semester_Attempted", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, "Semester Attempted"));
        displayTypes.Add("Attempt_Mark", new DisplayMetadata(DisplayMetadata.FieldTypes.Text, true, "Attempt Mark"));

        validationTypes = new Dictionary <string, EditMetadata>();
        validationTypes.Add("Unit_Att_ID", new EditMetadata(EditMetadata.FieldTypes.ID, "", "Unit Attempt ID"));

        Dictionary <string, string> courseAttempts = new Dictionary <string, string>();

        foreach (Dictionary <string, object> attemptData in StudentRecordsDAL.Query("SELECT * FROM Attempt_Lookup"))
        {
            courseAttempts.Add(attemptData["Attempt_ID"].ToString(), attemptData["Attempt"].ToString());
        }
        EditMetadata attempt = new EditMetadata(EditMetadata.FieldTypes.Dropdown, "You must add an entry to the student results table.", "Course Attempt");

        attempt.SetDropdownValues(courseAttempts);
        validationTypes.Add("Attempt_ID", attempt);

        Dictionary <string, string> units = new Dictionary <string, string>();

        foreach (Dictionary <string, object> unitData in StudentRecordsDAL.Query("SELECT * FROM Unit"))
        {
            units.Add(unitData["Unit_ID"].ToString(), unitData["Unit_Code"].ToString());
        }
        EditMetadata unit = new EditMetadata(EditMetadata.FieldTypes.Dropdown, "You must add an entry to the unit table.", "Unit");

        unit.SetDropdownValues(units);
        validationTypes.Add("Unit_ID", unit);

        validationTypes.Add("Semester_Attempted", new EditMetadata("^[0-9]{2}(1|2)$", "You must enter 2 numbers followed by a 1 or a 2.", "Semester Attempted"));
        validationTypes.Add("Attempt_Mark", new EditMetadata("^([0-9]{1,2}|100)$", "You must enter a mark between 0 and 100.", "Attempt Mark"));
    }