Пример #1
0
        public async Task <Result <IEnumerable <PostingItem> > > FindAsync(PostingFilter criteria)
        {
            var sql       = @"SELECT P.*,
	                        M.MapperName AS CodeMapping
                        FROM dbo.[Postings] P
                            INNER JOIN dbo.[CodeMappers] M ON M.Id = P.CodeMappingId";
            var sqlWhere  = " WHERE ";
            var sqlFilter = string.Empty;

            //if (criteria?. != null)
            //{
            //    sqlFilter += $" CA.Code = {criteria.ActionCode.Value}";
            //}

            if (sqlWhere.Trim() != "WHERE")
            {
                sql += sqlWhere + sqlFilter;
            }
            return(await _queryRepository.ExecuteSqlQueryAsync(sql).TaskAsyncResponse <PostingItem, Postings>());
        }
Пример #2
0
        /// <summary>
        /// postings according to filter
        /// </summary>
        /// <returns>return postings according to filter in rTemplate</returns>
        public List <PostingBrowserData> getPostings(PostingFilter filter)
        {
            try
            {
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                var request = new RestRequest(ResourcePath + "/postings", Method.POST);
                serializer.MaxJsonLength = int.MaxValue;
                string json = serializer.Serialize(filter);
                request.AddParameter("application/json", json, ParameterType.RequestBody);

                var          response             = RestClient.ExecuteTaskAsync(request);
                RestResponse queryResult          = (RestResponse)response.Result;
                List <PostingBrowserData> objects = RestSharp.SimpleJson.DeserializeObject <List <PostingBrowserData> >(queryResult.Content);
                return(objects);
            }
            catch (Exception e)
            {
                logger.Error("Unable to retrieve postings.", e);
                throw new ServiceExecption("Unable to retrieve postings.", e);
            }
        }
Пример #3
0
 public Task <Result <IEnumerable <PostingItem> > > FindAsync(PostingFilter criteria) => _repositoryQuery.FindAsync(criteria);
Пример #4
0
 public Result <IEnumerable <PostingItem> > Find(PostingFilter criteria = null) => _repositoryQuery.Find(criteria);