Beispiel #1
0
        protected void Insert(object sender, EventArgs e)
        {
            switch ((UserDetailSet)MultiView1.ActiveViewIndex)
            {
                case UserDetailSet.Equipments:
                {
                    Equipment equipment = new Equipment(DetailsUser);

                    equipment.Container = equipContainer.Text;
                    equipment.MainCanopy = equipMainCanopy.Text;
                    equipment.ReserveCanopy = equipReserveCanopy.Text;
                    equipment.Skyhook = equipSkyhook.Checked;
                    equipment.AAD = equipAad.Text;

                    equipment.Insert();

                    // Add item to current equipment.
                    BindEquipment();

                    equipmentRepeater.Items[equipmentRepeater.Items.Count - 1].Focus();
                }
                break;

                case UserDetailSet.NextOfKins:
                {
                    NextOfKin nextOfKin = new NextOfKin(DetailsUser);

                    nextOfKin.Forename = nextOfKinForeName.Text;
                    nextOfKin.Surname = nextOfKinSurName.Text;
                    nextOfKin.Address = nextOfKinAddress.Text;
                    nextOfKin.Town = nextOfKinTown.Text;
                    nextOfKin.County = nextOfKinCounty.Text;
                    nextOfKin.Country = nextOfKinCountry.Text;
                    nextOfKin.Postcode = nextOfKinPostcode.Text;
                    nextOfKin.PhoneHome = nextOfKinPhoneHome.Text;
                    nextOfKin.PhoneWork = nextOfKinPhoneWork.Text;
                    nextOfKin.Mobile = nextOfKinMobile.Text;

                    nextOfKin.Insert();

                    // Add item to current next of kin.
                    BindNextOfKin();

                    nextOfKinRepeater.Items[nextOfKinRepeater.Items.Count - 1].Focus();
                }
                break;
            }
            Session[Local.UserDetails.ToString()] = DetailsUser;
        }
Beispiel #2
0
        private static void GenerateNextOfKin(Details details)
        {
            Random firstNameRnd = new Random();
            Random surNameRnd = new Random();
            Random houseNoRnd = new Random();
            Random roadPt1Rnd = new Random();
            Random roadPt2Rnd = new Random();

            Random townsRnd = new Random();
            Random countiesRnd = new Random();
            Random countriesRnd = new Random();
            Random postCodeRnd = new Random();

            Random phoneHomeRnd = new Random();
            Random phoneWorkRnd = new Random();
            Random mobileRnd = new Random();

            for (int counter = 0; counter < new Random().Next(5); counter++)
            {
                NextOfKin nextOfKin = new NextOfKin(details);

                nextOfKin.Forename = Firstnames[firstNameRnd.Next(Firstnames.Count)];
                nextOfKin.Surname = Surnames[surNameRnd.Next(Surnames.Count)];
                nextOfKin.Address = houseNoRnd.Next(1, 251) + " " +
                    RoadPart1[roadPt1Rnd.Next(RoadPart1.Count)] + " " +
                    RoadPart2[roadPt2Rnd.Next(RoadPart2.Count)];

                nextOfKin.Town = Towns[townsRnd.Next(Towns.Count)];
                nextOfKin.County = Counties[countiesRnd.Next(Counties.Count)];
                nextOfKin.Country = Countries[countriesRnd.Next(Countries.Count)];
                nextOfKin.Postcode = PostCodes[postCodeRnd.Next(PostCodes.Count)] + new Random().Next(1, 21)
                    + " " + new Random().Next(1, 21) + PostCodes[postCodeRnd.Next(PostCodes.Count)];

                nextOfKin.PhoneHome = "02" + phoneHomeRnd.Next(100000000, 1000000000).ToString();
                nextOfKin.PhoneWork = "02" + phoneWorkRnd.Next(100000000, 1000000000).ToString();
                nextOfKin.Mobile = "07" + mobileRnd.Next(100000000, 1000000000).ToString();
            }
        }