예제 #1
0
파일: TRow.cs 프로젝트: wangchengqun/azos
        public static CheckoutRow MakeFake(GDID gdid)
        {
            var ch = new CheckoutRow()
            {
                ID          = gdid,
                Customer    = PersonRow.MakeFake(gdid),
                FileName    = "myface_" + gdid.ID.ToString(),
                Date        = DateTime.Now,
                StartOffset = gdid.ID * 20,
                G_Block     = gdid,

                Address1 = Text.NaturalTextGenerator.GenerateAddressLine(),
                Address2 = (gdid.ID % 7) == 0 ? Text.NaturalTextGenerator.GenerateAddressLine() : null
            };

            var chCnt = (int)(gdid.ID % 10);

            ch.Charges = new ChargeRow[chCnt];

            for (int i = 0; i < chCnt; i++)
            {
                ch.Charges[i] = ChargeRow.MakeFake(gdid);
            }

            return(ch);
        }
예제 #2
0
파일: TRow.cs 프로젝트: wangchengqun/azos
        public static PersonRow MakeFake(GDID parentGdid)
        {
            var age = (int)(parentGdid.ID % 99);

            var tags = Ambient.Random.NextRandomInteger > 0 ? new string[Ambient.Random.NextScaledRandomInteger(1, 20)] : null;

            if (tags != null)
            {
                for (int i = 0; i < tags.Length; i++)
                {
                    tags[i] = ((char)('a' + i)) + "tag";
                }
            }

            var pers = new PersonRow()
            {
                ID          = parentGdid,
                Name        = Text.NaturalTextGenerator.GenerateFullName(true),
                Age         = age,
                DOB         = DateTime.Now.AddYears(-age),
                Sex         = (parentGdid.ID % 2) == 0 ? Sex.Male : Sex.Female,
                Income      = (parentGdid.ID % 79) * 1000,
                Debt        = (parentGdid.ID % 11) * 1000,
                Rating      = (parentGdid.ID % 2) == 0 ? (double?)null : 3.25,
                Notes       = parentGdid.ToString(),
                Voter       = (parentGdid.ID % 2) == 0 ? (bool?)null : true,
                MilitarySvc = (parentGdid.ID % 2) == 0 ? (bool?)null : false,
                Address1    = Text.NaturalTextGenerator.GenerateAddressLine(),
                Address2    = (parentGdid.ID % 7) == 0 ? Text.NaturalTextGenerator.GenerateAddressLine() : null,
                City        = Text.NaturalTextGenerator.GenerateCityName(),
                State       = "OH",
                Zip         = "44000" + (parentGdid.ID % 999),
                Phone1      = "(555) 222-3222",
                Phone2      = (parentGdid.ID % 3) == 0 ? "(555) 737-9789" : null,
                Email1      = Text.NaturalTextGenerator.GenerateEMail(),
                Email2      = (parentGdid.ID % 5) == 0 ? Text.NaturalTextGenerator.GenerateEMail() : null,
                URL         = (parentGdid.ID % 2) == 0 ? "https://ibm.com/products/" + parentGdid.ID : null,
                Tags        = tags
            };

            return(pers);
        }