本文整理汇总了C#中Schedule.DataLayer.ScheduleContext类的典型用法代码示例。如果您正苦于以下问题:C# ScheduleContext类的具体用法?C# ScheduleContext怎么用?C# ScheduleContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScheduleContext类属于Schedule.DataLayer命名空间,在下文中一共展示了ScheduleContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddGroupsInFaculty
public GroupsInFaculty AddGroupsInFaculty(GroupsInFaculty groupsInFaculty)
{
using (var context = new ScheduleContext(ConnectionString))
{
groupsInFaculty.GroupsInFacultyId = 0;
groupsInFaculty.StudentGroup = context.StudentGroups.FirstOrDefault(gif => gif.StudentGroupId == groupsInFaculty.StudentGroup.StudentGroupId);
groupsInFaculty.Faculty = context.Faculties.FirstOrDefault(gif => gif.FacultyId == groupsInFaculty.Faculty.FacultyId);
context.GroupsInFaculties.Add(groupsInFaculty);
context.SaveChanges();
return groupsInFaculty;
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:15,代码来源:ScheduleRepository.cs
示例2: FindConfigOption
public ConfigOption FindConfigOption(string key)
{
using (var context = new ScheduleContext(ConnectionString))
{
return context.Config.FirstOrDefault(op => op.Key == key);
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:7,代码来源:ScheduleRepository.cs
示例3: FindFaculty
public Faculty FindFaculty(string name)
{
using (var context = new ScheduleContext(ConnectionString))
{
return context.Faculties.FirstOrDefault(f => f.Name == name);
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:7,代码来源:ScheduleRepository.cs
示例4: ClearAllExams
public void ClearAllExams()
{
using (var context = new ScheduleContext(ConnectionString))
{
var examIds = context.Exams.Select(e => e.ExamId).ToList();
foreach (var examId in examIds)
{
RemoveExam(examId);
}
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:12,代码来源:ScheduleRepository.cs
示例5: FindAuditorium
public Auditorium FindAuditorium(string name)
{
using (var context = new ScheduleContext(ConnectionString))
{
return context.Auditoriums.FirstOrDefault(a => a.Name == name);
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:7,代码来源:ScheduleRepository.cs
示例6: AddTeacher
public Teacher AddTeacher(Teacher teacher)
{
using (var context = new ScheduleContext(ConnectionString))
{
teacher.TeacherId = 0;
context.Teachers.Add(teacher);
context.SaveChanges();
return teacher;
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:12,代码来源:ScheduleRepository.cs
示例7: AddTeacherForDisciplineRange
public void AddTeacherForDisciplineRange(IEnumerable<TeacherForDiscipline> teacherForDisciplineList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var teacherForDiscipline in teacherForDisciplineList)
{
teacherForDiscipline.TeacherForDisciplineId = 0;
context.TeacherForDiscipline.Add(teacherForDiscipline);
}
context.SaveChanges();
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:13,代码来源:ScheduleRepository.cs
示例8: AddLessonWOLog
public Lesson AddLessonWOLog(Lesson lesson)
{
using (var context = new ScheduleContext(ConnectionString))
{
lesson.LessonId = 0;
lesson.TeacherForDiscipline = context.TeacherForDiscipline.FirstOrDefault(tfd => tfd.TeacherForDisciplineId == lesson.TeacherForDiscipline.TeacherForDisciplineId);
lesson.Calendar = context.Calendars.FirstOrDefault(c => c.CalendarId == lesson.Calendar.CalendarId);
lesson.Ring = context.Rings.FirstOrDefault(r => r.RingId == lesson.Ring.RingId);
lesson.Auditorium = context.Auditoriums.FirstOrDefault(a => a.AuditoriumId == lesson.Auditorium.AuditoriumId);
context.Lessons.Add(lesson);
context.SaveChanges();
return lesson;
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:18,代码来源:ScheduleRepository.cs
示例9: AddLogEvent
public LogEvent AddLogEvent(LogEvent logEvent)
{
using (var context = new ScheduleContext(ConnectionString))
{
logEvent.OldExam = context.Exams.FirstOrDefault(e => e.ExamId == logEvent.OldExam.ExamId);
logEvent.NewExam = context.Exams.FirstOrDefault(e => e.ExamId == logEvent.NewExam.ExamId);
context.EventLog.Add(logEvent);
context.SaveChanges();
return logEvent;
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:13,代码来源:ScheduleRepository.cs
示例10: AddLessonLogEventRange
public void AddLessonLogEventRange(IEnumerable<LessonLogEvent> lessonLogEventList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var lessonLogEvent in lessonLogEventList)
{
lessonLogEvent.LessonLogEventId = 0;
lessonLogEvent.OldLesson = context.Lessons.FirstOrDefault(l => l.LessonId == lessonLogEvent.OldLesson.LessonId);
lessonLogEvent.NewLesson = context.Lessons.FirstOrDefault(l => l.LessonId == lessonLogEvent.NewLesson.LessonId);
context.LessonLog.Add(lessonLogEvent);
}
context.SaveChanges();
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:17,代码来源:ScheduleRepository.cs
示例11: AddLessonRange
public void AddLessonRange(IEnumerable<Lesson> lessonList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var lesson in lessonList)
{
lesson.LessonId = 0;
lesson.TeacherForDiscipline = context.TeacherForDiscipline.FirstOrDefault(tfd => tfd.TeacherForDisciplineId == lesson.TeacherForDiscipline.TeacherForDisciplineId);
lesson.Calendar = context.Calendars.FirstOrDefault(c => c.CalendarId == lesson.Calendar.CalendarId);
lesson.Ring = context.Rings.FirstOrDefault(r => r.RingId == lesson.Ring.RingId);
lesson.Auditorium = context.Auditoriums.FirstOrDefault(a => a.AuditoriumId == lesson.Auditorium.AuditoriumId);
context.Lessons.Add(lesson);
}
context.SaveChanges();
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:19,代码来源:ScheduleRepository.cs
示例12: AddLessonLogEvent
public LessonLogEvent AddLessonLogEvent(LessonLogEvent lessonLogEvent)
{
using (var context = new ScheduleContext(ConnectionString))
{
lessonLogEvent.LessonLogEventId = 0;
lessonLogEvent.OldLesson = (lessonLogEvent.OldLesson == null) ? null : context.Lessons.FirstOrDefault(l => l.LessonId == lessonLogEvent.OldLesson.LessonId);
lessonLogEvent.NewLesson = (lessonLogEvent.NewLesson == null) ? null : context.Lessons.FirstOrDefault(l => l.LessonId == lessonLogEvent.NewLesson.LessonId);
context.LessonLog.Add(lessonLogEvent);
context.SaveChanges();
return lessonLogEvent;
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:14,代码来源:ScheduleRepository.cs
示例13: AddLesson
public Lesson AddLesson(Lesson lesson, string publicComment = "", string hiddenComment = "")
{
using (var context = new ScheduleContext(ConnectionString))
{
lesson.LessonId = 0;
lesson.TeacherForDiscipline = context.TeacherForDiscipline.FirstOrDefault(tfd => tfd.TeacherForDisciplineId == lesson.TeacherForDiscipline.TeacherForDisciplineId);
lesson.Calendar = context.Calendars.FirstOrDefault(c => c.CalendarId == lesson.Calendar.CalendarId);
lesson.Ring = context.Rings.FirstOrDefault(r => r.RingId == lesson.Ring.RingId);
lesson.Auditorium = context.Auditoriums.FirstOrDefault(a => a.AuditoriumId == lesson.Auditorium.AuditoriumId);
context.Lessons.Add(lesson);
context.LessonLog.Add(
new LessonLogEvent
{
OldLesson = null,
NewLesson = lesson,
DateTime = DateTime.Now,
PublicComment = publicComment,
HiddenComment = hiddenComment
}
);
context.SaveChanges();
return lesson;
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:28,代码来源:ScheduleRepository.cs
示例14: AddGroupsInFacultyRange
public void AddGroupsInFacultyRange(IEnumerable<GroupsInFaculty> groupsInFacultiesList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var groupsInFaculty in groupsInFacultiesList)
{
groupsInFaculty.GroupsInFacultyId = 0;
groupsInFaculty.StudentGroup = context.StudentGroups.FirstOrDefault(gif => gif.StudentGroupId == groupsInFaculty.StudentGroup.StudentGroupId);
groupsInFaculty.Faculty = context.Faculties.FirstOrDefault(gif => gif.FacultyId == groupsInFaculty.Faculty.FacultyId);
context.GroupsInFaculties.Remove(groupsInFaculty);
}
context.SaveChanges();
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:17,代码来源:ScheduleRepository.cs
示例15: AddStudentsInGroups
public StudentsInGroups AddStudentsInGroups(StudentsInGroups studentsInGroups)
{
using (var context = new ScheduleContext(ConnectionString))
{
studentsInGroups.StudentsInGroupsId = 0;
studentsInGroups.Student = context.Students.FirstOrDefault(s => s.StudentId == studentsInGroups.Student.StudentId);
studentsInGroups.StudentGroup = context.StudentGroups.FirstOrDefault(sg => sg.StudentGroupId == studentsInGroups.StudentGroup.StudentGroupId);
context.StudentsInGroups.Add(studentsInGroups);
context.SaveChanges();
return studentsInGroups;
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:15,代码来源:ScheduleRepository.cs
示例16: AddRing
public Ring AddRing(Ring ring)
{
using (var context = new ScheduleContext(ConnectionString))
{
ring.RingId = 0;
context.Rings.Add(ring);
context.SaveChanges();
return ring;
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:12,代码来源:ScheduleRepository.cs
示例17: AddStudentsInGroupsRange
public void AddStudentsInGroupsRange(IEnumerable<StudentsInGroups> studentsInGroupsList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var studentsInGroups in studentsInGroupsList)
{
studentsInGroups.StudentsInGroupsId = 0;
context.StudentsInGroups.Add(studentsInGroups);
}
context.SaveChanges();
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:13,代码来源:ScheduleRepository.cs
示例18: AddRingRange
public void AddRingRange(IEnumerable<Ring> ringList)
{
using (var context = new ScheduleContext(ConnectionString))
{
foreach (var ring in ringList)
{
ring.RingId = 0;
context.Rings.Add(ring);
}
context.SaveChanges();
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:13,代码来源:ScheduleRepository.cs
示例19: AddTeacherForDiscipline
public TeacherForDiscipline AddTeacherForDiscipline(TeacherForDiscipline teacherForDiscipline)
{
using (var context = new ScheduleContext(ConnectionString))
{
teacherForDiscipline.TeacherForDisciplineId = 0;
teacherForDiscipline.Teacher = context.Teachers.FirstOrDefault(t => t.TeacherId == teacherForDiscipline.Teacher.TeacherId);
teacherForDiscipline.Discipline = context.Disciplines.FirstOrDefault(d => d.DisciplineId == teacherForDiscipline.Discipline.DisciplineId);
context.TeacherForDiscipline.Add(teacherForDiscipline);
context.SaveChanges();
return teacherForDiscipline;
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:15,代码来源:ScheduleRepository.cs
示例20: AddScheduleNote
public ScheduleNote AddScheduleNote(ScheduleNote sNote)
{
using (var context = new ScheduleContext(ConnectionString))
{
sNote.ScheduleNoteId = 0;
sNote.Lesson.TeacherForDiscipline = context.TeacherForDiscipline.FirstOrDefault(tfd => tfd.TeacherForDisciplineId == sNote.Lesson.TeacherForDiscipline.TeacherForDisciplineId);
sNote.Lesson.Calendar = context.Calendars.FirstOrDefault(c => c.CalendarId == sNote.Lesson.Calendar.CalendarId);
sNote.Lesson.Ring = context.Rings.FirstOrDefault(r => r.RingId == sNote.Lesson.Ring.RingId);
sNote.Lesson.Auditorium = context.Auditoriums.FirstOrDefault(a => a.AuditoriumId == sNote.Lesson.Auditorium.AuditoriumId);
context.ScheduleNotes.Add(sNote);
context.SaveChanges();
return sNote;
}
}
开发者ID:BesuglovS,项目名称:ScheduleRepository,代码行数:17,代码来源:ScheduleRepository.cs
注:本文中的Schedule.DataLayer.ScheduleContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论