예제 #1
0
        public async Task <ListResultDto <ListClientDto> > GetAll(GetAllClientsInput input)
        {
            var clients = await _clientRepository
                          .GetAll()
                          // .WhereIf(input.State.HasValue, t => t.State == input.State.Value)
                          .OrderByDescending(t => t.CreationTime)
                          .ToListAsync();

            return(new ListResultDto <ListClientDto>(
                       ObjectMapper.Map <List <ListClientDto> >(clients)
                       ));
        }
예제 #2
0
        public async Task <PagedResultDto <GetClientForViewDto> > GetAll(GetAllClientsInput input)
        {
            var filteredClients = _clientRepository.GetAll()
                                  .Include(e => e.ContactPersonFk)
                                  .WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false || e.ClientName.Contains(input.Filter) || e.ClientTin.Contains(input.Filter) || e.ClientAddress.Contains(input.Filter) || e.ClientPhone.Contains(input.Filter))
                                  .WhereIf(!string.IsNullOrWhiteSpace(input.ClientNameFilter), e => e.ClientName.ToLower() == input.ClientNameFilter.ToLower().Trim())
                                  .WhereIf(!string.IsNullOrWhiteSpace(input.ClientTinFilter), e => e.ClientTin.ToLower() == input.ClientTinFilter.ToLower().Trim())
                                  .WhereIf(!string.IsNullOrWhiteSpace(input.ClientAddressFilter), e => e.ClientAddress.ToLower() == input.ClientAddressFilter.ToLower().Trim())
                                  .WhereIf(!string.IsNullOrWhiteSpace(input.ClientPhoneFilter), e => e.ClientPhone.ToLower() == input.ClientPhoneFilter.ToLower().Trim())
                                  .WhereIf(!string.IsNullOrWhiteSpace(input.ContactPersonFullNameFilter), e => e.ContactPersonFk != null && e.ContactPersonFk.FullName.ToLower() == input.ContactPersonFullNameFilter.ToLower().Trim());

            var pagedAndFilteredClients = filteredClients
                                          .OrderBy(input.Sorting ?? "id asc")
                                          .PageBy(input);

            var clients = from o in pagedAndFilteredClients
                          join o1 in _lookup_contactPersonRepository.GetAll() on o.ContactPersonId equals o1.Id into j1
                          from s1 in j1.DefaultIfEmpty()

                          select new GetClientForViewDto()
            {
                Client = new ClientDto
                {
                    ClientName    = o.ClientName,
                    ClientTin     = o.ClientTin,
                    ClientAddress = o.ClientAddress,
                    ClientPhone   = o.ClientPhone,
                    Id            = o.Id
                },
                ContactPersonFullName = s1 == null ? "" : s1.FullName.ToString()
            };

            var totalCount = await filteredClients.CountAsync();

            return(new PagedResultDto <GetClientForViewDto>(
                       totalCount,
                       await clients.ToListAsync()
                       ));
        }
예제 #3
0
        public async Task <PagedResultDto <GetClientsForViewDto> > GetAll(GetAllClientsInput input)
        {
            var    filteredClients        = _clientsRepository.GetAll();
            string defaultCurrentLanguage = await SettingManager.GetSettingValueForUserAsync(AppSettings.DefaultCurrentLanguage, AbpSession.ToUserIdentifier());

            if (string.IsNullOrWhiteSpace(defaultCurrentLanguage))
            {
                defaultCurrentLanguage = "EN";
            }


            var pagedAndFilteredClients = filteredClients
                                          .OrderBy(input.Sorting ?? "id asc")
                                          .PageBy(input);

            var clients = from o in pagedAndFilteredClients
                          join o1 in _lookup_cruiseMasterAmenitiesRepository.GetAll() on o.ClientGender equals o1.Id into j1
                          from s1 in j1.DefaultIfEmpty().Where(x => x.Lang.ToUpper() == defaultCurrentLanguage.ToUpper())

                          join o2 in _lookup_cruiseMasterAmenitiesRepository.GetAll() on o.ClientDocumentID equals o2.Id into j2
                          from s2 in j2.DefaultIfEmpty().Where(x => x.Lang.ToUpper() == defaultCurrentLanguage.ToUpper())

                          //join o3 in _lookup_cruiseMasterAmenitiesRepository.GetAll() on o.ClientDocumentNo equals o3.Id into j3
                          //from s3 in j3.DefaultIfEmpty()

                          select new GetClientsForViewDto()
            {
                Clients = new ClientsDto
                {
                    ReservationHolderID = o.ReservationHolderID,
                    ClientFirstName     = o.ClientFirstName,
                    ClientLastName      = o.ClientLastName,
                    ClientDOB           = o.ClientDOB,
                    WeddingAniversary   = o.WeddingAniversary,
                    ClientCountry       = o.ClientCountry,
                    ClientGoogleAddress = o.ClientGoogleAddress,
                    ClientEmail         = o.ClientEmail,
                    ContactCellPhone    = o.ContactCellPhone,
                    Issued            = o.Issued,
                    Expiration        = o.Expiration,
                    CountryResidence  = o.CountryResidence,
                    MedicalIssues     = o.MedicalIssues,
                    FoodIssues        = o.FoodIssues,
                    ClientPassword    = o.ClientPassword,
                    IsClientLoginWith = o.IsClientLoginWith,
                    LoginFailAttempt  = o.LoginFailAttempt,
                    IsLocked          = o.IsLocked,
                    ProfilePictureId  = o.ProfilePictureId,
                    Id = o.Id
                },
                CruiseMasterAmenitiesDisplayName = s1 == null ? "" : s1.DisplayName.ToString(),
                CruiseMasterAmenitiesDisplayName2 = s2 == null ? "" : s2.DisplayName.ToString(),
                // CruiseMasterAmenitiesDisplayName3 = s3 == null ? "" : s3.DisplayName.ToString()
            };

            var totalCount = await filteredClients.CountAsync();

            return(new PagedResultDto <GetClientsForViewDto>(
                       totalCount,
                       await clients.ToListAsync()
                       ));
        }