Пример #1
0
        public void LoadAttendanceList()
        {
            dgvAttendances.Rows.Clear();

            var searchDto = new SearchDto()
            {
                SearchBy   = comboSearchBy.Text,
                SearchText = txtSearchText.Text,
                PlaceId    = Helpers.PlaceHelper.PlaceId
            };

            var attendances = AttendanceRepository.GetAttendanceBySearchParameter(searchDto);


            foreach (var attendance in attendances)
            {
                dgvAttendances.Rows.Add(attendance.Name,
                                        attendance.VisitedDateTime,
                                        attendance.Temperature,
                                        attendance.Location,
                                        attendance.AttendeeRFID,
                                        attendance.Status,
                                        attendance.Id,
                                        attendance.AttendeeId);
            }
        }
Пример #2
0
        private void AddButtonSearch(Control control, ComponentItemDto componentDto, ConfigurationColumnFillDto config_fill, ref int position_y, ref int position_x)
        {
            Button btn = new Button();

            btn.Parent   = control;
            btn.Name     = $"btn_search_{componentDto.Group}";
            btn.Text     = "...";
            btn.Location = new System.Drawing.Point(position_x + 20, position_y);

            var code   = componentDto.ConfigurationColumns.FirstOrDefault(fi => fi.Id == config_fill.ConfigurationColumnSourceId);
            var val    = componentDto.ConfigurationColumns.FirstOrDefault(fi => fi.Id == config_fill.ConfigurationColumnDestinationId);
            var search = new SearchDto()
            {
                LabelDescriptionName  = val.Title,
                LabelIdName           = code.Title,
                SearchItems           = code.EnableValues,
                ColumnSourceName      = $"{code.Name}_{code.Id}",
                ColumnDestinationName = $"{val.Name}_{val.Id}",
            };

            btn.Click += (object sender, EventArgs e) =>
            {
                var form = new GenericSearch(search, this);
                form.Show();
            };
            position_y += 40;
            position_x += btn.Width;
        }
Пример #3
0
        public async Task <IActionResult> Search([FromQuery] SearchDto search)
        {
            _logger.LogThisMethod();
            var products = await _catalogService.SearchProductsAsync(search);

            return(Ok(products));
        }
Пример #4
0
        public OkObjectResult SearchEnsemblesNotOnEvent([FromBody] SearchDto dto)
        {
            var userId = GetUserId();

            var ensemblesRequestedIds = _context.Bookings
                                        .Where(b => b.EventId == dto.EventId)
                                        .Select(b => b.EnsembleId)
                                        .ToArray();

            var ensemblesModeratedIds = _context.EnsembleModerators
                                        .Where(em => em.UserIdRecipient == userId &&
                                               em.Status == RequestStatus.Accepted)
                                        .Select(em => em.EnsembleId)
                                        .ToArray();

            var ensembles = _context.Ensembles
                            .Where(e => e.Name.ToLower().Contains(dto.Search.ToLower()) &&
                                   !ensemblesRequestedIds.Contains(e.EnsembleId))
                            .Select(e => new EnsembleDto
            {
                EnsembleId = e.EnsembleId,
                Name       = e.Name,
                UserIsMod  = ensemblesModeratedIds.Contains(e.EnsembleId)
            });

            return(new OkObjectResult(new { success = true, ensembles }));
        }
Пример #5
0
        public IHttpActionResult GetAttendeeBySearchParameter(SearchDto searchDto)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            var attendees = _context.Attendees.AsEnumerable();

            switch (searchDto.SearchBy.ToUpper().Trim())
            {
            case "NAME":
                attendees = attendees.Where(a => a.Name.Contains(searchDto.SearchText));
                break;

            case "ADDRESS":
                attendees = attendees.Where(a => a.Address.Contains(searchDto.SearchText));
                break;

            default:
                break;
            }
            //.ToList()
            //.Select(Mapper.Map<Item, ItemDto>);

            return(Ok(attendees.ToList()));
        }
Пример #6
0
        public async Task <IEnumerable <EmployeeDto> > SearchEmployeeAsync(SearchDto dto)
        {
            var listEmployee = await this.context.Employees
                               .Where(name => name.FirstName.ToLower().Contains(dto.Data
                                                                                .ToLower()) && name.IsDeleted == false)
                               .Select(employee => new EmployeeDto
            {
                Id                   = employee.Id,
                FirstName            = employee.FirstName,
                LastName             = employee.LastName,
                ExperienceEmployeeId = employee.ExperienceEmployeeId,
                VacationDays         = employee.VacationDays,
                StartingDate         = employee.StartingDate,
                Salary               = employee.Salary,
                IsDeleted            = employee.IsDeleted,
                CompanyId            = employee.CompanyId,
                CompanyName          = employee.Company.Name,
                OfficeIsDeleted      = employee.Office.IsDeleted,
                CompanyIsDeleted     = employee.Company.IsDeleted,
                OfficeId             = employee.OfficeId,
                CityName             = employee.Office.City.Name,
                CountryName          = employee.Office.City.Country.Name,
                CountryId            = employee.Office.City.Country.Id
            })
                               .ToListAsync();

            return(listEmployee);
        }
Пример #7
0
        public List <BlogDto> SearchBlogs(SearchDto searchDto)
        {
            MapperConfiguration config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <Post, BlogDto>();
                cfg.CreateMap <UserProfile, UserDto>();
            });

            Mapper mapper = new Mapper(config);

            if (searchDto != null)
            {
                string uniqueTags = CheckUniqueTags(searchDto.Text).FirstOrDefault();

                IEnumerable <Post> searchResults = null;

                if (uniqueTags != null)
                {
                    searchResults = _uow.TagRepository.GetRange(p => p.Body == uniqueTags, x => x.Post.Select(z => z.UserProfile)).Select(x => x.Post).FirstOrDefault().Where(x => !x.IsDeleted);
                }
                else if (uniqueTags == null)
                {
                    searchResults = _uow.PostRepository.GetRange(x => !x.IsDeleted, p => p.UserProfile).Where(x => x.Text.Contains(searchDto.Text));
                }

                List <BlogDto> foundBlogs = mapper.Map <List <BlogDto> >(searchResults);

                return(foundBlogs);
            }

            return(new List <BlogDto>());
        }
Пример #8
0
        public List <CompanyDto> Search(SearchDto searchDto)
        {
            var companies = _companyRepository.Search(searchDto.Keyword, searchDto.EmployeeDateOfBirthFrom,
                                                      searchDto.EmployeeDateOfBirthTo, ParseEnum <Position>(searchDto.EmployeeJobTitles));

            return(_mapper.Map <List <CompanyDto> >(companies));
        }
Пример #9
0
        public async Task <BudgetListDto> GetList(SearchDto searchDto)
        {
            BudgetListDto    res     = new BudgetListDto();
            List <BudgetDto> budgets = await(from a in _dbContext.Budgets.Where(c => c.IsCurrent == true)
                                             where (searchDto.Search != null ? (a.Name.Contains(searchDto.Search) || a.ReferenceId.Contains(searchDto.Search)) : true)
                                             select new BudgetDto()
            {
                Name         = a.Name,
                Description  = a.Description,
                ReferenceId  = a.ReferenceId,
                BudgetStatus = a.BudgetStatus,
                BudgetType   = a.BudgetType,
                TotalAmount  = a.TotalAmount,
                CreatedDate  = a.CreatedDate,
                StartDate    = a.StartDate,
                EndDate      = a.EndDate,
                CreatedBy    = a.CreatedBy,
                Id           = a.Id,
                Uid          = a.Uid,
                CurrencyId   = a.CurrencyId,
            }).OrderByDescending(c => c.Id).ToListAsync();

            res.Total_count = budgets.Count();
            res.Items       = budgets;
            return(res);
        }
        public IHttpActionResult GetTransactionsBySearchParameter(SearchDto searchDto)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            var transactions = _context.Transactions.Include("Branch")
                               .Where(a => a.BranchId == searchDto.BranchId)
                               .AsEnumerable();

            switch (searchDto.SearchBy.ToUpper().Trim())
            {
            case "PLATENUMBER":
                transactions = transactions.Where(a => a.PlateNumber.Contains(searchDto.SearchText));
                break;

            default:
                break;
            }
            //.ToList()
            //.Select(Mapper.Map<Item, ItemDto>);

            return(Ok(transactions.ToList().Select(Mapper.Map <Transaction, TransactionDto>)));
        }
Пример #11
0
        public Result <SearchResult> SearchWeb(SearchDto searchDto)
        {
            if (string.IsNullOrWhiteSpace(searchDto.URL) || string.IsNullOrWhiteSpace(searchDto.Expression))
            {
                return(new Result <SearchResult>(false, "URL and Expression fields are required."));
            }

            var validUri = Uri.TryCreate(searchDto.URL, UriKind.Absolute, out Uri uri);

            if (!validUri)
            {
                return(new Result <SearchResult>(false, $"Can't parse URL: {searchDto.URL}"));
            }

            var document = new HtmlDocument();

            using (var client = new WebClient())
            {
                var html = client.DownloadString(uri);
                document.LoadHtml(html);
                var original = document.DocumentNode.InnerText;
                var replaced = original.Replace(searchDto.Expression, "", System.StringComparison.InvariantCultureIgnoreCase);
                var hitCount = (original.Length - replaced.Length) / searchDto.Expression.Length;

                var result = new SearchResult
                {
                    URL      = searchDto.URL,
                    Query    = searchDto.Expression,
                    HitCount = hitCount
                };

                return(new Result <SearchResult>(result));
            }
        }
Пример #12
0
        public IHttpActionResult GetVehiclesBySearchParameter(SearchDto searchDto)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            var vehicles = _context.Vehicles.AsEnumerable();

            switch (searchDto.SearchBy.ToUpper().Trim())
            {
            case "TYPE":
                vehicles = vehicles.Where(a => a.Type.Contains(searchDto.SearchText));
                break;

            case "DESCRIPTION":
                vehicles = vehicles.Where(a => a.Description.Contains(searchDto.SearchText));
                break;

            case "BRAND":
                vehicles = vehicles.Where(a => a.Brand.Contains(searchDto.SearchText));
                break;

            case "MODEL":
                vehicles = vehicles.Where(a => a.Model.Contains(searchDto.SearchText));
                break;

            default:
                break;
            }

            return(Ok(vehicles.ToList().Select(Mapper.Map <Vehicle, VehicleDto>)));
        }
Пример #13
0
        public IHttpActionResult GetServicesBySearchParameter(SearchDto searchDto)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            var services = _context.Services.AsEnumerable();

            switch (searchDto.SearchBy.ToUpper().Trim())
            {
            case "TYPE":
                services = services.Where(a => a.Type.Contains(searchDto.SearchText));
                break;

            case "DESCRIPTION":
                services = services.Where(a => a.Description.Contains(searchDto.SearchText));
                break;

            default:
                break;
            }
            //.ToList()
            //.Select(Mapper.Map<Item, ItemDto>);

            return(Ok(services.ToList().Select(Mapper.Map <Service, ServiceDto>)));
        }
Пример #14
0
        public ActionResult GetAttendanceByDate([FromBody] SearchDto searchDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var attendances = _ahcmsContext.Attendances.Include(a => a.Attendee)
                              .Include(a => a.Place)
                              .Where(a => a.VisitedDateTime.Year == searchDto.Date.Value.Year &&
                                     a.VisitedDateTime.Month == searchDto.Date.Value.Month &&
                                     a.VisitedDateTime.Day == searchDto.Date.Value.Day)
                              .Select(a => new AttendanceDto
            {
                Id = a.Id,
                VisitedDateTime = a.VisitedDateTime,
                Temperature     = a.Temperature,
                AttendeeId      = a.Attendee.Id,
                AttendeeRFID    = a.Attendee.AttendeeRFID,
                AttendeeStatus  = a.Attendee.Status,
                Status          = a.Status,
                ContactNumber   = a.Attendee.ContactNumber,
                Name            = a.Attendee.Name,
                Age             = a.Attendee.Age,
                Address         = a.Attendee.Address,
                PlaceId         = a.Place.Id,
                Location        = a.Place.Location
            })
                              .AsEnumerable();

            return(Ok(attendances.ToList()));
        }
Пример #15
0
 public List <FixedDto> Search(SearchDto dto)
 {
     return(ctx.Leads.
            Where(p => dto.UserId == null || dto.UserId == p.UserId).
            Select(p => new FixedDto {
         Id = p.Id, Name = p.StoreName, Description = p.StoreNumber.ToString(), Title = p.StoreAddress
     }).ToList());
 }
Пример #16
0
 public List <FixedDto> Search(SearchDto dto)
 {
     return(ctx.Orders.Include(p => p.Party).
            Where(p => dto.UserId == null || dto.UserId == p.Party.UserId).
            Select(p => new FixedDto {
         Id = p.Id, Name = p.Party.StoreName, Description = p.Description, Title = p.Party.StoreAddress
     }).ToList());
 }
Пример #17
0
 public List <FixedDto> Search(SearchDto dto)
 {
     return(ctx.Expenses.
            Where(p => dto.UserId == null || dto.UserId == p.UserId).
            Select(p => new FixedDto {
         Id = p.Id, Title = p.CreatedAt.ToDateLongString(), Description = "", Name = p.Name
     }).ToList());
 }
Пример #18
0
        public async Task <byte[]> CsvExportAsync(SearchDto search)
        {
            var citizens = (await _repository.SearchAsync(SearchDto.ToCriteria(search), null, null).ConfigureAwait(false))
                           .Select(a => CitizenExportDto.FromEntity(a)).ToArray();
            var fileContent = await GetCsvFromDataAsync(citizens).ConfigureAwait(false);

            return(fileContent);
        }
Пример #19
0
        public IHttpActionResult GetAttendanceBySearchParameter(SearchDto searchDto)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            var attendances = _context.Attendances.Include(a => a.Attendee)
                              .Include(a => a.Place)
                              .Where(a => a.PlaceId == searchDto.PlaceId)
                              .Select(a => new AttendanceDto
            {
                Id = a.Id,
                VisitedDateTime = a.VisitedDateTime,
                Temperature     = a.Temperature,
                AttendeeId      = a.Attendee.Id,
                AttendeeRFID    = a.Attendee.AttendeeRFID,
                AttendeeStatus  = a.Attendee.Status,
                Status          = a.Status,
                ContactNumber   = a.Attendee.ContactNumber,
                Name            = a.Attendee.Name,
                Age             = a.Attendee.Age,
                Address         = a.Attendee.Address,
                PlaceId         = a.Place.Id,
                Location        = a.Place.Location
            })
                              .AsEnumerable();

            switch (searchDto.SearchBy.ToUpper().Trim())
            {
            case "DATEANDTIME":
                attendances = attendances.Where(a => a.VisitedDateTime.ToString().Contains(searchDto.SearchText));
                break;

            case "TEMPERATURE":
                attendances = attendances.Where(a => a.Temperature.ToString().Contains(searchDto.SearchText));
                break;

            case "NAME":
                attendances = attendances.Where(a => a.Name.ToString().Contains(searchDto.SearchText));
                break;

            case "RFID":
                attendances = attendances.Where(a => a.AttendeeRFID.ToString().Contains(searchDto.SearchText));
                break;

            case "LOCATION":
                attendances = attendances.Where(a => a.Location.ToString().Contains(searchDto.SearchText));
                break;

            default:
                break;
            }
            //.ToList()
            //.Select(Mapper.Map<Item, ItemDto>);

            return(Ok(attendances.ToList()));
        }
Пример #20
0
        public async Task <IEnumerable <ServiceTaskDto> > Get(SearchDto SearchData)
        {
            List <ServiceTaskDto> tasks = (await _serviceTaskService.SearchAsync(SearchData))
                                          .Select(st => FormTaskDto(st)).ToList();

            await AddTargets(tasks);

            return(tasks);
        }
Пример #21
0
        public List <Vehicle> GetVehiclesBySearchCriteria(SearchDto search)
        {
            var priceRange = GetPriceRange(search.PriceRange.Value);

            return(_context.Vehicles.Where(v =>
                                           (!string.IsNullOrEmpty(search.Make) && v.Make == search.Make) &&
                                           (search.PriceRange.HasValue && v.Price >= priceRange.MinPrice) &&
                                           (search.PriceRange.HasValue && v.Price <= priceRange.MaxPrice)).ToList());
        }
Пример #22
0
        public async Task <IActionResult> GetBudgets(SearchDto searchDto)
        {
            var budgets = await _unitOfWork.Budgets.GetList(searchDto);

            if (budgets == null)
            {
                return(Ok(null));
            }
            return(Ok(budgets));
        }
        public async Task <IActionResult> Search([FromBody] SearchDto dto)
        {
            var result = await repo.Search(dto);

            if (result != null)
            {
                return(Ok(result));
            }
            return(BadRequest());
        }
Пример #24
0
        public async Task <IActionResult> GetDivisions(SearchDto searchDto)
        {
            var divisions = await _unitOfWork.Divisions.GetList(searchDto);

            if (divisions == null)
            {
                return(Ok(null));
            }
            return(Ok(divisions));
        }
        public async Task <IActionResult> SearchEmployee([FromQuery] string searchData)
        {
            var dto = new SearchDto {
                Data = searchData
            };

            var result = await this.searchService.SearchEmployeeAsync(dto);

            return(Json(result));
        }
Пример #26
0
 public GenericSearch(SearchDto searchDto, MainForm1 called)
 {
     InitializeComponent();
     Called                   = called;
     BaseListSearch           = searchDto.SearchItems;
     SearchDtoBase            = searchDto;
     SearchDtoBase.SelectItem = new ValueDto();
     SetLabelsName(searchDto);
     BindingGrid(searchDto);
 }
Пример #27
0
        public async Task <IActionResult> GetList([FromBody] SearchDto searchDto)
        {
            var budgetHeads = await _unitOfWork.BudgetCategories.GetList(searchDto);

            if (budgetHeads.Total_count == 0)
            {
                return(Ok(null));
            }
            return(Ok(budgetHeads));
        }
Пример #28
0
        public async Task <IActionResult> SearchAsync([FromQuery] SearchDto input)
        {
            // Act.
            var users = await _userService.SearchAsync(input.Query, input.ToNavigation()).ToListAsync();

            // Map.
            var output = _mapper.Map <IEnumerable <UserWithRelationWrapperDto> >(users);

            // Return.
            return(Ok(output));
        }
Пример #29
0
        private void BindingGrid(SearchDto searchDto)
        {
            var bindingSource = new BindingSource();

            dgv_search.AutoGenerateColumns = true;
            dgv_search.DataSource          = searchDto.SearchItems;
            dgv_search.AutoResizeColumns();
            dgv_search.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            dgv_search.AutoSize            = true;
            this.AutoSize = true;
        }
Пример #30
0
        public IEnumerable <ResultDto> Search(int fromId, int toId, string departure)
        {
            var query = new SearchDto
            {
                JourneyFromId = fromId,
                JourneyToId   = toId,
                Departure     = DateTime.ParseExact(departure, "dd-MM-yyyy", null)
            };

            return(_busService.SearchSchedules(query));
        }