Exemplo n.º 1
0
        /*
         * Load available judges that don't have auditions assigned to them
         */
        private void LoadEmptyJudges(int auditionId)
        {
            // Clear before updating
            ddlOpenJudges.Items.Clear();
            ddlOpenJudges.Items.Add(new ListItem("", ""));

            // Load judge's that have not yet been assigned to any auditions
            DataTable table = DbInterfaceJudge.LoadUnscheduledJudges(auditionId);

            ddlOpenJudges.DataSource = table;
            ddlOpenJudges.DataBind();
        }
Exemplo n.º 2
0
    /*
     * Pre:
     * Post: The input preference is deleted front the judge's list of preferences
     * @param preferenceType is the type of the preference to delete
     * @param preference is the specific preference to delete
     * @returns true if the preference is successfully deleted and false otherwise
     */
    public bool deletePreference(Utility.JudgePreferences preferenceType, string preference)
    {
        bool            result;
        JudgePreference prefToDelete = new JudgePreference(-1, preferenceType, preference);

        result = DbInterfaceJudge.DeleteJudgePreference(id, preferenceType, preference);

        if (result)
        {
            preferences.Remove(prefToDelete);
        }

        return(result);
    }
Exemplo n.º 3
0
 /*
  * Constructor for an existing judge
  * @param loadPreferences should be true if the judge's preferences need to be
  *        loaded from the database and false otherwise
  */
 public Judge(int id, string firstName, string mi, string lastName, string email,
              string phone, int districtId, string contactTypeId,
              List <JudgePreference> preferences, bool loadPreferences)
     : base(id, firstName, mi, lastName, email, phone, districtId, contactTypeId)
 {
     if (!loadPreferences)
     {
         this.preferences = preferences;
     }
     else
     {
         this.preferences = DbInterfaceJudge.GetJudgePreferences(id);
     }
 }
Exemplo n.º 4
0
        /*
         * Pre:  id must be an integer or the empty string
         * Post:  The input parameters are used to search for existing contacts.  Matching contact
         *        information is displayed in the input gridview.
         * @param gridView is the gridView in which the search results will be displayed
         * @param id is the id being searched for - must be an integer or the empty string
         * @param firstName is all or part of the first name being searched for
         * @param lastName is all or part of the last name being searched for
         * @returns true if results were found and false otherwise
         */
        private bool searchJudgeContacts(GridView gridView, string id, string firstName, string lastName, string session)
        {
            DataTable table;
            bool      result = true;

            try
            {
                if (!id.Equals(""))
                {
                    table = DbInterfaceJudge.GetJudgeSearchResults(id, firstName, lastName);
                }
                else
                {
                    table = DbInterfaceJudge.GetJudgeSearchResults("", firstName, lastName);
                }

                //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();
                    gridView.HeaderRow.BackColor = Color.Black;

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

                //log issue in database
                Utility.LogError("Judge Setup", "searchJudgeContacts", gridView.ID + ", " + id + ", " + firstName + ", " + lastName + ", " + session, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            return(result);
        }
Exemplo n.º 5
0
    /*
     * Pre:
     * Post:  The new preference is added to the judge's list of preferences
     *@param preferenceType is the type of the new preference
     *@param preference is the specific preference
     *@returns true if the preference was successfully added and false otherwise
     */
    public bool addPreference(Utility.JudgePreferences preferenceType, string preference)
    {
        bool            result  = true;
        JudgePreference newPref = DbInterfaceJudge.AddJudgePreference(id, preferenceType, preference);

        if (preferences == null)
        {
            preferences = new List <JudgePreference>();
        }

        if (newPref != null)
        {
            preferences.Add(newPref);
        }
        else
        {
            result = false;
        }

        return(result);
    }
Exemplo n.º 6
0
 public JudgeAuditionOrganizer(Dictionary <int, List <AuditionSlot> > judgeSlots, int auditionOrgId)
 {
     JudgeSlots        = judgeSlots;
     JudgeTimeSlots    = DbInterfaceJudge.LoadAuditionJudgesTimeSlots(auditionOrgId);
     AuditionTimeSlots = DbInterfaceAudition.GetAuditionTimeSlots(auditionOrgId);
 }
Exemplo n.º 7
0
 /*
  * Constructor for loading the data of an existing judge
  */
 public Judge(int id)
     : base(id, true)
 {
     preferences = DbInterfaceJudge.GetJudgePreferences(id);
 }
Exemplo n.º 8
0
        /*
         * Load the time options for the selected audition
         */
        //private void LoadAuditionTimes(int auditionOrgId)
        //{
        //    DataTable timePreferences = DbInterfaceAudition.LoadJudgeTimePreferenceOptions(auditionOrgId);
        //    chkLstTime.DataSource = timePreferences;
        //    chkLstTime.DataBind();
        //}

        /*
         * Load the preferences of the selected judge for the selected year and audition district
         */
        private void LoadJudgePreferences(int auditionOrgId)
        {
            int           contactId      = Convert.ToInt32(lblId.Text);
            List <string> auditionLevels = DbInterfaceJudge.LoadJudgeAuditionLevels(contactId, auditionOrgId);
            List <string> types          = DbInterfaceJudge.LoadJudgeAuditionTypes(contactId, auditionOrgId);
            List <string> levels         = DbInterfaceJudge.LoadJudgeLevels(contactId, auditionOrgId);
            List <string> instruments    = DbInterfaceJudge.LoadJudgeInstruments(contactId, auditionOrgId);
            List <string> timeIds        = DbInterfaceJudge.LoadJudgeTimes(contactId, auditionOrgId);

            // Load audition levels
            foreach (string level in auditionLevels)
            {
                int idx = -1;

                if (level.Equals("D2") || level.Equals("D2NM") || level.Equals("D3")) // Convert D2, D2NM, and D3 to District
                {
                    idx = chkLstTrack.Items.IndexOf(new ListItem("District"));

                    if (idx >= 0)
                    {
                        chkLstTrack.Items.FindByValue("District").Selected = true;
                    }
                }
                else
                {
                    idx = chkLstTrack.Items.IndexOf(new ListItem(level));

                    if (idx >= 0)
                    {
                        chkLstTrack.Items.FindByValue(level).Selected = true;
                    }
                }
            }

            // Load audition types
            foreach (string type in types)
            {
                int idx = -1;

                idx = chkLstType.Items.IndexOf(new ListItem(type));

                if (idx >= 0)
                {
                    chkLstType.Items.FindByValue(type).Selected = true;
                }
            }

            // Load levels
            foreach (string level in levels)
            {
                if (chkLstCompLevel.Items.Count == 0)
                {
                    chkLstCompLevel.DataBind();
                }

                ListItem temp = chkLstCompLevel.Items.FindByValue(level.Trim());

                if (temp != null)
                {
                    chkLstCompLevel.Items.FindByValue(temp.Value).Selected = true;
                }
            }

            // Load instruments
            foreach (string instrument in instruments)
            {
                int idx = -1;

                if (chkLstInstrument.Items.Count == 0)
                {
                    chkLstInstrument.DataBind();
                }

                idx = chkLstInstrument.Items.IndexOf(new ListItem(instrument));

                if (idx >= 0)
                {
                    chkLstInstrument.Items.FindByValue(instrument).Selected = true;
                }
            }

            // Load times
            //foreach (string timeId in timeIds)
            //{
            //    if (chkLstTime.Items.Count == 0) chkLstTime.DataBind();

            //    ListItem temp = chkLstTime.Items.FindByValue(timeId.Trim());

            //    if (temp != null)
            //        chkLstTime.Items.FindByValue(temp.Value).Selected = true;
            //}
        }
Exemplo n.º 9
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");
            }
        }
Exemplo n.º 10
0
 /*
  * Load the total time each judge for the audition has available
  */
 private void LoadJudgeTimeAllowances(int auditionId)
 {
     judgeTimeAllowances        = DbInterfaceJudge.LoadAuditionJudgesTimeAllowances(auditionId);
     Session[judgeTimesSession] = judgeTimeAllowances;
 }