Exemple #1
0
        private void AddPlaneType()
        {
            // Error Message.

            if (string.IsNullOrEmpty(planeTypeValue.Text))
            {
                planeTypeError.InnerText = "Empty type values not allowed.";

                return;
            }

            TypeOfPlane type = new TypeOfPlane();
            type.Type = planeTypeValue.Text;

            if (!Plane.TypeOfPlaneCollection.Exists(x => x.Type == type.Type) && type.Insert())
            {
                Response.Redirect(Request.RawUrl);

                return;
            }

            planeTypeError.InnerText = "Insert Failed, please enter a different plane type.";
        }
Exemple #2
0
        private static void GeneratePlaneTypes(int numberOfPlaneTypes)
        {
            for(int counter = 0; counter < numberOfPlaneTypes; counter++)
            {
                TypeOfPlane planeType = new TypeOfPlane();
                planeType.Type = PlaneTypes[counter % PlaneTypes.Count];

                if (Plane.TypeOfPlaneCollection.Exists(x => x.Type == planeType.Type)) continue;

                planeType.Insert();
            }
        }