Esempio n. 1
0
        public static Models.StudentModel GetStudent(Guid studentId)
        {
            var dataItem = GetContext().GetStudent(studentId).Single();
            var result   = new Models.StudentModel {
                StudentId = studentId, UserID = dataItem.UserId, DateOfBirth = dataItem.DateOfBirth, DateOfEntry = dataItem.DateOfEntry, ExpectedGraduationYear = dataItem.ExpectedGraduationYear, FirstName = dataItem.FirstName, LastName = dataItem.LastName, IEPDate = dataItem.IEPDate, LocalEducationAgency = dataItem.LocalEducationAgency, NextEvaluationDueOn = dataItem.NextEvaluationDueOn, NextIEPDueDate = dataItem.NextIEPDueDate, PrimaryDisabilityId = dataItem.PrimaryDisabilityID, SecondaryDisabilityId = dataItem.SecondaryDisabilityID
            };

            return(result);
        }
Esempio n. 2
0
        public static void UpdateStudent(StudentModel student, int userId)
        {
            Debug.Assert(student.DateOfBirth != null, "student.DateOfBirth != null");
            Debug.Assert(student.ExpectedGraduationYear != null, "student.ExpectedGraduationYear != null");
            Debug.Assert(student.PrimaryDisabilityId != null, "student.PrimaryDisabilityId != null");

            using (var context = DataContext.GetContext())
            {
                var existingItem = context.Students.Single(a => a.StudentId == student.StudentId);
                existingItem.DateOfBirth = student.DateOfBirth.Value;
                existingItem.FirstName = student.FirstName;
                existingItem.LastName = student.LastName;
                existingItem.ExpectedGraduationYear = student.ExpectedGraduationYear.Value;
                existingItem.PrimaryDisabilityID = student.PrimaryDisabilityId.Value;
                existingItem.SecondaryDisabilityID = student.SecondaryDisabilityId;
                existingItem.LocalEducationAgency = student.LocalEducationAgency;
                existingItem.DateOfEntry = student.DateOfEntry;
                existingItem.LastModifiedBy = userId;
                existingItem.LastModifiedOn = DateTime.Now;
                existingItem.Current = student.CurrentStudent;
                context.SaveChanges();

            }
        }
Esempio n. 3
0
        public static void InsertStudent(StudentModel student, int userId)
        {
            using (var context = DataContext.GetContext())
            {
                Debug.Assert(student.UserId != null, "student.UserId != null");
                Debug.Assert(student.ExpectedGraduationYear != null, "student.ExpectedGraduationYear != null");
                Debug.Assert(student.PrimaryDisabilityId != null, "student.PrimaryDisabilityId != null");
                Debug.Assert(student.DateOfBirth != null, "student.DateOfBirth != null");

                var newItem = new Entities.Student
                {
                    UserId = student.UserId.Value,
                    FirstName = student.FirstName,
                    LastName = student.LastName,
                    ExpectedGraduationYear = student.ExpectedGraduationYear.Value,
                    PrimaryDisabilityID = student.PrimaryDisabilityId.Value,
                    LocalEducationAgency = student.LocalEducationAgency,
                    DateOfEntry = student.DateOfEntry,
                    DateOfBirth = student.DateOfBirth.Value,
                    SecondaryDisabilityID = student.SecondaryDisabilityId,
                    CreatedBy = userId,
                    CreatedOn = DateTime.Now,
                    LastModifiedBy = userId,
                    LastModifiedOn = DateTime.Now,
                    Current = true
                };

                context.Students.AddObject(newItem);
                context.SaveChanges();
            }
        }
Esempio n. 4
0
 public static Models.StudentModel GetStudent(Guid studentId)
 {
     var dataItem = GetContext().GetStudent(studentId).Single();
     var result = new Models.StudentModel { StudentId = studentId, UserID = dataItem.UserId, DateOfBirth = dataItem.DateOfBirth, DateOfEntry = dataItem.DateOfEntry, ExpectedGraduationYear = dataItem.ExpectedGraduationYear, FirstName = dataItem.FirstName, LastName = dataItem.LastName, IEPDate = dataItem.IEPDate, LocalEducationAgency = dataItem.LocalEducationAgency, NextEvaluationDueOn = dataItem.NextEvaluationDueOn, NextIEPDueDate = dataItem.NextIEPDueDate, PrimaryDisabilityId = dataItem.PrimaryDisabilityID, SecondaryDisabilityId = dataItem.SecondaryDisabilityID };
     return result;
 }
Esempio n. 5
0
 public static void SaveStudent(Models.StudentModel student)
 {
     GetContext().SaveStudent(student.StudentId, student.UserID, student.DateOfBirth, student.FirstName, student.LastName, student.ExpectedGraduationYear, student.PrimaryDisabilityId, student.SecondaryDisabilityId, student.LocalEducationAgency, student.IEPDate, student.NextIEPDueDate, student.NextEvaluationDueOn, student.DateOfEntry);
 }