Пример #1
0
        /*
         * Pre:
         * Post: If an event matching the search criteria is found, execute
         *       the reports for that audition
         */
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            int auditionOrgId = DbInterfaceAudition.GetAuditionOrgId(Convert.ToInt32(ddlDistrictSearch.SelectedValue),
                                                                     Convert.ToInt32(ddlYear.SelectedValue));

            if (auditionOrgId != -1)
            {
                int teacherId  = Utility.GetTeacherId((User)Session[Utility.userRole]);
                int districtId = Convert.ToInt32(ddlDistrictSearch.SelectedValue);

                showInfoMessage("Please allow several minutes for your reports to generate.");

                // Have two different report types so reports can be printed front-to-back *per student*
                // D2 and D2NM use Even paged reports and print off front-to-back without breaks since students have 2 compositions
                // D3 and State use Odd paged reports and print a blank page between students so they can be printed front-to-back, but not have multiple students on the front/back of the same piece of paper
                // Just go with it.
                createReport("DistrictPianoJudgingFormEven", rptPianoFormE, auditionOrgId, teacherId, "E");
                createReport("DistrictPianoJudgingFormOdd", rptPianoFormO, auditionOrgId, teacherId, "O");
                createReport("DistrictOrganJudgingFormEven", rptOrganFormE, auditionOrgId, teacherId, "E");
                createReport("DistrictOrganJudgingFormOdd", rptOrganFormO, auditionOrgId, teacherId, "O");
                createReport("DistrictVocalJudgingFormEven", rptVocalFormE, auditionOrgId, teacherId, "E");
                createReport("DistrictVocalJudgingFormOdd", rptVocalFormO, auditionOrgId, teacherId, "O");
                createReport("DistrictInstrumentalJudgingFormEven", rptInstrumentalFormE, auditionOrgId, teacherId, "E");
                createReport("DistrictInstrumentalJudgingFormOdd", rptInstrumentalFormO, auditionOrgId, teacherId, "O");
                createReport("DistrictStringsJudgingFormEven", rptStringsFormE, auditionOrgId, teacherId, "E");
                createReport("DistrictStringsJudgingFormOdd", rptStringsFormO, auditionOrgId, teacherId, "O");
            }
            else
            {
                showWarningMessage("No audition exists matching the input criteria.");
            }
        }
Пример #2
0
        /*
         * Load the judge's preferences and the audition's time ranges
         */
        private void LoadJudgeAndAuditionData()
        {
            if (ddlDistrict.SelectedIndex > 0 && ddlYear.SelectedIndex > 0)
            {
                int auditionOrgId = DbInterfaceAudition.GetAuditionOrgId(Convert.ToInt32(ddlDistrict.SelectedValue), Convert.ToInt32(ddlYear.SelectedValue));

                if (auditionOrgId != -1)
                {
                    //LoadAuditionTimes(auditionOrgId);
                    LoadJudgePreferences(auditionOrgId);

                    pnlJudges.Visible  = true;
                    pnlButtons.Visible = true;
                }
                else
                {
                    showWarningMessage("The audition for the selected year has not been created.");
                }
            }
            else
            {
                pnlJudges.Visible  = false;
                pnlButtons.Visible = false;
            }
        }
Пример #3
0
        /*
         * Pre:
         * Post: Load the auditions for the selected event.  Filter on teacher if a teacher was selected
         */
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            int year          = Convert.ToInt32(ddlYear.SelectedValue);
            int districtId    = Convert.ToInt32(ddlDistrictSearch.SelectedValue);
            int auditionOrgId = DbInterfaceAudition.GetAuditionOrgId(districtId, year);

            if (auditionOrgId != -1)
            {
                int teacherId = 0;
                if (ddlTeacher.SelectedIndex >= 0 && !ddlTeacher.SelectedValue.Equals(""))
                {
                    teacherId = Convert.ToInt32(ddlTeacher.SelectedValue);
                }

                // Update gridview
                Dictionary <int, StateAudition> auditions = DbInterfaceAudition.GetFullDataDump(auditionOrgId, teacherId, year, districtId);
                DataTable table = PopulateTable(auditions);
                gvAuditions.DataSource = table;
                gvAuditions.DataBind();
            }
            else
            {
                showWarningMessage("No audition exists matching the input criteria.");
            }
        }
Пример #4
0
        /*
         * Pre:
         * Post: If an event matching the search criteria is found, execute
         *       the reports for that audition
         */
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            //get selected teacher
            int teacherId = 0;

            if (ddlTeacher.SelectedIndex >= 0 && !ddlTeacher.SelectedValue.Equals(""))
            {
                teacherId = Convert.ToInt32(ddlTeacher.SelectedValue);
            }

            int districtId = 0;

            if (ddlDistrictSearch.SelectedIndex >= 0 && !ddlDistrictSearch.SelectedValue.Equals(""))
            {
                districtId = Convert.ToInt32(ddlDistrictSearch.SelectedValue);
            }

            int auditionOrgId = DbInterfaceAudition.GetAuditionOrgId(districtId,
                                                                     Convert.ToInt32(ddlYear.SelectedValue));

            if (auditionOrgId != -1)
            {
                showInfoMessage("Please allow several minutes for your reports to generate.");

                createReport("DistrictTeacherDetail", rptTeacherDetail, auditionOrgId, teacherId);
            }
            else
            {
                showWarningMessage("No audition exists matching the input criteria.");
            }
        }
Пример #5
0
        /*
         * Pre:  audition must exist as the id of an audition in the system
         * Post: The existing data for the audition associated with the auditionId
         *       is loaded to the page.
         * @param auditionId is the id of the audition being edited
         */
        private void loadSchedule(int auditionId)
        {
            try
            {
                DataTable scheduleTable = DbInterfaceAudition.LoadEventScheduleDataTable(auditionId, true);
                //load data to page
                if (scheduleTable != null && scheduleTable.Rows.Count > 0)
                {
                    gvSchedule.DataSource = scheduleTable;
                    gvSchedule.DataBind();
                    Session[scheduleData] = scheduleTable;
                }
                else
                {
                    showErrorMessage("Error: The schedule information could not be loaded.  Please make sure that a schedule has been created and saved.");
                    Session[scheduleData] = null;
                }
            }
            catch (Exception e)
            {
                showErrorMessage("Error: An error occurred while loading the audition data.");

                Utility.LogError("Schedule View", "loadSchedule", "auditionId: " + auditionId, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "RefreshDatepickers", "refreshDatePickers()", true);
        }
        /*
         * Pre:  id must be an integer or the empty string
         * Post: The input parameters are used to search for existing auditions.  Matchin audition
         *       information is displayed in the input gridview
         * @param gridview is the gridview in which the search results will be displayed
         * @param district is the district id of the audition being searched for
         * @param year is the year of the audition being searched for
         */
        private bool searchAuditions(GridView gridview, int districtId, int year, string session)
        {
            bool result = true;

            try
            {
                DataTable table = DbInterfaceAudition.GetAuditionSearchResults("", "", districtId, year);

                //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
                {
                    showInfoMessage("The search did not return any results.");
                    clearGridView(gridview);
                    result = false;
                }
            }
            catch (Exception e)
            {
                showErrorMessage("Error: An error occurred during the search.");

                Utility.LogError("AssignBadgerRoomsAndJudges", "searchAuditions", "gridView: " + gridview.ID + ", districtId: " + districtId + ", year: " + year, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            return(result);
        }
Пример #7
0
        /*
         * Show the times that have been assigned to the audition, but are not yet
         * submitted to the final version of the schedule
         */
        private void ShowTimes(int auditionOrgId)
        {
            DataTable scheduleTable = DbInterfaceAudition.LoadEventScheduleDataTable(auditionOrgId, false);

            //load data to page
            if (scheduleTable != null && scheduleTable.Rows.Count > 0)
            {
                gvSchedule.DataSource = scheduleTable;
                gvSchedule.DataBind();
                Session[scheduleData] = scheduleTable;

                // Switch buttons
                btnSaveOrder.Visible   = false;
                btnAssignTimes.Visible = false;
                pnlInputs.Visible      = false;
                btnContinue.Visible    = true;
                btnSave.Visible        = true;
                lblAudition2.Visible   = true;
            }
            else
            {
                showErrorMessage("Error: The schedule information could not be loaded.  Please make sure that a schedule has been created and saved.");
                Session[scheduleData] = null;
            }
        }
Пример #8
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();
            }
        }
Пример #9
0
        /*
         * Pre:
         * Post: If an event matching the search criteria is found, execute
         *       the reports for that audition
         */
        //Modified by Daniel Leo 3/3/2019
        //Added AC and PE tests

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string[]       theoryTests = new string[] { "AA", "AB", "AC", "EA-alto", "EA-bass", "EA-keybrd", "EA-treble", "EB-alto", "EB-bass", "EB-keybrd", "EB-treble", "EC", "IA", "IB", "IC", "PE" };
            ReportViewer[] rptViewers  = new ReportViewer[] { rptAA, rptAB, rptAC, rptEAalto, rptEAbass, rptEAkeybrd, rptEAtreble, rptEBalto, rptEBbass, rptEBkeybrd, rptEBtreble, rptEC, rptIA, rptIB, rptIC, rptPE };

            Tuple <int, string> orgIdAndSeries = DbInterfaceAudition.GetAuditionOrgIdAndTestSeries(Convert.ToInt32(ddlDistrictSearch.SelectedValue),
                                                                                                   Convert.ToInt32(ddlYear.SelectedValue));

            if (orgIdAndSeries.Item1 != -1 && !orgIdAndSeries.Item2.Equals(""))
            {
                int    auditionOrgId = orgIdAndSeries.Item1;
                string testSeries    = orgIdAndSeries.Item2;

                showInfoMessage("Please allow several minutes for your reports to generate.");

                for (int i = 0; i < theoryTests.Count(); i++)
                {
                    createReport("Theory_" + testSeries + "_" + theoryTests[i], rptViewers[i], auditionOrgId, testSeries, theoryTests[i]);
                }
            }
            else if (orgIdAndSeries.Item1 == -1)
            {
                showWarningMessage("No audition exists matching the input criteria.");
            }
            else if (orgIdAndSeries.Item2.Equals(""))
            {
                showWarningMessage("The selected audition does not have a theory test series specified.");
            }
        }
Пример #10
0
        /*
         * Pre:  id must be an integer or the empty string
         * Post: The input parameters are used to search for existing auditions.  Matchin audition
         *       information is displayed in the input gridview
         * @param gridview is the gridview in which the search results will be displayed
         * @param district is the district id of the audition being searched for
         * @param year is the year of the audition being searched for
         */
        private bool searchAuditions(GridView gridview, int districtId, int year, string session)
        {
            bool result = true;

            try
            {
                DataTable table = DbInterfaceAudition.GetAuditionSearchResults("", "State", districtId, year);

                //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
                {
                    clearGridView(gridview);
                    result = false;
                }
            }
            catch (Exception e)
            {
                lblErrorMsg.Text    = "An error occurred during the search.";
                lblErrorMsg.Visible = true;

                Utility.LogError("Create State Audition", "searchAuditions", "gridView: " + gridview.ID + ", districtId: " + districtId + ", year: " + year, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            return(result);
        }
Пример #11
0
        /*
         * Pre:
         * Post: If an event matching the search criteria is found, execute
         *       the reports for that audition
         */
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            int auditionOrgId = DbInterfaceAudition.GetAuditionOrgId(Convert.ToInt32(ddlDistrictSearch.SelectedValue),
                                                                     Convert.ToInt32(ddlYear.SelectedValue));

            if (auditionOrgId != -1)
            {
                int teacherId = 0;
                if (ddlTeacher.SelectedIndex >= 0 && !ddlTeacher.SelectedValue.Equals(""))
                {
                    teacherId = Convert.ToInt32(ddlTeacher.SelectedValue);
                }

                int districtId = Convert.ToInt32(ddlDistrictSearch.SelectedValue);

                showInfoMessage("Please allow several minutes for your reports to generate.");

                createReport("BadgerPianoJudgingForm", rptPianoForm, auditionOrgId, teacherId);
                createReport("BadgerOrganJudgingForm", rptOrganForm, auditionOrgId, teacherId);
                createReport("BadgerVocalJudgingForm", rptVocalForm, auditionOrgId, teacherId);
                createReport("BadgerStringsJudgingForm", rptStringsForm, auditionOrgId, teacherId);
                createReport("BadgerInstrumentalJudgingForm", rptInstrumentalForm, auditionOrgId, teacherId);
            }
            else
            {
                showWarningMessage("No audition exists matching the input criteria.");
            }
        }
Пример #12
0
        private void selectAudition()
        {
            User user = (User)Session[Utility.userRole];

            if (!user.permissionLevel.Contains('A') && ddlDistrictSearch.SelectedIndex > 0)
            {
                upAuditionSearch.Visible = false;
                upViewSchedule.Visible   = true;
                upInputs.Visible         = true;
                //pnlButtons.Visible = true;

                int year = DateTime.Today.Year;
                if (DateTime.Today.Month >= 6 && !Utility.reportSuffix.Equals("Test"))
                {
                    year = year + 1;
                }

                ddlYear.SelectedIndex = ddlYear.Items.IndexOf(ddlYear.Items.FindByValue(year.ToString()));

                int auditionOrgId = DbInterfaceAudition.GetAuditionOrgId(Convert.ToInt32(ddlDistrictSearch.SelectedValue), year);
                lblAudition.Text   = ddlDistrictSearch.SelectedItem.Text + " " + ddlYear.Text + " Schedule";
                lblAudition2.Text  = lblAudition.Text;
                lblAuditionId.Text = auditionOrgId.ToString();

                LoadScheduleInformation(auditionOrgId);
            }
            else if (user.permissionLevel.Contains('A'))
            {
                upAuditionSearch.Visible = false;
                upViewSchedule.Visible   = true;
                upInputs.Visible         = true;
                //pnlButtons.Visible = true;

                int index = gvAuditionSearch.SelectedIndex;

                if (index >= 0 && index < gvAuditionSearch.Rows.Count)
                {
                    ddlDistrictSearch.SelectedIndex =
                        ddlDistrictSearch.Items.IndexOf(ddlDistrictSearch.Items.FindByText(
                                                            gvAuditionSearch.Rows[index].Cells[2].Text));
                    ddlYear.SelectedIndex = ddlYear.Items.IndexOf(ddlYear.Items.FindByValue(
                                                                      gvAuditionSearch.Rows[index].Cells[3].Text));

                    lblAudition.Text   = ddlDistrictSearch.SelectedItem.Text + " " + ddlYear.Text + " Schedule";
                    lblAudition2.Text  = lblAudition.Text;
                    lblAuditionId.Text = gvAuditionSearch.Rows[index].Cells[1].Text;

                    LoadScheduleInformation(Convert.ToInt32(lblAuditionId.Text));
                }
            }
        }
Пример #13
0
        /*
         * Pre:
         * Post: If an event matching the search criteria is found, execute
         *       the reports for that audition
         */
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            int auditionOrgId = DbInterfaceAudition.GetAuditionOrgId(Convert.ToInt32(ddlDistrictSearch.SelectedValue),
                                                                     Convert.ToInt32(ddlYear.SelectedValue));

            if (auditionOrgId != -1)
            {
                showInfoMessage("Please allow several minutes for your reports to generate.");

                createReport("DistrictChairSummaryReport", rptSummary, auditionOrgId);
            }
            else
            {
                showWarningMessage("No audition exists matching the input criteria.");
            }
        }
Пример #14
0
        /*
         * Pre:
         * Post: If an event matching the search criteria is found, execute
         *       the reports for that audition
         */
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            int teacherId     = ddlTeacher.SelectedIndex >= 0 && !ddlTeacher.SelectedValue.Equals("") ? Convert.ToInt32(ddlTeacher.SelectedValue) : 0;
            int auditionOrgId = DbInterfaceAudition.GetAuditionOrgId(Convert.ToInt32(ddlDistrictSearch.SelectedValue),
                                                                     Convert.ToInt32(ddlYear.SelectedValue));

            if (auditionOrgId != -1)
            {
                showInfoMessage("Please allow several minutes for your reports to generate.");

                createReport("DistrictStudentResults_V2", rptResults, auditionOrgId, teacherId);
                createReportWithYear("OutOfDistrictStudentResults_V2", rptOutOfDistrictResults, Convert.ToInt32(ddlDistrictSearch.SelectedValue), teacherId, Convert.ToInt32(ddlYear.SelectedValue));
            }
            else
            {
                showWarningMessage("No audition exists matching the input criteria.");
            }
        }
        /*
         * Pre:
         * Post: If an event matching the search criteria is found, execute
         *       the reports for that audition
         */
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            int auditionOrgId = DbInterfaceAudition.GetAuditionOrgId(Convert.ToInt32(ddlDistrictSearch.SelectedValue),
                                                                     Convert.ToInt32(ddlYear.SelectedValue));

            if (auditionOrgId != -1)
            {
                int teacherId = Utility.GetTeacherId((User)Session[Utility.userRole]);

                showInfoMessage("Please allow several minutes for your reports to generate.");

                createReport("RegistrationReport_V2", rptRegistration, auditionOrgId, teacherId);
            }
            else
            {
                showWarningMessage("No audition exists matching the input criteria.");
            }
        }
        private void selectAudition()
        {
            pnlMain.Visible          = true;
            pnlButtons.Visible       = true;
            upAuditionSearch.Visible = false;
            clearAllExceptSearch();

            User user = (User)Session[Utility.userRole];

            if (!user.permissionLevel.Contains('A') && ddlDistrictSearch.SelectedIndex > 0)
            {
                int year = DateTime.Today.Year;
                if (DateTime.Today.Month >= 6)
                {
                    year = year + 1;
                }

                // Look at current year no matter what if on the test site
                if (Utility.reportSuffix.Equals("Test"))  //delete this
                {
                    year = DateTime.Today.Year;
                }

                loadAuditionData(DbInterfaceAudition.GetAuditionOrgId(Convert.ToInt32(ddlDistrictSearch.SelectedValue), year));
            }
            else if (user.permissionLevel.Contains('A'))
            {
                int index = gvAuditionSearch.SelectedIndex;

                if (index >= 0 && index < gvAuditionSearch.Rows.Count)
                {
                    ddlDistrictSearch.SelectedIndex =
                        ddlDistrictSearch.Items.IndexOf(ddlDistrictSearch.Items.FindByText(
                                                            gvAuditionSearch.Rows[index].Cells[2].Text));
                    ddlYear.SelectedIndex = ddlYear.Items.IndexOf(ddlYear.Items.FindByValue(
                                                                      gvAuditionSearch.Rows[index].Cells[3].Text));
                    loadAuditionData(Convert.ToInt32(gvAuditionSearch.Rows[index].Cells[1].Text));
                }
            }
        }
        /*
         * Pre:  audition must exist as the id of an audition in the system
         * Post: The existing data for the audition associated with the auditionId
         *       is loaded to the page.
         * @param auditionId is the id of the audition being scheduled
         * @returns the audition data
         */
        private Audition loadAuditionData(int auditionId, int year)
        {
            try
            {
                audition = DbInterfaceAudition.LoadAuditionData(auditionId);

                //load data to page
                if (audition != null)
                {
                    txtIdHidden.Text     = audition.auditionId.ToString();
                    lblAuditionSite.Text = audition.venue;
                    lblAuditionDate.Text = audition.auditionDate.ToShortDateString();

                    DataTable timePreferences = DbInterfaceAudition.LoadJudgeTimePreferenceOptions(auditionId);
                    chkLstTime.DataSource = timePreferences;
                    chkLstTime.DataBind();

                    LoadRooms(audition);
                    LoadAvailableJudgesToDropdown(audition);
                    LoadAuditionJudges(audition);
                    LoadAuditionJudgeRooms(audition);

                    Session[auditionSession] = audition;
                    pnlMain.Visible          = true;
                    upAuditionSearch.Visible = false;
                }
                else
                {
                    showErrorMessage("Error: The audition information could not be loaded. Please ensure one has been created for " + year + ".");
                }
            }
            catch (Exception e)
            {
                showErrorMessage("Error: An error occurred while loading the audition data.");

                Utility.LogError("AssignBadgerRoomsAndJudges", "loadAuditionData", "auditionId: " + auditionId, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            return(audition);
        }
Пример #18
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();
            }
        }
        private void selectAudition()
        {
            User user = (User)Session[Utility.userRole];

            if (!user.permissionLevel.Contains('A') && ddlDistrictSearch.SelectedIndex > 0)
            {
                int year = DateTime.Today.Year;
                if (DateTime.Today.Month >= 6 && !Utility.reportSuffix.Equals("Test"))
                {
                    year = year + 1;
                }

                ddlYear.SelectedIndex = ddlYear.Items.IndexOf(ddlYear.Items.FindByValue(year.ToString()));

                loadAuditionData(DbInterfaceAudition.GetAuditionOrgId(Convert.ToInt32(ddlDistrictSearch.SelectedValue), year), year);
            }
            else if (user.permissionLevel.Contains('A'))
            {
                int index = gvAuditionSearch.SelectedIndex;

                if (index >= 0 && index < gvAuditionSearch.Rows.Count)
                {
                    int auditionId = Convert.ToInt32(gvAuditionSearch.Rows[index].Cells[1].Text);

                    //populate event information
                    ddlDistrictSearch.SelectedIndex =
                        ddlDistrictSearch.Items.IndexOf(ddlDistrictSearch.Items.FindByText(
                                                            gvAuditionSearch.Rows[index].Cells[2].Text));

                    ddlYear.SelectedIndex = ddlYear.Items.IndexOf(ddlYear.Items.FindByValue(
                                                                      gvAuditionSearch.Rows[index].Cells[3].Text));

                    loadAuditionData(auditionId, Convert.ToInt32(ddlYear.SelectedValue));
                }
            }
        }
Пример #20
0
 /*
  * Pre:  All attributes must have values
  * Post: A new audition is added to the database
  */
 private void addNewAudition()
 {
     DbInterfaceAudition.AddNewAudition(this);
 }
        /*
         * Pre:
         * Post: If all entered data is valid, a new audition is created in the database
         */
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Audition audition;

            //make sure the entered data is valid before adding or updating
            if (dataIsValid())
            {
                int districtId = Convert.ToInt32(ddlDistrict.SelectedValue);
                //int numJudges = Convert.ToInt32(txtNumJudges.Text);
                string   chairperson = ddlChairPerson.SelectedValue;
                DateTime auditionDate, freezeDate;
                DateTime.TryParse(txtDate.Value, out auditionDate);
                DateTime.TryParse(txtFreezeDate.Value, out freezeDate);

                // Get session start and end times
                TimeSpan session1StartTime        = GetTime(ddlAmPmStart1, ddlHourStart1, ddlMinutesStart1);
                TimeSpan session1EndTime          = GetTime(ddlAmPmEnd1, ddlHourEnd1, ddlMinutesEnd1);
                TimeSpan session2StartTime        = GetTime(ddlAmPmStart2, ddlHourStart2, ddlMinutesStart2);
                TimeSpan session2EndTime          = GetTime(ddlAmPmEnd2, ddlHourEnd2, ddlMinutesEnd2);
                TimeSpan session3StartTime        = GetTime(ddlAmPmStart3, ddlHourStart3, ddlMinutesStart3);
                TimeSpan session3EndTime          = GetTime(ddlAmPmEnd3, ddlHourEnd3, ddlMinutesEnd3);
                TimeSpan session4StartTime        = GetTime(ddlAmPmStart4, ddlHourStart4, ddlMinutesStart4);
                TimeSpan session4EndTime          = GetTime(ddlAmPmEnd4, ddlHourEnd4, ddlMinutesEnd4);
                string   session1StartDisplayTime = GetDisplayTime(ddlAmPmStart1, ddlHourStart1, ddlMinutesStart1);
                string   session2StartDisplayTime = GetDisplayTime(ddlAmPmStart2, ddlHourStart2, ddlMinutesStart2);
                string   session3StartDisplayTime = GetDisplayTime(ddlAmPmStart3, ddlHourStart3, ddlMinutesStart3);
                string   session4StartDisplayTime = GetDisplayTime(ddlAmPmStart4, ddlHourStart4, ddlMinutesStart4);
                string   session1EndDisplayTime   = GetDisplayTime(ddlAmPmEnd1, ddlHourEnd1, ddlMinutesEnd1);
                string   session2EndDisplayTime   = GetDisplayTime(ddlAmPmEnd2, ddlHourEnd2, ddlMinutesEnd2);
                string   session3EndDisplayTime   = GetDisplayTime(ddlAmPmEnd3, ddlHourEnd3, ddlMinutesEnd3);
                string   session4EndDisplayTime   = GetDisplayTime(ddlAmPmEnd4, ddlHourEnd4, ddlMinutesEnd4);

                //if a new audition is being created and the same audition doesn't already exist, add it
                if (action == Utility.Action.Add && !DbInterfaceAudition.AuditionExists(districtId, auditionDate.Year))
                {
                    audition = new Audition(districtId, /*numJudges*/ 0, txtVenue.Text, chairperson,
                                            ddlTheorySeries.Text, auditionDate, freezeDate, session1StartTime,
                                            session1EndTime, session2StartTime, session2EndTime, session3StartTime,
                                            session3EndTime, session4StartTime, session4EndTime, session1StartDisplayTime,
                                            session2StartDisplayTime, session3StartDisplayTime, session4StartDisplayTime,
                                            session1EndDisplayTime, session2EndDisplayTime, session3EndDisplayTime, session4EndDisplayTime,
                                            true);

                    //if the audition was successfully created, display a success message and clear the page
                    if (audition.auditionId != -1)
                    {
                        showSuccessMessage("The event was successfully created.");
                        clearPage();
                    }
                    else
                    {
                        showErrorMessage("Error: The audition could not be created. Please make sure all entered data is valid.");
                    }
                }
                //update the information of an existing audition
                else if (action == Utility.Action.Edit)
                {
                    int auditionId = Convert.ToInt32(txtIdHidden.Text);

                    audition = new Audition(auditionId, districtId, /*numJudges*/ 0, txtVenue.Text, chairperson, ddlTheorySeries.SelectedValue,
                                            auditionDate, freezeDate, session1StartTime, session1EndTime, session2StartTime, session2EndTime,
                                            session3StartTime, session3EndTime, session4StartTime, session4EndTime, session1StartDisplayTime,
                                            session2StartDisplayTime, session3StartDisplayTime, session4StartDisplayTime, session1EndDisplayTime,
                                            session2EndDisplayTime, session3EndDisplayTime, session4EndDisplayTime, true);

                    if (audition.auditionId != -1 && audition.updateInDatabase())
                    {
                        showSuccessMessage("The event was successfully updated.");
                        clearPage();
                    }
                    else
                    {
                        showErrorMessage("Error: An error occurred while updating the audition.");
                    }
                }
                //display an error message if the audition already exists
                else
                {
                    showErrorMessage("Error: An audition for this venue already exists.");
                }
            }

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "RefreshDatepickers", "refreshDatePickers()", true);
        }
        /*
         * Pre:  audition must exist as the id of an audition in the system
         * Post: The existing data for the audition associated with the auditionId
         *       is loaded to the page.
         * @param auditionId is the id of the audition being edited
         */
        private void loadAuditionData(int auditionId)
        {
            Audition audition = null;

            try
            {
                audition = DbInterfaceAudition.LoadAuditionData(auditionId);

                //load data to page
                if (audition != null)
                {
                    txtIdHidden.Text          = audition.auditionId.ToString();
                    ddlDistrict.SelectedIndex =
                        ddlDistrict.Items.IndexOf(ddlDistrict.Items.FindByValue(
                                                      audition.districtId.ToString()));
                    txtVenue.Text = audition.venue;
                    //txtNumJudges.Text = audition.numJudges.ToString();
                    ddlChairPerson.DataBind();
                    ListItem item = ddlChairPerson.Items.FindByValue(audition.chairpersonId);
                    ddlChairPerson.SelectedIndex = ddlChairPerson.Items.IndexOf(
                        ddlChairPerson.Items.FindByValue(audition.chairpersonId));
                    ddlTheorySeries.SelectedIndex = ddlTheorySeries.Items.IndexOf(
                        ddlTheorySeries.Items.FindByValue(audition.theoryTestSeries));

                    // Set session times
                    SetTime(audition.startTimeSession1, ddlAmPmStart1, ddlHourStart1, ddlMinutesStart1);
                    SetTime(audition.endTimeSession1, ddlAmPmEnd1, ddlHourEnd1, ddlMinutesEnd1);
                    SetTime(audition.startTimeSession2, ddlAmPmStart2, ddlHourStart2, ddlMinutesStart2);
                    SetTime(audition.endTimeSession2, ddlAmPmEnd2, ddlHourEnd2, ddlMinutesEnd2);
                    SetTime(audition.startTimeSession3, ddlAmPmStart3, ddlHourStart3, ddlMinutesStart3);
                    SetTime(audition.endTimeSession3, ddlAmPmEnd3, ddlHourEnd3, ddlMinutesEnd3);
                    SetTime(audition.startTimeSession4, ddlAmPmStart4, ddlHourStart4, ddlMinutesStart4);
                    SetTime(audition.endTimeSession4, ddlAmPmEnd4, ddlHourEnd4, ddlMinutesEnd4);

                    //dates must be in form of YYYY-MM-DD
                    string month = audition.auditionDate.Month.ToString();
                    string day   = audition.auditionDate.Day.ToString();

                    if (month.Length == 1)
                    {
                        month = "0" + month;
                    }
                    if (day.Length == 1)
                    {
                        day = "0" + day;
                    }

                    txtDate.Value = audition.auditionDate.ToShortDateString();

                    month = audition.freezeDate.Month.ToString();
                    day   = audition.freezeDate.Day.ToString();

                    if (month.Length == 1)
                    {
                        month = "0" + month;
                    }
                    if (day.Length == 1)
                    {
                        day = "0" + day;
                    }

                    txtFreezeDate.Value = audition.freezeDate.ToShortDateString();
                }
                else
                {
                    showErrorMessage("Error: The audition information could not be loaded.");
                }
            }
            catch (Exception e)
            {
                showErrorMessage("Error: An error occurred while loading the audition data.");

                Utility.LogError("Create District Audition", "loadAuditionData", "auditionId: " + auditionId, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "RefreshDatepickers", "refreshDatePickers()", true);
        }
Пример #23
0
        /*
         * Pre:  audition must exist as the id of an audition in the system
         * Post: The existing data for the audition associated with the auditionId
         *       is loaded to the page.
         * @param auditionId is the id of the audition being edited
         */
        private void loadAuditionData(int auditionId)
        {
            Audition audition = null;

            try
            {
                audition = DbInterfaceAudition.LoadAuditionData(auditionId);

                //load data to page
                if (audition != null)
                {
                    txtIdHidden.Text          = audition.auditionId.ToString();
                    ddlDistrict.SelectedIndex =
                        ddlDistrict.Items.IndexOf(ddlDistrict.Items.FindByValue(
                                                      audition.districtId.ToString()));
                    txtVenue.Text                = audition.venue;
                    txtNumJudges.Text            = audition.numJudges.ToString();
                    ddlChairPerson.SelectedIndex = ddlChairPerson.Items.IndexOf(
                        ddlChairPerson.Items.FindByValue(audition.chairpersonId));
                    ddlTheorySeries.SelectedIndex = ddlTheorySeries.Items.IndexOf(
                        ddlTheorySeries.Items.FindByValue(audition.theoryTestSeries));
                    txtStartTime.Value = audition.startTime.ToString();
                    txtEndTime.Value   = audition.endTime.ToString();

                    //dates must be in form of YYYY-MM-DD
                    string month = audition.auditionDate.Month.ToString();
                    string day   = audition.auditionDate.Day.ToString();

                    if (month.Length == 1)
                    {
                        month = "0" + month;
                    }
                    if (day.Length == 1)
                    {
                        day = "0" + day;
                    }

                    txtDate.Value = audition.auditionDate.ToShortDateString();

                    month = audition.freezeDate.Month.ToString();
                    day   = audition.freezeDate.Day.ToString();

                    if (month.Length == 1)
                    {
                        month = "0" + month;
                    }
                    if (day.Length == 1)
                    {
                        day = "0" + day;
                    }

                    txtFreezeDate.Value = audition.freezeDate.ToShortDateString();
                }
                else
                {
                    lblErrorMsg.Text    = "The audition information could not be loaded";
                    lblErrorMsg.Visible = true;
                }
            }
            catch (Exception e)
            {
                lblErrorMsg.Text    = "An error occurred while loading the audition data";
                lblErrorMsg.Visible = true;

                Utility.LogError("Create District Audition", "loadAuditionData", "auditionId: " + auditionId, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }
        }
Пример #24
0
        /*
         * Pre:
         * Post: If all entered data is valid, a new audition is created in the database
         */
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Audition audition;

            clearErrors();

            //make sure the entered data is valid before adding or updating
            if (dataIsValid())
            {
                int      districtId = Convert.ToInt32(ddlDistrict.SelectedValue);
                int      numJudges = Convert.ToInt32(txtNumJudges.Text);
                string   chairperson = ddlChairPerson.SelectedValue;
                DateTime auditionDate, freezeDate;
                DateTime.TryParse(txtDate.Value, out auditionDate);
                DateTime.TryParse(txtFreezeDate.Value, out freezeDate);
                TimeSpan startTime, endTime;

                //get start time
                string tempTime = txtStartTime.Value;
                tempTime = tempTime.Substring(0, tempTime.Length - 2) + ":00 " + tempTime.Substring(tempTime.Length - 2, 2);
                if (tempTime.Length == 10)
                {
                    tempTime = "0" + tempTime;
                }
                if (tempTime.Substring(tempTime.Length - 2, 2).ToUpper().Equals("PM"))
                {
                    tempTime = Utility.ConvertToPm(tempTime);
                }
                tempTime = tempTime.Substring(0, tempTime.Length - 2);
                TimeSpan.TryParse(tempTime, out startTime);

                //get end time
                tempTime = txtEndTime.Value;
                tempTime = tempTime.Substring(0, tempTime.Length - 2) + ":00 " + tempTime.Substring(tempTime.Length - 2, 2);
                if (tempTime.Substring(tempTime.Length - 2, 2).ToUpper().Equals("PM"))
                {
                    tempTime = Utility.ConvertToPm(tempTime);
                }
                tempTime = tempTime.Substring(0, tempTime.Length - 2);
                TimeSpan.TryParse(tempTime, out endTime);

                //if a new audition is being created and the same audition doesn't already exist, add it
                if ((bool)Session[creatingNew] && !DbInterfaceAudition.AuditionExists(districtId, auditionDate.Year))
                {
                    audition = new Audition(districtId, numJudges, txtVenue.Text, chairperson,
                                            ddlTheorySeries.Text, auditionDate, freezeDate,
                                            startTime, endTime, true);

                    //if the audition was successfully created, display a success message
                    if (audition.auditionId != -1)
                    {
                        displaySuccessMessageAndOptions();
                        Session[completed] = true;
                    }
                    else
                    {
                        lblErrorMsg.Text = "The audition could not be created. Please make sure " +
                                           "all entered data is valid.";
                        lblErrorMsg.Visible = true;
                    }
                }
                //update the information of an existing audition
                else if (!(bool)Session[creatingNew])
                {
                    int auditionId = Convert.ToInt32(txtIdHidden.Text);

                    audition = new Audition(auditionId, districtId, numJudges, txtVenue.Text,
                                            chairperson, ddlTheorySeries.SelectedValue, auditionDate,
                                            freezeDate, startTime, endTime, true);

                    if (audition.auditionId != -1 && audition.updateInDatabase())
                    {
                        displaySuccessMessageAndOptions();
                        Session[completed] = true;
                    }
                    else
                    {
                        lblErrorMsg.Text    = "An error occurred while updating the audition.";
                        lblErrorMsg.Visible = true;
                    }
                }
                //display an error message if the audition already exists
                else
                {
                    lblErrorMsg.Text    = "An audition for this venue already exists";
                    lblErrorMsg.Visible = true;
                }
            }
        }
Пример #25
0
 /*
  * Pre:  The audition must already exist in the database
  * Post: The audition's information is edited in the database
  * @returns true if the update is successful and false otherwise
  */
 public bool updateInDatabase()
 {
     return(DbInterfaceAudition.EditAudition(this));
 }
Пример #26
0
        /*
         * Pre:  audition must exist as the id of an audition in the system
         * Post: The existing data for the audition associated with the auditionId
         *       is loaded to the page.
         * @param auditionId is the id of the audition being edited
         */
        private void loadAuditionData(int auditionId)
        {
            Audition audition = null;

            try
            {
                audition = DbInterfaceAudition.LoadAuditionData(auditionId);

                //load data to page
                if (audition != null)
                {
                    txtIdHidden.Text = audition.auditionId.ToString();
                    ddlDistrict.DataBind();
                    ddlDistrict.SelectedIndex =
                        ddlDistrict.Items.IndexOf(ddlDistrict.Items.FindByValue(
                                                      audition.districtId.ToString()));
                    txtVenue.Text = audition.venue;

                    if (audition.duetsAllowed)
                    {
                        ddlDuets.SelectedIndex = 1;
                    }

                    //txtNumJudges.Text = audition.numJudges.ToString();
                    ddlChairPerson.DataBind();
                    ddlChairPerson.SelectedIndex = ddlChairPerson.Items.IndexOf(
                        ddlChairPerson.Items.FindByValue(audition.chairpersonId));

                    // Set session times
                    SetTime(audition.startTimeSession1, ddlAmPmStart1, ddlHourStart1, ddlMinutesStart1);
                    SetTime(audition.endTimeSession1, ddlAmPmEnd1, ddlHourEnd1, ddlMinutesEnd1);
                    SetTime(audition.startTimeSession2, ddlAmPmStart2, ddlHourStart2, ddlMinutesStart2);
                    SetTime(audition.endTimeSession2, ddlAmPmEnd2, ddlHourEnd2, ddlMinutesEnd2);
                    SetTime(audition.startTimeSession3, ddlAmPmStart3, ddlHourStart3, ddlMinutesStart3);
                    SetTime(audition.endTimeSession3, ddlAmPmEnd3, ddlHourEnd3, ddlMinutesEnd3);
                    SetTime(audition.startTimeSession4, ddlAmPmStart4, ddlHourStart4, ddlMinutesStart4);
                    SetTime(audition.endTimeSession4, ddlAmPmEnd4, ddlHourEnd4, ddlMinutesEnd4);

                    //dates must be in form of YYYY-MM-DD
                    string month = audition.auditionDate.Month.ToString();
                    string day   = audition.auditionDate.Day.ToString();

                    if (month.Length == 1)
                    {
                        month = "0" + month;
                    }
                    if (day.Length == 1)
                    {
                        day = "0" + day;
                    }

                    txtDate.Value = audition.auditionDate.ToShortDateString();

                    month = audition.freezeDate.Month.ToString();
                    day   = audition.freezeDate.Day.ToString();

                    if (month.Length == 1)
                    {
                        month = "0" + month;
                    }
                    if (day.Length == 1)
                    {
                        day = "0" + day;
                    }

                    txtFreezeDate.Value = audition.freezeDate.ToShortDateString();
                }
                else
                {
                    showErrorMessage("Error: The competition information could not be loaded.");
                }
            }
            catch (Exception e)
            {
                showErrorMessage("Error: An error occurred while loading the competition data.");

                Utility.LogError("Create Badger Audition", "loadAuditionData", "auditionId: " + auditionId, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }
        }
Пример #27
0
        /*
         * Submit the changes to the judge's preferences for the selected audition
         */
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int  contactId = -1;
            bool success   = true;

            if (ddlDistrict.SelectedIndex > 0 && ddlYear.SelectedIndex > 0 && Int32.TryParse(lblId.Text, out contactId))
            {
                int auditionOrgId = DbInterfaceAudition.GetAuditionOrgId(Convert.ToInt32(ddlDistrict.SelectedValue), Convert.ToInt32(ddlYear.SelectedValue));

                // Delete all current preferences for the audition before updating
                DbInterfaceJudge.DeleteJudgePreferences(contactId, auditionOrgId, false);

                // Add new audition tracks
                foreach (ListItem item in chkLstTrack.Items)
                {
                    if (item.Selected && item.Value.Equals("District")) // Convert District to D2, D2NM, and D3
                    {
                        success = success && DbInterfaceJudge.AddJudgeAuditionLevel(contactId, auditionOrgId, "D2");
                        success = success && DbInterfaceJudge.AddJudgeAuditionLevel(contactId, auditionOrgId, "D2NM");
                        success = success && DbInterfaceJudge.AddJudgeAuditionLevel(contactId, auditionOrgId, "D3");
                    }
                    else if (item.Selected)
                    {
                        success = success && DbInterfaceJudge.AddJudgeAuditionLevel(contactId, auditionOrgId, "State");
                    }
                }

                // Add new audition types
                foreach (ListItem item in chkLstType.Items)
                {
                    if (item.Selected)
                    {
                        success = success && DbInterfaceJudge.AddJudgeAuditionType(contactId, auditionOrgId, item.Value);
                    }
                }

                // Add new comp levels
                foreach (ListItem item in chkLstCompLevel.Items)
                {
                    if (item.Selected)
                    {
                        success = success && DbInterfaceJudge.AddJudgeLevel(contactId, auditionOrgId, item.Value);
                    }
                }

                // Add new instruments
                foreach (ListItem item in chkLstInstrument.Items)
                {
                    if (item.Selected)
                    {
                        success = success && DbInterfaceJudge.AddJudgeInstrument(contactId, auditionOrgId, item.Value);
                    }
                }

                // Add new time preferences
                //foreach (ListItem item in chkLstTime.Items)
                //{
                //    if (item.Selected)
                //        success = success && DbInterfaceJudge.AddJudgeTime(contactId, auditionOrgId, Convert.ToInt32(item.Value));
                //}
            }
            else
            {
                showWarningMessage("Please select a judge, district, and year.");
                success = false;
            }

            if (success)
            {
                showSuccessMessage("The judge's preferences were successfully updated.");
                clearPage();
            }
            else
            {
                showErrorMessage("There was an error updating the judge's preferences");
            }
        }
Пример #28
0
        /*
         * Pre:
         * Post: Determines whether all required fields contain data and all
         *       data is in a valid format
         * @returns true if all required fields contain data and all
         *          data is in a valid format
         */
        private bool dataIsValid()
        {
            bool     result = true;
            DateTime dateVal, auditionDate;

            //make sure a district is chosen
            if (ddlDistrict.SelectedValue.ToString().Equals(""))
            {
                lblDistrictError.Visible = true;
                result = false;
            }

            //make sure a venue is entered
            if (txtVenue.Text.Equals(""))
            {
                lblVenueError.Visible = true;
                result = false;
            }

            //make sure the number of judges is a positive integer
            if (txtNumJudges.Text.Equals(""))
            {
                lblNumJudgesError.Visible = true;
                result = false;
            }
            else
            {
                int  num;
                bool isNum;

                isNum = Int32.TryParse(txtNumJudges.Text, out num);

                if (!isNum || num < 0)
                {
                    lblNumJudgesError.Visible = true;
                    result = false;
                }
            }

            //make sure a chairperson is selected
            if (ddlChairPerson.SelectedIndex <= 0)
            {
                lblChairpersonError.Visible = true;
                result = false;
            }

            //make sure a valid date is entered
            if (!DateTime.TryParse(txtDate.Value, out auditionDate))
            {
                lblDateError.Visible = true;
                result = false;
            }

            //make sure valid freeze date is entered
            if (!DateTime.TryParse(txtFreezeDate.Value, out dateVal))
            {
                lblFreezeDateError.Visible = true;
                result = false;
            }

            //make sure freeze date is before audition date
            if (!lblDateError.Visible && !lblFreezeDateError.Visible &&
                (int)((DateTime.Parse(txtDate.Value) - DateTime.Parse(txtFreezeDate.Value)).TotalDays) < 1)
            {
                int temp = (int)((DateTime.Parse(txtDate.Value) - DateTime.Parse(txtFreezeDate.Value)).TotalDays);
                lblFreezeDateError2.Visible = true;
                lblFreezeDateError.Visible  = true;
                result = false;
            }

            //make sure a valid start time is entered
            if (!DateTime.TryParse(txtStartTime.Value, out dateVal))
            {
                lblStartTimeError.Visible = true;
                result = false;
            }

            //make sure a valid end time is entered
            if (!DateTime.TryParse(txtEndTime.Value, out dateVal))
            {
                lblEndTimeError.Visible = true;
                result = false;
            }

            //make sure end time is after start time
            if (!lblStartTimeError.Visible && !lblEndTimeError.Visible &&
                DateTime.Parse(txtStartTime.Value) >= DateTime.Parse(txtEndTime.Value))
            {
                lblTimeError.Visible = true;
                result = false;
            }

            //if duets are enabled, make sure there isn't already a state audition for the upcoming year
            //that already has duets enabled
            if (ddlDuets.SelectedValue.Equals("Yes") && !lblDateError.Visible && !ddlDistrict.SelectedValue.ToString().Equals("") && !ddlDistrict.SelectedItem.Text.Contains("Non"))
            {
                if (DbInterfaceAudition.StateDuetSiteExists(DateTime.Parse(txtDate.Value).Year, Convert.ToInt32(ddlDistrict.SelectedValue)))
                {
                    lblErrorMsg.Text    = "There is already a Badger Keyboard audition with duets enabled";
                    lblErrorMsg.Visible = true;
                    result = false;
                }
            }

            return(result);
        }
Пример #29
0
 public JudgeAuditionOrganizer(Dictionary <int, List <AuditionSlot> > judgeSlots, int auditionOrgId)
 {
     JudgeSlots        = judgeSlots;
     JudgeTimeSlots    = DbInterfaceJudge.LoadAuditionJudgesTimeSlots(auditionOrgId);
     AuditionTimeSlots = DbInterfaceAudition.GetAuditionTimeSlots(auditionOrgId);
 }
Пример #30
0
        /*
         * Pre:
         * Post: Determines whether all required fields contain data and all
         *       data is in a valid format
         * @returns true if all required fields contain data and all
         *          data is in a valid format
         */
        private bool dataIsValid()
        {
            bool     result = true;
            DateTime dateVal, auditionDate;

            //make sure the number of judges is a positive integer
            //int num;
            //bool isNum = Int32.TryParse(txtNumJudges.Text, out num);
            //if (!isNum || num < 0)
            //{
            //    showWarningMessage("The number of judges must be a positive integer.");
            //    result = false;
            //}

            //make sure freeze date is before audition date
            DateTime date;

            if (!DateTime.TryParse(txtDate.Value, out date))
            {
                showWarningMessage("The Date must be in the form mm/dd/yyyy.");
                result = false;
            }
            else if (!DateTime.TryParse(txtFreezeDate.Value, out date))
            {
                showWarningMessage("The Freeze Date must be in the form mm/dd/yyyy.");
                result = false;
            }
            else if (DateTime.Parse(txtFreezeDate.Value) >= DateTime.Parse(txtDate.Value))
            {
                showWarningMessage("The Freeze Date must be before the Competition Date.");
                result = false;
            }

            // Make sure end time is after start time for each session
            if (!endAfterStart(ddlAmPmStart1, ddlAmPmEnd1, ddlHourStart1, ddlHourEnd1, ddlMinutesStart1, ddlMinutesEnd1))
            {
                showWarningMessage("The Start Time for Session 1 must be before the End Time.");
                result = false;
            }
            else if (!endAfterStart(ddlAmPmStart2, ddlAmPmEnd2, ddlHourStart2, ddlHourEnd2, ddlMinutesStart2, ddlMinutesEnd2))
            {
                showWarningMessage("The Start Time for Session 2 must be before the End Time.");
                result = false;
            }
            else if (!endAfterStart(ddlAmPmStart3, ddlAmPmEnd3, ddlHourStart3, ddlHourEnd3, ddlMinutesStart3, ddlMinutesEnd3))
            {
                showWarningMessage("The Start Time for Session 3 must be before the End Time.");
                result = false;
            }
            else if (!endAfterStart(ddlAmPmStart4, ddlAmPmEnd4, ddlHourStart4, ddlHourEnd4, ddlMinutesStart4, ddlMinutesEnd4))
            {
                showWarningMessage("The Start Time for Session 4 must be before the End Time.");
                result = false;
            }

            // Make sure the sessions are set in order
            if (!sessionsInOrder(ddlAmPmEnd1, ddlAmPmStart2, ddlHourEnd1, ddlHourStart2, ddlMinutesEnd1, ddlMinutesStart2))
            {
                showWarningMessage("Session 2 must start after session 1");
                result = false;
            }
            else if (!sessionsInOrder(ddlAmPmEnd2, ddlAmPmStart3, ddlHourEnd2, ddlHourStart3, ddlMinutesEnd2, ddlMinutesStart3))
            {
                showWarningMessage("Session 3 must start after session 2");
                result = false;
            }
            else if (!sessionsInOrder(ddlAmPmEnd3, ddlAmPmStart4, ddlHourEnd3, ddlHourStart4, ddlMinutesEnd3, ddlMinutesStart4))
            {
                showWarningMessage("Session 4 must start after session 3");
                result = false;
            }

            //if duets are enabled, make sure there isn't already a state audition for the upcoming year
            //that already has duets enabled
            if (ddlDuets.SelectedValue.Equals("Yes") && !ddlDistrict.SelectedItem.Text.Contains("Vocal/Instrumental"))
            {
                if (DbInterfaceAudition.StateDuetSiteExists(DateTime.Parse(txtDate.Value).Year, Convert.ToInt32(ddlDistrict.SelectedValue)))
                {
                    showWarningMessage("There is already a Badger Keyboard competition with duets enabled.");
                    result = false;
                }
            }

            return(result);
        }