Exemplo n.º 1
0
        public void GetAlertsTypes_Success(string name)
        {
            RunInitSql(name, "ConnectionStringAlerts");

            GetAlertsTypes request = PrepareRequest <GetAlertsTypes>(name);

            GetAlertsTypesResponse response = Post <GetAlertsTypes, GetAlertsTypesResponse>("GetAlertsTypes", request);

            RunFinalizeSql(name, "ConnectionStringAlerts");

            Assert.AreEqual(response.Success, true, "GetAlertsTypes call failed");
            Assert.IsNotEmpty(response.Payload.Types, "Types is empty");
        }
        public object Any(GetAlertsTypes request)
        {
            GetAlertsTypesResponse response = new GetAlertsTypesResponse();

            TransferHeader(request, response);

            try
            {
                IAlertsDalGetAlertTypesParams getParams = _dal.CreateGetAlertTypesParams();

                var getResult = _dal.GetAlertTypes(getParams);

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

                    response.Success = true;
                }
                else
                {
                    response.Success = false;
                    response.Errors.AddRange(getResult.Errors);
                }
            }
            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);
        }
Exemplo n.º 3
0
        public GetAlertsTypesResponse PostGetAlertsTypes(GetAlertsTypes request)
        {
            GetAlertsTypesResponse response = Post <GetAlertsTypes, GetAlertsTypesResponse>("GetAccountAlerts", request);

            return(response);
        }