Beispiel #1
0
 public IHttpActionResult UpdateUser(User user)
 {
     try
     {
         mng.Update(user);
         apiResp.Message = "Executed";
         return(Ok(apiResp));
     }
     catch (BussinessException bex)
     {
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(bex.AppMessage);
         return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                  + bex.AppMessage.Message)));
     }
     catch (Exception ex)
     {
         ApplicationMessage msg = new ApplicationMessage
         {
             Message = ex.Message
         };
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(msg);
         return(InternalServerError(new Exception(ex.Message)));
     }
 }
Beispiel #2
0
        //************************************************************************
        /// <summary>
        /// 指定された検索IDのSQLファイルからSELECT文を作成し、検索を実行する。
        /// </summary>
        /// <param name="argSelectIdList">検索IDリスト</param>
        /// <param name="argParamList">検索条件リスト</param>
        /// <param name="argSelectType">検索種別</param>
        /// <param name="argMessage">返却メッセージ</param>
        /// <returns>検索結果</returns>
        //************************************************************************
        public DataSet SelectList(List <SelectId> argSelectIdList, List <SelectParam> argParamList,
                                  SelectType argSelectType, out ApplicationMessage argMessage)
        {
            // 最大検索件数取得
            int maxRow = m_dataAccess.GetMaxRow();

            // 検索実行
            bool isOver;
            var  result = m_dataAccess.SelectList(argSelectIdList, argParamList, argSelectType, maxRow, out isOver);

            argMessage = null;
            // 検索結果なし
            if (result.Tables[0].Rows.Count == 0)
            {
                argMessage = new ApplicationMessage("IV001");
            }
            // 最大検索件数オーバー
            else if (isOver)
            {
                argMessage = new ApplicationMessage("IV002");
            }

            System.Threading.Thread.Sleep(5000);

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Handles the application messages.
        /// </summary>
        /// <param name="message">The message.</param>
        private void HandleApplicationMessages(ApplicationMessage message)
        {
            try
            {
                switch (message.MessageType)
                {
                case MessageType.CommandLineMessage:
                    ProcessCommandLineArguments(message.Arguments.ToArray());
                    break;

                case MessageType.Shutdown:
                    Deactivate();
                    break;

                case MessageType.AddNewTorrentFromSearchView:
                    var torrent =
                        _torrentService.InitializeNewTorrentFromMagnetOrFileAsync(message.Arguments.First(), true);
                    if (torrent != null)
                    {
                        AddNewTorrent(torrent);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                _dialogService.ShowMessageBox(ex.ToString());
            }
        }
Beispiel #4
0
 public IHttpActionResult GetAirlinesByAirportId(string airportId)
 {
     try
     {
         var airlineManagement = new AirlineManagement();
         apiResp = new ApiResponse
         {
             //Data = airlineManagement.GetAirlinesByAirportId(airportId),
             Message = "Action was executed."
         };
         return(Ok(apiResp));
     }
     catch (BussinessException bex)
     {
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(bex.AppMessage);
         return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                  + bex.AppMessage.Message)));
     }
     catch (Exception ex)
     {
         ApplicationMessage msg = new ApplicationMessage
         {
             Message = ex.Message
         };
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(msg);
         return(InternalServerError(new Exception(ex.Message)));
     }
 }
Beispiel #5
0
 public IHttpActionResult CheckIfUserExists(string userName)
 {
     try
     {
         apiResp.Data = mng.CheckIfUserExists(userName);
         return(Ok(apiResp));
     }
     catch (BussinessException bex)
     {
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(bex.AppMessage);
         return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                  + bex.AppMessage.Message)));
     }
     catch (Exception ex)
     {
         ApplicationMessage msg = new ApplicationMessage
         {
             Message = ex.Message
         };
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(msg);
         return(InternalServerError(new Exception(ex.Message)));
     }
 }
        public IHttpActionResult GetAirlineAdminByAirlineId(string ID)
        {
            try
            {
                var AirlineManager = new AirlineManager
                {
                    ID = ID
                };

                AirlineManager = mng.RetrieveAirlineAdminByAirlineId(AirlineManager);
                apiResp.Data   = AirlineManager;
                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Beispiel #7
0
        public IHttpActionResult Post(AirportManager manager)
        {
            try
            {
                var CorreoElectronico = manager.Email;
                var pass = manager.Password;
                mng.Create(manager);
                string Mensaje = "Estimado " + manager.FirstName + "  " + manager.LastName + " <br/><br/> " + "Su contraseña de inicio es: " + pass;
                ToolsHelper.SendMail(CorreoElectronico, "Confirmación de cuenta", Mensaje);
                apiResp = new ApiResponse
                {
                    Message = "Action was executed"
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
 internal Confirmable(ApplicationMessage message, IEnumerable <Node> allOtherNodes)
 {
     _message          = message;
     _unconfirmedNodes = AllUnconfirmedFor(allOtherNodes);
     _createdOn        = DateTimeHelper.CurrentTimeMillis();
     _trackingId       = message.TrackingId;
 }
Beispiel #9
0
 public virtual async Task SendSmsAsync(ApplicationMessage message)
 {
     if (_userManager.SmsService != null)
     {
         await _userManager.SmsService.SendAsync(message.ToIdentityMessage());
     }
 }
Beispiel #10
0
        /// <summary>
        /// Delivers an application message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="senderIsPublisher">if set to <c>true</c> the sender is a publisher.</param>
        /// <returns></returns>
        internal static bool DeliverApplicationMessage(ApplicationMessage message, bool senderIsPublisher = false)
        {
            if (!senderIsPublisher)
            {
                Publisher publisher = EllaModel.Instance.GetPublisher(message.Handle.PublisherId);

                if (publisher != null)
                {
                    return(DeliverMessage(message, publisher.Instance));
                }
                else
                {
                    _log.FatalFormat("Found no suitable subscriber for handle {0}", message.Handle);
                    return(false);
                }
            }
            else
            {
                Object subscriber = EllaModel.Instance.GetSubscriber(message.Handle.SubscriberId);

                if (subscriber != null)
                {
                    return(DeliverMessage(message, subscriber));
                }
                else
                {
                    _log.FatalFormat("Found no suitable publisher for handle {0}", message.Handle);
                    return(false);
                }
            }
        }
Beispiel #11
0
        public IHttpActionResult Get(string id)
        {
            try
            {
                var airportManager = new AirportManager
                {
                    ID = id
                };

                airportManager = mng.RetrieveById(airportManager);
                apiResp.Data   = airportManager;
                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
        /// <summary>
        /// Generates the password reset email.
        /// </summary>
        /// <param name="url">The URL helper from the controller asking for the email.</param>
        /// <param name="id">The id of the user who needs their password resetting.</param>
        /// <returns>
        /// Generates a boiler-plate email including the confirmation token to send to
        /// the user.  Uses <see cref="ApplicationMessage"/> to generate both an HTML
        /// and Plain Text email when <see cref="EmailService"/> is used.
        /// </returns>
        public async Task GeneratePasswordResetEmailAsync(UrlHelper url, string id)
        {
            var token = await GeneratePasswordResetTokenAsync(id);

            var callbackUrl = url.Action("ResetPassword", "Account", new { userId = id, code = token }, "http");
            var homeUrl     = url.Action("Index", "Home", null, "http");

            var html = $"<html><body><p>Hi,</p><p>You've asked to reset your password on the <a href='{homeUrl}'>SJA Tracker website</a>.</p>";

            html += $"<p>Please click <a href='{callbackUrl}'>this link</a> to complete the reset.</p>";
            html += "<p>Please let me know if you have any problems.</p><p>Kind regards,</p><p>Tony Richards</p>";

            var text = $"Hi,\n\nYou've asked to reset your password on {homeUrl} (the SJA Tracker website).\n\n";

            text += $"Please go to {callbackUrl} to complete the reset.\n\n";
            text += "Please let me know if you have any problems.\n\nKind regards,\n\nTony Richards";

            var msg = new ApplicationMessage
            {
                Body        = text,
                HtmlBody    = html,
                Destination = await GetEmailAsync(id),
                Subject     = "SJA Tracker: Reset your password"
            };

            await EmailService.SendAsync(msg);
        }
Beispiel #13
0
        public IHttpActionResult Get(string Id)
        {
            try
            {
                var mng    = new FlightManagement();
                var flight = new Flight
                {
                    Id = Id
                };

                flight       = mng.RetrieveById(flight);
                apiResp      = new ApiResponse();
                apiResp.Data = flight;
                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
 private Confirmable()
 {
     _message          = null;
     _unconfirmedNodes = new Dictionary <Node, int>();
     _createdOn        = 0L;
     _trackingId       = "";
 }
Beispiel #15
0
        public IHttpActionResult getAirlinesWaiting(string id)
        {
            try
            {
                var mng     = new AirlineManagement();
                var airline = new Airline
                {
                    Id = id
                };
                apiResp      = new ApiResponse();
                apiResp.Data = mng.RetrieveWaitingAirlines(airline);

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Beispiel #16
0
        public IHttpActionResult GetCanceled()
        {
            try
            {
                apiResp = new ApiResponse();
                var mng = new FlightManagement();
                apiResp.Data = mng.flightsCanceled();

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Beispiel #17
0
        private void CreateSaveCommand()
        {
            this.save = new RelayCommand(() =>
            {
                try
                {
                    this.selectedTest.Items.Clear();

                    foreach (TestItem item in this.items)
                    {
                        this.selectedTest.Items.Add(item);
                    }

                    if (this.selectedTest.Id > 0)
                    {
                        this.testSetsModel.Update(this.selectedTest);
                    }
                    else
                    {
                        this.testSetsModel.Add(this.selectedTest);
                    }

                    ApplicationMessage.Send(MessageType.TestsDisplay, MessageType.TestsDisplay.ToString());
                }
                catch (Exception ex)
                {
                    ApplicationErrorHandler.HandleException(ex);
                }
            });
        }
        public IHttpActionResult UpdateAndSendEmailRejected(AirlineManager manager)
        {
            try
            {
                var CorreoElectronico = manager.Email;
                var pass = manager.Password;
                mng.Update(manager);
                string Mensaje = "Estimado " + manager.FirstName + "  " + manager.LastName + " lamentamos informarle que su aerolínea ha sido rechazada por nuestra administración";
                ToolsHelper.SendMail(CorreoElectronico, "Denegación de cuenta", Mensaje);
                apiResp = new ApiResponse
                {
                    Message = "Action was executed."
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
        public async Task <ResponseDTO> ValidateAuthorizationAsync(AuthorizationRequest search, int?amigoTenantTUserId)
        {
            var activityType = await _activityTypeService.SearchActivityByCodeAsync(Constants.ActivityTypeCode.Authentication);

            var command = _mapper.Map <AuthorizationRequest, UpdateDeviceAuthorizationCommand>(search);

            command.AssignedAmigoTenantTUserId = amigoTenantTUserId;
            command.ActivityTypeId             = activityType.ActivityTypeId;

            //Execute Command

            var commandResult = await _bus.SendAsync(command);

            var reponseDTO = new ResponseDTO <AmigoTenantTUserDTO>();

            reponseDTO.IsValid = commandResult.IsCorrect;
            foreach (var item in commandResult.Errors)
            {
                var appMsg = new ApplicationMessage()
                {
                    Key = null, Message = item
                };
                reponseDTO.Messages.Add(appMsg);
            }
            reponseDTO.Data = _mapper.Map <AmigoTenantTUser, AmigoTenantTUserDTO>(commandResult.Data);

            return(reponseDTO);
        }
Beispiel #20
0
        void OnApplicationMessage(ApplicationMessage message)
        {
            switch (message.Action)
            {
            case ApplicationMessage.ActionType.Add:
                Add(message.Application, message.Tab, message.SuppressMessage);
                break;

            case ApplicationMessage.ActionType.AddNew:
                AddNew();
                break;

            case ApplicationMessage.ActionType.Edit:
                Edit(message.Application);
                break;

            case ApplicationMessage.ActionType.Move:
                Move(message.Application, message.Tab);
                break;

            case ApplicationMessage.ActionType.Remove:
                Remove(message.Application);
                break;
            }
        }
 /// <summary>
 /// Обычный конструктор
 /// </summary>
 public ApplicationMessageBinding(ApplicationMessage message, Keys mainKey, WindowMessage messageType)
 {
     Message = message;
     Title = EnumFriendlyName<ApplicationMessage>.GetString(message);
     this.mainKey = mainKey;
     this.messageType = messageType;
 }
        private void HandleApplicationMessage(ApplicationMessage message)
        {
            logger.Trace($"Got an application message [{message}]");

            switch (message)
            {
            case ApplicationMessage.ShellLoaded:
                if (state_manager.CurrentCollection == null)
                {
                    shell.NavigateTo(typeof(ICollectionsModule), show_windows_commands: false);
                }
                else
                {
                    shell.NavigateTo(typeof(IBooksModule));
                }
                break;

            case ApplicationMessage.SnackbarMessageDurationUpdated:
                shell.UpdateSnackbarQueue();
                break;

            case ApplicationMessage.CollectionChanged:
                IndexCollection();
                break;

            default:
                throw new ArgumentException($"Unhandled application message {message}");
            }
        }
Beispiel #23
0
        public IHttpActionResult Put(UserHistory userHistory)
        {
            try
            {
                apiResp = new ApiResponse();
                var mng = new UserHistoryManager();
                mng.Update(userHistory);

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Beispiel #24
0
        public IHttpActionResult Get()
        {
            try
            {
                apiResp.Data = mng.RetrieveAll();

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Beispiel #25
0
        public IHttpActionResult Get(string id)
        {
            try
            {
                var mng   = new StoreManagement();
                var store = new Store
                {
                    IDStore = id
                };

                store        = mng.RetrieveById(store);
                apiResp      = new ApiResponse();
                apiResp.Data = store;
                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Beispiel #26
0
        /// <summary>
        /// Displays sample exceptions to the user
        /// </summary>
        /// <param name="e">The exception that was thrown</param>
        /// <param name="Type">Extra information on how to handle the exception</param>
        public void HandleException(Exception e, ApplicationMessage Type)
        {
            ServiceRegistration.Get <ILogger>().Error(e);
            // Build a message to display to the user
            IList <string> strMsg = new List <string>();

            if (e != null)
            {
                strMsg.Add(e.Message);
            }
            MessageBoxIcon icon = MessageBoxIcon.Exclamation;

            switch (Type)
            {
            case ApplicationMessage.ApplicationMustExit:
                strMsg.Add("MediaPortal has to be closed.");
                icon = MessageBoxIcon.Error;
                break;

            case ApplicationMessage.WarnSwitchToRef:
                strMsg.Add("Switching to the reference rasterizer, a software device that implements the entire\n" +
                           "Direct3D feature set, but runs very slowly.");
                icon = MessageBoxIcon.Information;
                break;
            }
            MessageBox.Show(StringUtils.Join("\n\n", strMsg), "Error DirectX layer", MessageBoxButtons.OK, icon);
        }
Beispiel #27
0
        public IHttpActionResult RemoveAirportManager(AirportManager manager)
        {
            try
            {
                mng.Delete(manager);
                apiResp = new ApiResponse
                {
                    Message = "Action was exectued."
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Beispiel #28
0
        public void FakeNetworkControllerApplicationMessageIsSent()
        {
            FakeNetworkController nc = new FakeNetworkController();

            Networking.NetworkController = nc;
            Networking.Start();

            //TestPublisher p = new TestPublisher();
            //Start.Publisher(p);

            TestSubscriber s = new TestSubscriber();

            s.Subscribe();

            //Thread.Sleep(1000);

            //p.PublishEvent();

            byte[] b = { 1, 2 };

            ApplicationMessage msg = new ApplicationMessage();

            msg.Data = b;

            Send.Message(msg, new RemoteSubscriptionHandle(), s);

            Assert.AreEqual(1, FakeNetworkController.countMsg);
        }
Beispiel #29
0
        public IHttpActionResult UpdateAirport(Airport airport)
        {
            try
            {
                var mng = new AirportManagement();
                mng.Update(airport);

                apiResp = new ApiResponse
                {
                    Message = "Action was executed."
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Beispiel #30
0
        public IHttpActionResult GetGates(string id)
        {
            try
            {
                var mng     = new AirportManagement();
                var airport = new Airport
                {
                    ID = id
                };

                List <Gate> list = mng.RetrieveGates(airport);
                apiResp      = new ApiResponse();
                apiResp.Data = list;
                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Beispiel #31
0
        public IHttpActionResult GetPossibleDestinyAirports(RequestAirlineAirport rqaa)
        {
            try
            {
                var mng = new AirportManagement();

                apiResp      = new ApiResponse();
                apiResp.Data = mng.RetrievePossibleDestinyAirports(rqaa);

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Beispiel #32
0
 /// <summary>
 /// Displays sample exceptions to the user
 /// </summary>
 /// <param name="e">The exception that was thrown</param>
 /// <param name="Type">Extra information on how to handle the exception</param>
 public void HandleException(Exception e, ApplicationMessage Type)
 {
   ServiceRegistration.Get<ILogger>().Error(e);
   // Build a message to display to the user
   IList<string> strMsg = new List<string>();
   if (e != null)
     strMsg.Add(e.Message);
   MessageBoxIcon icon = MessageBoxIcon.Exclamation;
   switch (Type)
   {
     case ApplicationMessage.ApplicationMustExit:
       strMsg.Add("MediaPortal has to be closed.");
       icon = MessageBoxIcon.Error;
       break;
     case ApplicationMessage.WarnSwitchToRef:
       strMsg.Add("Switching to the reference rasterizer, a software device that implements the entire\n" +
           "Direct3D feature set, but runs very slowly.");
       icon = MessageBoxIcon.Information;
       break;
   }
   MessageBox.Show(StringUtils.Join("\n\n", strMsg), "Error DirectX layer", MessageBoxButtons.OK, icon);
 }
    /// <summary>
    /// Displays sample exceptions to the user
    /// </summary>
    /// <param name="e">The exception that was thrown</param>
    /// <param name="Type">Extra information on how to handle the exception</param>
    public void HandleSampleException(SampleException e, ApplicationMessage Type)
    {
        // Build a message to display to the user
        string strMsg = string.Empty;
        if (e != null)
            strMsg = e.Message;

        if (ApplicationMessage.ApplicationMustExit == Type) {
            strMsg  += "\n\nThis sample will now exit.";
            System.Windows.Forms.MessageBox.Show(strMsg, this.Text,
                System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);

            // Close the window, which shuts down the app
            if (this.IsHandleCreated)
                this.Close();
        }
        else {
            if (ApplicationMessage.WarnSwitchToRef == Type)
                strMsg = "\n\nSwitching to the reference rasterizer,\n";
            strMsg += "a software device that implements the entire\n";
            strMsg += "Direct3D feature set, but runs very slowly.";

            System.Windows.Forms.MessageBox.Show(strMsg, this.Text,
                System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
        }
    }
Beispiel #34
0
    /// <summary>
    /// Displays sample exceptions to the user
    /// </summary>
    /// <param name="e">The exception that was thrown</param>
    /// <param name="Type">Extra information on how to handle the exception</param>
    public void HandleSampleException(SampleException e, ApplicationMessage Type)
    {
      try
      {
        if (UseMillisecondTiming)
        {
          timeEndPeriod(MILLI_SECONDS_TIMER);
        }
      }
      catch (Exception) {}

      UseMillisecondTiming = false;
      // Build a message to display to the user
      string strMsg = "";
      string strSource = "";
      string strStack = "";
      if (e != null)
      {
        strMsg = e.Message;
        strSource = e.Source;
        strStack = e.StackTrace;
      }
      Log.Error("D3D: Exception: {0} {1} {2}", strMsg, strSource, strStack);
      if (ApplicationMessage.ApplicationMustExit == Type)
      {
        strMsg += "\n\nMediaPortal has to be closed.";
        MessageBox.Show(strMsg, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);

        // Close the window, which shuts down the app
        if (this.IsHandleCreated)
        {
          this.Close();
        }
      }
      else
      {
        if (ApplicationMessage.WarnSwitchToRef == Type)
        {
          strMsg = "\n\nSwitching to the reference rasterizer,\n";
        }

        strMsg += "a software device that implements the entire\n";
        strMsg += "Direct3D feature set, but runs very slowly.";
        MessageBox.Show(strMsg, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
      }
    }