Exemplo n.º 1
0
        private bool checkChangePatrolConnectionTypeIsPossible()
        {
            Structs.PatrolConnectionTypeEnum newPatrolConnectionType =
                (Structs.PatrolConnectionTypeEnum)DDPatrolConnectionType.SelectedIndex;
            Structs.Patrol[] patrols = CommonCode.GetPatrols();

            string listOfPatrolsThatFailedCheck = "";

            foreach (Structs.Patrol patrol in patrols)
            {
                if (!CommonCode.CheckChangePatrolConnectionTypeIsPossible(patrol, newPatrolConnectionType))
                {
                    listOfPatrolsThatFailedCheck += patrol.PatrolId.ToString() + ",";
                }
            }
            if (listOfPatrolsThatFailedCheck.Length > 0)
            {
                listOfPatrolsThatFailedCheck =
                    listOfPatrolsThatFailedCheck.Substring(0, listOfPatrolsThatFailedCheck.Length - 1);

                MessageBox.Show("Du kan inte ändra hur patruller kopplas samman " +
                                "eftersom befintliga patruller inte uppfyller det nya kravet. " +
                                "Patruller med detta problem är:\r\n" + listOfPatrolsThatFailedCheck,
                                "Kan inte spara ändrad tävling", MessageBoxButtons.OK);
                return(false);
            }
            else
            {
                return(true);
            }
        }