public DataItem(int i) { var rnd = new DeterministicRandom(i); Customer c = rnd.GetRandomItem(Customer.Customers); CustomerID = c.CustomerID; CompanyName = c.CompanyName; ContactName = c.ContactName; ContactTitle = c.ContactTitle; Address = c.Address; City = c.City; PostalCode = c.PostalCode; Region = c.Region; Country = c.Country; Phone = c.Phone; Fax = c.Fax; Email = ContactName.Split(' ')[0].Replace(' ', '.').ToLower() + "@" + CompanyName.Split(' ')[0].ToLower() + ".com"; Invoice = string.Format("{0}{1}-{2}", rnd.RandomLitera, rnd.Random(100, 1000), rnd.Random(100, 1000)); CustomerAccount = rnd.GetRandomItem(accountType); CustomerIdentifiers = string.Format("{0}-{1}", rnd.Random(1000, 10000), rnd.Random(10, 100)); BillingPeriodStart = rnd.RandomTime(); BillingPeriodEnd = rnd.RandomTime(BillingPeriodStart, 7 * 24, 30 * 24); BillingDate = rnd.RandomTime(BillingPeriodEnd, 7 * 24, 30 * 24); Term term = rnd.GetRandomItem(Term.Terms); Terms = term.Name; int adjustmentsCount = rnd.Random(6) + 4; Adjustments = new Adjustment[adjustmentsCount]; int h = (int)((BillingPeriodEnd - BillingPeriodStart).TotalHours / adjustmentsCount); var adj = Adjustments[0] = Adjustment.CreateBalanceForward(rnd.RandomTime(BillingPeriodStart, 0, h), rnd.Random(10000)); int[] items = rnd.RandomList(adjustmentsCount - 1, 2); for (int j = 1; j < Adjustments.Length; j++) { DateTime nextDate = rnd.RandomTime(BillingPeriodStart.AddHours(h * j), 0, h); switch (items[j - 1]) { case 0: adj = Adjustments[j] = Adjustment.CreateCharge(nextDate, rnd.Random(10000)); break; case 1: adj = Adjustments[j] = Adjustment.CreatePayment(nextDate, rnd.Random(10000)); break; } } }