private void CreateTestUserAccount() { AzureUser testAzureUser = new AzureUser { SessionTimeout = 60, IsLockedOut = false, IsOnline = false, LastActivityDate = DateTime.Now, LastLockoutDate = new DateTime(1900, 1, 1), LastPasswordChangedDate = new DateTime(1900, 1, 1), LastLoginDate = new DateTime(1900, 1, 1), RealName = "Jack Daniels", Email = "*****@*****.**", CreationDate = DateTime.Now, IsApproved = true, Password = "******", Username = "******", PartitionKey = "j", RowKey = Guid.NewGuid().ToString() }; //save test user new AzureUserRepository().Save(testAzureUser); string roleID = Guid.NewGuid().ToString(); AzureRole azureUserRole = new AzureRole { RowKey = roleID, RoleName = "Webmaster", PartitionKey = roleID.Substring(0, 1), UserRowKey = testAzureUser.RowKey, Timestamp = DateTime.Now }; //save a role for the test user new AzureRoleRepository().Save(azureUserRole); }
private void GenerateSampleData() { for (int i = 0; i < 200; i++) { //Create Users string rndUser = RandomString(5); AzureUser au = new AzureUser { SessionTimeout = 60, IsLockedOut = false, IsOnline = false, //Timestamp = DateTime.Now, LastActivityDate = DateTime.Now, LastLockoutDate = new DateTime(1900, 1, 1), LastPasswordChangedDate = new DateTime(1900, 1, 1), LastLoginDate = new DateTime(1900, 1, 1), RealName = rndUser, Email = rndUser + "@testuserdomain.com", CreationDate = DateTime.Now, IsApproved = true, Password = "******", Username = rndUser + "@testuserdomain.com", PartitionKey = rndUser.Substring(0, 1), RowKey = Guid.NewGuid().ToString() }; new AzureUserRepository().Save(au); string UID = Guid.NewGuid().ToString(); AzureRole arm = new AzureRole { RowKey = UID, RoleName = "RegisteredUser", PartitionKey = UID.Substring(0, 1), UserRowKey = au.RowKey, Timestamp = DateTime.Now }; new AzureRoleRepository().Save(arm); //Create Companies string rndCompanyName = RandomString(5); var company = new CompanyModel(au.RowKey, rndCompanyName, "sales@" + rndCompanyName + ".com", "accounts@" + rndCompanyName + ".com", i.ToString()); company.Country = "South Africa"; new CompanyRepository().Save(company); //Create 10 Products for (int x = 0; x < 10; x++) { ProductModel product; byte[] photo = null; Thread printThread = new Thread(() => { photo = CreateImage(RandomString(2)); }); printThread.SetApartmentState(ApartmentState.STA); printThread.Start(); printThread.Join(); string CatID = GetRandomCategory(categoryList); string photoUrl = new PhotoRepository().SavePhoto(photo, Guid.NewGuid().ToString() + "_Test.png"); product = new ProductModel(RandomString(6), NextLoremIpsum(10), photoUrl, company.RowKey); product.CategoryID = CatID; product.Description = product.Description + " " + CatID; product.FobPrice = RandomInt().ToString(); product.MinimumOrderQuantity = RandomInt(); product.ModelNumber = RandomInt().ToString(); product.PackagingAndDelivery = NextLoremIpsum(3); product.PaymentTerms = NextLoremIpsum(4); product.PlaceOfOrigin = NextLoremIpsum(2); product.Port = NextLoremIpsum(1); product.Quality = NextLoremIpsum(2); product.Specifications = NextLoremIpsum(2); product.SupplyAbility = NextLoremIpsum(2); product.Colour = NextLoremIpsum(1); product.BrandName = NextLoremIpsum(1); new ProductRepository().Save(product); } } }