Пример #1
0
        /*
         * Pre:  There must exist a contact with the input contact id
         * Post: The informatin of the contact with the input contact id is loaded to the page
         * @param contactId is the contact id of the contact to load
         */
        private void loadContact(int contactId)
        {
            Contact contact = new Contact(contactId);

            if (contact.id != -1)
            {
                Session[contactVar] = contact;

                //load contact data to form
                lblId.Text = contact.id.ToString();
                txtFirstNameSearch.Text = contact.firstName;
                txtLastNameSearch.Text  = contact.lastName;
                lblName.Text            = contact.firstName + " " + contact.middleInitial + " " + contact.lastName;
                lblDistrict.Text        = DbInterfaceStudent.GetStudentDistrict(contact.districtId);
                lblContactType.Text     = contact.contactTypeId;

                string mtnaId = DbInterfaceContact.GetMtnaId(contact.id);

                if (!mtnaId.Equals(""))
                {
                    txtMtnaId.Text    = mtnaId;
                    txtMtnaId.Enabled = false;
                }
            }
            else
            {
                lblContactSearchError.Text    = "An error occurred during the search";
                lblContactSearchError.Visible = true;
            }
        }
Пример #2
0
        /*
         * Pre:
         * Post:  If the current user is not an administrator, the district
         *        dropdown is filtered to contain only the current
         *        user's district
         */
        private void loadDistrictDropdown()
        {
            User user = (User)Session[Utility.userRole];

            if (!user.permissionLevel.Contains('A')) //if the user is a district admin, add only their district
            {
                //get own district dropdown info
                string districtName = DbInterfaceStudent.GetStudentDistrict(user.districtId);

                //add new items to dropdown
                ddlDistrictSearch.Items.Add(new ListItem(districtName, user.districtId.ToString()));

                ddlDistrictSearch.SelectedIndex = 1;

                //load the audition
                selectAudition();
            }
            else //if the user is an administrator, add all districts
            {
                ddlDistrictSearch.DataSource = DbInterfaceAudition.GetDistricts();

                ddlDistrictSearch.DataTextField  = "GeoName";
                ddlDistrictSearch.DataValueField = "GeoId";

                ddlDistrictSearch.DataBind();
            }
        }
Пример #3
0
        /*
         * Pre:
         * Post:  If the current user is not an administrator, the district
         *        dropdowns are filtered to containing only the current
         *        user's district
         */
        private void loadDistrictDropdown()
        {
            User user = (User)Session[Utility.userRole];

            ddlDistrictSearch.DataSource = null;
            ddlDistrictSearch.DataBind();
            ddlDistrictSearch.Items.Clear();
            ddlDistrictSearch.Items.Add(new ListItem(""));

            if (!user.permissionLevel.Contains('A') && !user.permissionLevel.Contains('T')) //if the user is a district admin add only their district
            {
                //get own district dropdown info
                string districtName = DbInterfaceStudent.GetStudentDistrict(user.districtId);

                //add new item to dropdown and select it
                ddlDistrictSearch.Items.Add(new ListItem(districtName, user.districtId.ToString()));
                ddlDistrictSearch.SelectedIndex = 1;
                updateTeacherDropdown();
            }
            else if (user.permissionLevel.Contains('T')) // Get all districts the teacher registered students for in the selected year
            {
                ddlDistrictSearch.DataSource = DbInterfaceAudition.GetTeacherDistrictsForYear(user.contactId, Convert.ToInt32(ddlYear.SelectedValue));

                ddlDistrictSearch.DataTextField  = "GeoName";
                ddlDistrictSearch.DataValueField = "GeoId";

                ddlDistrictSearch.DataBind();
            }
            else //if the user is an administrator, add all districts
            {
                ddlDistrictSearch.DataSource = DbInterfaceAudition.GetDistricts();

                ddlDistrictSearch.DataTextField  = "GeoName";
                ddlDistrictSearch.DataValueField = "GeoId";

                ddlDistrictSearch.DataBind();
            }
        }
Пример #4
0
 /*
  * Pre:  The districtId must exist in the system
  * Post: The name of the district with the current districtId
  *       is returned.
  */
 public string getDistrict()
 {
     return(DbInterfaceStudent.GetStudentDistrict(districtId));
 }