示例#1
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            TimeTableEntry obj2 = obj as TimeTableEntry;

            if (obj2 != null)
            {
                return(this.blockNum.CompareTo(obj2.blockNum));
            }
            else
            {
                throw new ArgumentException("Object is not a TimeTableEntry");
            }
        }
示例#2
0
        public static TimeTableEntry getEarliest(List <TimeTableEntry> timetableentries)
        {
            TimeTableEntry returnMe = null;

            foreach (TimeTableEntry tte in timetableentries)
            {
                if (returnMe == null)
                {
                    returnMe = tte;
                }

                if (returnMe.blockNum > tte.blockNum)
                {
                    returnMe = tte;
                }
            }

            return(returnMe);
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            string selectedStudentID      = "106757957";
            int    selectedReportPeriodID = 479;

            using (SqlConnection connection = new SqlConnection(LSKYCommon.dbConnectionString_SchoolLogic))
            {
                Student selectedStudent = Student.loadThisStudent(connection, selectedStudentID);
                displayString("<B>Selected Student: </B>" + selectedStudent);

                // Derive the term to get classes from
                Term selectedTerm = Term.loadTermFromReportPeriod(connection, selectedReportPeriodID);
                displayString("<B>Term:</B> " + selectedTerm);

                // Track is already loaded from the student load function
                displayString("<B>Student Track: </B>" + selectedStudent.track);


                // Load student timetable entries
                selectedStudent.TimeTable = TimeTableEntry.loadStudentTimeTable(connection, selectedStudent, selectedTerm);

                // Load absences from the last month (for testing)
                selectedStudent.absences = Absence.loadAbsencesForThisStudentAndTimePeriod(connection, selectedStudent, DateTime.Now.AddDays(-30), DateTime.Now);

                // Display absences
                displayList("Absences", selectedStudent.absences);
            }



            displayString("<BR><BR>");
            stopwatch.Stop();
            displayString("Elapsed time: " + stopwatch.Elapsed);
        }
示例#4
0
        public static List <TimeTableEntry> loadTimeTableEntries(SqlConnection connection, int termID, SchoolClass schoolClass)
        {
            List <TimeTableEntry> returnMe = new List <TimeTableEntry>();

            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.Connection  = connection;
            sqlCommand.CommandType = CommandType.Text;
            sqlCommand.CommandText = "SELECT * FROM LSKY_ClassSchedule WHERE iTermID=@TERMID AND iClassID=@CLASSID ORDER BY iBlockNumber ASC, cName ASC;";
            sqlCommand.Parameters.AddWithValue("@TERMID", termID);
            sqlCommand.Parameters.AddWithValue("@CLASSID", schoolClass.classid);
            sqlCommand.Connection.Open();

            SqlDataReader dataReader = sqlCommand.ExecuteReader();

            if (dataReader.HasRows)
            {
                while (dataReader.Read())
                {
                    TimeTableEntry newTimeTableEntry = new TimeTableEntry(
                        int.Parse(dataReader["iDayNumber"].ToString().Trim()),
                        int.Parse(dataReader["iBlockNumber"].ToString().Trim()),
                        int.Parse(dataReader["iSchoolID"].ToString().Trim()),
                        int.Parse(dataReader["itermID"].ToString().Trim()),
                        dataReader["Room"].ToString().Trim(),
                        schoolClass
                        );
                    returnMe.Add(newTimeTableEntry);
                }
            }

            sqlCommand.Connection.Close();


            return(returnMe);
        }