コード例 #1
0
ファイル: FlightAdmin.aspx.cs プロジェクト: sliplow/Skyline
        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.";
        }
コード例 #2
0
ファイル: Generate.aspx.cs プロジェクト: sliplow/Skyline
        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();
            }
        }