示例#1
0
        public static void ToggleIgnore(int idFlight, bool fIgnore)
        {
            if (!HttpContext.Current.User.Identity.IsAuthenticated || String.IsNullOrEmpty(HttpContext.Current.User.Identity.Name))
            {
                throw new UnauthorizedAccessException();
            }
            LogbookEntryBase le = new LogbookEntry();

            if (!le.FLoadFromDB(idFlight, HttpContext.Current.User.Identity.Name))
            {
                throw new UnauthorizedAccessException();
            }

            if (le.IsNewFlight) // should never happen.
            {
                throw new InvalidOperationException("Flight doesn't exist");
            }

            SetIgnoreFlagForFlight(le, fIgnore);
            le.CommitRoute();  // Save the change, but hold on to the flight in the list for now so that you can uncheck it.
        }