Esempio n. 1
0
        public static Adjustment CreateBalanceForward(DateTime dt, int random)
        {
            var        rnd = new DeterministicRandom(random);
            Adjustment res = new Adjustment();

            res.currentDateTime    = dt;
            res.currentDescription = "Balance Forward";
            res.currentAmount      = rnd.Random(10, 300) * 10;
            return(res);
        }
Esempio n. 2
0
        public static Adjustment CreatePayment(DateTime dt, int random)
        {
            var        rnd = new DeterministicRandom(random);
            Adjustment res = new Adjustment();

            res.currentDateTime    = dt;
            res.currentDescription = "Payment";
            res.currentAmount      = -rnd.Random(1, 40) * 10;
            return(res);
        }
Esempio n. 3
0
        public static Adjustment CreateCharge(DateTime dt, int random)
        {
            var        rnd = new DeterministicRandom(random);
            Adjustment res = new Adjustment();

            res.currentDateTime    = dt;
            res.currentDescription = rnd.GetRandomItem(bills);
            res.currentAmount      = rnd.Random(10, 50) * 10;
            return(res);
        }
Esempio n. 4
0
        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.RandomChar, 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 currentTerm = rnd.GetRandomItem(Term.Terms);

            Terms = currentTerm.Name;

            int adjustmentsCount = rnd.Random(6) + 4;

            Adjustments = new Adjustment[adjustmentsCount];
            int h = (int)((BillingPeriodEnd - BillingPeriodStart).TotalHours / adjustmentsCount);

            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:
                    Adjustments[j] = Adjustment.CreateCharge(nextDate, rnd.Random(10000));
                    break;

                case 1:
                    Adjustments[j] = Adjustment.CreatePayment(nextDate, rnd.Random(10000));
                    break;
                }
            }
        }