示例#1
0
        private void AddRoster()
        {
            string[]  firstName  = { "赵", "钱", "孙", "李", "周", "吴", "郑", "王", "冯", "陈" };
            string[]  lastName   = { "尹", "沛", "雯", "梅", "寒", "凝", "典", "秋", "蝶", "慧" };
            ArrayList rosterList = new ArrayList();
            Random    ra         = new Random();

            for (int x = 0; x < 10; ++x)
            {
                for (int y = 0; y < 10; ++y)
                {
                    RosterInfo roster = new RosterInfo();
                    roster.Name = "" + firstName.GetValue(x) + lastName.GetValue(y);
                    if (y % 2 == 0)
                    {
                        roster.Sex = true;
                    }
                    else
                    {
                        roster.Sex = false;
                    }
                    roster.IdentityNo = "" + ra.Next(1, 10);
                    for (int z = 1; z < 18; ++z)
                    {
                        roster.IdentityNo += ra.Next(10);
                    }
                    rosterList.Add(roster);
                }
            }
            rosterService.AddRosterData(rosterList);
        }