public async Task <QueryResult <UserProfileModel> > FindListUsers(BlockCommitteeSearchCriteria criteria) { var searchCriteria = new UsersSearchCriteriaModel(); searchCriteria.Email = criteria.Email; searchCriteria.Name = criteria.EmployeeName; searchCriteria.MobileNumber = criteria.PhoneNumber; searchCriteria.PageNumber = criteria.PageNumber; searchCriteria.PageSize = criteria.PageSize; searchCriteria.AgencyId = criteria.AgencyId; searchCriteria.isGovVendor = criteria.isGovVendor; searchCriteria.isSemiGovAgency = criteria.isSemiGovAgency; searchCriteria.AgencyType = (int)criteria.AgencyType; searchCriteria.NationalId = criteria.CommercialRegistrationNo; if (!string.IsNullOrEmpty(searchCriteria.NationalId)) { searchCriteria.NationalIds.Add(searchCriteria.NationalId); } searchCriteria.RoleNames = new List <string> { RoleNames.MonafasatBlockListSecritary, RoleNames.MonafasatBlackListCommittee }; var idmUsers = await _iDMAppService.GetMonafasatUsersForBlockUserList(searchCriteria); var Users = _mapper.Map <QueryResult <UserProfileModel> >(idmUsers); return(Users); }
public async Task ShouldFindBlockCommittee() { //=== arrange========= var _blockObj = new BlockCommitteeSearchCriteria(); //============Return Result=========== var result = await _sut.FindBlockCommittee(_blockObj); //====== Assert===== Assert.NotNull(result); Assert.IsType <QueryResult <BlockCommitteeModel> >(result); }
public async Task <QueryResult <BlockCommitteeModel> > GetBlockCommittee(BlockCommitteeSearchCriteriaModel blockCommitteeSearchCriteriaModel) { var blockSearchCriteria = new BlockCommitteeSearchCriteria() { CommercialRegistrationNo = blockCommitteeSearchCriteriaModel.CommercialRegistrationNo, CommercialSupplierName = blockCommitteeSearchCriteriaModel.CommercialSupplierName, EmployeeName = blockCommitteeSearchCriteriaModel.EmployeeName, PageNumber = blockCommitteeSearchCriteriaModel.PageNumber }; var blockCommitteeModel = await _blockService.FindBlockCommittee(blockSearchCriteria); return(blockCommitteeModel); }
public async Task <QueryResult <BlockCommitteeModel> > FindBlockCommittee(BlockCommitteeSearchCriteria criteria) { var result = await _context.SupplierBlock.Include(x => x.BlockType) .WhereIf(!string.IsNullOrEmpty(criteria.CommercialRegistrationNo), x => x.CommercialRegistrationNo.Contains(criteria.CommercialRegistrationNo)) .WhereIf(!string.IsNullOrEmpty(criteria.CommercialSupplierName), x => x.CommercialSupplierName.Contains(criteria.CommercialSupplierName)) .OrderBy(x => x.SupplierBlockId) .SortBy(criteria.Sort, criteria.SortDirection).Select(r => new BlockCommitteeModel { CommercialRegistrationNo = r.CommercialRegistrationNo, CommercialSupplierName = r.CommercialSupplierName }) .ToQueryResult(criteria.PageNumber, criteria.PageSize); return(result); }
private BlockCommitteeSearchCriteria GetUserAgencyTypeAndIdWithFlags(BlockCommitteeSearchCriteria userSearchCriteriaModel) { if (User.IsInRole(RoleNames.MonafasatAdmin)) { userSearchCriteriaModel.isGovVendor = User.UserIsGovVendor(); userSearchCriteriaModel.isSemiGovAgency = User.UserIsSemiGovAgency(); userSearchCriteriaModel.AgencyType = userSearchCriteriaModel.isSemiGovAgency ? AgencyType.SemiGovAgency : (userSearchCriteriaModel.isGovVendor ? AgencyType.GovVendor : AgencyType.Agency); userSearchCriteriaModel.AgencyId = User.UserAgency(); } else { userSearchCriteriaModel.AgencyType = AgencyType.None; } return(userSearchCriteriaModel); }
public async Task <QueryResult <UserProfileModel> > GetBlockListUsers(BlockCommitteeSearchCriteriaModel blockCommitteeSearchCriteriaModel) { var blockSearchCriteria = new BlockCommitteeSearchCriteria() { CommercialRegistrationNo = blockCommitteeSearchCriteriaModel.CommercialRegistrationNo, EmployeeName = blockCommitteeSearchCriteriaModel.CommercialSupplierName, PageNumber = blockCommitteeSearchCriteriaModel.PageNumber, PhoneNumber = blockCommitteeSearchCriteriaModel.PhoneNumber, Email = blockCommitteeSearchCriteriaModel.Email, }; blockSearchCriteria = GetUserAgencyTypeAndIdWithFlags(blockSearchCriteria); var blockCommitteeModel = await _blockService.FindListUsers(blockSearchCriteria); return(blockCommitteeModel); }
public Task <QueryResult <BlockCommitteeModel> > FindBlockCommittee(BlockCommitteeSearchCriteria criteria) { return(_blockQueries.FindBlockCommittee(criteria)); }