/// <summary> /// 初始化数据处理 /// </summary> /// <param name="context"></param> /// <returns></returns> public async Task SeedAsync(DataSeedContext context) { if (await _bookRepository.GetCountAsync() > 0) { return; } if (await _authorRepository.GetCountAsync() <= 0) { var authorLi = await _authorRepository.InsertAsync( await _authorManager.CreateAsync( "Li", new DateTime(1993, 08, 25), "qwertyuiopasdfghjkl") ); var authorJun = await _authorRepository.InsertAsync( await _authorManager.CreateAsync( "Jun", new DateTime(1993, 08, 25), "sadfkjsdfsaoisdadgfsagdjskssgdladsgafjsfjlskdejfjsfjsaklfjserdofisjdfklsjdfoisdjflskdfjsdhsofjsldkfjsodfisjdkfsiodfjskfsjlgsgijgsagsgsdgsagwgehrtntvsvdsdavvsfbsbsbsfabbsfgsagsdagsadg") ); if (await _bookRepository.GetCountAsync() <= 0) { var bookHD = await _bookRepository.InsertAsync( new Book() { AuthorId = authorLi.Id, Name = "2021荒岛日记", Type = BookType.Adventure, PublishDate = new DateTime(2021, 5, 6), Price = 19.84f, IsTrue = BookIsTrue.True }, autoSave : true ); var bookKB = await _bookRepository.InsertAsync( new Book() { AuthorId = authorJun.Id, Name = "2021恐怖小船", Type = BookType.Horror, PublishDate = new DateTime(2021, 5, 6), Price = 42.0f, IsTrue = BookIsTrue.True }, autoSave : true ); if (await _bookMarkRepository.GetCountAsync() <= 0) { await _bookMarkRepository.InsertAsync( new BookMark() { Name = "testBookMark", BookId = bookHD.Id, PageNum = 1, RowNum = 10, BookMarkContent = "123456", ContentLength = 6, StartingWordNum = 5 }, autoSave : true); await _bookMarkRepository.InsertAsync( new BookMark() { Name = "testBookMark2", BookId = bookKB.Id, PageNum = 1, RowNum = 10, BookMarkContent = "1234567", ContentLength = 7, StartingWordNum = 5 }, autoSave : true); } } } }
public async Task SeedAsync(DataSeedContext context) { await CreateAuthorAsync(); await CreateCategoryAsync(); await CreateBookAsync(); }
public async Task SeedAsync(DataSeedContext context) { await _permissionManager.SetAsync(MyPermissions.Cats.Default, "U", "a7234ca4-2130-46dd-b77a-1d94412cbb01", true); await _permissionManager.SetAsync(MyPermissions.Cats.Default, "U", "a7234ca4-2130-46dd-b77a-1d94412cbb02", true); }
public async Task SeedAsync(DataSeedContext context) { await _targetSourceRepository.InsertAsync( new TargetSource() { Name = "Github Trending", Title = "Github Trending", WebURL = "https://github.com/trending", TargetSelectors = new List <TargetSelector>() { new TargetSelector() { SelectorType = SelectorType.CSSSelector, ExpressionString = ">div.application-main>main>div.explore-pjax-container.container-lg.p-responsive.pt-6>div.Box>div:nth-child(2)>article.Box-row:nth-child(1)", } }, ScheduleCheck = new ScheduleCheck() { ScheduleType = ScheduleType.Interval, Duration = 15, }, Alerts = new List <Alert>() { new Alert() { AlertType = AlertType.Telegram, Detail1 = "999-999-99-99" } } }); await _targetSourceRepository.InsertAsync( new TargetSource() { Name = "Github Project Stars", Title = "Github Project Stars", WebURL = "https://github.com/KatmerTeam", TargetSelectors = new List <TargetSelector>() { new TargetSelector() { SelectorType = SelectorType.CSSSelector, ExpressionString = "#org-repositories>div.col-12.col-md-8.d-md-inline-block>div.org-repos.repo-list>ul>li.public.source.d-block.py-4.border-bottom:nth-child(1)>div.text-gray.f6.mt-2>span.no-wrap>relative-time.no-wrap", } }, ScheduleCheck = new ScheduleCheck() { ScheduleType = ScheduleType.Interval, Duration = 20, }, Alerts = new List <Alert>() { new Alert() { AlertType = AlertType.SMS, Detail1 = "999-999-99-99" } } }); await _targetSourceRepository.InsertAsync( new TargetSource() { Name = "ABP Last Release", Title = "ABP Last Release", WebURL = "https://github.com/abpframework/abp/releases", TargetSelectors = new List <TargetSelector>() { new TargetSelector() { SelectorType = SelectorType.CSSSelector, ExpressionString = "body > div.application-main > div > main > div.container-lg.clearfix.new-discussion-timeline.experiment-repo-nav.p-responsive > div > div.position-relative.border-top.clearfix > div:nth-child(1) > div > div.col-12.col-md-9.col-lg-10.px-md-3.py-md-4.release-main-section.commit.open.float-left > div.release-header > div > div", } }, ScheduleCheck = new ScheduleCheck() { ScheduleType = ScheduleType.Interval, Duration = 25, }, Alerts = new List <Alert>() { new Alert() { AlertType = AlertType.Telegram, Detail1 = "999-999-99-99" } } }); }
public async Task SeedAsync(DataSeedContext context) { await _storeDataSeeder.SeedAsync(context); }
public async Task SeedAsync(DataSeedContext context) { var configurationSection = _configuration.GetSection("GlobalConfiguration"); var baseUrl = configurationSection["BaseUrl"]; var gatewayname = configurationSection["Name"]; if (!string.IsNullOrWhiteSpace(gatewayname)) { var ocelot = await _ocelotRepository.FindByNameAsync(gatewayname); if (ocelot == null) { ocelot = new Ocelot( _guidGenerator.Create(), gatewayname, null, baseUrl); int index = 0; do { string name = configurationSection[$"Routes:{index}:Name"]; if (string.IsNullOrWhiteSpace(name)) { break; } var UpstreamPathTemplate = configurationSection[$"Routes:{index}:UpstreamPathTemplate"]; var DownstreamScheme = configurationSection[$"Routes:{index}:DownstreamScheme"]; var DownstreamPathTemplate = configurationSection[$"Routes:{index}:DownstreamPathTemplate"]; int methodIndex = 0; List <string> methods = new List <string>(); do { string method = configurationSection[$"Routes:{index}:UpstreamHttpMethod:{methodIndex++}"]; if (string.IsNullOrWhiteSpace(method)) { break; } methods.Add(method); } while (true); int hostIndex = 0; Dictionary <string, int> DownstreamHostAndPorts = new Dictionary <string, int>(); do { string host = configurationSection[$"Routes:{index}:DownstreamHostAndPorts:{hostIndex}:Host"]; string port = configurationSection[$"Routes:{index}:DownstreamHostAndPorts:{hostIndex}:Port"]; hostIndex++; if (string.IsNullOrWhiteSpace(host) || string.IsNullOrWhiteSpace(port)) { break; } DownstreamHostAndPorts.Add(host, Convert.ToInt32(port)); } while (true); ocelot.AddRoutes( name, UpstreamPathTemplate, null, null, DownstreamPathTemplate, DownstreamScheme, upstreamHttpMethods: methods, downstreamHostAndPorts: DownstreamHostAndPorts ); index++; } while (true); await _ocelotRepository.InsertAsync(ocelot); } } }
public virtual async Task SeedAsync(DataSeedContext context) { await _editionDataSeeder.CreateStandardEditionsAsync(); }
public async Task SeedAsync(DataSeedContext context) { if (await _bookRepository.GetCountAsync() > 0) { return; } var orwell = await _authorRepository.InsertAsync( new Author { Name = "George Orwell", BirthDate = new DateTime(1903, 06, 25), ShortBio = "Orwell produced literary criticism and poetry, fiction and polemical journalism; and is best known for the allegorical novella Animal Farm (1945) and the dystopian novel Nineteen Eighty-Four (1949)." }, autoSave : true ); var douglas = await _authorRepository.InsertAsync( new Author { Name = "Douglas Adams", BirthDate = new DateTime(1952, 03, 11), ShortBio = "Douglas Adams was an English author, screenwriter, essayist, humorist, satirist and dramatist. Adams was an advocate for environmentalism and conservation, a lover of fast cars, technological innovation and the Apple Macintosh, and a self-proclaimed 'radical atheist'." }, autoSave : true ); await _bookRepository.InsertAsync( new Book { AuthorId = orwell.Id, // SET THE AUTHOR Name = "1984", Image = "CV.jpg", Type = BookType.Dystopia, PublishDate = new DateTime(1949, 6, 8), Price = 19.84f }, autoSave : true ); await _bookRepository.InsertAsync( new Book { AuthorId = douglas.Id, // SET THE AUTHOR Name = "The Hitchhiker's Guide to the Galaxy", Image = "CV.jpg", Type = BookType.ScienceFiction, PublishDate = new DateTime(1995, 9, 27), Price = 42.0f }, autoSave : true ); await _slideRepository.InsertAsync( new Slide { Name = "12102020112534images (3).jpg" }, autoSave : true ); await _slideRepository.InsertAsync( new Slide { Name = "12112020024942images (4).jpg" }, autoSave : true ); }
public async Task SeedAsync(DataSeedContext context) { if (await _commandRepository.GetCountAsync() <= 0) { await _commandRepository.InsertAsync( new Command { CommandName = "dt.request", FriendlyName = "Downtime Request", CommandType = "Direct Command" }, autoSave : true ); await _commandRepository.InsertAsync( new Command { CommandName = "geo.request", FriendlyName = "Polygon Request", CommandType = "Direct Command" }, autoSave : true ); await _commandRepository.InsertAsync( new Command { CommandName = "hourmeter.seconds", FriendlyName = "Set hour meter", CommandType = "Set Command" }, autoSave : true ); await _commandRepository.InsertAsync( new Command { CommandName = "geo.clear.entry", FriendlyName = "Clear Geofence Area", CommandType = "Set Command" }, autoSave : true ); await _commandRepository.InsertAsync( new Command { CommandName = "heartbeat.min", FriendlyName = "Device Heartbeat", CommandType = "GSM Command" }, autoSave : true ); await _commandRepository.InsertAsync( new Command { CommandName = "sem.config", FriendlyName = "sem.config", CommandType = "GSM Command" }, autoSave : true ); } if (await _settingRepository.GetCountAsync() <= 0) { await _settingRepository.InsertAsync( new Setting { SettingName = "DeviceHiveCommandUrl", Description = "Authourization token for DeviceHive", SettingValue = "d2MTYW1iiEiNaIVm9rf8SUviFS+ZbIghuO1iyJGhjqM=" }, autoSave : true ); await _settingRepository.InsertAsync( new Setting { SettingName = "DeviceHiveCommandUrl", Description = "The url to device commands endpoint", SettingValue = "http://api.vsvt.co.za/device/<deviceid>/command" }, autoSave : true ); } }
public async Task SeedAsync(DataSeedContext context) { if (await _hotelTypeRepository.GetCountAsync() > 0) { return; } if (await _hotelRepository.GetCountAsync() > 0) { return; } var hotelTypes = new List <HotelType>() { new HotelType { Name = "Business", Description = "Business" }, new HotelType { Name = "Airpot", Description = "Airpot" }, new HotelType { Name = "Suite", Description = "Suite" }, new HotelType { Name = "Resort", Description = "Resort" }, new HotelType { Name = "Homestays", Description = "Homestays" }, new HotelType { Name = "Vacation Rentals", Description = "Vacation Rentals" }, new HotelType { Name = "Conference", Description = "Conference" }, }; hotelTypes.ForEach(h => _hotelTypeRepository.InsertAsync(h, autoSave: true).GetAwaiter().GetResult()); var hotels = new List <Hotel>() { new Hotel { Name = "Hotel Himalayan", ShortDescription = "In the land of himalayan", FullDescription = "In the land of himalayan", ShowOnHomePage = true, Rating = 4, AllowCustomerReviews = true, IsEnabled = true, HotelType = hotelTypes.FirstOrDefault(p => p.Name == "Homestays"), Address = new Address { City = "Hetauda", Province = "3", District = "Makawanpur" }, Location = new Location { Latitude = 87.6, Longitude = 26.4 }, Rooms = new List <Room> { new Room { Name = "Everest", Capacity = 3, MaxNoOfChildren = 1, Price = 1200, BedType = BedType.Double, IsSmoking = true, IsBooked = false } } }, new Hotel { Name = "Hotel Everest", ShortDescription = "In the land of Everest", FullDescription = "In the land of Everest", ShowOnHomePage = true, Rating = 4, AllowCustomerReviews = true, IsEnabled = true, HotelType = hotelTypes.FirstOrDefault(p => p.Name == "Resort"), Rooms = new List <Room> { new Room { Name = "Everest1122", Capacity = 3, MaxNoOfChildren = 1, Price = 1200, BedType = BedType.Double, IsSmoking = true, IsBooked = false } }, Address = new Address { City = "Hetauda", Province = "3", District = "Makawanpur" }, Location = new Location { Latitude = 87.6, Longitude = 26.4 } }, new Hotel { Name = "Hotel Avocado", ShortDescription = "Hotel Avocado", FullDescription = "Hotel Avocado", ShowOnHomePage = true, Rating = 4, AllowCustomerReviews = true, IsEnabled = true, HotelType = hotelTypes.FirstOrDefault(p => p.Name == "Vacation Rentals"), Rooms = new List <Room> { new Room { Name = "Hotel Avocado", Capacity = 3, MaxNoOfChildren = 1, Price = 1200, BedType = BedType.Single, IsSmoking = true, IsBooked = false } }, Address = new Address { City = "Hetauda", Province = "3", District = "Makawanpur" }, Location = new Location { Latitude = 87.6, Longitude = 26.4 }, }, }; hotels.ForEach(h => _hotelRepository.InsertAsync(h, autoSave: true).GetAwaiter().GetResult()); }
public async Task SeedAsync(DataSeedContext dataSeedContext) { if (await _textileGroups.GetCountAsync() <= 0) { await _textileGroups.InsertAsync( new TextileGroup { GroupName = "武汉裕大华纺织服装集团有限公司", WebSite = "http://www.yudahua.com.cn", Address = "湖北省武汉市青山区工业四路5号", Slogan = "经纬编织,跨越百年。创造价值,分享成果。" }, autoSave : true ); await _textileGroups.InsertAsync( new TextileGroup { GroupName = "夏邑恒天永安新织造有限公司", WebSite = "http://www.xiayihengtianyongan.com/index.html", Address = "河南省商丘市夏邑县长寿大道与腾飞大道交叉口东北角夏邑产业集聚区科技孵化园内", Slogan = "" }, autoSave : true ); await _textileGroups.InsertAsync( new TextileGroup { GroupName = "河南永安纺织有限公司", WebSite = "", Address = "夏邑县产业集聚区跨越大道东段南侧", Slogan = "军魂育人,孝道造心,人本诚信,学习创新" }, autoSave : true ); await _textileGroups.InsertAsync( new TextileGroup { GroupName = "无锡经纬纺织科技试验有限公司", WebSite = "http://wxjw.jwgf.com/", Address = "江苏无锡滨湖区马山梅梁西路42号", Slogan = "" }, autoSave : true ); await _textileGroups.InsertAsync( new TextileGroup { GroupName = "江苏联发纺织股份有限公司", WebSite = "http://www.lianfa.cn/", Address = "中国江苏省南通市海安县恒联路88号", Slogan = "编织梦想,传承文明" }, autoSave : true ); await _textileGroups.InsertAsync( new TextileGroup { GroupName = "山东如意科技集团", WebSite = "http://www.chinaruyi.com/home", Address = "山东省济宁市高新区如意工业园", Slogan = "以传承千年的儒学精神为根基,提炼德载品质、竞显卓越、从严求实、至诚至善" }, autoSave : true ); await _textileGroups.InsertAsync( new TextileGroup { GroupName = "江苏大生集团有限公司", WebSite = "http://www.dasheng-group.com.cn/", Address = "江苏省南通市港闸区唐闸南市街14号", Slogan = "天地之大德日生" }, autoSave : true ); await _textileGroups.InsertAsync( new TextileGroup { GroupName = "宜宾弘曲线业有限公司", WebSite = "", Address = "四川省宜宾市屏山县屏山镇王场工业园区", Slogan = "" }, autoSave : true ); await _textileGroups.InsertAsync( new TextileGroup { GroupName = "天虹纺织集团有限公司", WebSite = "http://www.texhong.com", Address = "上海市黄浦区中山东二路88号", Slogan = "敬天爱人、自利利他" }, autoSave : true ); await _textileGroups.InsertAsync( new TextileGroup { GroupName = "南阳木兰花股份有限公司", WebSite = "", Address = "河南省南阳市伏牛南路", Slogan = "" }, autoSave : true ); await _textileGroups.InsertAsync( new TextileGroup { GroupName = "芦山湘邻纺织有限公司", WebSite = "", Address = "芦山县芦阳镇灵鹫山路2号附10号", Slogan = "" }, autoSave : true ); } }
public async Task SeedAsync(DataSeedContext context) { var curCompanies = await _CompaniesRepo.GetListAsync(); var curBranches = await _BranchesRepo.GetListAsync(); if (curCompanies.Any(x => x.CompanyName == "TestCorp" && curBranches.Any(x => x.Name == "Head"))) { // if (!DictionaryValueTypesRepo.Any(x => x.ValueTypeName == "Cashflow Statement Types")) // { // Guid guid = _guidGenerator.Create(); // List<DictionaryValue> cashflowDicValues = new List<DictionaryValue>() { // new DictionaryValue(_guidGenerator.Create()) // { // Key = "01001", // Value = "Cash Generated From Operations", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "01002", // Value = "Cash Flow From Operating Activities", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "01003", // Value = "Cash Generated From Financing Activities", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "01004", // Value = "Net Profit Before Tax", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "01005", // Value = "Operating Profit Before Working Capital", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "01006", // Value = "Cash and Cash Equivalents", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // } // }; // await DictionaryValueTypesRepo.InsertAsync(new DictionaryValueType(guid) // { // ValueTypeFor = ValueTypeModules.CashflowStatementType, // ValueTypeCode = "01", // ValueTypeName = "Cashflow Statement Types", // ActiveStatus = true, // Values = cashflowDicValues, // Branch = null, // Company = _CompaniesRepo.First(), // TenantId = context.TenantId // }); // } // if (!DictionaryValueTypesRepo.Any(x => x.ValueTypeName == "Country")) // { // Guid guid = _guidGenerator.Create(); // List<DictionaryValue> locationsDicValues = new List<DictionaryValue>() { // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02001", // Value = "UAE", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02002", // Value = "Bahrain", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02003", // Value = "Qatar", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02004", // Value = "Saudi Arabia", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02005", // Value = "Yemen", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02006", // Value = "Syria", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02007", // Value = "Egypt", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02008", // Value = "Libya", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "020017", // Value = "Sudan", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02009", // Value = "Palestine", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02010", // Value = "Pakistan", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02011", // Value = "India", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02012", // Value = "Lebanon", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02013", // Value = "Jordan", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02014", // Value = "Kuwait", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02015", // Value = "Bangladesh", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "02016", // Value = "Philippines", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // } // }; // await DictionaryValueTypesRepo.InsertAsync(new DictionaryValueType(guid) // { // ValueTypeFor = ValueTypeModules.Country, // ValueTypeCode = "02", // ValueTypeName = "Country", // ActiveStatus = true, // Values = locationsDicValues, // Branch = null, // Company = _CompaniesRepo.First() // }); // } // if (!DictionaryValueTypesRepo.Any(x => x.ValueTypeName == "Gender")) // { // Guid guid = _guidGenerator.Create(); // List<DictionaryValue> genderDicValues = new List<DictionaryValue>() { // new DictionaryValue(_guidGenerator.Create()) // { // Key = "03001", // Value = "Male", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "03002", // Value = "Female", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // } // }; // await DictionaryValueTypesRepo.InsertAsync(new DictionaryValueType(guid) // { // ValueTypeFor = ValueTypeModules.Gender, // ValueTypeCode = "03", // ValueTypeName = "Gender", // ActiveStatus = true, // Values = genderDicValues, // Branch = null, // Company = _CompaniesRepo.First(), // TenantId = context.TenantId // }); // } // if (!DictionaryValueTypesRepo.Any(x => x.ValueTypeName == "Marital Status")) // { // Guid guid = _guidGenerator.Create(); // List<DictionaryValue> maritalStatusDicValues = new List<DictionaryValue>() { // new DictionaryValue(_guidGenerator.Create()) // { // Key = "04001", // Value = "Married", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "04002", // Value = "Un-Married", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // } // }; // await DictionaryValueTypesRepo.InsertAsync(new DictionaryValueType(guid) // { // ValueTypeFor = ValueTypeModules.MaritalStatus, // ValueTypeCode = "04", // ValueTypeName = "Marital Status", // ActiveStatus = true, // Values = maritalStatusDicValues, // Branch = null, // Company = _CompaniesRepo.First(), // TenantId = context.TenantId // }); // } // if (!DictionaryValueTypesRepo.Any(x => x.ValueTypeName == "Blood Group")) // { // Guid guid = _guidGenerator.Create(); // List<DictionaryValue> bloodGroupsDicValues = new List<DictionaryValue>() { // new DictionaryValue(_guidGenerator.Create()) // { // Key = "05001", // Value = "AB+", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "05002", // Value = "A-", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "05003", // Value = "B+", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "05004", // Value = "A+", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "05005", // Value = "O+", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "05006", // Value = "O-", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "05007", // Value = "AB-", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "05008", // Value = "Unknown", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // } // }; // await DictionaryValueTypesRepo.InsertAsync(new DictionaryValueType(guid) // { // ValueTypeFor = ValueTypeModules.BloodGroup, // ValueTypeCode = "05", // ValueTypeName = "Blood Group", // ActiveStatus = true, // Values = bloodGroupsDicValues, // Branch = null, // Company = _CompaniesRepo.First(), // TenantId = context.TenantId // }); // } // if (!DictionaryValueTypesRepo.Any(x => x.ValueTypeName == "Religion")) // { // Guid guid = _guidGenerator.Create(); // List<DictionaryValue> religionDicValues = new List<DictionaryValue>() { // new DictionaryValue(_guidGenerator.Create()) // { // Key = "06001", // Value = "Muslim", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "06002", // Value = "Christian", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "06003", // Value = "Jew", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "06004", // Value = "Other", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // } // }; // await DictionaryValueTypesRepo.InsertAsync(new DictionaryValueType(guid) // { // ValueTypeFor = ValueTypeModules.Religion, // ValueTypeCode = "06", // ValueTypeName = "Religion", // ActiveStatus = true, // Values = religionDicValues, // Branch = null, // Company = _CompaniesRepo.First(), // TenantId = context.TenantId // }); // } // if (!DictionaryValueTypesRepo.Any(x => x.ValueTypeName == "ID Type")) // { // Guid guid = _guidGenerator.Create(); // List<DictionaryValue> idTypesDicValues = new List<DictionaryValue>() { // new DictionaryValue(_guidGenerator.Create()) // { // Key = "07001", // Value = "Iqama", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "07002", // Value = "Passport", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // }, // new DictionaryValue(_guidGenerator.Create()) // { // Key = "07003", // Value = "Ahwal", // ActiveStatus = true, // Branch = null, // Company = _CompaniesRepo.First(), // ValueTypeId = guid, //TenantId = context.TenantId // } // }; // await DictionaryValueTypesRepo.InsertAsync(new DictionaryValueType(guid) // { // ValueTypeFor = ValueTypeModules.IDType, // ValueTypeCode = "07", // ValueTypeName = "ID Type", // ActiveStatus = true, // Values = idTypesDicValues, // Branch = null, // Company = _CompaniesRepo.First(), // TenantId = context.TenantId // }); // } // if (DictionaryValueTypesRepo.Count() == -1) // { // if (!DictionaryValuesRepo.Any(x => x.Value == "Cash Generated From Operations")) // { // await DictionaryValuesRepo.InsertAsync(new DictionaryValue(_guidGenerator.Create()) // { // Key = "01", // Value = "Cash Generated From Operations", // ActiveStatus = true, // ValueType = DictionaryValueTypesRepo.First(x => x.ValueTypeName == "Cashflow Statement Types"), // TenantId = context.TenantId // }); // } // if (!DictionaryValuesRepo.Any(x => x.Value == "Cash Flow From Operating Activities")) // { // await DictionaryValuesRepo.InsertAsync(new DictionaryValue(_guidGenerator.Create()) // { // Key = "01", // Value = "Cash Flow From Operating Activities", // ActiveStatus = true, // ValueType = DictionaryValueTypesRepo.First(x => x.ValueTypeName == "Cashflow Statement Types"), // TenantId = context.TenantId // }); // } // if (!DictionaryValuesRepo.Any(x => x.Value == "Cash Generated From Financing Activities")) // { // await DictionaryValuesRepo.InsertAsync(new DictionaryValue(_guidGenerator.Create()) // { // Key = "01", // Value = "Cash Generated From Financing Activities", // ActiveStatus = true, // ValueType = DictionaryValueTypesRepo.First(x => x.ValueTypeName == "Cashflow Statement Types"), // TenantId = context.TenantId // }); // } // if (!DictionaryValuesRepo.Any(x => x.Value == "Net Profit Before Tax")) // { // await DictionaryValuesRepo.InsertAsync(new DictionaryValue(_guidGenerator.Create()) // { // Key = "01", // Value = "Net Profit Before Tax", // ActiveStatus = true, // ValueType = DictionaryValueTypesRepo.First(x => x.ValueTypeName == "Cashflow Statement Types"), // TenantId = context.TenantId // }); // } // if (!DictionaryValuesRepo.Any(x => x.Value == "Operating Profit Before Working Capital")) // { // await DictionaryValuesRepo.InsertAsync(new DictionaryValue(_guidGenerator.Create()) // { // Key = "01", // Value = "Operating Profit Before Working Capital", // ActiveStatus = true, // ValueType = DictionaryValueTypesRepo.First(x => x.ValueTypeName == "Cashflow Statement Types"), // TenantId = context.TenantId // }); // } // if (!DictionaryValuesRepo.Any(x => x.Value == "Cash and Cash Equivalents")) // { // await DictionaryValuesRepo.InsertAsync(new DictionaryValue(_guidGenerator.Create()) // { // Key = "01", // Value = "Cash and Cash Equivalents", // ActiveStatus = true, // ValueType = DictionaryValueTypesRepo.First(x => x.ValueTypeName == "Cashflow Statement Types"), // TenantId = context.TenantId // }); // } // } } }
public Task SeedAsync(DataSeedContext context) { var lb = _appPoet.InsertAsync(new Poet { Name = "李白", Description = "诗人" }, true).Result; var df = _appPoet.InsertAsync(new Poet { Name = "杜甫", Description = "诗人" }, true).Result; var c1 = _appCategory.InsertAsync(new Category { CategoryName = "唐诗三百首" }, true).Result; var c2 = _appCategory.InsertAsync(new Category { CategoryName = "小学生必背诗词" }, true).Result; var p1 = _appPoem.InsertAsync(new Core.Poems.Poem { Title = "静夜思", PoetID = lb.Id }, true).Result; var p2 = _appPoem.InsertAsync(new Core.Poems.Poem { Title = "望庐山瀑布", PoetID = lb.Id }, true).Result; var p3 = _appPoem.InsertAsync(new Core.Poems.Poem { Title = "石壕吏", PoetID = df.Id }, true).Result; _appCategoryPoem.InsertAsync(new CategoryPoem { CategoryId = c1.Id, PoemId = p1.Id }, true); _appCategoryPoem.InsertAsync(new CategoryPoem { CategoryId = c2.Id, PoemId = p1.Id }, true); _appCategoryPoem.InsertAsync(new CategoryPoem { CategoryId = c1.Id, PoemId = p2.Id }, true); _appCategoryPoem.InsertAsync(new CategoryPoem { CategoryId = c1.Id, PoemId = p3.Id }, true); return(Task.CompletedTask); }
public async Task SeedAsync(DataSeedContext context) { string line; // 定义文件绝对路径 string path = @"C:\\Users\\tpl\\Desktop\\主泵\\RCS-1\\RCS-1.csv"; StreamReader sr = new StreamReader(path, Encoding.UTF8); sr.ReadLine(); sr.ReadLine(); sr.ReadLine(); while (!sr.EndOfStream) { // 一行一行读取数据 line = sr.ReadLine(); string[] arr = line.Split(","); var parameterhas = await _parameterRepository.FindAsync(p => p.Id == arr[0].ConvertToTimeStamp()); if (parameterhas == null) { // 通过异步方法给对象赋值插入到数据库中 await _parameterRepository.InsertAsync( new Parameter(arr[0]) { P_vibration_X = Convert.ToDouble(arr[1]), P_vibration_Y = Convert.ToDouble(arr[2]), P_Motor_Displacement_X = Convert.ToDouble(arr[3]), P_Motor_Displacement_Y = Convert.ToDouble(arr[4]), P_Pump_Displacement_X = Convert.ToDouble(arr[5]), P_Pump_Displacement_Y = Convert.ToDouble(arr[6]), P_Motor_Speed = Convert.ToDouble(arr[7]), P_Zero_Speed = Convert.ToDouble(arr[8]), P_Pump_Outlet_P1 = Convert.ToDouble(arr[9]), P_Pump_Outlet_P2 = Convert.ToDouble(arr[10]), P_Filter_Pressure_1 = Convert.ToDouble(arr[11]), P_Filter_Pressure_2 = Convert.ToDouble(arr[12]), P_Fir_PreBeforeSeal = Convert.ToDouble(arr[13]), P_Sec_PreBeforeSeal = Convert.ToDouble(arr[14]), P_Thi_PreBeforeSeal = Convert.ToDouble(arr[15]), P_Upper_BearTemperature = Convert.ToDouble(arr[16]), P_Upper_BearBushTemperature = Convert.ToDouble(arr[17]), P_Lower_Thrust_BearBushTemperature = Convert.ToDouble(arr[18]), P_Upper_Thrust_BearBushTemperature = Convert.ToDouble(arr[19]), P_Up_Motor_AirTemperature = Convert.ToDouble(arr[20]), P_StatorTemperature_U = Convert.ToDouble(arr[21]), P_StatorTemperature_V = Convert.ToDouble(arr[22]), P_StatorTemperature_W = Convert.ToDouble(arr[23]), P_Low_Motor_AirTemperature = Convert.ToDouble(arr[24]), P_Lower_oilTemperature = Convert.ToDouble(arr[25]), P_Lower_BearTemperature = Convert.ToDouble(arr[26]), P_Cooler_InletTempeture = Convert.ToDouble(arr[27]), P_Cooler_OutletTempeture = Convert.ToDouble(arr[28]), P_Inject_WaterTempeture = Convert.ToDouble(arr[29]), P_Control_LeakageTemperature = Convert.ToDouble(arr[30]), P_Control_LeakageFlow = Convert.ToDouble(arr[31]), P_LowPressure_LeakageFlow = Convert.ToDouble(arr[32]), P_Inject_WaterFlow = Convert.ToDouble(arr[33]), P_Cooler_SecFlow = Convert.ToDouble(arr[34]), P_Upperbearing_OilLevel = Convert.ToDouble(arr[35]), P_Lowerbearing_OilLevel = Convert.ToDouble(arr[36]), P_Seal_PositionMonitor = Convert.ToDouble(arr[37]), P_Flywheel_PositionMonitor = Convert.ToDouble(arr[38]), }, autoSave : true ); } } // 关闭数据流 sr.Close(); }
public virtual async Task SeedAsync(DataSeedContext context) { await CreateUserWithExtraProperty(); }
public Task <List <Guid> > GetGrantMenuIdsAsync(DataSeedContext context) { return(Task.FromResult(new List <Guid>())); }
public async Task SeedAsync(DataSeedContext context) { await SeedCategories(context); }
public async Task SeedAsync(DataSeedContext context) { await InsertMenusAsync(context); await InsertMenuGrantAsync(context); }
public async Task SeedAsync(DataSeedContext context) { }
public async Task SeedAsync(DataSeedContext context) { await CreateUserAsync("john", "John", "Nash", context); await CreateUserAsync("albert", "Albert", "Einstein", context); }
public async Task SeedAsync(DataSeedContext context) { if (await _unitRepository.GetCountAsync() <= 0) { Unit FirstUnit = await _unitRepository.InsertAsync( new Unit { Name = "First Unit" }, autoSave : true ); Unit SecondUnit = await _unitRepository.InsertAsync( new Unit { Name = "Second Unit" }, autoSave : true ); if (await _itemRepository.GetCountAsync() <= 0) { Item FirstItem = await _itemRepository.InsertAsync( new Item { Name = "First Item", UnitId = FirstUnit.Id, TenantId = Tenant1Id }, autoSave : true ); Item SecondItem = await _itemRepository.InsertAsync( new Item { Name = "Second Item", UnitId = FirstUnit.Id, TenantId = Tenant1Id }, autoSave : true ); Item ThirdItem = await _itemRepository.InsertAsync( new Item { Name = "Third Item", UnitId = SecondUnit.Id, TenantId = Tenant2Id }, autoSave : true ); Item FourthItem = await _itemRepository.InsertAsync( new Item { Name = "Fourth Item", UnitId = SecondUnit.Id, TenantId = Tenant2Id }, autoSave : true ); if (await _categoryRepository.GetCountAsync() <= 0) { Category FirstCategory = await _categoryRepository.InsertAsync( new Category { Name = "First Category", }, autoSave : true ); Category SecondCategory = await _categoryRepository.InsertAsync( new Category { Name = "Second Category", ParentId = FirstCategory.Id, }, autoSave : true ); Category ThirdCategory = await _categoryRepository.InsertAsync( new Category { Name = "Third Category", ParentId = FirstCategory.Id, }, autoSave : true ); if (await _categoryItemRepository.GetCountAsync() <= 0) { CategoryItem FirstCategoryItem = await _categoryItemRepository.InsertAsync( new CategoryItem { ItemId = FirstItem.Id, CategoryId = FirstCategory.Id }, autoSave : true ); CategoryItem SecondCategoryItem = await _categoryItemRepository.InsertAsync( new CategoryItem { ItemId = SecondItem.Id, CategoryId = SecondCategory.Id }, autoSave : true ); CategoryItem ThirdCategoryItem = await _categoryItemRepository.InsertAsync( new CategoryItem { ItemId = ThirdItem.Id, CategoryId = ThirdCategory.Id }, autoSave : true ); CategoryItem FourthCategoryItem = await _categoryItemRepository.InsertAsync( new CategoryItem { ItemId = FourthItem.Id, CategoryId = SecondCategory.Id }, autoSave : true ); await _categoryItemRepository.InsertAsync( new CategoryItem { ItemId = FourthItem.Id, CategoryId = ThirdCategory.Id }, autoSave : true ); } } } } }
private async Task CreateUserAsync(string userName, string name, string surname, DataSeedContext context) { if ((await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName(userName))) != null) { return; } var user = new IdentityUser( _guidGenerator.Create(), userName, userName + "@abp.io", context.TenantId ); user.Name = name; user.Surname = surname; await _identityUserManager.CreateAsync(user, "1q2w3E*" ); await _identityUserManager.AddToRoleAsync(user, "admin"); }
public async Task SeedAsync(DataSeedContext context) { if (await _contactRepository.GetCountAsync() > 0) { return; } //Add group to db if (await _groupRepository.GetCountAsync() <= 0) { var group03 = await _groupRepository.InsertAsync( await _groupManager.CreateAsync( "Group03", "This is group 3" ) ); var group04 = await _groupRepository.InsertAsync( await _groupManager.CreateAsync( "Group04", "This is group 4" ) ); var group01 = await _groupRepository.InsertAsync( await _groupManager.CreateAsync( "Group01", "This is group 1" ) ); var group02 = await _groupRepository.InsertAsync( await _groupManager.CreateAsync( "Group02", "This is group 2" ) ); var group05 = await _groupRepository.InsertAsync( await _groupManager.CreateAsync( "Group05", "This is group 5" ) ); //Add contact to db if (await _contactRepository.GetCountAsync() <= 0) { /*List<ContactGroup> groups1 = new List<ContactGroup>(); * groups1.Add(new ContactGroup() * { * * }); * groups1.Add(group02); * List<Group> groups2 = new List<Group>(); * groups2.Add(group03); * groups2.Add(group02); * List<Group> groups3 = new List<Group>(); * groups3.Add(group04); * List<Group> groups4 = new List<Group>(); * groups3.Add(group05); * groups3.Add(group01);*/ await _contactRepository.InsertAsync( new Contact { //Contact//Groups = groups1, Email = "*****@*****.**", FirstName = "Pham", LastName = "Thinh", DateOfBirth = new DateTime(1999, 5, 21), PhoneNumber = "0905901869", Type = ContactType.Group01 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { ////Groups = groups2, Email = "*****@*****.**", FirstName = "Bich", LastName = "Tram", DateOfBirth = new DateTime(2004, 8, 9), PhoneNumber = "0932443774", Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { ////Groups = groups3, Email = "*****@*****.**", FirstName = "Pham", LastName = "Thinh", DateOfBirth = new DateTime(1999, 5, 21), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { ////Groups = groups4, Email = "*****@*****.**", FirstName = "Hoàng", LastName = "Hiệp", DateOfBirth = new DateTime(1999, 4, 30), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { ////Groups = groups3, Email = "*****@*****.**", FirstName = "Công", LastName = "Văn", DateOfBirth = new DateTime(1999, 4, 27), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { ////Groups = groups1, Email = "*****@*****.**", FirstName = "Tran Công", LastName = "Văn", DateOfBirth = new DateTime(1999, 4, 27), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { ////Groups = groups4, Email = "*****@*****.**", FirstName = "Pham", LastName = "Hưng", DateOfBirth = new DateTime(1998, 1, 27), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { // //Groups = groups2, Email = "*****@*****.**", FirstName = "Vũ", LastName = "Minh", DateOfBirth = new DateTime(1999, 2, 27), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups1, Email = "*****@*****.**", FirstName = "Minh", LastName = "Hào", DateOfBirth = new DateTime(1999, 3, 20), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups3, Email = "*****@*****.**", FirstName = "Trí", LastName = "Lâm", DateOfBirth = new DateTime(1999, 5, 30), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups3, Email = "*****@*****.**", FirstName = "Nhật", LastName = "Anh", DateOfBirth = new DateTime(1999, 5, 30), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups4, Email = "*****@*****.**", FirstName = "Nguyễn", LastName = "Minh", DateOfBirth = new DateTime(1999, 5, 30), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups1, Email = "*****@*****.**", FirstName = "Trung", LastName = "Nam", DateOfBirth = new DateTime(1999, 5, 30), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups2, Email = "*****@*****.**", FirstName = "Việt", LastName = "Long", DateOfBirth = new DateTime(1999, 1, 30), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups4, Email = "*****@*****.**", FirstName = "Hoàng", LastName = "Hiệp", DateOfBirth = new DateTime(1999, 1, 30), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups3, Email = "*****@*****.**", FirstName = "Công", LastName = "Huy", DateOfBirth = new DateTime(1999, 1, 25), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups3, Email = "*****@*****.**", FirstName = "Manh", LastName = "Cường", DateOfBirth = new DateTime(1999, 1, 20), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups1, Email = "*****@*****.**", FirstName = "Đức", LastName = "Huy", DateOfBirth = new DateTime(1999, 7, 20), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups3, Email = "*****@*****.**", FirstName = "Anh", LastName = "Khoa", DateOfBirth = new DateTime(1999, 7, 20), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups3, Email = "*****@*****.**", FirstName = "Thế", LastName = "Duy", DateOfBirth = new DateTime(1999, 7, 20), Type = ContactType.Group02 }, autoSave : true ); await _contactRepository.InsertAsync( new Contact { //Groups = groups2, Email = "*****@*****.**", FirstName = "Bích", LastName = "Trâm", DateOfBirth = new DateTime(2004, 7, 8), Type = ContactType.Group02 }, autoSave : true ); } ; } if (await _campaignRepository.GetCountAsync() <= 0) { await _campaignRepository.InsertAsync( await _campaignManager.CreateAsync( "Campaign01", "This is Campaign 1", new DateTime(2021, 5, 11), "abcxyz", "Title01" ) , autoSave : true ); await _campaignRepository.InsertAsync( await _campaignManager.CreateAsync( "Campaign02", "This is Campaign 2", new DateTime(2021, 05, 10), "abcxyz123", "Title02" ) , autoSave : true ); } if (await _emailRepository.GetCountAsync() <= 0) { var email = await _emailManager.CreateAsync( "*****@*****.**", "thuqua1997", 0 ); await _emailRepository.InsertAsync( email, autoSave : true ); await _emailRepository.InsertAsync( await _emailManager.CreateAsync( "*****@*****.**", "Abc123#!", 0 ), autoSave : true ); await _emailRepository.InsertAsync( await _emailManager.CreateAsync( "*****@*****.**", "Sdc@2021", 0 ), autoSave : true ); } }
public async Task SeedAsync(DataSeedContext context) { var fdPrice = await _fieldDefinitionRepository.FindAsync(fd => fd.Name == "Price"); if (fdPrice == null) { fdPrice = await _fieldDefinitionRepository.InsertAsync(new FieldDefinition(_guidGenerator.Create(), "Price", "Price", FieldDataType.Number)); } var fdCpu = await _fieldDefinitionRepository.FindAsync(fd => fd.Name == "Cpu"); if (fdCpu == null) { fdCpu = await _fieldDefinitionRepository.InsertAsync(new FieldDefinition(_guidGenerator.Create(), "Cpu", "Cpu", FieldDataType.Text)); } var fdRam = await _fieldDefinitionRepository.FindAsync(fd => fd.Name == "Ram"); if (fdRam == null) { fdRam = await _fieldDefinitionRepository.InsertAsync(new FieldDefinition(_guidGenerator.Create(), "Ram", "Ram", FieldDataType.Text)); } var mdComputer = await _modelDefinitionRepository.FindAsync(md => md.Name == "Computer"); if (mdComputer == null) { const string permissionPrefix = DynamicEntityConsts.DynamicPermissionPrefix; var permissionSet = new PermissionSetValueObject( get: (await GetOrCreatePermissionAsync($"{permissionPrefix}.Computer")).Name, getList: (await GetOrCreatePermissionAsync($"{permissionPrefix}.Computer")).Name, create: (await GetOrCreatePermissionAsync($"{permissionPrefix}.Computer.Create")).Name, update: (await GetOrCreatePermissionAsync($"{permissionPrefix}.Computer.Update")).Name, delete: (await GetOrCreatePermissionAsync($"{permissionPrefix}.Computer.Delete")).Name ); mdComputer = new ModelDefinition(_guidGenerator.Create(), "Computer", "Computer", "DynamicEntitySample.Computer", permissionSet); mdComputer.AddField(fdCpu, 1); mdComputer.AddField(fdRam, 2); mdComputer.AddField(fdPrice, 3); await _modelDefinitionRepository.InsertAsync(mdComputer); } var deComputer = await _dynamicEntityRepository.FirstOrDefaultAsync(de => de.ModelDefinitionId == mdComputer.Id); if (deComputer == null) { var cpus = new[] { "Intel I3", "Intel I5", "Intel I7", "Intel I9" }; var rams = new[] { "4GB", "8GB", "16GB", "32GB" }; var prices = new[] { "999", "1999", "2999", "3999" }; var rnd = new Random(); for (int i = 0; i < 300; i++) { var entity = new DynamicEntity(_guidGenerator.Create(), context.TenantId, mdComputer.Id); entity.SetProperty("Cpu", cpus[rnd.Next() % cpus.Length]); entity.SetProperty("Ram", rams[rnd.Next() % rams.Length]); entity.SetProperty("Price", prices[rnd.Next() % prices.Length]); await _dynamicEntityRepository.InsertAsync(entity); } } }
public async Task SeedAsync(DataSeedContext context) { if (await _wellRepository.GetCountAsync() <= 0) { await _wellRepository.InsertAsync ( new Well { TenantId = 1, Name = "J-A1", Field = "Jerun", Platform = "Jerun A", Psc = "SK408", Producer = WellType.Gas, Category = WellCategory.Normal }, autoSave : true ); await _wellRepository.InsertAsync ( new Well { TenantId = 1, Name = "J-A2", Field = "Jerun", Platform = "Jerun A", Psc = "SK408", Producer = WellType.Gas, Category = WellCategory.Normal }, autoSave : true ); await _wellRepository.InsertAsync ( new Well { TenantId = 2, Name = "B15-A1St1", Field = "B15", Platform = "B15A", Psc = "SK310", Producer = WellType.Gas, Category = WellCategory.HPHT }, autoSave : true ); await _wellRepository.InsertAsync ( new Well { TenantId = 4, Name = "EPA-12L", Field = "East Piatu", Platform = "EPA", Psc = "PM329", Producer = WellType.Oil, Category = WellCategory.GasLifted }, autoSave : true ); await _wellRepository.InsertAsync ( new Well { TenantId = 4, Name = "EPA-12S", Field = "East Piatu", Platform = "EPA", Psc = "PM329", Producer = WellType.Oil, Category = WellCategory.GasLifted }, autoSave : true ); await _wellRepository.InsertAsync ( new Well { TenantId = 5, Name = "EPA-29", Field = "East Belumut", Platform = "EBA", Psc = "PM323", Producer = WellType.Injector, Category = WellCategory.Normal }, autoSave : true ); } }
public virtual async Task SeedAsync(DataSeedContext context) { await _identityResourceDataSeeder.CreateStandardResourcesAsync(); await CreateApiResourcesAsync(); }
public async Task SeedAsync(DataSeedContext context) { await BuildCommonUserAsync(); }
public async Task SeedAsync(DataSeedContext context) { await CreateScopesAsync(); await CreateApplicationsAsync(); }
public Task SeedAsync(DataSeedContext context) { /* Seed additional test data... */ return(Task.CompletedTask); }
public async Task SeedAsync(DataSeedContext context) { if (await _bookRepository.GetCountAsync() > 0) { return; } var orwell = await _authorRepository.InsertAsync( await _authorManager.CreateAsync( "George Orwell", new DateTime(1903, 06, 25), "Orwell produced literary criticism and poetry, fiction and polemical journalism; and is best known for the allegorical novella Animal Farm (1945) and the dystopian novel Nineteen Eighty-Four (1949)." ) ); var douglas = await _authorRepository.InsertAsync( await _authorManager.CreateAsync( "Douglas Adams", new DateTime(1952, 03, 11), "Douglas Adams was an English author, screenwriter, essayist, humorist, satirist and dramatist. Adams was an advocate for environmentalism and conservation, a lover of fast cars, technological innovation and the Apple Macintosh, and a self-proclaimed 'radical atheist'." ) ); await _bookRepository.InsertAsync( new Book { AuthorId = orwell.Id, Name = "1984", Type = BookType.Dystopia, PublishDate = new DateTime(1949, 6, 8), Price = 19.84f }, autoSave : true ); await _bookRepository.InsertAsync( new Book { AuthorId = douglas.Id, Name = "The Hitchhiker's Guide to the Galaxy", Type = BookType.ScienceFiction, PublishDate = new DateTime(1995, 9, 27), Price = 42.0f }, autoSave : true ); #region Events Seed Data await _EventRepository.InsertAsync( new Event { Title = " Event 1 ", Description = " Event 1 Description ", StartDate = new DateTime(2020, 10, 1), EndDate = new DateTime(2020, 10, 1), EventType = EventType.Event }, autoSave : true ); await _EventRepository.InsertAsync( new Event { Title = " Event 2 ", Description = " Event 2 Description ", StartDate = new DateTime(2020, 10, 1), EndDate = new DateTime(2020, 10, 1), EventType = EventType.Event }, autoSave : true ); await _EventRepository.InsertAsync( new Event { Title = " Event 3 ", Description = " Event 3 Description ", StartDate = new DateTime(2020, 10, 1), EndDate = new DateTime(2020, 10, 1), EventType = EventType.Exhibition }, autoSave : true ); await _EventRepository.InsertAsync( new Event { Title = " Event 4 ", Description = " Event 4 Description ", StartDate = new DateTime(2020, 10, 1), EndDate = new DateTime(2020, 10, 1), EventType = EventType.Exhibition }, autoSave : true ); await _EventRepository.InsertAsync( new Event { Title = " Event 5 ", Description = " Event 5 Description ", StartDate = new DateTime(2020, 10, 1), EndDate = new DateTime(2020, 10, 1), EventType = EventType.Exhibition }, autoSave : true ); await _EventRepository.InsertAsync( new Event { Title = " Event 6 ", Description = " Event 6 Description ", StartDate = new DateTime(2020, 10, 1), EndDate = new DateTime(2020, 10, 1), EventType = EventType.Initiative }, autoSave : true ); await _EventRepository.InsertAsync( new Event { Title = " Event 7 ", Description = " Event 7 Description ", StartDate = new DateTime(2020, 10, 1), EndDate = new DateTime(2020, 10, 1), EventType = EventType.Initiative }, autoSave : true ); #endregion }