示例#1
0
        public void GetAlertNotificationTypes_Success()
        {
            IAlertsDal dal = PrepareAlertsDal();
            IAlertsDalGetAlertNotificationTypesParams getTypesParams = dal.CreateGetAlertNotificationTypesParams();

            var getTypesResult = dal.GetAlertNotificationTypes(getTypesParams);

            Assert.IsTrue(getTypesResult.Success);
            Assert.IsNotNull(getTypesResult.Types != null);
            Assert.IsNotEmpty(getTypesResult.Types);
        }
        public object Any(GetNotificationTypes request)
        {
            GetNotificationTypesResponse response = new GetNotificationTypesResponse();

            TransferHeader(request, response);

            try
            {
                IAlertsDalGetAlertNotificationTypesParams getParams = _dal.CreateGetAlertNotificationTypesParams();

                var getResult = _dal.GetAlertNotificationTypes(getParams);

                if (getResult.Success)
                {
                    foreach (var at in getResult.Types)
                    {
                        response.Payload.Types.Add(new DTO.NotificationType()
                        {
                            ID   = at.ID,
                            Name = at.Value
                        });
                    }

                    response.Success = true;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Errors.Add(new Interfaces.Error()
                {
                    Code    = Interfaces.EErrorCodes.GeneralError,
                    Type    = Interfaces.EErrorType.Error,
                    Message = ex.Message
                });
            }

            return(response);
        }