private static void CreateBugStatuses(LmPlatformModelsContext context) { context.BugStatuses.Add(new BugStatus { Name = "Обнаружена" }); context.BugStatuses.Add(new BugStatus { Name = "Назначена" }); context.BugStatuses.Add(new BugStatus { Name = "Исправлена" }); context.BugStatuses.Add(new BugStatus { Name = "Проверена" }); context.BugStatuses.Add(new BugStatus { Name = "Отложена" }); context.BugStatuses.Add(new BugStatus { Name = "Отклонена" }); context.BugStatuses.Add(new BugStatus { Name = "Закрыта" }); context.BugStatuses.Add(new BugStatus { Name = "Открыта заново" }); }
private static void CreateBugSeverities(LmPlatformModelsContext context) { context.BugSeverities.Add(new BugSeverity { Name = "Низкая" }); context.BugSeverities.Add(new BugSeverity { Name = "Средняя" }); context.BugSeverities.Add(new BugSeverity { Name = "Высокая" }); context.BugSeverities.Add(new BugSeverity { Name = "Критическая" }); }
public static string GetProjectCreatorName(int projectId) { var context = new LmPlatformModelsContext(); var _context = new ProjectManagementService(); var project = context.Projects.Find(projectId); var creator = context.Users.Find(project.CreatorId); return _context.GetCreatorName(creator.Id); }
private static void FillInitData(LmPlatformModelsContext context) { FillRoles(context); CreateGroups(context); CreateBugSeverities(context); CreateBugSymptoms(context); CreateBugStatuses(context); CreateProjectRoles(context); CreateModules(context); context.SaveChanges(); }
public string GetTasksSheetHtml(int courseProjectId) { //todo var courseProject = new LmPlatformModelsContext().CourseProjects .Include(x => x.AssignedCourseProjects.Select(y => y.Student.Group.Secretary.CoursePercentagesGraphs)) .Single(x => x.CourseProjectId == courseProjectId); return courseProject.AssignedCourseProjects.Count == 1 ? WordCourseProject.CourseProjectToDocView(courseProject.AssignedCourseProjects.First()) : WordCourseProject.CourseProjectToDocView(courseProject); }
private static void CreateProjectRoles(LmPlatformModelsContext context) { context.ProjectRoles.Add(new ProjectRole { Name = "Разработчик" }); context.ProjectRoles.Add(new ProjectRole { Name = "Тестировщик" }); context.ProjectRoles.Add(new ProjectRole { Name = "Руководитель проекта" }); }
public static bool InitializeDatabase(LmPlatformModelsContext context) { if (!context.Database.Exists()) { ((IObjectContextAdapter)context).ObjectContext.CreateDatabase(); FillInitData(context); return(true); } else { return(false); } }
private static void CreateGroups(LmPlatformModelsContext context) { context.Groups.Add(new Group { Name = "107219", StartYear = string.Format("2009"), GraduationYear = string.Format("2014"), }); context.Groups.Add(new Group { Name = "107229", StartYear = string.Format("2009"), GraduationYear = string.Format("2014"), }); }
private static void CreateModules(LmPlatformModelsContext context) { context.Modules.Add(new Module { DisplayName = "Новости", Name = "News", ModuleType = ModuleType.News, Order = 1, Visible = true }); context.Modules.Add(new Module { DisplayName = "Лекции", Name = "Lectures", ModuleType = ModuleType.Lectures, Order = 2, Visible = true }); context.Modules.Add(new Module { DisplayName = "Лабораторные работы", Name = "Labs", ModuleType = ModuleType.Labs, Order = 3, Visible = true }); context.Modules.Add(new Module { DisplayName = "Курсовые проекты/работы", Name = "YEManagment", ModuleType = ModuleType.YeManagment, Order = 7, Visible = true }); context.Modules.Add(new Module { DisplayName = "Файлы", Name = "SubjectAttachments", ModuleType = ModuleType.SubjectAttachments, Order = 5, Visible = true }); context.Modules.Add(new Module { DisplayName = "Архив", Name = "LabAttachments", ModuleType = ModuleType.LabAttachments, Visible = false }); context.Modules.Add(new Module { DisplayName = "Проекты", Name = "Projects", ModuleType = ModuleType.Projects, Visible = false }); context.Modules.Add(new Module { DisplayName = "Тестирование знаний", Name = "SmartTest", ModuleType = ModuleType.SmartTest, Order = 6, Visible = true }); context.Modules.Add(new Module { DisplayName = "Методические материалы", Name = "DSM", ModuleType = ModuleType.Dsm, Order = 8, Visible = true }); context.Modules.Add(new Module { DisplayName = "График защиты", Name = "ScheduleProtection", ModuleType = ModuleType.ScheduleProtection, Visible = false }); context.Modules.Add(new Module { DisplayName = "Результаты", Name = "Results", ModuleType = ModuleType.Results, Visible = false }); context.Modules.Add(new Module { DisplayName = "Статистика посещения", Name = "StatisticsVisits", ModuleType = ModuleType.StatisticsVisits, Visible = false }); context.Modules.Add(new Module { DisplayName = "Практические занятия", Name = "Practical", ModuleType = ModuleType.Practical, Order = 4, Visible = true }); context.Modules.Add(new Module { DisplayName = "Учебно-методический комплекс", Name = "CM", ModuleType = ModuleType.ComplexMaterial, Visible = true }); }
private static void CreateBugSymptoms(LmPlatformModelsContext context) { context.BugSymptoms.Add(new BugSymptom { Name = "Запрос на улучшение" }); context.BugSymptoms.Add(new BugSymptom { Name = "Инсталяционная ошибка" }); context.BugSymptoms.Add(new BugSymptom { Name = "Искажение данных" }); context.BugSymptoms.Add(new BugSymptom { Name = "Косметическая ошибка" }); context.BugSymptoms.Add(new BugSymptom { Name = "Локализационные проблемы" }); context.BugSymptoms.Add(new BugSymptom { Name = "Неверное действие" }); context.BugSymptoms.Add(new BugSymptom { Name = "Недружественное поведение" }); context.BugSymptoms.Add(new BugSymptom { Name = "Неожиданное поведение" }); context.BugSymptoms.Add(new BugSymptom { Name = "Низкая производительность" }); context.BugSymptoms.Add(new BugSymptom { Name = "Отказ системы" }); context.BugSymptoms.Add(new BugSymptom { Name = "Отсутствующий функционал" }); context.BugSymptoms.Add(new BugSymptom { Name = "Ошибка документации" }); context.BugSymptoms.Add(new BugSymptom { Name = "Потеря данных" }); context.BugSymptoms.Add(new BugSymptom { Name = "Различие со спецификацией" }); }
private static void FillRoles(LmPlatformModelsContext context) { context.Roles.Add(new Role { RoleName = "admin", RoleDisplayName = "Администратор" }); context.Roles.Add(new Role { RoleName = "student", RoleDisplayName = "Студент" }); context.Roles.Add(new Role { RoleName = "lector", RoleDisplayName = "Лектор" }); }
public void GetTasksSheetDocument(int courseProjectId) { var courseProject = new LmPlatformModelsContext().CourseProjects .Include(x => x.AssignedCourseProjects.Select(y => y.Student.Group.Secretary.CoursePercentagesGraphs)) .Single(x => x.CourseProjectId == courseProjectId); string docName; if (courseProject.AssignedCourseProjects.Count == 1) { var stud = courseProject.AssignedCourseProjects.Single().Student; docName = string.Format("{0}_{1}", stud.LastName, stud.FirstName); } else { docName = string.Format("{0}", courseProject.Theme); } WordCourseProject.CourseProjectToWord(docName, courseProject, Response); }
public UserInfoViewModel(int _id) { var context = new LmPlatformModelsContext(); var id = context.ProjectUsers.Find(_id).UserId; if (context.Students.Find(id) != null) { //var creator = context.Students.Find(id); var creator = new Student(); foreach (var student in context.Students) { if (student.Id == id) { creator = student; } } UserName = creator.LastName + " " + creator.FirstName + " " + creator.MiddleName; GroupNumber = context.Groups.Find(creator.GroupId).Name; ProjectQuentity = context.ProjectUsers.Select(e => e.User).Count(e => e.Id == creator.Id); Role = "Студент"; } else { var creator = context.Lecturers.Find(id); UserName = creator.LastName + " " + creator.FirstName + " " + creator.MiddleName; ProjectQuentity = context.ProjectUsers.Select(e => e.User).Count(e => e.Id == creator.Id); Role = "Преподаватель"; var _context = new SubjectManagementService(); SubjectList = new List<Subject>(); foreach (var subject in _context.GetUserSubjects(creator.Id)) { SubjectList.Add(subject); } } }
public IList<SelectListItem> GetSymptomNames() { var symptoms = new LmPlatformModelsContext().BugSymptoms.ToList(); return symptoms.Select(e => new SelectListItem { Text = e.Name, Value = e.Id.ToString(CultureInfo.InvariantCulture) }).ToList(); }
private void GetBugPropertyList() { var context = new LmPlatformModelsContext(); _statuses = context.BugStatuses.ToList(); _severities = context.BugSeverities.ToList(); }
private void GetStatusList() { var context = new LmPlatformModelsContext(); _statuses = context.BugStatuses.ToList(); }
public static bool InitializeDatabase(LmPlatformModelsContext context) { if (!context.Database.Exists()) { ((IObjectContextAdapter)context).ObjectContext.CreateDatabase(); FillInitData(context); return true; } else { return false; } }
public IList<SelectListItem> GetStatusNames() { var allStatuses = new LmPlatformModelsContext().BugStatuses.ToList(); var statuses = new List<BugStatus>(); var userRoleOnProject = new ProjectManagementService().GetProjectsOfUser(WebSecurity.CurrentUserId).Single(e => e.ProjectId == ProjectId).ProjectRoleId; switch (userRoleOnProject) { //Роль "Разработчик" case 1: switch (StatusId) { //Статус "Обнаружена" case 1: statuses.Add(allStatuses[0]); statuses.Add(allStatuses[1]); statuses.Add(allStatuses[5]); break; //Статус "Назначена" case 2: statuses.Add(allStatuses[1]); statuses.Add(allStatuses[2]); statuses.Add(allStatuses[5]); break; //Статус "Исправлена" case 3: statuses.Add(allStatuses[2]); break; //Статус "Проверена" case 4: statuses.Add(allStatuses[3]); statuses.Add(allStatuses[6]); break; //Статус "Отложена" case 5: statuses.Add(allStatuses[4]); break; //Статус "Отклонена" case 6: statuses.Add(allStatuses[5]); statuses.Add(allStatuses[6]); break; //Статус "Открыта заново" case 8: if (AssignedDeveloperId == 0) { statuses.Add(allStatuses[1]); } statuses.Add(allStatuses[7]); break; } break; //Роль "Тестировщик" case 2: switch (StatusId) { //Статус "Обнаружена" case 1: statuses.Add(allStatuses[0]); statuses.Add(allStatuses[1]); statuses.Add(allStatuses[4]); statuses.Add(allStatuses[5]); break; //Статус "Назначена" case 2: statuses.Add(allStatuses[1]); break; //Статус "Исправлена" case 3: statuses.Add(allStatuses[2]); statuses.Add(allStatuses[3]); statuses.Add(allStatuses[4]); statuses.Add(allStatuses[7]); break; //Статус "Проверена" case 4: statuses.Add(allStatuses[3]); break; //Статус "Отложена" case 5: if (AssignedDeveloperId != 0) { statuses.Add(allStatuses[2]); } statuses.Add(allStatuses[4]); statuses.Add(allStatuses[5]); statuses.Add(allStatuses[7]); break; //Статус "Отклонена" case 6: statuses.Add(allStatuses[5]); statuses.Add(allStatuses[7]); break; //Статус "Открыта заново" case 8: if (AssignedDeveloperId != 0) { statuses.Add(allStatuses[2]); } statuses.Add(allStatuses[4]); statuses.Add(allStatuses[5]); statuses.Add(allStatuses[7]); break; } break; //Роль "Руководитель проекта" case 3: switch (StatusId) { //Статус "Обнаружена" case 1: statuses.Add(allStatuses[0]); statuses.Add(allStatuses[1]); statuses.Add(allStatuses[4]); statuses.Add(allStatuses[5]); break; //Статус "Назначена" case 2: statuses.Add(allStatuses[1]); break; //Статус "Исправлена" case 3: statuses.Add(allStatuses[2]); statuses.Add(allStatuses[4]); break; //Статус "Проверена" case 4: statuses.Add(allStatuses[3]); statuses.Add(allStatuses[6]); break; //Статус "Отложена" case 5: if (AssignedDeveloperId != 0) { statuses.Add(allStatuses[2]); } statuses.Add(allStatuses[4]); statuses.Add(allStatuses[5]); statuses.Add(allStatuses[7]); break; //Статус "Отклонена" case 6: statuses.Add(allStatuses[5]); statuses.Add(allStatuses[6]); statuses.Add(allStatuses[7]); break; //Статус "Открыта заново" case 8: statuses.Add(allStatuses[1]); statuses.Add(allStatuses[4]); statuses.Add(allStatuses[5]); statuses.Add(allStatuses[7]); break; } break; } return statuses.Select(e => new SelectListItem { Text = e.Name, Value = e.Id.ToString(CultureInfo.InvariantCulture) }).ToList(); }
public IList<SelectListItem> GetRoles() { var roles = new LmPlatformModelsContext().ProjectRoles.ToList(); return roles.Select(e => new SelectListItem { Text = e.Name, Value = e.Id.ToString(CultureInfo.InvariantCulture) }).ToList(); }
public static string GetRoleName(int id) { var context = new LmPlatformModelsContext(); var role = context.ProjectRoles.Find(id); return role.Name; }
public string GetStatusName(int id) { var status = new LmPlatformModelsContext().BugStatuses.Find(id); return status.Name; }
public string GetSymptomName(int id) { var symptom = new LmPlatformModelsContext().BugSymptoms.Find(id); return symptom.Name; }
public ProjectListViewModel FromProject(Project project) { var context = new LmPlatformModelsContext(); var isAssigned = false; foreach (var user in context.ProjectUsers) { if (user.ProjectId == project.Id && user.UserId == WebSecurity.CurrentUserId) { isAssigned = true; } } var _context = new ProjectManagementService(); var creatorId = project.Creator.Id; return new ProjectListViewModel { Id = project.Id, Title = string.Format("<a href=\"{0}\">{1}</a>", Url.Action("ProjectManagement", "BTS", new { id = project.Id }), project.Title), CreatorName = _context.GetCreatorName(creatorId), CreationDate = project.DateOfChange.ToShortDateString(), UserQuentity = _context.GetProjectUsers(project.Id).Count, IsAssigned = isAssigned }; }
public string GetSeverityName(int id) { var severity = new LmPlatformModelsContext().BugSeverities.Find(id); return severity.Name; }
private int GetStatusIdByName(string name) { var context = new LmPlatformModelsContext(); var statuses = context.BugStatuses.ToList(); var id = 0; foreach (var n in statuses) { if (n.Name == name) { id = n.Id; } } return id; }
public SimpleMembershipInitializer() { Database.SetInitializer<LmPlatformModelsContext>(null); try { bool firstLoad; using (var context = new LmPlatformModelsContext()) { firstLoad = DataBaseInitializer.InitializeDatabase(context); } WebSecurity.InitializeDatabaseConnection("DefaultConnection", "Users", "UserId", "UserName", autoCreateTables: false); if (firstLoad) { WebSecurity.CreateUserAndAccount("admin", "123456"); Roles.AddUserToRole("admin", "admin"); WebSecurity.CreateUserAndAccount("popova", "123456"); Roles.AddUserToRole("popova", "lector"); WebSecurity.CreateUserAndAccount("hawk_1", "123456"); Roles.AddUserToRole("hawk_1", "student"); WebSecurity.CreateUserAndAccount("hawk_2", "123456"); Roles.AddUserToRole("hawk_2", "student"); WebSecurity.CreateUserAndAccount("hawk_3", "123456"); Roles.AddUserToRole("hawk_3", "student"); WebSecurity.CreateUserAndAccount("hawk_4", "123456"); Roles.AddUserToRole("hawk_4", "student"); WebSecurity.CreateUserAndAccount("hawk_5", "123456"); Roles.AddUserToRole("hawk_5", "student"); WebSecurity.CreateUserAndAccount("hawk_6", "123456"); Roles.AddUserToRole("hawk_6", "student"); WebSecurity.CreateUserAndAccount("hawk_7", "123456"); Roles.AddUserToRole("hawk_7", "student"); WebSecurity.CreateUserAndAccount("hawk_8", "123456"); Roles.AddUserToRole("hawk_8", "student"); WebSecurity.CreateUserAndAccount("hawk_9", "123456"); Roles.AddUserToRole("hawk_9", "student"); WebSecurity.CreateUserAndAccount("hawk_10", "123456"); Roles.AddUserToRole("hawk_10", "student"); using (var context = new LmPlatformModelsContext()) { context.Lecturers.Add(new Lecturer { Id = 2, FirstName = "Юлия", MiddleName = "Борисовна", LastName = "Попова" }); context.Students.Add(new Student { Id = 3, GroupId = 2, FirstName = "Сергей", MiddleName = "Викторович", LastName = "Яцынович" }); context.Students.Add(new Student { Id = 4, GroupId = 2, FirstName = "Киррил", MiddleName = "Викторович", LastName = "Андреевич" }); context.Students.Add(new Student { Id = 5, GroupId = 2, FirstName = "Петр", MiddleName = "Викторович", LastName = "Петров" }); context.Students.Add(new Student { Id = 6, GroupId = 2, FirstName = "Иван", MiddleName = "Иванович", LastName = "Иванов" }); context.Students.Add(new Student { Id = 7, GroupId = 2, FirstName = "Виктор", MiddleName = "Викторович", LastName = "Иванченко" }); context.Students.Add(new Student { Id = 8, GroupId = 2, FirstName = "Виктор", MiddleName = "Васильевич", LastName = "Шеремет" }); context.Students.Add(new Student { Id = 9, GroupId = 2, FirstName = "Андрей", MiddleName = "Петрович", LastName = "Беляк" }); context.Students.Add(new Student { Id = 10, GroupId = 2, FirstName = "Екатерина", MiddleName = "Ивановна", LastName = "Крузернштейн" }); context.Students.Add(new Student { Id = 11, GroupId = 2, FirstName = "Анатолий", MiddleName = "Васильевич", LastName = "Шибека" }); context.Students.Add(new Student { Id = 12, GroupId = 2, FirstName = "Николай", MiddleName = "Николаевич", LastName = "Гурский" }); context.SaveChanges(); } } } catch (Exception ex) { throw new InvalidOperationException("Ошибка", ex); } }