public async Task SearchEquipment_Call_PagedList_in_repository() { var request = new EquipmentSearchRequest() { EquipmentNo = "PAPU0000004", Page = 1, PageSize = 20 }; A.CallTo(() => repo.ListPagedAsync(null, 0, 0, null, null)).WithAnyArguments().Returns(Task.FromResult(new Query.Common.PagedList <EquipmentDTO>() { PageSize = 1, Page = 1, Total = 1, Items = new List <EquipmentDTO>() { new EquipmentDTO() { EquipmentId = 666 } } })); //Act var resp = await appService.SearchEquipmentAsync(request); //Assert Assert.NotNull(resp); // A.CallTo(() => repo.ListPagedAsync(null, 0, 0, null, null)).WithAnyArguments().MustHaveHappened(); Assert.AreEqual(resp.Messages.First().Key, "Info"); }
public async Task <ResponseDTO <PagedList <MainTenantBasicDTO> > > SearchByCodeAndName(MainTenantCodeNameRequest search) { List <OrderExpression <MainTenantBasicDTO> > orderExpressionList = new List <OrderExpression <MainTenantBasicDTO> >(); orderExpressionList.Add(new OrderExpression <MainTenantBasicDTO>(OrderType.Asc, p => p.FullName)); Expression <Func <MainTenantBasicDTO, bool> > queryFilter = c => true; if (!string.IsNullOrEmpty(search.Code)) { queryFilter = queryFilter.And(p => p.Code.Contains(search.Code)); } if (!string.IsNullOrEmpty(search.FullName)) { queryFilter = queryFilter.And(p => p.FullName.Contains(search.FullName)); } var mainTenant = await _mainTenantSearchBasicDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <MainTenantBasicDTO>() { Items = mainTenant.Items, PageSize = mainTenant.PageSize, Page = mainTenant.Page, Total = mainTenant.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <EquipmentDTO> > > SearchEquipmentAsync(EquipmentSearchRequest search) { Expression <Func <EquipmentDTO, bool> > queryFilter = c => c.RowStatus; if (!string.IsNullOrEmpty(search.EquipmentNo)) { queryFilter = queryFilter.And(p => p.EquipmentNo.Contains(search.EquipmentNo)); } var equipment = await _equipmentDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize); var pagedResult = new PagedList <EquipmentDTO>() { Items = equipment.Items, PageSize = equipment.PageSize, Page = equipment.Page, Total = equipment.Total }; var response = ResponseBuilder.Correct(pagedResult); response.Messages = new List <ApplicationMessage>(); response.Messages.Add(new ApplicationMessage() { Key = "Info", Message = !pagedResult.Items.Any() ? "No records found for this request" : "" }); return(response); }
public async Task <ResponseDTO <PagedList <ExpenseDetailSearchDTO> > > GetDetailByExpenseIdAsync(ExpenseSearchRequest search) { List <OrderExpression <ExpenseDetailSearchDTO> > orderExpressionList = new List <OrderExpression <ExpenseDetailSearchDTO> >(); orderExpressionList.Add(new OrderExpression <ExpenseDetailSearchDTO>(OrderType.Asc, p => p.ConceptName)); Expression <Func <ExpenseDetailSearchDTO, bool> > queryFilter = c => true; if (search.ExpenseId.HasValue) { queryFilter = queryFilter.And(p => p.ExpenseId == search.ExpenseId); } var expense = await _expenseDetailSearchDataAccess.ListPagedAsync (queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <ExpenseDetailSearchDTO>() { Items = expense.Items, PageSize = expense.PageSize, Page = expense.Page, Total = expense.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <DispatchingPartyDTO> > > SearchDispatchingPartyAsync(DispatchingPartySearchRequest search) { Expression <Func <DispatchingPartyDTO, bool> > queryFilter = c => c.RowStatus; if (search.DispatchingPartyId > 0) { queryFilter = queryFilter.And(p => p.DispatchingPartyId == search.DispatchingPartyId); } if (!string.IsNullOrEmpty(search.Code)) { queryFilter = queryFilter.And(p => p.Code.Contains(search.Code)); } if (!string.IsNullOrEmpty(search.Name)) { queryFilter = queryFilter.And(p => p.Code.Contains(search.Name)); } var DispatchingParty = await _DispatchingPartyDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize); var pagedResult = new PagedList <DispatchingPartyDTO>() { Items = DispatchingParty.Items, PageSize = DispatchingParty.PageSize, Page = DispatchingParty.Page, Total = DispatchingParty.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <CostCenterDTO> > > SearchCostCenterByNameAsync(CostCenterSearchRequest search) { List <OrderExpression <CostCenterDTO> > orderExpressionList = new List <OrderExpression <CostCenterDTO> >(); orderExpressionList.Add(new OrderExpression <CostCenterDTO>(OrderType.Desc, p => p.CostCenterId)); Expression <Func <CostCenterDTO, bool> > queryFilter = c => c.RowStatus; if (!string.IsNullOrEmpty(search.Name)) { queryFilter = queryFilter.And(p => p.Name.Contains(search.Name)); } if (!string.IsNullOrEmpty(search.Code)) { queryFilter = queryFilter.And(p => p.Code.Contains(search.Code)); } var costCenter = await _costCenterDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <CostCenterDTO>() { Items = costCenter.Items, PageSize = costCenter.PageSize, Page = costCenter.Page, Total = costCenter.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <HouseDTO> > > Search(HouseSearchRequest search) { List <OrderExpression <HouseDTO> > orderExpressionList = new List <OrderExpression <HouseDTO> >(); orderExpressionList.Add(new OrderExpression <HouseDTO>(OrderType.Asc, p => p.Address)); Expression <Func <HouseDTO, bool> > queryFilter = c => true; if (!string.IsNullOrEmpty(search.Code)) { queryFilter = queryFilter.And(p => p.Code.Contains(search.Code)); } if (!string.IsNullOrEmpty(search.Name)) { queryFilter = queryFilter.And(p => p.Name.Contains(search.Name)); } if (!string.IsNullOrEmpty(search.PhoneNumber)) { queryFilter = queryFilter.And(p => p.PhoneNumber.Contains(search.PhoneNumber)); } if (search.HouseTypeId.HasValue) { queryFilter = queryFilter.And(p => p.HouseTypeId == search.HouseTypeId.Value); } if (!string.IsNullOrEmpty(search.Address)) { queryFilter = queryFilter.And(p => p.Address.Contains(search.Address)); } if (search.RowStatus.HasValue) { queryFilter = queryFilter.And(p => p.RowStatus == search.RowStatus); } if (search.HouseStatusId.HasValue) { queryFilter = queryFilter.And(p => p.HouseStatusId == search.HouseStatusId.Value); } var house = await _houseDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <HouseDTO>() { Items = house.Items, PageSize = house.PageSize, Page = house.Page, Total = house.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task DriverPayReportSearch_Call_PagedList_in_repository() { var request = new DriverPayReportSearchRequest() { ReportDateFrom = new DateTime(2017,1,25), ReportDateTo = new DateTime(2017, 2, 2), DriverId = 3015, PageSize = 10, Page = 1 }; var userList = new List<string>() {"Root"}; var json1 =@"[Data"":""[{""Id"":3015,""UserName"":""Root"",""FirstName"":""Root"",""LastName"":""AmigoTenant"", ""ProfilePictureUrl"":null,""Email"":"""",""PhoneNumber"":null,""Claims"":[]}],""IsValid"":true,""Messages"":null}]"" )"; var response = new HttpResponseMessage { /*Content = new StringContent("[\"Root\"]"), */ StatusCode = HttpStatusCode.OK, Content = new StringContent(json1, Encoding.UTF8, "application/json") }; A.CallTo(() => _repo.ListPagedAsync(null, 0, 0, null, null)) .WithAnyArguments().Returns(Task.FromResult(new Query.Common.PagedList<DriverPayReportDTO>() { PageSize = 1, Page = 1, Total = 1, Items = new List<DriverPayReportDTO>() { new DriverPayReportDTO() { DayPayDriverTotal = 95000, Driver = "root", DriverUserId = 3015,ReportDate = new DateTime(2017,1,27)} } })); A.CallTo(() => _repoIdentitySeverAgent.AmigoTenantTUser_Details_IdentityServer(userList)).WithAnyArguments().Returns(Task.FromResult(response)); // ACT // var resp = await appService.SearchDriverPayReportAsync(request); //Assert //Assert.NotNull(resp); A.CallTo(() => _repo.ListPagedAsync(null, 0, 0, null, null)).WithAnyArguments().MustHaveHappened(Repeated.NoMoreThan.Once); }
public async Task SearchModules_Call() { //-------------- Arrange ------------- CommonArrangements(); var searchRequest = new ModuleSearchRequest(); //-------------- Act ------------- var resp = await moduleService.SearchModulesAsync(searchRequest); //-------------- Assert ------------- A.CallTo(() => _moduleDataAccess.ListPagedAsync(null, 0, 0, null, null)).WithAnyArguments().MustHaveHappened(); }
public async Task Search_Call() { //-------------- Arrange ------------- //CommonArrangements(); var searchRequest = new AmigoTenantTEventLogSearchRequest(); //-------------- Act ------------- var resp = await amigoTenantTEventLogApplicationService.SearchAsync(searchRequest); //-------------- Assert ------------- A.CallTo(() => logSearchDataAccess.ListPagedAsync(null, 0, 0, null, null)).WithAnyArguments().MustHaveHappened(); }
public async Task <ResponseDTO <PagedList <MainTenantDTO> > > SearchTenantAsync(MainTenantSearchRequest search) { List <OrderExpression <MainTenantDTO> > orderExpressionList = new List <OrderExpression <MainTenantDTO> >(); orderExpressionList.Add(new OrderExpression <MainTenantDTO>(OrderType.Asc, p => p.FullName)); Expression <Func <MainTenantDTO, bool> > queryFilter = c => true; if (!string.IsNullOrEmpty(search.Code)) { queryFilter = queryFilter.And(p => p.Code.Contains(search.Code)); } if (!string.IsNullOrEmpty(search.FullName)) { queryFilter = queryFilter.And(p => p.FullName.Contains(search.FullName)); } if (!string.IsNullOrEmpty(search.PhoneNumber)) { queryFilter = queryFilter.And(p => p.PhoneN01.Contains(search.PhoneNumber)); } if (search.CountryId.HasValue) { queryFilter = queryFilter.And(p => p.CountryId == search.CountryId.Value); } if (search.TypeId.HasValue) { queryFilter = queryFilter.And(p => p.TypeId == search.TypeId.Value); } if (search.RowStatus.HasValue) { queryFilter = queryFilter.And(p => p.RowStatus == search.RowStatus); } var mainTenant = await _mainTenantSearchDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <MainTenantDTO>() { Items = mainTenant.Items, PageSize = mainTenant.PageSize, Page = mainTenant.Page, Total = mainTenant.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task ActivityEventLogSearchRequest_Call_PagedList_in_repository() { var request = new ActivityEventLogSearchRequest() { //ActivityTypeIds = 0, UserName = "******", ReportedActivityDateFrom = new DateTime(2017, 2, 3), PageSize = 10, Page = 1 }; A.CallTo(() => _repo.ListPagedAsync(null, 0, 0, null, null)) .WithAnyArguments() .Returns(Task.FromResult(new Query.Common.PagedList <ActivityEventLogDTO>())); //Act var resp = await appService.SearchActivityEventLogAll(request); //Assert Assert.NotNull(resp); A.CallTo(() => _repo.ListPagedAsync(null, 0, 0, null, null)) .WithAnyArguments() .MustHaveHappened(Repeated.NoMoreThan.Once); }
public async Task <ResponseDTO <PagedList <AmigoTenantTRoleBasicDTO> > > SearchAmigoTenantTRoleBasicCriteriaAsync(AmigoTenantTRoleSearchRequest search) { var queryFilter = GetQueryFilterBasic(search); var result = await _dataAccessBasic.ListPagedAsync(queryFilter, search.Page, search.PageSize); var pagedResult = new PagedList <AmigoTenantTRoleBasicDTO>() { Items = result.Items, PageSize = result.PageSize, Page = result.Page, Total = result.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <PermissionDTO> > > SearchPermissionByCriteriaAsync(PermissionSearchRequest search) { var queryFilter = GetQueryFilter(search); var result = await _permissionDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize); var pagedResult = new PagedList <PermissionDTO>() { Items = result.Items, PageSize = result.PageSize, Page = result.Page, Total = result.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <InternalReportDTO> > > SearchInternalHistoryAsync(ReportHistoryRequest search) { var queryFilter = GetQueryFilter(search); var eventLogs = await _reportDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize); eventLogs.Items.ToList().ForEach(x => { x.Status = (x.ServiceFinishDate == null) ? Constants.ServiceStatus.Ongoing : Constants.ServiceStatus.Done; x.IsHazardousLabel = (string.IsNullOrEmpty(x.IsHazardous) || x.IsHazardous == "0") ? Constants.YesNo.No : Constants.YesNo.Yes; int?approvalStatus = null; if (x.ServiceStatus.HasValue && x.ServiceStatus.Value) { approvalStatus = 1; } if (x.ServiceStatus.HasValue && !x.ServiceStatus.Value) { approvalStatus = 0; } x.ApprovalStatus = Constants.ApprovalStatus.FirstOrDefault(y => y.Item1 == approvalStatus).Item2; x.ServiceStartDayName = x.ServiceStartDate?.DateTime.ToString("dddd") ?? ""; x.ServiceFinishDayName = x.ServiceFinishDate?.DateTime.ToString("dddd") ?? ""; x.ServiceTotalHours = GetServiceTotalHours(x.ServiceStartDate, x.ServiceFinishDate); }); var pagedResult = new PagedList <InternalReportDTO>() { Items = eventLogs.Items, PageSize = eventLogs.PageSize, Page = eventLogs.Page, Total = eventLogs.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <AmigoTenantTEventLogSearchResultDTO> > > SearchAsync(AmigoTenantTEventLogSearchRequest search) { var queryFilter = GetQueryFilter(search); var eventLogs = await _logSearchDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize); var pagedResult = new PagedList <AmigoTenantTEventLogSearchResultDTO>() { Items = eventLogs.Items, PageSize = eventLogs.PageSize, Page = eventLogs.Page, Total = eventLogs.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <DeviceDTO> > > SearchDeviceAsync(DeviceSearchRequest search) { var queryFilter = GetQueryFilter(search); var device = await _deviceDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize); var pagedResult = new PagedList <DeviceDTO>() { Items = device.Items, PageSize = device.PageSize, Page = device.Page, Total = device.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <AmigoTenantTUserDTO> > > SearchUsersByCriteriaAsync(UserSearchRequest search) { var queryFilter = GetQueryFilter(search); var result = await _userDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize); await SetUsersAdditionalInformation(result.Items.ToList()); var pagedResult = new PagedList <AmigoTenantTUserDTO>() { Items = result.Items, PageSize = result.PageSize, Page = result.Page, Total = result.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <ActivityEventLogDTO> > > SearchActivityEventLogAll(ActivityEventLogSearchRequest search) { List <OrderExpression <ActivityEventLogDTO> > orderExpressionList = new List <OrderExpression <ActivityEventLogDTO> >(); orderExpressionList.Add(new OrderExpression <ActivityEventLogDTO>(OrderType.Desc, p => p.ReportedActivityDate)); var queryFilter = GetQueryFilter(search); var result = await _activityEventLogDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <ActivityEventLogDTO>() { Items = result.Items, PageSize = result.PageSize, Page = result.Page, Total = result.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <LocationDTO> > > SearchLocationAsync(LocationSearchRequest search) { List <OrderExpression <LocationDTO> > orderExpressionList = new List <OrderExpression <LocationDTO> >(); orderExpressionList.Add(new OrderExpression <LocationDTO>(OrderType.Asc, p => p.Name)); var queryFilter = GetQueryFilter(search); var location = await _locationDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <LocationDTO>() { Items = location.Items, PageSize = location.PageSize, Page = location.Page, Total = location.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <ModuleDTO> > > SearchModulesAsync(ModuleSearchRequest search) { Expression <Func <ModuleDTO, bool> > queryFilter = c => true; if (!string.IsNullOrEmpty(search.Code)) { queryFilter = queryFilter.And(p => p.Code == search.Code); } if (!string.IsNullOrEmpty(search.Name)) { queryFilter = queryFilter.And(p => p.Name.Contains(search.Name)); } if (search.OnlyParents != null && search.OnlyParents == true) { queryFilter = queryFilter.And(p => p.Url == null); } if (!string.IsNullOrEmpty(search.ParentName)) { queryFilter = queryFilter.And(p => p.ParentModuleName.Contains(search.ParentName)); } Expression <Func <ModuleDTO, object> > expressionModuleCode = p => p.Code; List <OrderExpression <ModuleDTO> > orderExpressions = new List <OrderExpression <ModuleDTO> >(); orderExpressions.Add(new OrderExpression <ModuleDTO>(OrderType.Asc, expressionModuleCode)); var module = await _moduleDataAcces.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressions.ToArray()); var pagedResult = new PagedList <ModuleDTO>() { Items = module.Items, PageSize = module.PageSize, Page = module.Page, Total = module.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <EquipmentSizeDTO> > > SearchEquipmentSizeAsync(EquipmentSizeSearchRequest search) { Expression <Func <EquipmentSizeDTO, bool> > queryFilter = c => c.RowStatus; if (!string.IsNullOrEmpty(search.Name)) { queryFilter = queryFilter.And(p => p.Name.Contains(search.Name)); } var equipmentSize = await _equipmentSizeDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize); var pagedResult = new PagedList <EquipmentSizeDTO>() { Items = equipmentSize.Items, PageSize = equipmentSize.PageSize, Page = equipmentSize.Page, Total = equipmentSize.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <ProductDTO> > > SearchProductsByNameAsync(ProductSearchRequest search) { List <OrderExpression <ProductDTO> > orderExpressionList = new List <OrderExpression <ProductDTO> >(); orderExpressionList.Add(new OrderExpression <ProductDTO>(OrderType.Asc, p => p.Name)); Expression <Func <ProductDTO, bool> > queryFilter = c => c.RowStatus == true; if (!string.IsNullOrEmpty(search.Code)) { queryFilter = queryFilter.And(p => p.Code.Contains(search.Code)); } if (!string.IsNullOrEmpty(search.Name)) { queryFilter = queryFilter.And(p => p.Name.Contains(search.Name)); } if (!string.IsNullOrEmpty(search.ShortName)) { queryFilter = queryFilter.And(p => p.ShortName.Contains(search.ShortName)); } if (!string.IsNullOrEmpty(search.IsHazardous)) { queryFilter = queryFilter.And(p => p.IsHazardous.Contains(search.IsHazardous)); } var product = await _productDataAcces.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <ProductDTO>() { Items = product.Items, PageSize = product.PageSize, Page = product.Page, Total = product.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <ServiceTypeDTO> > > SearchServiceTypeByNameAsync(ServiceTypeSearchRequest search) { Expression <Func <ServiceTypeDTO, bool> > queryFilter = c => c.RowStatus; if (!string.IsNullOrEmpty(search.Name)) { queryFilter = queryFilter.And(p => p.Name.Contains(search.Name)); } var product = await _serviceTypeDataAcces.ListPagedAsync(x => x.Name.StartsWith(search.Name), search.Page, search.PageSize); var pagedResult = new PagedList <ServiceTypeDTO>() { Items = product.Items, PageSize = product.PageSize, Page = product.Page, Total = product.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <RentalApplicationSearchDTO> > > SearchRentalApplicationAsync(RentalApplicationSearchRequest search) { List <OrderExpression <RentalApplicationSearchDTO> > orderExpressionList = new List <OrderExpression <RentalApplicationSearchDTO> >(); orderExpressionList.Add(new OrderExpression <RentalApplicationSearchDTO>(OrderType.Asc, p => p.ApplicationDate)); Expression <Func <RentalApplicationSearchDTO, bool> > queryFilter = c => true; //APPLICATIONDATE if (search.ApplicationDateFrom.HasValue && search.ApplicationDateTo.HasValue) { var toPlusADay = search.ApplicationDateTo.Value.AddDays(1); queryFilter = queryFilter.And(p => p.ApplicationDate.Value >= search.ApplicationDateFrom); queryFilter = queryFilter.And(p => p.ApplicationDate.Value < toPlusADay); } else if (search.ApplicationDateFrom.HasValue && !search.ApplicationDateTo.HasValue) { queryFilter = queryFilter.And(p => p.ApplicationDate.Value >= search.ApplicationDateFrom); } else if (!search.ApplicationDateFrom.HasValue && search.ApplicationDateTo.HasValue) { var toPlusADay = search.ApplicationDateTo.Value.AddDays(1); queryFilter = queryFilter.And(p => p.ApplicationDate.Value < toPlusADay); } //CHECKIN if (search.CheckInFrom.HasValue && search.CheckInTo.HasValue) { var toPlusADay = search.CheckInTo.Value.AddDays(1); queryFilter = queryFilter.And(p => p.CheckIn.Value >= search.CheckInFrom); queryFilter = queryFilter.And(p => p.CheckIn.Value < toPlusADay); } else if (search.CheckInFrom.HasValue && !search.CheckInTo.HasValue) { queryFilter = queryFilter.And(p => p.CheckIn.Value >= search.CheckInFrom); } else if (!search.CheckInFrom.HasValue && search.CheckInTo.HasValue) { var toPlusADay = search.CheckInTo.Value.AddDays(1); queryFilter = queryFilter.And(p => p.CheckIn.Value < toPlusADay); } //CHECKOUT if (search.CheckOutFrom.HasValue && search.CheckOutTo.HasValue) { var toPlusADay = search.CheckOutTo.Value.AddDays(1); queryFilter = queryFilter.And(p => p.CheckOut.Value >= search.CheckOutFrom); queryFilter = queryFilter.And(p => p.CheckOut.Value < toPlusADay); } else if (search.CheckOutFrom.HasValue && !search.CheckOutTo.HasValue) { queryFilter = queryFilter.And(p => p.CheckOut.Value >= search.CheckOutFrom); } else if (!search.CheckOutFrom.HasValue && search.CheckOutTo.HasValue) { var toPlusADay = search.CheckOutTo.Value.AddDays(1); queryFilter = queryFilter.And(p => p.CheckOut.Value < toPlusADay); } if (search.PropertyTypeId.HasValue) { queryFilter = queryFilter.And(p => p.PropertyTypeId == search.PropertyTypeId); } if (search.PeriodId.HasValue) { queryFilter = queryFilter.And(p => p.PeriodId == search.PeriodId); } if (!string.IsNullOrEmpty(search.Email)) { queryFilter = queryFilter.And(p => p.Email.Contains(search.Email)); } if (!string.IsNullOrEmpty(search.FullName)) { queryFilter = queryFilter.And(p => p.FullName.Contains(search.FullName)); } if (search.ResidenseCountryId.HasValue) { queryFilter = queryFilter.And(p => p.ResidenseCountryId == search.ResidenseCountryId); } if (search.BudgetId.HasValue) { queryFilter = queryFilter.And(p => p.BudgetId == search.BudgetId); } if (search.ReferredById.HasValue) { queryFilter = queryFilter.And(p => p.ReferredById == search.ReferredById); } //TODO: City of Interest //TODO: Feature var rentalApplication = await _rentalApplicationSearchDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <RentalApplicationSearchDTO>() { Items = rentalApplication.Items, PageSize = rentalApplication.PageSize, Page = rentalApplication.Page, Total = rentalApplication.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <ContractSearchDTO> > > SearchContractAsync(ContractSearchRequest search) { List <OrderExpression <ContractSearchDTO> > orderExpressionList = new List <OrderExpression <ContractSearchDTO> >(); orderExpressionList.Add(new OrderExpression <ContractSearchDTO>(OrderType.Asc, p => p.ContractCode)); Expression <Func <ContractSearchDTO, bool> > queryFilter = c => true; if (search.BeginDate.HasValue && search.EndDate.HasValue) { var toPlusADay = search.EndDate.Value.AddDays(1); queryFilter = queryFilter.And(p => p.CreationDate.Value >= search.BeginDate); queryFilter = queryFilter.And(p => p.CreationDate.Value < toPlusADay); } else if (search.BeginDate.HasValue && !search.EndDate.HasValue) { queryFilter = queryFilter.And(p => p.CreationDate.Value >= search.BeginDate); } else if (!search.BeginDate.HasValue && search.EndDate.HasValue) { var toPlusADay = search.EndDate.Value.AddDays(1); queryFilter = queryFilter.And(p => p.CreationDate.Value < toPlusADay); } if (!string.IsNullOrEmpty(search.ContractCode)) { queryFilter = queryFilter.And(p => p.ContractCode.Contains(search.ContractCode)); } if (!string.IsNullOrEmpty(search.TenantFullName)) { queryFilter = queryFilter.And(p => p.TenantFullName.Contains(search.TenantFullName)); } if (search.NextDaysToCollect > 0 && search.NextDaysToCollect == 1) { queryFilter = queryFilter.And(p => p.NextDaysToCollect >= 0 && p.NextDaysToCollect <= 5); } if (search.NextDaysToCollect > 0 && search.NextDaysToCollect == 2) { queryFilter = queryFilter.And(p => p.NextDaysToCollect >= 6 && p.NextDaysToCollect <= 10); } if (search.NextDaysToCollect > 0 && search.NextDaysToCollect == 3) { queryFilter = queryFilter.And(p => p.NextDaysToCollect >= 11 && p.NextDaysToCollect <= 15); } if (search.ContractStatusId.HasValue) { queryFilter = queryFilter.And(p => p.ContractStatusId == search.ContractStatusId); } if (search.HouseId.HasValue) { queryFilter = queryFilter.And(p => p.HouseId == search.HouseId); } if (search.UnpaidPeriods == "Y") { queryFilter = queryFilter.And(p => p.UnpaidPeriods > 0); } if (search.UnpaidPeriods == "N") { queryFilter = queryFilter.And(p => p.UnpaidPeriods == 0); } if (search.PeriodId.HasValue) { queryFilter = queryFilter.And(p => p.PeriodId == search.PeriodId); } var contract = await _contractSearchDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <ContractSearchDTO>() { Items = contract.Items, PageSize = contract.PageSize, Page = contract.Page, Total = contract.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <DriverPayReportDTO> > > SearchDriverPayReportAsync(DriverPayReportSearchRequest search) { Expression <Func <DriverPayReportDTO, bool> > queryFilter = p => true; if (search.ReportDateFrom.HasValue && search.ReportDateTo.HasValue) { var toPlusADay = search.ReportDateTo.Value.AddDays(1); queryFilter = queryFilter.And(p => p.ReportDate.Value >= search.ReportDateFrom); queryFilter = queryFilter.And(p => p.ReportDate.Value < toPlusADay); } else if (search.ReportDateFrom.HasValue && !search.ReportDateTo.HasValue) { queryFilter = queryFilter.And(p => p.ReportDate.Value >= search.ReportDateFrom); } else if (!search.ReportDateFrom.HasValue && search.ReportDateTo.HasValue) { var toPlusADay = search.ReportDateTo.Value.AddDays(1); queryFilter = queryFilter.And(p => p.ReportDate.Value < toPlusADay); } if (search.DriverId > 0) { queryFilter = queryFilter.And(p => p.DriverUserId == search.DriverId); } if (search.DedicatedLocationId > 0) { queryFilter = queryFilter.And(p => p.DedicatedLocationId == search.DedicatedLocationId); } var report = await _serviceDriverReportDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize); ResponseDTO <List <UserResponse> > users = new ResponseDTO <List <UserResponse> >(); if (report.Items.Any()) { List <string> userList = report.Items.Select(q => q.Driver).ToList(); users = await SetUsersAdditionalInformation(userList); } var result = report.Items .GroupBy(u => new { u.Driver, u.DriverUserId, u.DedicatedLocationCode }) .Select(g => new DriverPayReportDTO { Driver = g.Key.Driver, DriverUserId = g.Key.DriverUserId, DedicatedLocationCode = g.Key.DedicatedLocationCode, DayPayDriverTotal = g.Sum(x => x.DayPayDriverTotal), } ).ToList(); foreach (var item in result) { Expression <Func <AmigoTenanttServiceLatestDTO, bool> > expressionLatestService = p => p.AmigoTenantTUserId == item.DriverUserId; var latestAmigoTenantTService = (await _serviceAmigoTenantTServiceLatestDataAccess.ListAsync(expressionLatestService)).FirstOrDefault(); if (latestAmigoTenantTService != null) { item.ChargeNo = latestAmigoTenantTService.ChargeNo; item.ChargeType = latestAmigoTenantTService.ChargeType; if (latestAmigoTenantTService.ServiceFinishDate != null) { item.ServiceStatusOffOnDesc = Constants.ServiceStatus.Dispatched; } else { item.ServiceStatusOffOnDesc = Constants.ServiceStatus.Offline; } } else { item.ServiceStatusOffOnDesc = Constants.ServiceStatus.Offline; } item.ServiceLatestInformation = string.Format("Current Location: {0}, Status: {1}, Dispatcher: {2}", item.CurrentLocationCode, item.ServiceStatusOffOnDesc, item.DispatcherCode); var user = users.Data.FirstOrDefault(q => q.UserName.ToLower() == item.Driver.ToLower()); if (user != null) { item.FirstName = user.FirstName; item.LastName = user.LastName; } } var pagedResult = new PagedList <DriverPayReportDTO>() { Items = result, PageSize = report.PageSize, Page = report.Page, Total = result.Count }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <ExpenseSearchDTO> > > SearchExpenseAsync(ExpenseSearchRequest search) { List <OrderExpression <ExpenseSearchDTO> > orderExpressionList = new List <OrderExpression <ExpenseSearchDTO> >(); orderExpressionList.Add(new OrderExpression <ExpenseSearchDTO>(OrderType.Asc, p => p.ExpenseDate)); Expression <Func <ExpenseSearchDTO, bool> > queryFilter = c => true; //APPLICATIONDATE if (search.ExpenseDateFrom.HasValue && search.ExpenseDateTo.HasValue) { var toPlusADay = search.ExpenseDateTo.Value.AddDays(1); queryFilter = queryFilter.And(p => p.ExpenseDate.Value >= search.ExpenseDateFrom); queryFilter = queryFilter.And(p => p.ExpenseDate.Value < toPlusADay); } else if (search.ExpenseDateFrom.HasValue && !search.ExpenseDateTo.HasValue) { queryFilter = queryFilter.And(p => p.ExpenseDate.Value >= search.ExpenseDateFrom); } else if (!search.ExpenseDateFrom.HasValue && search.ExpenseDateTo.HasValue) { var toPlusADay = search.ExpenseDateTo.Value.AddDays(1); queryFilter = queryFilter.And(p => p.ExpenseDate.Value < toPlusADay); } if (search.HouseTypeId.HasValue) { queryFilter = queryFilter.And(p => p.HouseTypeId == search.HouseTypeId); } if (search.PeriodId.HasValue) { queryFilter = queryFilter.And(p => p.PeriodId == search.PeriodId); } if (search.HouseId.HasValue) { queryFilter = queryFilter.And(p => p.HouseId == search.HouseId); } if (search.PaymentTypeId.HasValue) { queryFilter = queryFilter.And(p => p.PaymentTypeId == search.PaymentTypeId); } if (!string.IsNullOrEmpty(search.ReferenceNo)) { queryFilter = queryFilter.And(p => p.ReferenceNo == search.ReferenceNo); } if (search.ExpenseDetailStatusId.HasValue) { queryFilter = queryFilter.And(p => p.ExpenseDetailStatusId == search.ExpenseDetailStatusId); } if (search.ConceptId.HasValue) { queryFilter = queryFilter.And(p => p.ConceptId == search.ConceptId); } if (!string.IsNullOrEmpty(search.Remark)) { queryFilter = queryFilter.And(p => p.Remark == search.Remark); } var expense = await _expenseSearchDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <ExpenseSearchDTO>() { Items = expense.Items, PageSize = expense.PageSize, Page = expense.Page, Total = expense.Total }; return(ResponseBuilder.Correct(pagedResult)); }
public async Task <ResponseDTO <PagedList <PPSearchDTO> > > SearchPaymentPeriodAsync(PaymentPeriodSearchRequest search) { List <OrderExpression <PPSearchDTO> > orderExpressionList = new List <OrderExpression <PPSearchDTO> >(); orderExpressionList.Add(new OrderExpression <PPSearchDTO>(OrderType.Asc, p => p.PeriodCode)); orderExpressionList.Add(new OrderExpression <PPSearchDTO>(OrderType.Asc, p => p.TenantFullName)); Expression <Func <PPSearchDTO, bool> > queryFilter = c => true; if (search.PeriodId.HasValue) { queryFilter = queryFilter.And(p => p.PeriodId == search.PeriodId); } if (search.TenantId.HasValue) { queryFilter = queryFilter.And(p => p.TenantId == search.TenantId); } if (search.HouseId.HasValue) { queryFilter = queryFilter.And(p => p.HouseId == search.HouseId); } if (search.PaymentPeriodStatusId.HasValue) { queryFilter = queryFilter.And(p => p.PaymentPeriodStatusId == search.PaymentPeriodStatusId); } if (search.HasPendingFines.HasValue) { if (search.HasPendingFines.Value) { queryFilter = queryFilter.And(p => p.FinesPending > 0); } else { queryFilter = queryFilter.And(p => p.FinesPending == 0); } } if (search.HasPendingLateFee.HasValue) { if (search.HasPendingLateFee.Value) { queryFilter = queryFilter.And(p => p.LateFeesPending > 0); } else { queryFilter = queryFilter.And(p => p.LateFeesPending == 0); } } if (search.HasPendingServices.HasValue) { if (search.HasPendingServices.Value) { queryFilter = queryFilter.And(p => p.ServicesPending > 0); } else { queryFilter = queryFilter.And(p => p.ServicesPending == 0); } } if (search.HasPendingDeposit.HasValue) { if (search.HasPendingDeposit.Value) { queryFilter = queryFilter.And(p => p.DepositPending > 0); } else { queryFilter = queryFilter.And(p => p.DepositPending == 0); } } if (!string.IsNullOrEmpty(search.ContractCode)) { queryFilter = queryFilter.And(p => p.ContractCode.Contains(search.ContractCode)); } var paymentPeriod = await _paymentPeriodSearchDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize, orderExpressionList.ToArray()); var pagedResult = new PagedList <PPSearchDTO>() { Items = paymentPeriod.Items, PageSize = paymentPeriod.PageSize, Page = paymentPeriod.Page, Total = paymentPeriod.Total }; return(ResponseBuilder.Correct(pagedResult)); }