Пример #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;
        }
Пример #2
0
        private static void GenerateEquipment(Details details)
        {
            Random containerRnd = new Random();
            Random mainCanopyRnd = new Random();
            Random reserveCanopyRnd = new Random();
            Random skyHookRnd = new Random();
            Random AADRnd = new Random();
            Random repackByDateRnd = new Random();
            Random approvedRnd = new Random();

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

                equipment.Container = Container[containerRnd.Next(Container.Count)];
                equipment.MainCanopy = MainCanopy[mainCanopyRnd.Next(MainCanopy.Count)];
                equipment.ReserveCanopy = ReserveCanopy[reserveCanopyRnd.Next(ReserveCanopy.Count)];
                equipment.Skyhook = Convert.ToBoolean(skyHookRnd.Next(2));
                equipment.AAD = AAD[AADRnd.Next(AAD.Count)];
                equipment.RepackByDate = DateTime.Now.AddMonths(repackByDateRnd.Next(7));
                equipment.Approved = Convert.ToBoolean(approvedRnd.Next(2));
            }
        }