/*
         * 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);
            }
        }
Пример #2
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;
            }
        }
Пример #4
0
        /*
         * 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;
            }
        }
Пример #5
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);
        }
        /*
         * 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;
            }
        }
Пример #7
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");
                    }
                }
            }
        }
        /*
         * 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.");
            }
        }
Пример #9
0
        /*
         * 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.");
                }
            }
        }
Пример #10
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);
        }
Пример #11
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);
        }
Пример #12
0
        /*
         * 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;
            }
        }
Пример #13
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);
            }
        }
Пример #14
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)
            {
                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);
        }
Пример #15
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);
        }
Пример #16
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;

                //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);
        }
Пример #17
0
        /*
         * 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.");
                }
            }
        }
Пример #18
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);
        }