public void DB_Modify_ActivitySupervisors(ActivitySupervisor activitySupervisor) { string query = $"UPDATE ActivitySupervisor SET activity_id=@activityid WHERE activity_supervisor_id = @supervisorid"; SqlParameter[] sqlParameters = { new SqlParameter("@supervisorid", SqlDbType.Int) { Value = activitySupervisor.SupervisorId }, new SqlParameter("@activityid", SqlDbType.Int) { Value = activitySupervisor.ActivityId }, }; ExecuteEditQuery(query, sqlParameters); }
private List <ActivitySupervisor> ReadTables(DataTable dataTable) { List <ActivitySupervisor> activitySupervisors = new List <ActivitySupervisor>(); foreach (DataRow dr in dataTable.Rows) { ActivitySupervisor activitySupervisor = new ActivitySupervisor() { SupervisorId = (int)dr["activity_supervisor_id"], ActivityId = (int)dr["activity_id"], ActivityName = (string)dr["activity_description"], TeacherName = (string)dr["teacher_name"], TeacherId = (int)dr["teacher_id"] }; activitySupervisors.Add(activitySupervisor); } return(activitySupervisors); }
public List <ActivitySupervisor> GetActivitySupervisor() { try { List <ActivitySupervisor> activitySupervisors = activitySupervisor_DAO.Db_Get_All_ActivitySupervisors(); return(activitySupervisors); } catch (Exception) { // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working! List <ActivitySupervisor> activitySupervisors = new List <ActivitySupervisor>(); ActivitySupervisor a = new ActivitySupervisor(); a.SupervisorId = 999; a.ActivityId = 999; a.TeacherId = 999; activitySupervisors.Add(a); return(activitySupervisors); } }
public void ModifyActivitySupervisor(ActivitySupervisor activitySupervisor) { activitySupervisor_DAO.DB_Modify_ActivitySupervisors(activitySupervisor); }