Exemplo n.º 1
0
        public List <GroupTableModel> Search(GroupQueryModel query, Guid languageId)
        {
            using (var command = Context.Connection.GenerateCommand(
                       "ais.search_organization",
                       query,
                       new Dictionary <string, object>
            {
                { "planguageid", languageId }
            }))
            {
                var result = new List <GroupTableModel>();
                using (var reader = command.ExecuteReaderSafety())
                {
                    while (reader.Read())
                    {
                        result.Add(
                            new GroupTableModel
                        {
                            Id            = reader.GetFieldValue <Guid>("id"),
                            GeoNetworkId  = reader.GetFieldValue <long?>("geonetworkid"),
                            Email         = reader.GetFieldValue <string>("email"),
                            Bulstat       = reader.GetFieldValue <string>("bulstat"),
                            Name          = reader.GetFieldValue <string>("name"),
                            ContactPerson = reader.GetFieldValue <string>("contactperson")
                        });
                    }
                }

                return(result);
            }
        }
Exemplo n.º 2
0
        public async Task <IResultModel> Query(GroupQueryModel model)
        {
            var result = new QueryResultModel <GroupEntity>
            {
                Rows  = await _repository.Query(model),
                Total = model.TotalCount
            };

            return(ResultModel.Success(result));
        }
Exemplo n.º 3
0
        public async Task <IList <GroupEntity> > Query(GroupQueryModel model)
        {
            var paging = model.Paging();

            var query = Db.Find();

            if (!paging.OrderBy.Any())
            {
                query.OrderByDescending(m => m.Id);
            }

            var result = await query.LeftJoin <AccountEntity>((x, y) => x.CreatedBy == y.Id)
                         .Select((x, y) => new { x, Creator = y.Name })
                         .PaginationAsync(paging);

            model.TotalCount = paging.TotalCount;

            return(result);
        }
Exemplo n.º 4
0
        public async Task <IList <GroupEntity> > Query(GroupQueryModel model)
        {
            var paging = model.Paging();

            var query = Db.Find();

            query.WhereNotNull(model.Name, m => m.Name.Contains(model.Name));
            query.WhereNotNull(model.Code, m => m.Code.Contains(model.Code));

            var joinQuery = query.LeftJoin <AccountEntity>((x, y) => x.CreatedBy == y.Id);

            if (!paging.OrderBy.Any())
            {
                joinQuery.OrderByDescending((x, y) => x.Id);
            }

            joinQuery.Select((x, y) => new { x, Creator = y.Name });

            var result = await joinQuery.PaginationAsync(paging);

            model.TotalCount = paging.TotalCount;

            return(result);
        }
Exemplo n.º 5
0
 public Task <IResultModel> Query([FromQuery] GroupQueryModel model)
 {
     return(_service.Query(model));
 }
Exemplo n.º 6
0
 public List <GroupTableModel> Search(GroupQueryModel query)
 {
     return(groupRepository.Search(query, RequestData.LanguageId));
 }