Ejemplo n.º 1
0
        public async Task <ResponseDTO <List <PeriodDTO> > > GetPeriodAllAsync()
        {
            Expression <Func <PeriodDTO, bool> > queryFilter = c => true;
            var periods = await _periodDataAccess.ListAsync(queryFilter);

            return(ResponseBuilder.Correct(periods.ToList()));
        }
Ejemplo n.º 2
0
        public async Task <ResponseDTO <List <CostCenterDTO> > > SearchCostCenterAll()
        {
            Expression <Func <CostCenterDTO, bool> > queryFilter = c => true;

            var list = (await _costCenterDataAccess.ListAsync(queryFilter)).ToList();

            return(ResponseBuilder.Correct(list));
        }
        public async Task <ResponseDTO <List <AmigoTenantParameterDTO> > > GetAmigoTenantParameters()
        {
            Expression <Func <AmigoTenantParameterDTO, bool> > queryFilter = c => true;

            var list = (await _amigoTenantParameterDataAcces.ListAsync(queryFilter)).ToList();

            return(ResponseBuilder.Correct(list));
        }
        public async Task <ResponseDTO <List <ServiceHouseDTO> > > GetServicesHouseAllAsync()
        {
            Expression <Func <ServiceHouseDTO, bool> > masterQueryFilter = c => c.RowStatus;

            var list = (await _serviceHouseDataAccess.ListAsync(masterQueryFilter)).ToList();

            return(ResponseBuilder.Correct(list));
        }
        public async Task <ResponseDTO <List <ConceptDTO> > > GetConceptsByTypeIdAsync(int?typeId)
        {
            Expression <Func <ConceptDTO, bool> > queryFilter = c => c.RowStatus == true;

            queryFilter = queryFilter.And(p => p.TypeId == typeId);

            var concept = await _conceptDataAccess.ListAsync(queryFilter);

            return(ResponseBuilder.Correct(concept.ToList()));
        }
Ejemplo n.º 6
0
        public async Task <ResponseDTO <List <LocationDTO> > > SearchLocationAll()
        {
            Expression <Func <LocationDTO, bool> > queryFilter         = c => true;
            List <OrderExpression <LocationDTO> >  orderExpressionList = new List <OrderExpression <LocationDTO> >();

            orderExpressionList.Add(new OrderExpression <LocationDTO>(OrderType.Asc, p => p.Name));

            var list = (await _locationDataAccess.ListAsync(queryFilter, orderExpressionList.ToArray())).ToList();

            return(ResponseBuilder.Correct(list));
        }
Ejemplo n.º 7
0
        public async Task <ResponseDTO <ModuleActionsDTO> > GetModuleAsync(GetModuleRequest getRequest)
        {
            var moduleAux = await SearchModulesAsync(new ModuleSearchRequest { Code = getRequest.Code, Page = 1, PageSize = 1 });

            var module = moduleAux.Data.Items.FirstOrDefault();

            if (module != null)
            {
                var actions = await _actionDataAcces.ListAsync(w => w.ModuleCode == module.Code);

                var moduleActions = new ModuleActionsDTO
                {
                    Code             = module.Code,
                    Name             = module.Name,
                    Url              = module.Url,
                    SortOrder        = module.SortOrder,
                    ParentModuleCode = module.ParentModuleCode,
                    Actions          = actions.ToList()
                };

                if (moduleActions.Actions != null)
                {
                    moduleActions.Actions.ForEach(p => p.TableStatus = DTOs.Requests.Common.ObjectStatus.Unchanged);
                }

                return(ResponseBuilder.Correct(moduleActions));
            }
            else
            {
                ModuleActionsDTO obj = null;
                return(ResponseBuilder.Correct(obj));
            }
        }
        public async Task <ResponseDTO <List <HouseFeatureAndDetailDTO> > > SearchHouseFeatureAndDetailAsync(int?houseId, int?contractId)
        {
            List <OrderExpression <HouseFeatureAndDetailDTO> > orderExpressionList = new List <OrderExpression <HouseFeatureAndDetailDTO> >();

            orderExpressionList.Add(new OrderExpression <HouseFeatureAndDetailDTO>(OrderType.Desc, p => p.IsAllHouse));
            orderExpressionList.Add(new OrderExpression <HouseFeatureAndDetailDTO>(OrderType.Asc, p => p.Sequence));
            Expression <Func <HouseFeatureAndDetailDTO, bool> > queryFilter = c => c.HouseId == houseId;
            var list = (await _houseFeatureAndDetailDataAccess.ListAsync(queryFilter, orderExpressionList.ToArray())).ToList();

            list.ForEach(r =>
            {
                r.IsDisabled = r.ContractId.HasValue && contractId != r.ContractId;
            });


            Expression <Func <HouseFeatureDetailContractDTO, bool> > queryFilterDetailContract = c => c.HouseId == houseId;
            var listDetailContract = await _houseFeatureDetailContractDataAccess.ListAsync(queryFilterDetailContract);



            //Deshabilitar Complete "IsAllHouse" porque ha sido alquilada por partes
            var existDisable = list.Any(r => r.IsDisabled.Value);

            if (existDisable)
            {
                list.Where(r => r.IsAllHouse.Value).ToList().ForEach(r => r.IsDisabled = true);
            }

            return(ResponseBuilder.Correct(list));
        }
        public async Task <ResponseDTO <List <HouseDTO> > > SearchHouseAll()
        {
            Expression <Func <HouseDTO, bool> > queryFilter = c => c.RowStatus;
            var list = (await _houseDataAccess.ListAsync(queryFilter)).ToList();

            return(ResponseBuilder.Correct(list));
        }
Ejemplo n.º 10
0
        public async Task <ResponseDTO <List <ParentLocationDTO> > > GetParentLocationsAsync()
        {
            var parentLocations = await _parentLocationDataAccess.ListAsync(null);

            var result = parentLocations.ToList();

            return(ResponseBuilder.Correct(result));
        }
        public async Task <ResponseDTO <List <ModelDTO> > > GetModelsAsync()
        {
            var models = await _modelDataAccess.ListAsync(null);

            var result = models.ToList();

            return(ResponseBuilder.Correct(result));
        }
        public async Task <ResponseDTO <List <HouseBasicDTO> > > SearchForTypeAhead(string search)
        {
            Expression <Func <HouseBasicDTO, bool> > queryFilter = c => c.Name.Contains(search);

            var list = (await _houseBasicDataAccess.ListAsync(queryFilter)).ToList();

            return(ResponseBuilder.Correct(list));
        }
Ejemplo n.º 13
0
        public async Task <ResponseDTO <List <LocationTypeDTO> > > GetLocationTypesAsync()
        {
            var locationTypes = await _locationTypeDataAccess.ListAsync(null);

            var result = locationTypes.ToList();

            return(ResponseBuilder.Correct(result));
        }
        public async Task <ResponseDTO <List <HouseFeatureDetailContractDTO> > > SearchHouseFeatureDetailContractAsync(int?houseId)
        {
            Expression <Func <HouseFeatureDetailContractDTO, bool> > queryFilter = c => c.HouseId == houseId;

            var contract = await _houseFeatureDetailContractDataAccess.ListAsync(queryFilter);

            return(ResponseBuilder.Correct(contract.ToList()));
        }
        public async Task <ResponseDTO <List <EquipmentStatusDTO> > > SearchEquipmentStatusAll()
        {
            Expression <Func <EquipmentStatusDTO, bool> > queryFilter = c => true;

            var list = (await _statusDataAcces.ListAsync(queryFilter)).ToList();

            return(ResponseBuilder.Correct(list));
        }
        public async Task <ResponseDTO <List <AppVersionDTO> > > GetAppVersionsAsync()
        {
            var appVersions = await _appVersionDataAccess.ListAsync(null);

            var result = appVersions.ToList();

            return(ResponseBuilder.Correct(result));
        }
        public async Task <ResponseDTO <List <ServiceDTO> > > GetServiceAll()
        {
            Expression <Func <ServiceDTO, bool> > queryFilter = c => true;

            var list = (await _serviceDataAcces.ListAsync(queryFilter)).ToList();

            return(ResponseBuilder.Correct(list));
        }
        public async Task <ResponseDTO <List <HouseFeatureDTO> > > GetFeaturesByHouseAsync(int houseId)
        {
            Expression <Func <HouseFeatureDTO, bool> > queryFilter = c => c.RowStatus == true && c.HouseId == houseId;

            var list = (await _houseFeatureHouseDataAccess.ListAsync(queryFilter)).ToList();

            return(ResponseBuilder.Correct(list));
        }
        public async Task <ResponseDTO <List <HouseTypeDTO> > > GetHouseTypesAsync()
        {
            var houseTypes = await _houseTypeDataAccess.ListAsync(null);

            var result = houseTypes.ToList();

            return(ResponseBuilder.Correct(result));
        }
Ejemplo n.º 20
0
        public async Task <ResponseDTO <List <CityDTO> > > GetCitiesAsync()
        {
            var cities = await _cityDataAccess.ListAsync(null);

            var result = cities.ToList();

            return(ResponseBuilder.Correct(result));
        }
Ejemplo n.º 21
0
        public async Task <ResponseDTO <List <DispatchingPartyDTO> > > GetAllAsync()
        {
            Expression <Func <DispatchingPartyDTO, bool> > queryFilter = c => c.RowStatus;

            var list = (await _DispatchingPartyDataAccess.ListAsync(queryFilter)).ToList();

            return(ResponseBuilder.Correct(list));
        }
        public async Task <ResponseDTO <List <HouseServiceDTO> > > GetHouseServiceByHouseAsync(int houseId)
        {
            Expression <Func <HouseServiceDTO, bool> > queryFilter = c => c.HouseId == houseId;
            var houseServices = (await _houseServiceDataAccess.ListAsync(queryFilter)).ToList();

            var list = GroupByHouseService(houseServices);

            return(ResponseBuilder.Correct(list));
        }
Ejemplo n.º 23
0
        public async Task <ResponseDTO <List <PPHeaderSearchByInvoiceDTO> > > SearchInvoiceByIdAsync(string invoiceNo)
        {
            Expression <Func <PPHeaderSearchByInvoiceDTO, bool> > queryFilter = c => true;

            queryFilter = queryFilter.And(p => p.InvoiceNo == invoiceNo);
            var paymentsPeriod = await _paymentPeriodSearchByInvoiceDataAccess.ListAsync(queryFilter);

            return(ResponseBuilder.Correct(paymentsPeriod.ToList()));
        }
Ejemplo n.º 24
0
        public async Task <ResponseDTO <LocationWithCoordinatesDTO> > GetLocationAsync(GetLocationRequest getRequest)
        {
            var locationAux = await SearchLocationAsync(new LocationSearchRequest { Code = getRequest.Code, Page = 1, PageSize = 1 });

            var location = locationAux.Data.Items.FirstOrDefault();

            if (location != null)
            {
                var coordinates = await _locationCoordinatesDataAccess.ListAsync(w => w.LocationCode == location.Code);

                var locationWithCoordinates = new LocationWithCoordinatesDTO
                {
                    LocationId         = location.LocationId,
                    Name               = location.Name,
                    Code               = location.Code,
                    ZipCode            = location.ZipCode,
                    CreationDate       = location.CreationDate,
                    HasGeofence        = location.HasGeofence,
                    CountryISOCode     = location.CountryISOCode,
                    CountryName        = location.CountryName,
                    StateCode          = location.StateCode,
                    StateName          = location.StateName,
                    CityCode           = location.CityCode,
                    CityName           = location.CityName,
                    LocationTypeCode   = location.LocationTypeCode,
                    Latitude           = location.Latitude,
                    Longitude          = location.Longitude,
                    Address1           = location.Address1,
                    Address2           = location.Address2,
                    ParentLocationCode = location.ParentLocationCode,
                    ParentLocationName = location.ParentLocationName,
                    LocationTypeName   = location.LocationTypeName,
                    Coordinates        = coordinates.ToList()
                };

                return(ResponseBuilder.Correct(locationWithCoordinates));
            }
            else
            {
                LocationWithCoordinatesDTO obj = null;
                return(ResponseBuilder.Correct(obj));
            }
        }
Ejemplo n.º 25
0
        public async Task GetAppVersions_Call()
        {
            //--------------    Arrange     -------------
            CommonArrangements();

            //--------------    Act     -------------
            var resp = await deviceService.GetAppVersionsAsync();

            //--------------    Assert     -------------

            A.CallTo(() => appVersionDataAccess.ListAsync(null, null, null)).WithAnyArguments().MustHaveHappened();
        }
Ejemplo n.º 26
0
        public async Task <ResponseDTO <List <CountryDTO> > > GetCountrieAll()
        {
            List <OrderExpression <CountryDTO> > orderExpressionList = new List <OrderExpression <CountryDTO> >();

            orderExpressionList.Add(new OrderExpression <CountryDTO>(OrderType.Asc, p => p.Name));

            Expression <Func <CountryDTO, bool> > queryFilter = c => true;

            var countries = await _countryDataAccess.ListAsync(queryFilter, orderExpressionList.ToArray());

            return(ResponseBuilder.Correct(countries.ToList()));
        }
        public async Task GetLocationTypes_Call()
        {
            //--------------    Arrange     -------------
            CommonArrangements();

            //--------------    Act     -------------
            var resp = await locationService.GetLocationTypesAsync();

            //--------------    Assert     -------------

            A.CallTo(() => locationTypeDataAccess.ListAsync(null, null, null)).WithAnyArguments().MustHaveHappened();
        }
        public async Task <ResponseDTO <List <UtilityBillDTO> > > GetHouseServices(int houseId, int year)
        {
            Expression <Func <UtilityHouseServicePeriodDTO, bool> > queryFilter =
                c => c.RowStatus == true &&
                c.HouseId == houseId &&
                c.PeriodCode.StartsWith(year.ToString());

            var servicePeriods = (await _houseServiceDataAccess.ListAsync(queryFilter)).ToList();

            var list = GroupByHouseService(servicePeriods);

            return(ResponseBuilder.Correct(list));
        }
        public async Task <ResponseDTO <List <ModuleTreeDTO> > > GetRoleTree(string roleCode)
        {
            // ModuleTreeDTO
            var role        = (await _rolDataAccess.FirstOrDefaultAsync(x => x.Code == roleCode && x.RowStatus));
            var permissions = (await _permissionDataAccess.ListAsync(x => x.AmigoTenantTRoleId == role.AmigoTenantTRoleId)).Select(x => x.ActionCode).ToList();

            var modules = (await _moduleDataAcces.ListAllAsync()).ToList();
            var actions = (await _actionDataAcces.ListAllAsync()).ToList();

            var tree = GetModulesForParent(null, modules, actions, permissions);

            return(ResponseBuilder.Correct(tree));
        }
        public async Task <ResponseDTO <List <GeneralTableDTO> > > GetGeneralTableByTableNameAsync(string tableName)
        {
            Expression <Func <GeneralTableDTO, bool> > queryFilter = c => true;

            if (!string.IsNullOrEmpty(tableName))
            {
                queryFilter = queryFilter.And(p => p.TableName == tableName);
            }

            var generalTable = await _generalTableDataAccess.ListAsync(queryFilter);

            return(ResponseBuilder.Correct(generalTable.ToList()));
        }