Exemple #1
0
        /*
         * Pre:
         * Post: Update the list of available students
         */
        private void updateStudentDropdown()
        {
            ddlStudent.DataSource = null;
            ddlStudent.DataBind();
            ddlStudent.Items.Clear();

            if (ddlTeacher.SelectedIndex > 0 || HighestPermissionTeacher())
            {
                int teacherId = Convert.ToInt32(ddlTeacher.SelectedValue);

                DataTable table = DbInterfaceStudent.GetStudentSearchResultsForTeacher("", "", "", teacherId);

                if (table != null)
                {
                    //add empty item
                    ddlStudent.Items.Add(new ListItem("", ""));

                    //add students for teacher
                    ddlStudent.DataSource = table;

                    ddlStudent.DataTextField  = "ComboName";
                    ddlStudent.DataValueField = "StudentId";

                    ddlStudent.DataBind();
                }
                else
                {
                    showErrorMessage("Error: The students for the selected teacher could not be retrieved.");
                }
            }
        }
Exemple #2
0
        /*
         * Pre:
         * Post: The information associated with the selected audition is loaded to the page
         */
        protected void cboAudition_SelectedIndexChanged(object sender, EventArgs e)
        {
            rblLength.SelectedIndex = -1;
            lblCurrentLength.Text   = "";

            //load associated audition information
            if (!cboAudition.SelectedValue.ToString().Equals(""))
            {
                if (!txtStudentId.Text.Equals(""))
                {
                    Student student = DbInterfaceStudent.LoadStudentData(Convert.ToInt32(txtStudentId.Text));

                    if (student != null)
                    {
                        DistrictAudition districtAudition = DbInterfaceStudentAudition.GetStudentDistrictAudition(
                            Convert.ToInt32(cboAudition.SelectedValue), student);

                        if (districtAudition != null)
                        {
                            lblCurrentLength.Text = districtAudition.auditionLength.ToString();
                        }
                        else
                        {
                            showErrorMessage("Error: An error occurred while loading the audition information.");
                        }
                    }
                    else
                    {
                        showWarningMessage("Please reselect the student");
                    }
                }
            }
        }
Exemple #3
0
        /*
         * Pre:
         * Post: Loads the information of the selected audition and saves it to a session variable
         */
        private void resetAuditionVar()
        {
            try
            {
                int     auditionId = Convert.ToInt32(cboAudition.SelectedValue);
                int     studentId  = Convert.ToInt32(Convert.ToInt32(txtStudentId.Text));
                Student student    = DbInterfaceStudent.LoadStudentData(studentId);

                //get all audition info associated with audition id and save as session variable
                if (student != null)
                {
                    audition = new StateAudition(auditionId, student, false);
                    audition = DbInterfaceStudentAudition.GetStudentStateAudition(audition.districtAudition, auditionId);

                    if (audition != null)
                    {
                        Session[auditionVar] = audition;

                        //if the audition was a duet, show label to inform user that the points for the
                        //partner will also be updated
                        if (audition.auditionType.ToUpper().Equals("DUET"))
                        {
                            showInfoMessage("The composition points of the student's duet partner will also be updated.");
                        }

                        setPoints();
                    }
                }
            }
            catch (Exception e)
            {
                Utility.LogError("Badger Point Entry", "resetAuditionVar", "", "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }
        }
        /*
         * Pre:
         * Post: Get audition information for the input year, audition type, and student
         *       if a matching audition exists
         * @param studentId is the unique id of the student
         * @year is the year of the audition
         * @auditionType signifies whether the points are being entered for HS Virtuoso
         *               or Composition
         */
        private void loadAudition(int studentId, int year, string auditionType)
        {
            //get student
            Student student = DbInterfaceStudent.LoadStudentData(studentId);

            //get audition
            if (student != null)
            {
                audition = DbInterfaceStudentAudition.GetStudentHsOrCompositionAudition(student, year, auditionType);

                Session[auditionVar] = audition;

                //set points on screen
                if (audition != null)
                {
                    setPoints();
                }
                else
                {
                    rblAttendance.SelectedIndex = 1;
                    ddlRoomAward.SelectedIndex  = 0;
                    lblPoints.InnerText         = "0";
                    btnSubmit.Text       = "Submit";
                    ddlRoomAward.Enabled = true;
                }
            }
            else
            {
                lblErrorMsg.Text    = "There was an error loading the student data";
                lblErrorMsg.Visible = true;
            }
        }
        /*
         * Pre:
         * Post:  The information for the selected student is loaded to the page
         */
        protected void gvStudent2Search_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = gvStudent2Search.SelectedIndex;

            lblStudent2SearchError.Visible = false;

            if (index >= 0 && index < gvStudent2Search.Rows.Count)
            {
                string id        = gvStudent2Search.Rows[index].Cells[1].Text;
                string firstName = gvStudent2Search.Rows[index].Cells[2].Text;
                string lastName  = gvStudent2Search.Rows[index].Cells[3].Text;

                //load student data to avoid the bug where ' shows up as &#39; if the data is just taken from the gridview
                Student student = DbInterfaceStudent.LoadStudentData(Convert.ToInt32(id));
                if (student != null)
                {
                    firstName = student.firstName;
                    lastName  = student.lastName;
                }

                //load search fields
                txtStudent2Id.Text      = id;
                txtFirstName2.Text      = firstName;
                txtLastName2.Text       = lastName;
                lblStudent2Id.InnerText = id;

                //select student from dropdown
                ddlStudent2.SelectedValue = txtStudent2Id.Text;

                //hide search area
                pnlStudent2Search.Visible = false;
                clearStudent2Search();
                btnStudent2Search.Visible = true;
            }
        }
Exemple #6
0
        /*
         * Pre:  txtStudentId must contain a student id that exists in the system
         * Post: The student's information is loaded to the page
         */
        private Student loadStudentData(int id)
        {
            Student student = DbInterfaceStudent.LoadStudentData(id);

            //get general student information
            if (student != null)
            {
                //load rest of search fields
                txtFirstNameSearch.Text = student.firstName;
                txtLastNameSearch.Text  = student.lastName;

                //load student data
                lblId.Text                   = id.ToString();
                txtFirstName.Text            = student.firstName;
                txtMiddleInitial.Text        = student.middleInitial;
                txtLastName.Text             = student.lastName;
                cboDistrict.SelectedIndex    = cboDistrict.Items.IndexOf(cboDistrict.Items.FindByValue(student.districtId.ToString()));
                txtGrade.Text                = student.grade;
                cboCurrTeacher.SelectedIndex = cboCurrTeacher.Items.IndexOf(cboCurrTeacher.Items.FindByValue(student.currTeacherId.ToString()));
                cboPrevTeacher.SelectedIndex = cboPrevTeacher.Items.IndexOf(cboPrevTeacher.Items.FindByValue(student.prevTeacherId.ToString()));
            }
            else
            {
                lblStudentSearchError.Text    = "The student's information could not be loaded";
                lblStudentSearchError.Visible = true;
            }

            return(student);
        }
Exemple #7
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();
            }
        }
 /*
  * Pre:  The student must have an entry in the DataStudentYearHistory table
  *       for the current year.
  * Post: The year id is set for the current student
  */
 private void setYearId()
 {
     //if (!reason.ToUpper().Equals("DUET"))
     yearId = DbInterfaceStudent.GetStudentYearId(student.id);
     //else
     //    yearId = -1;
 }
Exemple #9
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;
            }
        }
        /*
         * Pre:
         * Post: Get audition information for the input year, audition type, and student
         *       if a matching audition exists
         * @param studentId is the unique id of the student
         * @year is the year of the audition
         * @auditionType signifies whether the points are being entered for HS Virtuoso
         *               or Composition
         */
        private void loadAudition(int studentId, int year, string auditionType)
        {
            //get student
            Student student = DbInterfaceStudent.LoadStudentData(studentId);

            //get audition
            if (student != null)
            {
                audition = DbInterfaceStudentAudition.GetStudentHsOrCompositionAudition(student, year, auditionType);

                Session[auditionVar] = audition;

                //set points on screen
                if (audition != null)
                {
                    setPoints();
                }
                else
                {
                    rblAttendance.SelectedIndex = 0;
                    ddlRoomAward.SelectedIndex  = 0;
                    ddlRoomAward.Enabled        = true;
                    lblPoints.Text = "10";
                }
            }
            else
            {
                showErrorMessage("Error: There was an error loading the student data.");
            }
        }
        private void LoadYearsLegacyPoints()
        {
            int studentId = Convert.ToInt32(lblId.Text);
            int points    = DbInterfaceStudent.GetLegacyPointsForYear(studentId, Convert.ToInt32(ddlLegacyPtsYear.SelectedValue));

            txtLegacyPoints.Text = points.ToString();
        }
        /*
         * Pre:   The selected index must be a positive number less than the number of rows
         *        in the gridView
         * Post:  The information for the selected student is loaded to the page
         */
        protected void gvStudentSearch_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblStudentError.Visible = false;
            clearAllExceptSearch();

            int index = gvStudentSearch.SelectedIndex;

            if (index >= 0 && index < gvStudentSearch.Rows.Count)
            {
                string id        = gvStudentSearch.Rows[index].Cells[1].Text;
                string firstName = gvStudentSearch.Rows[index].Cells[2].Text;
                string lastName  = gvStudentSearch.Rows[index].Cells[3].Text;

                //load student data to avoid the bug where ' shows up as &#39; if the data is just taken from the gridview
                Student student = DbInterfaceStudent.LoadStudentData(Convert.ToInt32(id));
                if (student != null)
                {
                    firstName = student.firstName;
                    lastName  = student.lastName;
                }

                txtStudentId.Text    = id;
                txtFirstName.Text    = firstName;
                txtLastName.Text     = lastName;
                lblStudent.InnerText = firstName + " " + lastName;
                lblStudId.InnerText  = id;
            }
        }
        /*
         * Pre:
         * Post: Loads the information of the selected audition and saves it to a session variable
         */
        private void resetAuditionVar()
        {
            int studentId;

            try
            {
                if (Int32.TryParse(txtStudentId.Text, out studentId))
                {
                    Student student      = DbInterfaceStudent.LoadStudentData(studentId);
                    int     year         = Convert.ToInt32(ddlYear.SelectedValue);
                    string  auditionType = ddlAuditionType.SelectedValue;

                    //get all audition info associated with audition id and save as session variable
                    if (student != null)
                    {
                        audition             = new HsVirtuosoCompositionAudition(student, year, auditionType);
                        Session[auditionVar] = audition;
                    }
                }
            }
            catch (Exception e)
            {
                Utility.LogError("HS Virtuoso Composition Point Entry", "resetAuditionVar", "", "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }
        }
        /*
         * Pre:
         * Post: If the entered data is valid, the coordination is set between the two students
         */
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            bool success = true;

            if (dataIsValid())
            {
                string reason             = ddlReason.SelectedValue;
                bool   isDistrictAudition = ddlAuditionType.SelectedValue.Equals("District");

                // Put all students into a list
                List <Tuple <Student, StudentCoordinate> > students = new List <Tuple <Student, StudentCoordinate> >();
                for (int i = 1; i < tblCoordinates.Rows.Count; i++)
                {
                    Student student = DbInterfaceStudent.LoadStudentData(Convert.ToInt32(tblCoordinates.Rows[i].Cells[1].Text));

                    // Get the student's coordinates and add to list
                    if (student != null)
                    {
                        StudentCoordinate coordinate = new StudentCoordinate(student, reason, true, isDistrictAudition);
                        students.Add(new Tuple <Student, StudentCoordinate>(student, coordinate));
                    }
                    else
                    {
                        success = false;
                    }
                }

                // Coordinate all students
                for (int i = 0; i < students.Count - 1; i++)
                {
                    StudentCoordinate student1Coordinates = students.ElementAt(i).Item2;

                    for (int j = i + 1; j < students.Count; j++) // Coordinate student1 with all of the remaining students in the list
                    {
                        StudentCoordinate student2Coordinates = students.ElementAt(j).Item2;

                        foreach (int student1Id in student1Coordinates.auditionIds)
                        {
                            foreach (int student2Id in student2Coordinates.auditionIds)
                            {
                                success = success && DbInterfaceStudentAudition.CreateAuditionCoordinate(student1Id, student2Id, reason);
                            }
                        }
                    }
                }

                //display message depending on whether or not the operation was successful
                if (success)
                {
                    showSuccessMessage("The students were successfully coordinated.");
                    clearPage();
                }
                else
                {
                    showErrorMessage("Error: An error occurred while coordinating the students.");
                }
            }
        }
        /*
         * Pre:  id must be an integer or the empty string
         * Post:  The input parameters are used to search for existing students for the currently logged
         *        in teacher.  Matching student information is displayed in the input gridview.
         * @param gridView is the gridView in which the search results will be displayed
         * @param id is the id being searched for - must be an integer or the empty string
         * @param firstName is all or part of the first name being searched for
         * @param lastName is all or part of the last name being searched for
         * @param teacherContactId is the id of the current teacher
         * @returns true if results were found and false otherwise
         */
        private bool searchOwnStudents(GridView gridView, string id, string firstName, string lastName, string session, int teacherContactId)
        {
            bool result = true;

            try
            {
                DataTable table = DbInterfaceStudent.GetStudentSearchResultsForTeacher(id, firstName, lastName, teacherContactId);

                //If there are results in the table, display them.  Otherwise clear current
                //results and return false
                if (table != null && table.Rows.Count > 0)
                {
                    gridView.DataSource = table;
                    gridView.DataBind();

                    //save the data for quick re-binding upon paging
                    Session[session] = table;
                }
                else if (table != null && table.Rows.Count == 0)
                {
                    clearGridView(gridView);
                    result = false;
                }
                else if (table == null)
                {
                    if (gridView == gvStudent1Search)
                    {
                        lblStudent1SearchError.Text    = "An error occurred during the search";
                        lblStudent1SearchError.Visible = true;
                    }
                    else
                    {
                        lblStudent2SearchError.Text    = "An error occurred during the search";
                        lblStudent2SearchError.Visible = true;
                    }
                }
            }
            catch (Exception e)
            {
                if (gridView == gvStudent1Search)
                {
                    lblStudent1SearchError.Text    = "An error occurred during the search";
                    lblStudent1SearchError.Visible = true;
                }
                else
                {
                    lblStudent2SearchError.Text    = "An error occurred during the search";
                    lblStudent2SearchError.Visible = true;
                }

                Utility.LogError("Coordinate Students", "searchOwnStudents", "gridView: " + gridView.ID + ", id: " + id +
                                 ", firstName: " + firstName + ", lastName: " + lastName + ", session: " + session,
                                 "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            return(result);
        }
        /*
         * Pre:  The current user's highest permission level is teacher
         * Post: The only student's shown in the student dropdowns belong to th current teacher
         * @param contactId is the id of the teachers whose students should be shown
         */
        private void showTeacherStudentsOnly(int contactId)
        {
            DataTable table = DbInterfaceStudent.GetStudentSearchResultsForTeacher("", "", "", contactId);

            ddlStudent1.DataSourceID = null;
            ddlStudent1.DataSource   = table;
            ddlStudent1.DataBind();

            ddlStudent2.DataSourceID = null;
            ddlStudent2.DataSource   = table;
            ddlStudent2.DataBind();
        }
        /*
         * Pre:  The current user's highest permission level is district admin
         * Post: The only student's shown in the student dropdowns belong to th current district admin
         * @param districtId is the id of the district to get students from
         */
        private void showDistrictStudentsOnly(int districtId)
        {
            DataTable table = DbInterfaceStudent.GetStudentSearchResults("", "", "", districtId);

            ddlStudent1.DataSourceID = null;
            ddlStudent1.DataSource   = table;
            ddlStudent1.DataBind();

            ddlStudent2.DataSourceID = null;
            ddlStudent2.DataSource   = table;
            ddlStudent2.DataBind();
        }
        /*
         * Pre:
         * Post: Determines whether or not the student being added is a duplicate
         * @returns true if the student is a duplicate and false otherwise
         */
        private bool studentIsDuplicate(string firstName, string lastName)
        {
            bool duplicate = false;

            DataTable duplicateStudentsTbl = DbInterfaceStudent.StudentExists(firstName, lastName);

            if (duplicateStudentsTbl != null && duplicateStudentsTbl.Rows.Count > 0)
            {
                duplicate = true;
            }

            return(duplicate);
        }
Exemple #19
0
        /*
         * Pre:  studentId must exist as a StudentId in the system
         * Post: The existing data for the student associated to the studentId
         *       is loaded to the page.
         * @param studentId is the StudentId of the student being registered
         */
        private Student loadStudentData(int studentId, bool initialLoad)
        {
            Student student = null;

            try
            {
                student = DbInterfaceStudent.LoadStudentData(studentId);

                //get eligible auditions
                if (student != null)
                {
                    DataTable table = DbInterfaceStudentAudition.GetStateAuditionsForPointEntryDropdown(student, Convert.ToInt32(ddlYear.SelectedValue));
                    cboAudition.DataSource = null;
                    cboAudition.Items.Clear();
                    cboAudition.DataSourceID = "";

                    //load student name
                    txtFirstName.Text = student.firstName;
                    txtLastName.Text  = student.lastName;
                    lblStudent.Text   = student.firstName + " " + student.lastName;

                    if (table.Rows.Count > 0)
                    {
                        cboAudition.DataSource     = table;
                        cboAudition.DataTextField  = "DropDownInfo";
                        cboAudition.DataValueField = "AuditionId";
                        cboAudition.Items.Add(new ListItem(""));
                        cboAudition.DataBind();
                    }
                    else if (!initialLoad)
                    {
                        showWarningMessage("The student has no eligible auditions for the selected year.");
                    }

                    upStudentSearch.Visible = false;
                    pnlInfo.Visible         = true;
                }
                else
                {
                    showErrorMessage("Error: An error occurred while loading the student data.");
                }
            }
            catch (Exception e)
            {
                showErrorMessage("Error: An error occurred while loading the student data.");

                Utility.LogError("Badger Point Entry", "loadStudentData", "studentId: " + studentId, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            return(student);
        }
Exemple #20
0
        /*
         * Pre:  studentId must exist as a StudentId in the system
         * Post: The existing data for the student associated to the studentId
         *       is loaded to the page.
         * @param studentId is the StudentId of the student being registered
         * @returns the student information
         */
        private Student LoadStudentData(int studentId)
        {
            Student student = null;

            try
            {
                student = DbInterfaceStudent.LoadStudentData(studentId);

                //get general student information
                if (student != null)
                {
                    lblStudentId.Text = studentId.ToString();
                    txtFirstName.Text = student.firstName;
                    txtLastName.Text  = student.lastName;
                    lblName.Text      = student.lastName + ", " + student.firstName + " " + student.middleInitial;

                    // Get editable auditions
                    DataTable table = DbInterfaceStudentAudition.GetDistrictAuditionsForDropdown(student, false);
                    cboAudition.DataSource = null;
                    cboAudition.Items.Clear();
                    cboAudition.DataSourceID = "";

                    if (table.Rows.Count > 0 && (student.grade.Equals("11") || student.grade.Equals("12")))
                    {
                        cboAudition.DataSource = table;
                        cboAudition.Items.Add(new ListItem(""));
                        cboAudition.DataBind();
                    }
                    else if (!(student.grade.Equals("11") || student.grade.Equals("12")))
                    {
                        showWarningMessage("The selected student is not in 11/12th grade, the audition length cannot be adjusted.");
                    }
                    else
                    {
                        showWarningMessage("This student has no editable auditions. Add a new registration for this student with the 'Add Registration' option");
                    }
                }
                else
                {
                    showErrorMessage("An error occurred loading the student data");
                }
            }
            catch (Exception e)
            {
                showErrorMessage("An error occurred loading the student data");

                Utility.LogError("Add Extra Audition Time", "LoadStudentData", "studentId: " + studentId, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            return(student);
        }
        /*
         * Pre:
         * Post: If the entered data is valid, the coordination is set between the two students
         */
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            bool success = true;

            clearErrors();

            if (dataIsValid())
            {
                string reason             = ddlReason.SelectedValue;
                bool   isDistrictAudition = ddlAuditionType.SelectedValue.Equals("District");

                //get student data
                Student student1 = DbInterfaceStudent.LoadStudentData(Convert.ToInt32(lblStudent1Id.InnerText));
                Student student2 = DbInterfaceStudent.LoadStudentData(Convert.ToInt32(lblStudent2Id.InnerText));

                //get coordinate data
                if (student1 != null & student2 != null)
                {
                    StudentCoordinate coord1 = new StudentCoordinate(student1, reason, true, isDistrictAudition);
                    StudentCoordinate coord2 = new StudentCoordinate(student2, reason, true, isDistrictAudition);

                    //coordinate each audition between the two students
                    foreach (int i in coord1.auditionIds)
                    {
                        foreach (int j in coord2.auditionIds)
                        {
                            success = success && DbInterfaceStudentAudition.CreateAuditionCoordinate(i, j, reason);
                        }
                    }
                }
                else
                {
                    success = false;
                }
            }

            //display message depending on whether or not the operation was successful
            if (success)
            {
                displaySuccessMessageAndOptions();
            }
            else
            {
                lblMainError.Text    = "An error occurred while coordinating the students.";
                lblMainError.Visible = true;
            }
        }
Exemple #22
0
        /*
         * Pre:
         * Post: Loads the information of the selected audition and saves it to a session variable
         */
        private void resetAuditionVar()
        {
            try
            {
                int     auditionId = Convert.ToInt32(cboAudition.SelectedValue);
                int     studentId  = Convert.ToInt32(Convert.ToInt32(txtStudentId.Text));
                Student student    = DbInterfaceStudent.LoadStudentData(studentId);

                //get all audition info associated with audition id and save as session variable
                if (student != null)
                {
                    audition = DbInterfaceStudentAudition.GetStudentDistrictAudition(auditionId, student);

                    if (audition != null)
                    {
                        Session[auditionVar] = audition;

                        //if the audition was a duet, show label to inform user that the points for the
                        //partner will also be updated
                        if (audition.auditionType.ToUpper().Equals("DUET"))
                        {
                            lblDuetPartnerInfo.Visible = true;
                        }
                        else
                        {
                            lblDuetPartnerInfo.Visible = false;
                        }

                        loadCompositions();
                        txtTheoryPoints.Text = audition.theoryPoints.ToString();
                        calculatePointTotal();
                    }
                }
            }
            catch (Exception e)
            {
                lblErrorMsg.Text    = "An error occurred";
                lblErrorMsg.Visible = true;

                Utility.LogError("District Point Entry", "resetAuditionVar", "", "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }
        }
        /*
         * Pre:  studentId must exist as a StudentId in the system
         * Post: The existing data for the student associated to the studentId
         *       is loaded to the page.
         * @param studentId is the StudentId of the student being registered
         */
        private Student loadStudentData(int studentId, bool initialLoad)
        {
            Student student = DbInterfaceStudent.LoadStudentData(studentId);

            //get eligible auditions
            if (student != null)
            {
                DataTable table = DbInterfaceStudentAudition.GetDistrictAuditionsForPointEntryDropdown(student, Convert.ToInt32(ddlYear.SelectedValue));
                cboAudition.DataSource = null;
                cboAudition.Items.Clear();
                cboAudition.DataSourceID = "";

                //load student name
                txtFirstName.Text = student.firstName;
                txtLastName.Text  = student.lastName;
                lblStudent.Text   = student.firstName + " " + student.lastName;

                if (table.Rows.Count > 0)
                {
                    cboAudition.DataSource     = table;
                    cboAudition.DataTextField  = "DropDownInfo";
                    cboAudition.DataValueField = "AuditionId";
                    cboAudition.Items.Add(new ListItem(""));
                    cboAudition.DataBind();
                }
                else if (!initialLoad)
                {
                    showWarningMessage("This student has no district auditions to award points to for the selected year.");
                }

                pnlInfo.Visible         = true;
                upStudentSearch.Visible = false;
            }
            else
            {
                showErrorMessage("An error occurred while loading the student's audition data.");
            }

            return(student);
        }
Exemple #24
0
        /*
         * Pre:  id must be an integer or the empty string
         * Post:  The input parameters are used to search for existing students.  Matching student
         *        information is displayed in the input gridview.
         * @param gridView is the gridView in which the search results will be displayed
         * @param id is the id being searched for - must be an integer or the empty string
         * @param firstName is all or part of the first name being searched for
         * @param lastName is all or part of the last name being searched for
         * @returns true if results were found and false otherwise
         */
        private bool searchStudents(GridView gridView, string id, string firstName, string lastName, string session)
        {
            bool result = true;

            try
            {
                DataTable table = DbInterfaceStudent.GetStudentSearchResults(id, firstName, lastName, -1);

                //If there are results in the table, display them.  Otherwise clear current
                //results and return false
                if (table != null && table.Rows.Count > 0)
                {
                    gridView.DataSource = table;
                    gridView.DataBind();

                    //save the data for quick re-binding upon paging
                    Session[session] = table;
                }
                else if (table != null && table.Rows.Count == 0)
                {
                    clearGridView(gridView);
                    result = false;
                }
                else if (table == null)
                {
                    showWarningMessage("An error occurred during the search.");
                }
            }
            catch (Exception e)
            {
                showWarningMessage("An error occurred during the search.");

                Utility.LogError("Badger Point Entry", "searchStudents", "gridView: " + gridView.ID + ", id: " + id +
                                 ", firstName: " + firstName + ", lastName: " + lastName + ", session: " + session,
                                 "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            return(result);
        }
Exemple #25
0
        /*
         * Pre:  studentId must exist as a StudentId in the system
         * Post: The existing data for the student associated to the studentId
         *       is loaded to the page.
         * @param studentId is the StudentId of the student being registered
         */
        private Student loadStudentData(int studentId)
        {
            Student student = DbInterfaceStudent.LoadStudentData(studentId);

            //get eligible auditions
            if (student != null)
            {
                DataTable table = DbInterfaceStudentAudition.GetDistrictAuditionsForDropdownByYear(student, Convert.ToInt32(ddlYear.SelectedValue));
                cboAudition.DataSource = null;
                cboAudition.Items.Clear();
                cboAudition.DataSourceID = "";

                //load student name
                txtFirstName.Text = student.firstName;
                txtLastName.Text  = student.lastName;
                lblStudent.Text   = student.firstName + " " + student.lastName;

                if (table.Rows.Count > 0)
                {
                    cboAudition.DataSource     = table;
                    cboAudition.DataTextField  = "DropDownInfo";
                    cboAudition.DataValueField = "AuditionId";
                    cboAudition.Items.Add(new ListItem(""));
                    cboAudition.DataBind();
                }
                else
                {
                    lblAuditionError.InnerText = "This student has no district auditions to award points to for the selected year";
                    lblAuditionError.Visible   = true;
                }
            }
            else
            {
                lblErrorMsg.Text    = "An error occurred while loading the student's audition data";
                lblErrorMsg.Visible = true;
            }

            return(student);
        }
        /*
         * Pre:  txtStudentId must contain a student id that exists in the system
         * Post: The student's information is loaded to the page
         */
        private Student loadStudentData(int id)
        {
            Student student = DbInterfaceStudent.LoadStudentData(id);

            //get general student information
            if (student != null)
            {
                //load rest of search fields
                txtFirstNameSearch.Text = student.firstName;
                txtLastNameSearch.Text  = student.lastName;

                //bind dropdowns in case it hasn't been done yet
                ddlDistrict.DataBind();
                cboCurrTeacher.DataBind();
                cboPrevTeacher.DataBind();

                //load student data
                lblId.Text                   = id.ToString();
                txtFirstName.Text            = student.firstName;
                txtMiddleInitial.Text        = student.middleInitial;
                txtLastName.Text             = student.lastName;
                ddlDistrict.SelectedIndex    = ddlDistrict.Items.IndexOf(ddlDistrict.Items.FindByValue(student.districtId.ToString()));
                txtGrade.Text                = student.grade;
                cboCurrTeacher.SelectedIndex = cboCurrTeacher.Items.IndexOf(cboCurrTeacher.Items.FindByValue(student.currTeacherId.ToString()));
                cboPrevTeacher.SelectedIndex = cboPrevTeacher.Items.IndexOf(cboPrevTeacher.Items.FindByValue(student.prevTeacherId.ToString()));
                lblLegacyPoints.Text         = student.legacyPoints.ToString();
                lblTotalPoints.Text          = student.getTotalPoints().ToString();

                pnlButtons.Visible       = true;
                pnlFullPage.Visible      = true;
                pnlStudentSearch.Visible = false;
            }
            else
            {
                showErrorMessage("Error: The student's information could not be loaded");
            }

            return(student);
        }
        /*
         * 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();
            }
        }
        /*
         * Pre:
         * Post:  The selected student is added to the list of coordinates
         */
        protected void gvStudentSearch_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = gvStudentSearch.SelectedIndex;

            if (index >= 0 && index < gvStudentSearch.Rows.Count)
            {
                string id        = gvStudentSearch.Rows[index].Cells[1].Text;
                string firstName = gvStudentSearch.Rows[index].Cells[2].Text;
                string lastName  = gvStudentSearch.Rows[index].Cells[3].Text;

                // Add the student to the table if they aren't already there
                if (!StudentExists(id))
                {
                    //load student data to avoid the bug where ' shows up as &#39; if the data is just taken from the gridview
                    Student student = DbInterfaceStudent.LoadStudentData(Convert.ToInt32(id));
                    if (student != null)
                    {
                        firstName = student.firstName;
                        lastName  = student.lastName;
                    }

                    //load search fields
                    txtStudentId.Text = id;
                    txtFirstName.Text = firstName;
                    txtLastName.Text  = lastName;

                    // Add student to table
                    AddCoordinate(id, firstName, lastName);
                    clearStudentSearch();
                }
                else
                {
                    showWarningMessage("The student has already been added.");
                }
            }
        }
Exemple #29
0
        /*
         * Pre:
         * Post: If the entered data is valid, the students of the From teacher are associated with the To teacher
         */
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            bool success = true;

            if (dataIsValid())
            {
                int fromTeacherId = Convert.ToInt32(ddlFrom.SelectedValue);
                int toTeacherId   = Convert.ToInt32(ddlTo.SelectedValue);

                //do student transfer
                success = DbInterfaceStudent.TransferStudents(fromTeacherId, toTeacherId);

                //display message depending on whether or not the operation was successful
                if (success)
                {
                    showSuccessMessage("The students were successfully transferred.");
                    clearPage();
                }
                else
                {
                    showErrorMessage("Error: An error occurred while transferring the students.");
                }
            }
        }
Exemple #30
0
        /*
         * Pre:  studentId must exist as a StudentId in the system
         * Post: The existing data for the student associated to the studentId
         *       is loaded to the page.
         * @param studentId is the StudentId of the student being registered
         */
        private Student loadStudentData(int studentId, bool initialLoad)
        {
            Student student = DbInterfaceStudent.LoadStudentData(studentId);

            //get eligible auditions
            if (student != null)
            {
                //load student name
                lblStudId.InnerText = student.id.ToString();
                txtFirstName.Text   = student.firstName;
                txtLastName.Text    = student.lastName;
                lblStudent.Text     = student.firstName + " " + student.lastName;

                upAuditions.Visible     = true;
                pnlButtons.Visible      = true;
                upStudentSearch.Visible = false;
            }
            else
            {
                showErrorMessage("An error occurred while loading the student's audition data.");
            }

            return(student);
        }