/// <summary> /// Инициализация таблицы "Способы подачи документов" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateSubmittingDocumentsTypes(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Способы подачи документов" if (!await context.SubmittingDocumentsTypes.AnyAsync()) { var row01 = new SubmittingDocumentsType { SubmittingDocumentsTypeId = 1, SubmittingDocumentsTypeName = "Лично" }; var row02 = new SubmittingDocumentsType { SubmittingDocumentsTypeId = 2, SubmittingDocumentsTypeName = "Дистанционно" }; await context.SubmittingDocumentsTypes.AddRangeAsync( row01, row02 ); await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация справочника типов договоров /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateContractTypes(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Типы договоров" if (!await context.ContractTypes.AnyAsync()) { var Row01 = new ContractType { ContractTypeId = (int)ContractTypesEnum.ContractTargetTraining, ContractTypeName = "Договор о целевом обучении" }; var Row02 = new ContractType { ContractTypeId = (int)ContractTypesEnum.ContractPaidTraining, ContractTypeName = "Договор об оказании платных образовательных услуг" }; await context.ContractTypes.AddRangeAsync( Row01, Row02 ); await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация данных, связанных с численность обучающихся /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateEduChislen(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Численность обучающихся" if (!await context.EduChislens.AnyAsync()) { foreach (var profile in context.EduProfiles) { foreach (var form in context.EduForms) { EduChislen eduChislen = new EduChislen(); eduChislen.EduProfileId = profile.EduProfileId; eduChislen.EduFormId = form.EduFormId; await context.EduChislens.AddAsync(eduChislen); } } await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация таблицы "Пол" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateGenders(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Пол" if (!await context.Genders.AnyAsync()) { var Row01 = new Gender { GenderId = 1, GenderName = "Мужской" }; var Row02 = new Gender { GenderId = 2, GenderName = "Женский" }; await context.Genders.AddRangeAsync( Row01, Row02 ); await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация таблицы "Группы видов патентов (свидетельств)" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreatePatentVidGroups(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <Microsoft.Extensions.DependencyInjection.IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Группы видов патентов (свидетельств)" if (!await context.PatentVidGroups.AnyAsync()) { PatentVidGroup PatentVidGroup1 = new PatentVidGroup { PatentVidGroupId = 1, PatentVidGroupName = "Патенты" }; PatentVidGroup PatentVidGroup2 = new PatentVidGroup { PatentVidGroupId = 2, PatentVidGroupName = "Свидетельства" }; await context.PatentVidGroups.AddRangeAsync( PatentVidGroup1, PatentVidGroup2 ); await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация таблицы "Форма издания учебного пособия" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateUchPosobieFormaIzdaniya(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Форма издания учебного пособия" if (!await context.UchPosobieFormaIzdaniya.AnyAsync()) { UchPosobieFormaIzdaniya UchPosobieFormaIzdaniyaName1 = new UchPosobieFormaIzdaniya { UchPosobieFormaIzdaniyaId = 1, UchPosobieFormaIzdaniyaName = "Печатная", }; UchPosobieFormaIzdaniya UchPosobieFormaIzdaniyaName2 = new UchPosobieFormaIzdaniya { UchPosobieFormaIzdaniyaId = 2, UchPosobieFormaIzdaniyaName = "Электронная", }; await context.UchPosobieFormaIzdaniya.AddRangeAsync( UchPosobieFormaIzdaniyaName1, UchPosobieFormaIzdaniyaName2 ); await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация таблицы "Настройки приложения" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateAppSettings(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Настройки приложения" if (!await context.AppSettings.AnyAsync()) { AppSetting CurrentEduYear = new AppSetting { AppSettingId = (int)AppSettingTypesEnum.CurrentEduYear, AppSettingName = "Текущий учебный год", AppSettingValue = 2 }; await context.AppSettings.AddRangeAsync( CurrentEduYear ); await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация таблицы "Таблица для связи EduPlan и EduVidDeyat" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateEduPlanEduVidDeyats(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Таблица для связи EduPlan и EduVidDeyat" if (!await context.EduPlanEduVidDeyats.AnyAsync()) { EduPlanEduVidDeyat EduPlanEduVidDeyat1 = new EduPlanEduVidDeyat { EduPlanEduVidDeyatId = 1, EduPlanId = 1, EduVidDeyatId = 1 }; await context.EduPlanEduVidDeyats.AddRangeAsync( EduPlanEduVidDeyat1 ); await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация таблицы "Электронные библиотечные системы" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateElectronBiblSystem(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Электронные библиотечные системы" if (!await context.ElectronBiblSystem.AnyAsync()) { ElectronBiblSystem Ebs1 = new ElectronBiblSystem { NameEbs = "Издательство \"Лань\"", LinkEbs = "https://e.lanbook.com ", NumberDogovor = "1723", DateStart = new DateTime(2016, 12, 14) }; ElectronBiblSystem Ebs2 = new ElectronBiblSystem { NameEbs = "ООО \"НексМедиа\"", LinkEbs = "http://biblioclub.ru/index.php?page=main_ub_red ", NumberDogovor = "008-01/2017", DateStart = new DateTime(2017, 01, 19), DateEnd = new DateTime(2018, 01, 19) }; await context.ElectronBiblSystem.AddRangeAsync(Ebs1, Ebs2); await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация таблицы "Учебные планы" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateEduPlans(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Учебные планы" if (!await context.EduPlans.AnyAsync()) { EduPlan EduPlan1 = new EduPlan { ProtokolNumber = "4", ProtokolDate = new DateTime(2017, 09, 21), UtverjdDate = new DateTime(2017, 09, 30), EduFormId = 1, EduProfileId = 1, EduProgramPodgId = 1, EduSrokId = 1, StructKafId = 1 }; await context.EduPlans.AddRangeAsync( EduPlan1 ); await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация таблицы "Наименование части блока дисциплин Учебного плана" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateBlokDisciplChastName(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Наименование части блока дисциплин Учебного плана" if (!await context.BlokDisciplChastName.AnyAsync()) { BlokDisciplChastName BlokDisciplChastName1 = new BlokDisciplChastName { BlokDisciplChastNameId = 1, BlokDisciplChastNameName = "Базовая" }; BlokDisciplChastName BlokDisciplChastName2 = new BlokDisciplChastName { BlokDisciplChastNameId = 2, BlokDisciplChastNameName = "Вариативная" }; await context.BlokDisciplChastName.AddRangeAsync( BlokDisciplChastName1, BlokDisciplChastName2 ); await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация таблицы "Сведения об учредителях" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateUchredLaw(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Сведения об учредителях" if (!await context.UchredLaw.AnyAsync()) { UchredLaw UchredLawName1 = new UchredLaw { UchredLawId = 1, NameUchred = "Министерство сельского хозяйства Российской Федерации (Минсельхоз России)", FullnameUchred = "Министр сельского хозяйства РФ - Ткачев Александр Николаевич", AddressUchred = "107139, г. Москва, Орликов переулок, д. 1/1", TelUchred = "+7 (495) 607-80-00", mailUchred = "*****@*****.**", WebsiteUchred = "http://mcx.ru/" }; await context.UchredLaw.AddRangeAsync(UchredLawName1); await context.SaveChangesAsync(); } #endregion } }
public ActionResult Register(User u) { if (ModelState.IsValid) { var checkUser = db.Users.Where(x => x.Username == u.Username).Count(); if (checkUser == 0) { using (AppIdentityDBContext db = new AppIdentityDBContext()) { u.Role = "p"; u.Approved = "pending"; db.Users.Add(u); db.SaveChanges(); ModelState.Clear(); u = null; ViewBag.Msg = "Successfully registered."; } } else { ViewBag.Msg = "That username is already taken, try another one."; return(View(u)); } } return(View(u)); }
public static async Task CreateLinkTypes(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Дисциплины" if (!await context.LinkTypes.AnyAsync()) { LinkType LinkType1 = new LinkType { LinkTypeId = (int)LinkTypesEnum.OfficialWebSite, LinkTypeName = "Официальный веб-сайт" }; LinkType LinkType2 = new LinkType { LinkTypeId = (int)LinkTypesEnum.BusGovRu, LinkTypeName = "Ссылка на информацию, размещаемую на сайте http://bus.gov.ru" }; await context.LinkTypes.AddRangeAsync( LinkType1, LinkType2 ); await context.SaveChangesAsync(); } #endregion } }
/// <summary> /// Инициализация таблицы "Формы контроля" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateFormKontrolName(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Формы контроля" if (!await context.FormKontrolNames.AnyAsync()) { FormKontrolName FormKontrolName1 = new FormKontrolName { FormKontrolNameId = 1, FormKontrolNameName = "Экзамен" }; FormKontrolName FormKontrolName2 = new FormKontrolName { FormKontrolNameId = 2, FormKontrolNameName = "Зачет" }; FormKontrolName FormKontrolName3 = new FormKontrolName { FormKontrolNameId = 3, FormKontrolNameName = "Зачет с оценкой" }; FormKontrolName FormKontrolName4 = new FormKontrolName { FormKontrolNameId = 4, FormKontrolNameName = "Курсовой проект" }; FormKontrolName FormKontrolName5 = new FormKontrolName { FormKontrolNameId = 5, FormKontrolNameName = "Курсовая работа" }; FormKontrolName FormKontrolName6 = new FormKontrolName { FormKontrolNameId = 6, FormKontrolNameName = "Расчетно-графическая работа" }; await context.FormKontrolNames.AddRangeAsync( FormKontrolName1, FormKontrolName2, FormKontrolName3, FormKontrolName4, FormKontrolName5, FormKontrolName6 ); await context.SaveChangesAsync(); } #endregion } }
public EntranceTestsProtocolsRepository(AppIdentityDBContext context, IUserDocumentRepository userDocumentRepository, IPdfDocumentGenerator pdfDocumentGenerator) { _context = context; _userDocumentRepository = userDocumentRepository; _pdfDocumentGenerator = pdfDocumentGenerator; }
public EduPlanRepository(AppIdentityDBContext context, IHostingEnvironment appEnvironment, IFileModelRepository fileModelRepository) { _context = context; _appEnvironment = appEnvironment; _fileModelRepository = fileModelRepository; }
public EntranceTestsProtocolsController(AppIdentityDBContext context, IEntranceTestsProtocolsRepository entranceTestsProtocolsRepository, ISelectListRepository selectListRepository) { _context = context; _entranceTestsProtocolsRepository = entranceTestsProtocolsRepository; _selectListRepository = selectListRepository; }
public ProfessionalRetrainingsController(AppIdentityDBContext context, UserManager <AppUser> userMgr, IHostingEnvironment appEnvironment) { _context = context; _userManager = userMgr; _appEnvironment = appEnvironment; }
public LmsEventRepository(AppIdentityDBContext context, IAppUserLmsEventRepository appUserLmsEventsRepository, ILmsTaskSetRepository lmsTaskSetRepository) { _context = context; _appUserLmsEventsRepository = appUserLmsEventsRepository; _lmsTaskSetRepository = lmsTaskSetRepository; }
public UserAchievmentsController(AppIdentityDBContext context, IUserProfileRepository userProfileRepository, ISelectListRepository selectListRepository) { _context = context; _userProfileRepository = userProfileRepository; _selectListRepository = selectListRepository; }
public DocumentSamplesController(AppIdentityDBContext context, IDocumentSamplesRepository documentSamplesRepository, ISelectListRepository selectListRepository) { _context = context; _documentSamplesRepository = documentSamplesRepository; _selectListRepository = selectListRepository; }
public MetodKomissiyaRepository(AppIdentityDBContext context, IHostingEnvironment appEnvironment, IEduPlanRepository eduPlanRepository) { _context = context; _appEnvironment = appEnvironment; _eduPlanRepository = eduPlanRepository; }
public override string[] GetRolesForUser(string username) { AppIdentityDBContext db = new AppIdentityDBContext(); string s = db.Users.Where(x => x.Username == username).FirstOrDefault().Role; string[] resultS = { s }; return(resultS); }
public RevocationStatementsController(AppIdentityDBContext context, IRevocationStatementRepository revocationStatementRepository, ISelectListRepository selectListRepository) { _context = context; _revocationStatementRepository = revocationStatementRepository; _selectListRepository = selectListRepository; }
public EiosController(AppIdentityDBContext context, IUchPosobiyaRepository uchPosobiyaRepository, IUserProfileRepository userProfileRepository) { _context = context; _uchPosobiyaRepository = uchPosobiyaRepository; _userProfileRepository = userProfileRepository; }
public MetodKomissiyaMemberArmController(AppIdentityDBContext context, IMetodKomissiyaRepository metodKomissiyaRepository, ISelectListRepository selectListRepository) { _context = context; _metodKomissiyaRepository = metodKomissiyaRepository; _selectListRepository = selectListRepository; }
public DocumentsController(AppIdentityDBContext context, IHostingEnvironment appEnvironment, IFileModelRepository fileModelRepository) { _context = context; _appEnvironment = appEnvironment; _fileModelRepository = fileModelRepository; }
public EduPlansController(AppIdentityDBContext context, IHostingEnvironment appEnvironment, IEduPlanRepository eduPlanRepository) { _context = context; _appEnvironment = appEnvironment; _eduPlanRepository = eduPlanRepository; }
public UserDocumentRepository(AppIdentityDBContext context, IFileModelRepository fileModelRepository, IUserProfileRepository userProfileRepository) { _context = context; _fileModelRepository = fileModelRepository; _userProfileRepository = userProfileRepository; }