public static ReportPeriod loadThisReportPeriod(SqlConnection connection, int reportPeriodID)
        {
            ReportPeriod returnMe = null;

            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.Connection  = connection;
            sqlCommand.CommandType = CommandType.Text;
            sqlCommand.CommandText = "SELECT * FROM ReportPeriod WHERE iReportPeriodID=" + reportPeriodID + "";
            sqlCommand.Connection.Open();
            SqlDataReader dataReader = sqlCommand.ExecuteReader();

            if (dataReader.HasRows)
            {
                while (dataReader.Read())
                {
                    returnMe = new ReportPeriod(
                        int.Parse(dataReader["iReportPeriodID"].ToString().Trim()),
                        dataReader["cName"].ToString().Trim(),
                        DateTime.Parse(dataReader["dStartDate"].ToString()),
                        DateTime.Parse(dataReader["dEndDate"].ToString()),
                        int.Parse(dataReader["iSchoolID"].ToString().Trim()),
                        int.Parse(dataReader["iTermID"].ToString().Trim())
                        );
                }
            }

            sqlCommand.Connection.Close();
            returnMe.loadReportPeriodSettings(connection);
            return(returnMe);
        }
示例#2
0
        public Term(int id, int trackid, DateTime start, DateTime end, string name, int schoolid)
        {
            this.ReportPeriods     = new List <ReportPeriod>();
            this.Courses           = new List <SchoolClass>();
            this.FinalReportPeriod = null;

            this.ID        = id;
            this.trackID   = trackid;
            this.startDate = start;
            this.endDate   = end;
            this.name      = name;
            this.schoolID  = schoolid;
        }
示例#3
0
        /// <summary>
        /// Loads the term from a given report period ID number
        /// </summary>
        /// <param name="connection">An active SQL connection</param>
        /// <param name="reportPeriodID">The report period ID number to search for</param>
        /// <returns></returns>
        public static Term loadTermFromReportPeriod(SqlConnection connection, int reportPeriodID)
        {
            ReportPeriod selectedReportPeriod = ReportPeriod.loadThisReportPeriod(connection, reportPeriodID);

            if (selectedReportPeriod != null)
            {
                return(loadTermFromReportPeriod(connection, selectedReportPeriod));
            }
            else
            {
                return(null);
            }
        }
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            ReportPeriod obj2 = obj as ReportPeriod;

            if (obj2 != null)
            {
                return(this.startDate.CompareTo(obj2.startDate));
            }
            else
            {
                throw new ArgumentException("Object is not a ReportPeriod");
            }
        }
示例#5
0
 /// <summary>
 /// Loads the term from a given report period
 /// </summary>
 /// <param name="connection">An active SQL connection</param>
 /// <param name="reportPeriodID">The report period ID number to search for</param>
 /// <returns></returns>
 public static Term loadTermFromReportPeriod(SqlConnection connection, ReportPeriod reportPeriod)
 {
     return(Term.loadThisTerm(connection, reportPeriod.termID));
 }
示例#6
0
        /// <summary>
        /// Filter a list of report period comments to only include the specified report period
        /// </summary>
        /// <param name="comments">A list of comments</param>
        /// <param name="reportPeriod">A report period to filter by</param>
        /// <returns></returns>
        public static List <ReportPeriodComment> getCommentsForTheseReportPeriods(List <ReportPeriodComment> comments, ReportPeriod reportPeriod)
        {
            List <int> reportPeriodIDs = new List <int>();

            reportPeriodIDs.Add(reportPeriod.ID);
            return(getCommentsForTheseReportPeriods(comments, reportPeriodIDs));
        }
        public static List <OutcomeMark> loadOutcomeMarksForThisStudent(SqlConnection connection, List <ReportPeriod> reportPeriods, Student student)
        {
            List <OutcomeMark> returnMe = new List <OutcomeMark>();

            if (reportPeriods.Count > 0)
            {
                SqlCommand sqlCommand = new SqlCommand();
                sqlCommand.Connection = connection;
                sqlCommand.Connection.Open();

                sqlCommand.CommandType = CommandType.Text;
                sqlCommand.CommandText = "SELECT * FROM LSKY_ObjectiveMarks WHERE cStudentNumber=@StudentNum AND (";
                sqlCommand.Parameters.AddWithValue("@StudentNum", student.getStudentID());

                for (int x = 0; x < reportPeriods.Count; x++)
                {
                    ReportPeriod reportPeriod = reportPeriods[x];
                    sqlCommand.CommandText += "iReportPeriodID=@RepPeriodID" + x;
                    if (x < reportPeriods.Count - 1)
                    {
                        sqlCommand.CommandText += " OR ";
                    }
                    sqlCommand.Parameters.AddWithValue("@RepPeriodID" + x, reportPeriod.ID);
                }

                sqlCommand.CommandText += ")";

                SqlDataReader dataReader = sqlCommand.ExecuteReader();

                if (dataReader.HasRows)
                {
                    while (dataReader.Read())
                    {
                        float nMark = -1;
                        float.TryParse(dataReader["nMark"].ToString().Trim(), out nMark);
                        string cMark = dataReader["cMark"].ToString().Trim();

                        // Only load the outcome mark if it is nonzero/nonnull, since SchoolLogic neve deletes "blanked out" marks
                        if ((nMark > 0) || (!string.IsNullOrEmpty(cMark)))
                        {
                            returnMe.Add(new OutcomeMark(
                                             int.Parse(dataReader["iStudentCourseObjectiveID"].ToString().Trim()),
                                             int.Parse(dataReader["cStudentNumber"].ToString().Trim()),
                                             int.Parse(dataReader["iCourseObjectiveID"].ToString().Trim()),
                                             int.Parse(dataReader["iReportPeriodID"].ToString().Trim()),
                                             int.Parse(dataReader["MarkCourseID"].ToString().Trim()),
                                             cMark,
                                             (float)Math.Round(nMark, 1),
                                             new Outcome(
                                                 int.Parse(dataReader["iCourseObjectiveID"].ToString().Trim()),
                                                 int.Parse(dataReader["ObjectiveCourseID"].ToString().Trim()),
                                                 dataReader["cSubject"].ToString().Trim(),
                                                 dataReader["mNotes"].ToString().Trim(),
                                                 dataReader["OutcomeCategory"].ToString().Trim(),
                                                 dataReader["CourseName"].ToString().Trim(),
                                                 dataReader["cCourseCode"].ToString().Trim()
                                                 )
                                             ));
                        }
                    }
                }
                dataReader.Close();
                sqlCommand.Connection.Close();
            }

            return(returnMe);
        }