public GetIndexResponse GetIndex(string tableName, string indexName, bool withAllFields)
 {
     try
     {
         var options = new TransactionOptions()
         {
             IsolationLevel = System.Transactions.IsolationLevel.Serializable,
             Timeout        = new TimeSpan(0, TransactionTimeout, 0)
         };
         using (var trScope = new TransactionScope(TransactionScopeOption.Required, options))
         {
             IndexDbo dbo  = GetIndexDescription(tableName, indexName);
             var      rzlt = new GetIndexResponse()
             {
                 IsSuccess = true, Dbo = dbo
             };
             if (withAllFields)
             {
                 BuildListOfFields(tableName, dbo.IndexedColumns, rzlt.AllFields);
             }
             trScope.Complete();
             return(rzlt);
         }
     }
     catch (Exception ex)
     {
         return(new GetIndexResponse()
         {
             IsSuccess = false, ErrorMessage = ParseErrorMessage(ex)
         });
     }
 }
示例#2
0
        public async Task <IActionResult> GetIndex([FromQuery] IEnumerable <string> sectors = null)
        {
            try
            {
                var result = await _mediator.Send(new GetIndexQuery()
                {
                    Sectors = sectors
                });

                var response = new GetIndexResponse
                {
                    Opportunities = result.Opportunities.Select(x => new GetIndexResponse.Opportunity
                    {
                        Id             = x.Id,
                        Amount         = x.Amount,
                        IsNamePublic   = x.IsNamePublic,
                        DasAccountName = x.DasAccountName,
                        Sectors        = x.Sectors,
                        JobRoles       = x.JobRoles,
                        Levels         = x.Levels,
                        Locations      = x.Locations
                    }),
                    Sectors  = result.Sectors,
                    JobRoles = result.JobRoles,
                    Levels   = result.Levels,
                };

                return(Ok(response));
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"Error attempting to get Index result");
                return(new StatusCodeResult((int)HttpStatusCode.InternalServerError));
            }
        }
示例#3
0
        public JsonResult Index()
        {
            GetIndexResponse response = new GetIndexResponse();

            response.meta.serverName            = Program.ServerName;
            response.meta.implementationName    = "Mimir";
            response.meta.implementationVersion = Program.Version;
            response.skinDomains        = Program.SkinDomains;
            response.signaturePublickey = $"-----BEGIN PUBLIC KEY-----\n{Program.PublicKey}\n-----END PUBLIC KEY-----\n";

            return(new JsonResult(response));
        }
示例#4
0
        /// <summary>
        /// Get all indexes
        /// </summary>
        public async Task <GetIndexResponse> GetIndexes()
        {
            GetIndexResponse result = null;

            try
            {
                result = await _client.Indices.GetAsync(new GetIndexRequest(Indices.All));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Failed to get indexes");
            }

            return(result);
        }
        public async Task <IActionResult> GetIndex(long accountId)
        {
            try
            {
                var response = await _mediator.Send(new GetIndexQuery()
                {
                    AccountId = accountId,
                });

                var model = new GetIndexResponse
                {
                    PledgesCount      = response.PledgesCount,
                    ApplicationsCount = response.ApplicationsCount
                };

                return(Ok(model));
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Error getting transfers");
                return(BadRequest());
            }
        }