/* * Pre: * Post: Returns the list of judges scheduled for the audition * @param refresh is an optional parameter to force a refresh of the list of judges * @returns the list of judges */ public List <Judge> GetEventJudges(int auditionId, bool refresh) { if (scheduledJudges == null || refresh) { scheduledJudges = DbInterfaceScheduling.GetAuditionJudges(auditionId); } return(scheduledJudges); }
/* * Pre: * Post: Returns the list of judge room assignments scheduled for the audition * @param refresh is an optional parameter to force a refresh of the list of assignments * @returns the list of judge room assignments */ public List <JudgeRoomAssignment> GetEventJudgeRoomAssignments(int auditionId, bool refresh) { if (judgeRooms == null || refresh) { judgeRooms = DbInterfaceScheduling.GetAuditionJudgeRoomAssignments(auditionId); } return(judgeRooms); }
/* * Pre: * Post: Returns the list of theory test rooms for the audition * @param refresh is an optional parameter to force a refresh of the list of rooms * @returns the list of rooms */ public List <Tuple <string, string> > GetTheoryRooms(int auditionId, bool refresh) { if (theoryRooms == null || refresh) { theoryRooms = DbInterfaceScheduling.GetAuditionTheoryRooms(auditionId); } return(theoryRooms); }
/* * Pre: * Post: Returns the list of judges for the audition's district * @param refresh is an optional parameter to force a refresh of the list of judges * @returns the list of judges */ public List <Judge> GetAvailableJudges(int auditionId, bool refresh) { if (availableJudges == null || refresh) { availableJudges = DbInterfaceScheduling.GetJudgesAvailableForAudition(auditionId); } return(availableJudges); }
/* * Pre: * Post: Returns the list of rooms for the audition * @param refresh is an optional parameter to force a refresh of the list of rooms * @returns the list of rooms */ public List <string> GetRooms(int auditionId, bool refresh) { if (rooms == null || refresh) { rooms = DbInterfaceScheduling.GetAuditionRooms(auditionId); } return(rooms); }
/* * Pre: * Post: Commit the updated schedule and show a message saying it has been commited */ protected void btnDelete_Click(object sender, EventArgs e) { if (DbInterfaceScheduling.DeleteSchedule(Convert.ToInt32(lblAuditionId.Text))) { showSuccessMessage("The schedule was successfully deleted"); } else { showErrorMessage("The schedule could not be deletec"); } }
/* * Pre: * Post: Save the new times to the temporary schedule table */ private bool SaveTimes() { bool success = true; foreach (int judgeId in JudgeSlots.Keys) { foreach (AuditionSlot slot in JudgeSlots[judgeId]) { success = success && DbInterfaceScheduling.UpdateTempAuditionTimes(slot.AuditionId, slot.StartTime, judgeId); } } return(success); }
/* * Save the updates to the schedule order */ protected void btnSaveOrder_Click(object sender, EventArgs e) { DataTable schedule = (DataTable)Session[scheduleData]; if (DbInterfaceScheduling.UpdateScheduleOrder(schedule, Convert.ToInt32(lblAuditionId.Text))) { showSuccessMessage("The schedule order was successfully saved."); } else { showErrorMessage("The schedule order could not be saved."); } LoadEmptyJudges(Convert.ToInt32(lblAuditionId.Text)); }
/* * Pre: * Post: The scheduling data is updated in the database for the input audition id */ public bool Save(int auditionId) { bool success = true; // Delete items in delete lists foreach (string room in roomsToRemove) { success = success && DbInterfaceScheduling.DeleteRoom(auditionId, room); } foreach (Tuple <string, string> theoryRoom in theoryRoomsToRemove) { success = success && DbInterfaceScheduling.DeleteTheoryRoom(auditionId, theoryRoom.Item1, theoryRoom.Item2); } foreach (Judge judge in scheduledJudgesToRemove) { success = success && DbInterfaceScheduling.DeleteJudge(auditionId, judge.id); } foreach (JudgeRoomAssignment assignment in judgeRoomsToRemove) { foreach (Tuple <int, string> time in assignment.times) { success = success && DbInterfaceScheduling.DeleteJudgeTime(auditionId, assignment.judge.id, time.Item1); } } // Update foreach (string room in rooms) { success = success && DbInterfaceScheduling.AddRoom(auditionId, room); } foreach (Tuple <string, string> theoryRoom in theoryRooms) { success = success && DbInterfaceScheduling.AddTheoryRoom(auditionId, theoryRoom.Item1, theoryRoom.Item2); } foreach (Judge judge in scheduledJudges) { success = success && DbInterfaceScheduling.AddJudge(auditionId, judge.id, GetScheduleOrder(judge)); } foreach (JudgeRoomAssignment assignment in judgeRooms) { foreach (Tuple <int, string> time in assignment.times) { success = success && DbInterfaceScheduling.AddJudgeTime(auditionId, assignment.judge.id, time.Item1, assignment.room); } } return(success); }
/* * 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 LoadScheduleInformation(int auditionId) { //load schedule table DataTable schedule = DbInterfaceScheduling.LoadScheduleForUpdate(auditionId); if (schedule != null && schedule.Rows.Count > 0) { gvSchedule.DataSource = schedule; gvSchedule.DataBind(); Session[scheduleData] = schedule; } else { showErrorMessage("Error: The schedule could not be loaded. Please make sure it has been created and saved."); Session[scheduleData] = null; } }
/* * 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 LoadScheduleInformation(int auditionId) { //load schedule table DataTable schedule = DbInterfaceScheduling.LoadScheduleForUpdate(auditionId); if (schedule != null && schedule.Rows.Count > 0) { // Load each judge's available time and juge's that haven't had auditions assigned to them LoadJudgeTimeAllowances(auditionId); LoadEmptyJudges(auditionId); gvSchedule.DataSource = schedule; gvSchedule.DataBind(); Session[scheduleData] = schedule; } else { showErrorMessage("Error: The schedule could not be loaded. Please make sure it has been created and saved."); Session[scheduleData] = null; } }
/* * Pre: * Post: The scheduling routine is ran and the schedule is displayed */ protected void btnCreateSchedule_Click(object sender, EventArgs e) { DataTable schedule = DbInterfaceScheduling.CreateSchedule(Convert.ToInt32(lblAuditionId.Text), false); if (schedule != null && schedule.Rows.Count > 0) { pnlViewSchedule.Visible = true; pnlCreateSchedule.Visible = false; pnlMinusSchedule.Visible = false; gvSchedule.DataSource = schedule; gvSchedule.DataBind(); Session[scheduleData] = schedule; showSuccessMessage("The schedule has been successfully created."); } else { showErrorMessage("Error: An error occurred while creating the schedule. Please ensure that you have students assigned to the audition."); Session[scheduleData] = null; } }
/* * 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 table = DbInterfaceScheduling.ValidateEventJudges(auditionId); if (table != null && table.Rows.Count == 0) // No errors, give option to create schedule { pnlCreateSchedule.Visible = true; Session[judgeValidation] = table; } else if (table != null & table.Rows.Count > 0) // Display errors { pnlValidateSchedule.Visible = true; gvJudgeValidation.DataSource = table; gvJudgeValidation.DataBind(); Session[judgeValidation] = table; } else { upAuditionSearch.Visible = true; showErrorMessage("Error: The event information could not be loaded."); Session[judgeValidation] = null; } } catch (Exception e) { showErrorMessage("Error: An error occurred while loading the event data."); Utility.LogError("BadgerSchedule", "loadSchedule", "auditionId: " + auditionId, "Message: " + e.Message + " Stack Trace: " + e.StackTrace, -1); } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "RefreshDatepickers", "refreshDatePickers()", true); }