Exemplo n.º 1
0
 /// <summary>Gets how many Teachers exist.<summary>
 public int GetTeachersCount()
 {
     using (DA.SampleDataContext dataContext = new DA.SampleDataContext())
     {
         return(dataContext.Teachers.Count());
     }
 }
Exemplo n.º 2
0
 /// <summary>Gets how many Enrollments exist.<summary>
 public int GetEnrollmentsCount()
 {
     using (DA.SampleDataContext dataContext = new DA.SampleDataContext())
     {
         return(dataContext.Enrollments.Count());
     }
 }
Exemplo n.º 3
0
 /// <summary>Gets how many Students exist.<summary>
 public int GetStudentsCount()
 {
     using (DA.SampleDataContext dataContext = new DA.SampleDataContext())
     {
         return(dataContext.Students.Count());
     }
 }
Exemplo n.º 4
0
 /// <summary>Gets how many Courses exist.<summary>
 public int GetCoursesCount()
 {
     using (DA.SampleDataContext dataContext = new DA.SampleDataContext())
     {
         return(dataContext.Courses.Count());
     }
 }
Exemplo n.º 5
0
 /// <summary>Gets how many Semesters exist.<summary>
 public int GetSemestersCount()
 {
     using (DA.SampleDataContext dataContext = new DA.SampleDataContext())
     {
         return(dataContext.Semesters.Count());
     }
 }
Exemplo n.º 6
0
        public static void DeleteEnrollment(int id)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();

            DeleteEnrollment(context, id);

            context.SubmitChanges();
            DA.Enrollment.OnCacheNeedsRefresh();
        }
Exemplo n.º 7
0
        public static void DeleteTeacher(int id)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();

            DeleteTeacher(context, id);

            context.SubmitChanges();
            DA.Teacher.OnCacheNeedsRefresh();
        }
        public static void DeleteCourse(int id)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();

            DeleteCourse(context, id);

            context.SubmitChanges();
            DA.Course.OnCacheNeedsRefresh();
        }
Exemplo n.º 9
0
 public static List<Course> FindCourseAPI(SampleDataContext context, string keyword)
 {
     return (from c in context.Courses
             where
                 c.Name.Contains(keyword)
                 || c.Teacher.FirstName.Contains(keyword)
                 || c.Teacher.LastName.Contains(keyword)
             select c).ToList();
 }
        public static DA.Course CreateCourse(DA.Semester Semester_Parameter, DA.Teacher Teacher_Parameter, string Number_Parameter, string Name_Parameter, DO.CourseStatus Status_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Course obj = CreateCourse(context, Semester_Parameter, Teacher_Parameter, Number_Parameter, Name_Parameter, Status_Parameter);

            context.SubmitChanges();
            DA.Course.OnCacheNeedsRefresh();

            return obj;
        }
Exemplo n.º 11
0
        public static void DeleteStudent(DA.SampleDataContext context, int id)
        {
            DA.Student obj = GetByID(context, id);

            PerformPreDeleteLogic(context, obj);

            context.Students.DeleteOnSubmit(obj);

            PerformPostDeleteLogic(context, obj);
        }
Exemplo n.º 12
0
        public static void DeleteCourse(DA.SampleDataContext context, int id)
        {
            DA.Course obj = GetByID(context, id);

            PerformPreDeleteLogic(context, obj);

            context.Courses.DeleteOnSubmit(obj);

            PerformPostDeleteLogic(context, obj);
        }
Exemplo n.º 13
0
        public static DA.Enrollment CreateEnrollment(DA.Student Student_Parameter, DA.Course Course_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Enrollment        obj     = CreateEnrollment(context, Student_Parameter, Course_Parameter);

            context.SubmitChanges();
            DA.Enrollment.OnCacheNeedsRefresh();

            return(obj);
        }
Exemplo n.º 14
0
        public static DA.Course CreateCourse(DA.Semester Semester_Parameter, DA.Teacher Teacher_Parameter, string Number_Parameter, string Name_Parameter, DO.CourseStatus Status_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Course            obj     = CreateCourse(context, Semester_Parameter, Teacher_Parameter, Number_Parameter, Name_Parameter, Status_Parameter);

            context.SubmitChanges();
            DA.Course.OnCacheNeedsRefresh();

            return(obj);
        }
Exemplo n.º 15
0
        public static DA.Student CreateStudent(DA.Major Major_Parameter, string SSN_Parameter, string FirstName_Parameter, string LastName_Parameter, bool Active_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Student           obj     = CreateStudent(context, Major_Parameter, SSN_Parameter, FirstName_Parameter, LastName_Parameter, Active_Parameter);

            context.SubmitChanges();
            DA.Student.OnCacheNeedsRefresh();

            return(obj);
        }
Exemplo n.º 16
0
        public static DA.Semester CreateSemester(DateTime Begin_Parameter, DateTime End_Parameter, string Name_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Semester          obj     = CreateSemester(context, Begin_Parameter, End_Parameter, Name_Parameter);

            context.SubmitChanges();
            DA.Semester.OnCacheNeedsRefresh();

            return(obj);
        }
Exemplo n.º 17
0
        public static void DeleteTeacher(DA.SampleDataContext context, int id)
        {
            DA.Teacher obj = GetByID(context, id);

            PerformPreDeleteLogic(context, obj);

            context.Teachers.DeleteOnSubmit(obj);

            PerformPostDeleteLogic(context, obj);
        }
Exemplo n.º 18
0
        public static DA.Major CreateMajor(string Name_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Major             obj     = CreateMajor(context, Name_Parameter);

            context.SubmitChanges();
            DA.Major.OnCacheNeedsRefresh();

            return(obj);
        }
Exemplo n.º 19
0
        public static DA.Teacher CreateTeacher(string SSN_Parameter, string FirstName_Parameter, string LastName_Parameter, bool Active_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Teacher           obj     = CreateTeacher(context, SSN_Parameter, FirstName_Parameter, LastName_Parameter, Active_Parameter);

            context.SubmitChanges();
            DA.Teacher.OnCacheNeedsRefresh();

            return(obj);
        }
Exemplo n.º 20
0
        public static DA.Major CreateMajor(DA.SampleDataContext context, string Name_Parameter)
        {
            DA.Major obj = new DA.Major();

            obj.Name = Name_Parameter;

            Validate(context, obj);

            PerformPreCreateLogic(context, obj);

            context.Majors.InsertOnSubmit(obj);

            PerformPostCreateLogic(context, obj);

            return(obj);
        }
Exemplo n.º 21
0
        public static DA.Enrollment CreateEnrollment(DA.SampleDataContext context, DA.Student Student_Parameter, DA.Course Course_Parameter)
        {
            DA.Enrollment obj = new DA.Enrollment();

            obj.Student = Student_Parameter;
            obj.Course  = Course_Parameter;

            Validate(context, obj);

            PerformPreCreateLogic(context, obj);

            context.Enrollments.InsertOnSubmit(obj);

            PerformPostCreateLogic(context, obj);

            return(obj);
        }
Exemplo n.º 22
0
        public static DA.Semester CreateSemester(DA.SampleDataContext context, DateTime Begin_Parameter, DateTime End_Parameter, string Name_Parameter)
        {
            DA.Semester obj = new DA.Semester();

            obj.Begin = Begin_Parameter;
            obj.End   = End_Parameter;
            obj.Name  = Name_Parameter;

            Validate(context, obj);

            PerformPreCreateLogic(context, obj);

            context.Semesters.InsertOnSubmit(obj);

            PerformPostCreateLogic(context, obj);

            return(obj);
        }
Exemplo n.º 23
0
        public static DA.Teacher CreateTeacher(DA.SampleDataContext context, string SSN_Parameter, string FirstName_Parameter, string LastName_Parameter, bool Active_Parameter)
        {
            DA.Teacher obj = new DA.Teacher();

            obj.SSN       = SSN_Parameter;
            obj.FirstName = FirstName_Parameter;
            obj.LastName  = LastName_Parameter;
            obj.Active    = Active_Parameter;

            Validate(context, obj);

            PerformPreCreateLogic(context, obj);

            context.Teachers.InsertOnSubmit(obj);

            PerformPostCreateLogic(context, obj);

            return(obj);
        }
Exemplo n.º 24
0
        public static DA.Course CreateCourse(DA.SampleDataContext context, DA.Semester Semester_Parameter, DA.Teacher Teacher_Parameter, string Number_Parameter, string Name_Parameter, DO.CourseStatus Status_Parameter)
        {
            DA.Course obj = new DA.Course();

            obj.Semester = Semester_Parameter;
            obj.Teacher  = Teacher_Parameter;
            obj.Number   = Number_Parameter;
            obj.Name     = Name_Parameter;
            obj.Status   = Status_Parameter;

            Validate(context, obj);

            PerformPreCreateLogic(context, obj);

            context.Courses.InsertOnSubmit(obj);

            PerformPostCreateLogic(context, obj);

            return(obj);
        }
Exemplo n.º 25
0
        public static DA.Student CreateStudent(DA.SampleDataContext context, DA.Major Major_Parameter, string SSN_Parameter, string FirstName_Parameter, string LastName_Parameter, bool Active_Parameter)
        {
            DA.Student obj = new DA.Student();

            obj.Major     = Major_Parameter;
            obj.SSN       = SSN_Parameter;
            obj.FirstName = FirstName_Parameter;
            obj.LastName  = LastName_Parameter;
            obj.Active    = Active_Parameter;

            Validate(context, obj);

            PerformPreCreateLogic(context, obj);

            context.Students.InsertOnSubmit(obj);

            PerformPostCreateLogic(context, obj);

            return(obj);
        }
Exemplo n.º 26
0
 /// <summary>Gets how many Enrollments exist.<summary>
 public int GetEnrollmentsCount()
 {
     using(DA.SampleDataContext dataContext = new DA.SampleDataContext())
     {
         return dataContext.Enrollments.Count();
     }
 }
Exemplo n.º 27
0
 /// <summary>When implemented, validates that the object conforms to standard business rules using the supplied data context.</summary>
 static partial void Validate(DA.SampleDataContext context, DA.Teacher obj);
Exemplo n.º 28
0
 /// <summary>Gets how many Teachers exist.<summary>
 public int GetTeachersCount()
 {
     using(DA.SampleDataContext dataContext = new DA.SampleDataContext())
     {
         return dataContext.Teachers.Count();
     }
 }
        public static DA.Semester CreateSemester(DateTime Begin_Parameter, DateTime End_Parameter, string Name_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Semester obj = CreateSemester(context, Begin_Parameter, End_Parameter, Name_Parameter);

            context.SubmitChanges();
            DA.Semester.OnCacheNeedsRefresh();

            return obj;
        }
 public static Semester GetByBeginAndEnd(SampleDataContext context, DateTime begin, DateTime end)
 {
     return context.Semesters.FirstOrDefault(o => o.Begin == begin && o.End == end);
 }
 public static Student GetBySSN(SampleDataContext context, string sSN)
 {
     return context.Students.FirstOrDefault(o => o.SSN == sSN);
 }
 /// <summary>Returns the Enrollment with the provided primary key value.</summary>
 /// <param name="id">The primary key of the Enrollment to fetch.</param>
 /// <param name="context">The data context to use.</param>
 /// <returns>A single Enrollment, or null if it does not exist.</returns>
 public static DA.Enrollment GetByID(SampleDataContext context, int ID)
 {
     return context.Enrollments.SingleOrDefault(o => o.ID == ID);
 }
Exemplo n.º 33
0
 public static DA.Course GetBySemesterIDAndName(DA.SampleDataContext context, int semesterID, string name)
 {
     return(DA.Course.GetBySemesterIDAndName(context, semesterID, name));
 }
 public static Course GetBySemesterIDAndName(SampleDataContext context, int semesterID, string name)
 {
     return context.Courses.FirstOrDefault(o => o.SemesterID == semesterID && o.Name == name);
 }
 /// <summary>Gets a list of all of the Courses in the database which are associated with the Teacher table via the ID column.</summary>
 /// <param name="teacherID">The ID of the Teacher for which to retrieve the child Courses.</param>
 /// <returns>An IEnumerable of Courses.</returns>
 public static IEnumerable<Course> GetByTeacherID(SampleDataContext context, int iD)
 {
     var source = context.Courses;
     return (from o in source where o.TeacherID == iD select o);
 }
 public static Teacher GetBySSN(SampleDataContext context, string sSN)
 {
     return context.Teachers.FirstOrDefault(o => o.SSN == sSN);
 }
Exemplo n.º 37
0
 /// <summary>Gets how many Semesters exist.<summary>
 public int GetSemestersCount()
 {
     using(DA.SampleDataContext dataContext = new DA.SampleDataContext())
     {
         return dataContext.Semesters.Count();
     }
 }
Exemplo n.º 38
0
 /// <summary>Gets how many Students exist.<summary>
 public int GetStudentsCount()
 {
     using(DA.SampleDataContext dataContext = new DA.SampleDataContext())
     {
         return dataContext.Students.Count();
     }
 }
Exemplo n.º 39
0
 /// <summary>When implemented, allows logic to be performed before the object is created using the supplied data context.</summary>
 static partial void PerformPreCreateLogic(DA.SampleDataContext context, DA.Teacher obj);
 public static Enrollment GetByStudentIDAndCourseID(SampleDataContext context, int studentID, int courseID)
 {
     return context.Enrollments.FirstOrDefault(o => o.StudentID == studentID && o.CourseID == courseID);
 }
Exemplo n.º 41
0
 /// <summary>When implemented, allows logic to be performed after the object is deleted using the supplied data context.</summary>
 static partial void PerformPostDeleteLogic(DA.SampleDataContext context, DA.Teacher obj);
 /// <summary>Returns the Major with the provided primary key value.</summary>
 /// <param name="id">The primary key of the Major to fetch.</param>
 /// <param name="context">The data context to use.</param>
 /// <returns>A single Major, or null if it does not exist.</returns>
 public static DA.Major GetByID(SampleDataContext context, int ID)
 {
     return context.Majors.SingleOrDefault(o => o.ID == ID);
 }
 /// <summary>Gets a list of all of the Semesters in the database.</summary>
 /// <returns>An IEnumerable of Semesters.</returns>
 public static IEnumerable<Semester> GetAll(SampleDataContext context)
 {
     return context.Semesters;
 }
Exemplo n.º 44
0
 /// <summary>Gets how many Courses exist.<summary>
 public int GetCoursesCount()
 {
     using(DA.SampleDataContext dataContext = new DA.SampleDataContext())
     {
         return dataContext.Courses.Count();
     }
 }
 /// <summary>Gets a list of all of the Students in the database.</summary>
 /// <returns>An IEnumerable of Students.</returns>
 public static IEnumerable<Student> GetAll(SampleDataContext context)
 {
     return context.Students;
 }
Exemplo n.º 46
0
 /// <summary>Gets how many Majors exist.<summary>
 public int GetMajorsCount()
 {
     using(DA.SampleDataContext dataContext = new DA.SampleDataContext())
     {
         return dataContext.Majors.Count();
     }
 }
 /// <summary>Gets a list of all of the Teachers in the database.</summary>
 /// <returns>An IEnumerable of Teachers.</returns>
 public static IEnumerable<Teacher> GetAll(SampleDataContext context)
 {
     return context.Teachers;
 }
        public static DA.Student CreateStudent(DA.Major Major_Parameter, string SSN_Parameter, string FirstName_Parameter, string LastName_Parameter, bool Active_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Student obj = CreateStudent(context, Major_Parameter, SSN_Parameter, FirstName_Parameter, LastName_Parameter, Active_Parameter);

            context.SubmitChanges();
            DA.Student.OnCacheNeedsRefresh();

            return obj;
        }
 /// <summary>Gets a list of all of the Courses in the database.</summary>
 /// <returns>An IEnumerable of Courses.</returns>
 public static IEnumerable<Course> GetAll(SampleDataContext context)
 {
     return context.Courses;
 }
        public static void DeleteSemester(int id)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();

            DeleteSemester(context, id);

            context.SubmitChanges();
            DA.Semester.OnCacheNeedsRefresh();
        }
 public static Course GetBySemesterIDAndNumber(SampleDataContext context, int semesterID, string number)
 {
     return context.Courses.FirstOrDefault(o => o.SemesterID == semesterID && o.Number == number);
 }
Exemplo n.º 52
0
 public static DA.Course GetBySemesterIDAndNumber(DA.SampleDataContext context, int semesterID, string number)
 {
     return(DA.Course.GetBySemesterIDAndNumber(context, semesterID, number));
 }
 /// <summary>Gets a list of all of the Enrollments in the database.</summary>
 /// <returns>An IEnumerable of Enrollments.</returns>
 public static IEnumerable<Enrollment> GetAll(SampleDataContext context)
 {
     return context.Enrollments;
 }
Exemplo n.º 54
0
 /// <summary>Gets a list of all of the Teachers in the database.</summary>
 /// <returns>An IEnumerable of Teachers.</returns>
 public static IEnumerable <DA.Teacher> GetAll(DA.SampleDataContext context)
 {
     return(DA.Teacher.GetAll(context));
 }
 /// <summary>Gets a list of all of the Enrollments in the database which are associated with the Student table via the ID column.</summary>
 /// <param name="studentID">The ID of the Student for which to retrieve the child Enrollments.</param>
 /// <returns>An IEnumerable of Enrollments.</returns>
 public static IEnumerable<Enrollment> GetByStudentID(SampleDataContext context, int iD)
 {
     var source = context.Enrollments;
     return (from o in source where o.StudentID == iD select o);
 }
Exemplo n.º 56
0
 public static DA.Teacher GetBySSN(DA.SampleDataContext context, string sSN)
 {
     return(DA.Teacher.GetBySSN(context, sSN));
 }
 /// <summary>Gets a list of all of the Majors in the database.</summary>
 /// <returns>An IEnumerable of Majors.</returns>
 public static IEnumerable<Major> GetAll(SampleDataContext context)
 {
     return context.Majors;
 }
Exemplo n.º 58
0
 public static DA.Teacher LoadTeacherFromDataContext(this DA.Teacher obj, DA.SampleDataContext dataContext)
 {
     return(DA.Teacher.GetByID(dataContext, obj.ID));
 }
 public static Major GetByName(SampleDataContext context, string name)
 {
     return context.Majors.FirstOrDefault(o => o.Name == name);
 }
        public static DA.Teacher CreateTeacher(string SSN_Parameter, string FirstName_Parameter, string LastName_Parameter, bool Active_Parameter)
        {
            DA.SampleDataContext context = new DA.SampleDataContext();
            DA.Teacher obj = CreateTeacher(context, SSN_Parameter, FirstName_Parameter, LastName_Parameter, Active_Parameter);

            context.SubmitChanges();
            DA.Teacher.OnCacheNeedsRefresh();

            return obj;
        }