Beispiel #1
0
 /// <summary>
 /// Generate this given the <see cref="AttendanceMarking.id"/>.
 /// </summary>
 /// <param name="id"><see cref="AttendanceMarking.id"/></param>
 /// <param name="fullDetails">Fills in all of the non-mandatory fields if true.  Otherwise, only provides the mandatory data.</param>
 public AttendanceInfo(int id, bool fullDetails = false)
 {
     using (WebhostEntities db = new WebhostAPI.WebhostEntities())
     {
         AttendanceMarking marking = db.AttendanceMarkings.Find(id);
         Id        = id;
         StudentId = marking.StudentID;
         SectionId = marking.SectionIndex;
         Marking   = marking.GradeTableEntry.Name;
         Date      = marking.AttendanceDate;
         Notes     = marking.Notes;
         EnteredBy = new TeacherInfo(marking.SubmittedBy);
         if (fullDetails)
         {
             Student = new StudentInfo(StudentId);
             Section = new SectionInfo(SectionId);
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// Get Student Info given the student Id.
 /// </summary>
 /// <param name="studentId">Valid Student Id</param>
 /// <param name="shortVersion">Omit some data.</param>
 /// <exception cref="ArgumentException">Thrown when the student Id is Invalid.</exception>
 public StudentInfo(int studentId, bool shortVersion = true)
 {
     using (WebhostEntities db = new WebhostAPI.WebhostEntities())
     {
         Student student = db.Students.Find(studentId);
         if (student == null)
         {
             throw new ArgumentException("Invalid Student Id");
         }
         UserName = student.UserName;
         if (!shortVersion)
         {
             Email   = String.Format("{0}@dublinschool.org", student.UserName);
             Advisor = new TeacherInfo(student.AdvisorID, true);
         }
         FirstName      = student.FirstName;
         LastName       = student.LastName;
         Id             = student.ID;
         GraduationYear = student.GraduationYear;
         Groups         = new List <string>();
         this.Groups.Add("Students");
     }
 }