Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ((HtmlControl)Master.FindControl("Cor")).Attributes.Add("class", "active");
        ((HtmlControl)Master.FindControl("CorS")).Attributes.Add("class", "active");
        ((Literal)Master.FindControl("pagetitle")).Text = " - Staff Details";

        RecordsDataControl.BindViewData(StudentRecordsDAL.Query("SELECT * FROM Staff"));
        RecordsDataControl.BindEditData(StudentRecordsDAL.Query("SELECT * FROM Staff"));
        RecordsDataControl.SetTableName("Staff");
        RecordsDataControl.SetDisplayMetadata(displayTypes);
        RecordsDataControl.SetEditMetadata(validationTypes);
        RecordsDataControl.SetFunction(updateDB);
        RecordsDataControl.BuildControl();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ((HtmlControl)Master.FindControl("Cor")).Attributes.Add("class", "active");
        ((HtmlControl)Master.FindControl("CorU")).Attributes.Add("class", "active");
        ((Literal)Master.FindControl("pagetitle")).Text = " - Unit Details";

        RecordsDataControl.BindViewData(StudentRecordsDAL.Query("SELECT * FROM Unit_Coord"));
        RecordsDataControl.BindEditData(StudentRecordsDAL.Query("SELECT * FROM Unit"));
        RecordsDataControl.SetTableName("Unit");
        RecordsDataControl.SetDisplayMetadata(displayTypes);
        RecordsDataControl.SetEditMetadata(validationTypes);
        RecordsDataControl.SetFunction(updateDB);
        RecordsDataControl.AddValidationMethod("Unit_ID", setID);
        RecordsDataControl.AddValidationMethod("Unit_Code", unitCodeUnique);
        RecordsDataControl.BuildControl();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ((HtmlControl)Master.FindControl("Stu")).Attributes.Add("class", "active");
        ((HtmlControl)Master.FindControl("StuR")).Attributes.Add("class", "active");
        ((Literal)Master.FindControl("pagetitle")).Text = " - Student Results";

        RecordsDataControl.BindViewData(StudentRecordsDAL.Query("SELECT * FROM Course_Attempt_Details"));
        RecordsDataControl.BindEditData(StudentRecordsDAL.Query("SELECT * FROM Course_Attempt"));
        RecordsDataControl.SetTableName("Course_Attempt");
        RecordsDataControl.SetDisplayMetadata(displayTypes);
        RecordsDataControl.SetEditMetadata(validationTypes);
        RecordsDataControl.AddValidationMethod("Attempt_ID", setAttemptID);
        RecordsDataControl.AddValidationMethod("Student_ID", setStudentID);
        RecordsDataControl.AddValidationMethod("Course_ID", checkEnrolment);
        RecordsDataControl.SetFunction(updateDB);
        RecordsDataControl.BuildControl();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ((HtmlControl)Master.FindControl("Stu")).Attributes.Add("class", "active");
        ((HtmlControl)Master.FindControl("StuU")).Attributes.Add("class", "active");
        ((Literal)Master.FindControl("pagetitle")).Text = " - Unit Attempts";

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

        students.Add("0", "All Students");
        foreach (Dictionary <string, object> studentsData in StudentRecordsDAL.Query("SELECT * FROM Student"))
        {
            students.Add(studentsData["Student_ID"].ToString(), studentsData["Student_Number"].ToString() + " - " + studentsData["Student_Name"]);
        }
        filterBox.ID             = "filterdrop_";
        filterBox.DataSource     = students;
        filterBox.DataValueField = "Key";
        filterBox.DataTextField  = "Value";
        filterBox.DataBind();

        if (IsPostBack)
        {
            foreach (string key in Request.Form)
            {
                if (key.EndsWith("addButton") || Regex.Match(key, "edit([0-9]+)$").Success || key.EndsWith("editRow"))
                {
                    filterBox.Visible = false;
                }
                else
                {
                    if (key.EndsWith("filterdrop_"))
                    {
                        filterBox.SelectedValue = Request.Form[key];
                    }
                }
            }

            if (filterBox.SelectedValue != "0")
            {
                RecordsDataControl.BindViewData(StudentRecordsDAL.Query("SELECT * FROM Unit_Attempt_Details WHERE Student_ID=" + filterBox.SelectedValue));
            }
            else
            {
                RecordsDataControl.BindViewData(StudentRecordsDAL.Query("SELECT * FROM Unit_Attempt_Details"));
            }
        }
        else
        {
            filterBox.SelectedValue = "0";
            RecordsDataControl.BindViewData(StudentRecordsDAL.Query("SELECT * FROM Unit_Attempt_Details"));
        }

        RecordsDataControl.BindEditData(StudentRecordsDAL.Query("SELECT * FROM Unit_Attempt"));
        RecordsDataControl.SetTableName("Unit_Attempt");
        RecordsDataControl.SetDisplayMetadata(displayTypes);
        RecordsDataControl.SetEditMetadata(validationTypes);
        RecordsDataControl.AddValidationMethod("Unit_Att_ID", setUnitAttemptID);
        RecordsDataControl.AddValidationMethod("Attempt_ID", setAttemptID);
        RecordsDataControl.AddValidationMethod("Unit_ID", unitAttemptChecks);
        RecordsDataControl.AddValidationMethod("Semester_Attempted", multipleSemesterAttempts);
        RecordsDataControl.SetFunction(updateDB);
        RecordsDataControl.BuildControl();
    }