/// <summary>
        /// The current flight's dispole request method
        /// </summary>
        /// <param name="req">the request from the user side</param>
        /// <returns>the response to the user side</returns>
        public ResponseDisposeFlight DisposeFlight(RequestDisposeFlight req)
        {
            //performs a dispose action on the flight object using the repository, returns a bool value
            bool isDisposed = ctRepo.DisposeFlight(req.FlightSerial);

            if (isDisposed)
            {
                return(new ResponseDisposeFlight()
                {
                    Message = $"Flight #{req.FlightSerial} was disposed.",
                    IsSuccess = isDisposed
                });
            }
            else
            {
                throw new Exception("Unable to dispose flight object.");
            }
        }
        /// <summary>
        /// The simproxy flight object dispose event mothed
        /// </summary>
        /// <param name="sender">the sender object</param>
        /// <param name="flightSerial">the flight serial to dispose</param>
        void SimProxy_OnDisposeEvent(object sender, int flightSerial)
        {
            //a request is made to service to delete flight from DB
            RequestDisposeFlight reqDis = new RequestDisposeFlight()
            {
                FlightSerial = flightSerial
            };
            ResponseDisposeFlight resDis = simProxy.DisposeFlight(reqDis);

            if (resDis.IsSuccess)
            {
                //last checkpoint binding data cleared
                FlightInDeparted = InitializeFlightBindingObject();
                return;
            }
            else
            {
                throw new Exception("[UI] Service was unable to dispose the flight.");
            }
        }
Exemple #3
0
 public ResponseDisposeFlight DisposeFlight(RequestDisposeFlight req)
 {
     return(simService.DisposeFlight(req));
 }