예제 #1
0
    protected void butDeleteSchool_Click(object sender, EventArgs e)
    {
        // Will also need to add logic for removing the deleted school from
        // all the users who had it!
        long school = Convert.ToInt64(lboxSchools.SelectedValue);

        Schools.DeleteSchool(school);

        // reload the schools into a list.
        lboxSchools.DataSource = Schools.GetAllSchools();
        lboxSchools.DataBind();
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Display schools when page is first loaded:
        if (!IsPostBack)
        {
            // Load the schools into a list and then sort it.
            //System.Collections.Generic.List<School> schoolList = new System.Collections.Generic.List<School>();

            lboxSchools.DataSource = Schools.GetAllSchools();
            lboxSchools.DataBind();
        }
    }
예제 #3
0
    protected void butCreateSchool_Click(object sender, EventArgs e)
    {
        string schoolName  = tbTxtSchool.Text;
        string schoolCity  = tbSchoolCity.Text;
        string schoolState = tbSchoolState.Text;

        if (!Schools.SchoolExists(schoolName, schoolCity, schoolState))
        {
            Schools.CreateSchool(schoolName, schoolCity, schoolState);
            // reload the schools into a list.
            lboxSchools.DataSource = Schools.GetAllSchools();
            lboxSchools.DataBind();
            errorMessage.Visible = false;
        }
        else
        {
            errorMessage.Visible = true;
        }
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            // Load the roles into a list and then sort it.
            System.Collections.Generic.List <string> roleList = new System.Collections.Generic.List <string>(Roles.GetAllRoles());
            roleList.Sort();

            dlistRoles.DataSource = roleList;
            dlistRoles.DataBind();

            // Attempt to find a STUDENT role and set it as selected
            ListItem student = dlistRoles.Items.FindByText(STR_STUDENT) as ListItem;

            if (student != null)
            {
                student.Selected = true;
            }

            // Load the schools into a list and then sort it.
            System.Collections.Generic.List <School> schoolList = new System.Collections.Generic.List <School>(Schools.GetAllSchools());
            //schoolList.Sort(); sorted at DB level.

            dlistSchools.DataSource = schoolList;
            dlistSchools.DataBind();

            // Load the grade levels into a list.
            System.Collections.Generic.List <Grade> gradeList = new System.Collections.Generic.List <Grade>(Grades.GetAllGrades());
            dlistGrades.DataSource = gradeList;
            dlistGrades.DataBind();
        }
    }