本文整理汇总了C#中LmPlatformRepositoriesContainer类的典型用法代码示例。如果您正苦于以下问题:C# LmPlatformRepositoriesContainer类的具体用法?C# LmPlatformRepositoriesContainer怎么用?C# LmPlatformRepositoriesContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LmPlatformRepositoriesContainer类属于命名空间,在下文中一共展示了LmPlatformRepositoriesContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRootElementsBySubject
public IEnumerable<Concept> GetRootElementsBySubject(int subjectId)
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.ConceptRepository.GetRootElementsBySubjectId(subjectId);
}
}
示例2: GetStudents
public IEnumerable<Student> GetStudents()
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.StudentsRepository.GetAll(new Query<Student>().Include(e => e.Group).Include(e => e.User)).ToList();
}
}
示例3: GetGroupSubjects
public List<Subject> GetGroupSubjects(int groupId)
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.SubjectRepository.GetSubjects(groupId: groupId).Where(e => !e.IsArchive).ToList();
}
}
示例4: DeleteLabs
public void DeleteLabs(int id)
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
var labs =
repositoriesContainer.LabsRepository.GetBy(
new Query<Labs>(e => e.Id == id).Include(e => e.StudentLabMarks));
var deleteFiles =
repositoriesContainer.AttachmentRepository.GetAll(
new Query<Attachment>(e => e.PathName == labs.Attachments)).ToList();
var studentLabMarks =
repositoriesContainer.RepositoryFor<StudentLabMark>()
.GetAll(new Query<StudentLabMark>(e => e.LabId == id))
.ToList();
foreach (var attachment in deleteFiles)
{
FilesManagementService.DeleteFileAttachment(attachment);
}
foreach (var mark in studentLabMarks)
{
repositoriesContainer.RepositoryFor<StudentLabMark>().Delete(mark);
}
repositoriesContainer.ApplyChanges();
repositoriesContainer.LabsRepository.Delete(labs);
repositoriesContainer.ApplyChanges();
}
}
示例5: GetFileDisplayName
public string GetFileDisplayName(string guid)
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.AttachmentRepository.GetBy(new Query<Attachment>(e => e.FileName == guid)).Name;
}
}
示例6: GetModules
public ICollection<Module> GetModules()
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.ModulesRepository.GetAll().ToList();
}
}
示例7: GetById
public Concept GetById(int id)
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.ConceptRepository.GetById(id);
}
}
示例8: GetBugs
public List<Bug> GetBugs()
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.BugsRepository.GetAll().ToList();
}
}
示例9: GetBugLogs
public List<BugLog> GetBugLogs(int bugId)
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.BugLogsRepository.GetAll(new Query<BugLog>(e => e.BugId == bugId).Include(e => e.User)).ToList();
}
}
示例10: GetBug
public Bug GetBug(int bugId)
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.BugsRepository.GetBy(new Query<Bug>(e => e.Id == bugId));
}
}
示例11: GetUserByName
public User GetUserByName(string firstName, string lastName, string middleName)
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
var checkPatronymic = !string.IsNullOrEmpty(middleName);
var lecturers = repositoriesContainer.LecturerRepository.GetAll(
new Query<Lecturer>(e =>
(e.FirstName == firstName && e.LastName == lastName && !checkPatronymic)
|| (checkPatronymic && (e.MiddleName == middleName && e.FirstName == firstName && e.LastName == lastName))))
.Select(l => l.User).ToList();
if (lecturers.Any())
{
return lecturers.First();
}
var students = repositoriesContainer.StudentsRepository.GetAll(
new Query<Student>(e =>
(e.FirstName == firstName && e.LastName == lastName && !checkPatronymic)
|| (checkPatronymic && (e.MiddleName == middleName && e.FirstName == firstName && e.LastName == lastName))))
.Select(l => l.User);
return students.Any() ? students.First() : null;
}
}
示例12: GetRemainingTime
private int GetRemainingTime(int testId, int questionId, int userId)
{
var test = GetTest(testId);
TestPassResult testPassResult = GetTestPassResult(testId, userId);
double seconds = 0;
if (test.SetTimeForAllTest)
{
seconds = (test.TimeForCompleting * 60) - (DateTime.UtcNow - testPassResult.StartTime).TotalSeconds;
}
else
{
if (testPassResult.Comment == questionId.ToString())
{
seconds = test.TimeForCompleting - ((DateTime.UtcNow.Ticks - testPassResult.StartTime.Ticks) / TimeSpan.TicksPerSecond);
}
else
{
seconds = test.TimeForCompleting;
testPassResult.StartTime = DateTime.UtcNow;
testPassResult.Comment = questionId.ToString();
}
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
repositoriesContainer.RepositoryFor<TestPassResult>().Save(testPassResult);
repositoriesContainer.ApplyChanges();
}
}
return seconds > 0 ? (int)seconds : 0;
}
示例13: GetProjectsOfUser
public List<ProjectUser> GetProjectsOfUser(int userId)
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.ProjectUsersRepository.GetAll(new Query<ProjectUser>(e => e.UserId == userId).Include(e => e.Project).Include(e => e.User).Include(e => e.ProjectRole)).ToList();
}
}
示例14: GetRootElements
public IEnumerable<Concept> GetRootElements(Int32 authorId)
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.ConceptRepository.GetRootElementsByAuthorId(authorId);
}
}
示例15: GetProjectUser
public ProjectUser GetProjectUser(int projectUserId)
{
using (var repositoriesContainer = new LmPlatformRepositoriesContainer())
{
return repositoriesContainer.ProjectUsersRepository.GetBy(new Query<ProjectUser>(e => e.Id == projectUserId).Include(e => e.Project).Include(e => e.User).Include(e => e.ProjectRole));
}
}