Exemple #1
0
        private async Task ValidateBaseVehicleLookupsHasNoChangeRequest(BaseVehicle baseVehicle)
        {
            //Make
            var ChangeRequestId = await ChangeRequestBusinessService.ChangeRequestExist(typeof(Make).Name,
                                                                                        baseVehicle.MakeId);

            if (ChangeRequestId > 0)
            {
                throw new ChangeRequestExistException(
                          $"There is already an open CR ID {ChangeRequestId} for Make ID : {baseVehicle.MakeId}.");
            }
            //Model
            var changerequestid = await ChangeRequestBusinessService.ChangeRequestExist(typeof(Model).Name,
                                                                                        baseVehicle.ModelId);

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException(
                          $"There is already an open CR ID {changerequestid} for Model ID : {baseVehicle.ModelId}.");
            }

            // year
            var changerequestID =
                await ChangeRequestBusinessService.ChangeRequestExist(typeof(Year).Name, baseVehicle.YearId);

            if (changerequestID > 0)
            {
                throw new ChangeRequestExistException(
                          $"There is already an open CR ID {changerequestID} for Year ID : {baseVehicle.YearId}.");
            }
        }
Exemple #2
0
        private async Task ValidateVehicleToWheelBaseHasNoChangeReqeuest(VehicleToWheelBase vehicleToWheelBase)
        {
            // 1. Validate that there is no vehicle to wheel base with same configuration
            IList <VehicleToWheelBase> vehicleToWheelBaseFromDb =
                await _vehicleToWheelBaseRepositoryService.GetAsync(x =>
                                                                    x.VehicleId.Equals(vehicleToWheelBase.VehicleId) &&
                                                                    x.WheelBaseId.Equals(vehicleToWheelBase.WheelBaseId) &&
                                                                    x.DeleteDate == null);

            if (vehicleToWheelBaseFromDb != null && vehicleToWheelBaseFromDb.Count > 0)
            {
                throw new RecordAlreadyExist("Vehicle to Wheel Base with same configuration already exists.");
            }

            // 2. Validate that there is no open CR with same configuration
            var changeRequestId = await
                                  ChangeRequestBusinessService.ChangeRequestExist <VehicleToWheelBase>(
                x => x.VehicleId.Equals(vehicleToWheelBase.VehicleId) &&
                x.WheelBaseId.Equals(vehicleToWheelBase.WheelBaseId));

            if (changeRequestId > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changeRequestId} with same vehicle to wheel base configuration.");
            }
        }
Exemple #3
0
        private async Task ValidateNoChangeRequestExistsWithSameConfiguration(BaseVehicle baseVehicle)
        {
            var changeRequestId =
                await ChangeRequestBusinessService.ChangeRequestExist <BaseVehicle>(
                    item => item.MakeId == baseVehicle.MakeId &&
                    item.ModelId == baseVehicle.ModelId &&
                    item.YearId == baseVehicle.YearId);

            if (changeRequestId > 0)

            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changeRequestId} for  vehicle using this Basevehicle.");
            }

            //await ChangeRequestBusinessService.ChangeRequestExist<VehicleToBrakeConfig>(item =>
            //    item.VehicleId.Equals(vehicle.Id))
            //if (await
            //    ChangeRequestBusinessService.ChangeRequestExist<BaseVehicle>(
            //        item => item.MakeId == baseVehicle.MakeId &&
            //                item.ModelId == baseVehicle.ModelId &&
            //                item.YearId == baseVehicle.YearId))
            //{
            //    throw new ChangeRequestExistException("There is already an open CR with same base vehicle configuration.");
            //}
        }
Exemple #4
0
        public override async Task <ChangeRequestStagingModel <BodyNumDoors> > GetChangeRequestStaging <TId>(TId changeRequestId)
        {
            ChangeRequestStagingModel <BodyNumDoors> staging =
                await ChangeRequestBusinessService.GetChangeRequestStagingByChangeRequestIdAsync <BodyNumDoors, TId>(changeRequestId);

            return(staging);
        }
Exemple #5
0
        private async Task ValidateVehicleToBrakeConfigHasNoChangeReqeuest(VehicleToBrakeConfig vehicleToBrakeConfig)
        {
            // 1. Validate that there is no vehicle to brake config with same configuration
            IList <VehicleToBrakeConfig> vehicleToBrakeConfigFromDb =
                await _vehicleToBrakeConfigRepositoryService.GetAsync(x => x.VehicleId.Equals(vehicleToBrakeConfig.VehicleId) &&
                                                                      x.BrakeConfigId.Equals(vehicleToBrakeConfig.BrakeConfigId) &&
                                                                      x.DeleteDate == null);

            if (vehicleToBrakeConfigFromDb != null && vehicleToBrakeConfigFromDb.Count > 0)
            {
                throw new RecordAlreadyExist("Vehicle to Brake Config with same configuration already exists.");
            }

            // 2. Validate that there is no open CR with same configuration

            var ChangeRequestId = await
                                  ChangeRequestBusinessService.ChangeRequestExist <VehicleToBrakeConfig>(
                x => x.VehicleId.Equals(vehicleToBrakeConfig.VehicleId) &&
                x.BrakeConfigId.Equals(vehicleToBrakeConfig.BrakeConfigId));

            if (ChangeRequestId > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID {ChangeRequestId} with same vehicle to brake configuration.");
            }
        }
Exemple #6
0
        private async Task ValidateBodyStyleConfigLookUpHasNoChangeRequest(BodyStyleConfig bodyStyleConfig)
        {
            // 3. Validate that there are no open CR for any of the items that make of configuration. Body Type and Body Number Door
            {
                // Body Number Door
                var changerequestid =
                    await
                    ChangeRequestBusinessService.ChangeRequestExist(typeof(BodyNumDoors).Name,
                                                                    bodyStyleConfig.BodyNumDoorsId);

                if (changerequestid > 0)
                {
                    throw new ChangeRequestExistException(
                              $"There is already an open CR ID {changerequestid} for Body Number Doors Length ID : {bodyStyleConfig.BodyNumDoorsId}.");
                }

                // Body Type
                var changerequestID = await ChangeRequestBusinessService.ChangeRequestExist(typeof(BodyType).Name, bodyStyleConfig.BodyTypeId);

                ;
                if (changerequestID > 0)
                {
                    throw new ChangeRequestExistException(
                              $"There is already an open CR ID {changerequestID} for Body Type ID : {bodyStyleConfig.BodyTypeId}.");
                }
            }
        }
Exemple #7
0
        private async Task ValidateDriveTypeHasNoChangeRequest(DriveType driveType, ChangeType changeType)
        {
            // validate no CR for this DriveType Id.
            if (changeType != ChangeType.Add)
            {
                var changerequestid =
                    (await ChangeRequestBusinessService.ChangeRequestExist <DriveType>(item => item.Id == driveType.Id));

                if (changerequestid > 0)
                {
                    throw new ChangeRequestExistException($"There is already an open CR ID {changerequestid} with DriveType ID : {driveType.Id}.");
                }
            }

            // validate no CR for this DriveType Name.
            var changerequestid1 =
                await
                ChangeRequestBusinessService.ChangeRequestExist <DriveType>(
                    x => x.Name.Trim().Equals(driveType.Name.Trim(), StringComparison.CurrentCultureIgnoreCase));

            if (changerequestid1 > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changerequestid1} with same DriveType Name : {driveType.Name}.");
            }
        }
Exemple #8
0
        private async Task ValidateFuelSystemDesignHasNoChangeRequest(FuelSystemDesign fuelSystemDesign, ChangeType changeType)
        {
            // validate no CR for this FuelSystemDesign Id.
            if (changeType != ChangeType.Add)
            {
                var changerequestid =
                    (await ChangeRequestBusinessService.ChangeRequestExist <FuelSystemDesign>(item => item.Id == fuelSystemDesign.Id));

                if (changerequestid > 0)
                {
                    throw new ChangeRequestExistException($"There is already an open CR ID {changerequestid} with FuelSystemDesign ID : {fuelSystemDesign.Id}.");
                }
            }

            // validate no CR for this FuelSystemDesign Name.
            var changerequestid1 =
                await
                ChangeRequestBusinessService.ChangeRequestExist <FuelSystemDesign>(
                    x => x.FuelSystemDesignName.Trim().Equals(fuelSystemDesign.FuelSystemDesignName.Trim(), StringComparison.CurrentCultureIgnoreCase));

            if (changerequestid1 > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changerequestid1} with same FuelSystemDesign Name : {fuelSystemDesign.FuelSystemDesignName}.");
            }
        }
Exemple #9
0
        private async Task ValidateVehicleHasNoChangeRequest(Vehicle entity)
        {
            // 1. Validate that there is no vehicle with same configuration
            IList <Vehicle> existingVehicle =
                await _vehicleRepositoryService.GetAsync(item => item.BaseVehicleId == entity.Id &&
                                                         item.SubModelId == entity.SubModelId &&
                                                         item.RegionId == entity.RegionId &&
                                                         item.DeleteDate == null);

            if (existingVehicle != null && existingVehicle.Any())
            {
                throw new RecordAlreadyExist("Vehicle with same configuration already exists");
            }

            // 2. Validate that there is no open CR with same configuration
            // vehicle
            var changerequestid = await
                                  ChangeRequestBusinessService.ChangeRequestExist <Vehicle>(
                x =>
                x.BaseVehicleId == entity.BaseVehicleId && x.SubModelId == entity.SubModelId &&
                x.RegionId == entity.RegionId);

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changerequestid} with same vehicle configuration.");
            }
        }
Exemple #10
0
        public override async Task <ChangeRequestStagingModel <Vehicle> > GetChangeRequestStaging <TId>(TId changeRequestId)
        {
            ChangeRequestStagingModel <Vehicle> staging = await
                                                          ChangeRequestBusinessService.GetChangeRequestStagingByChangeRequestIdAsync <Vehicle, TId>(changeRequestId);

            return(staging);
        }
Exemple #11
0
        private async Task ValidateBaseVehicleLookupsHasNoChangeRequest(BaseVehicle baseVehicle)
        {
            long changerequestid = 0;

            //make
            changerequestid =
                await ChangeRequestBusinessService.ChangeRequestExist(typeof(Make).Name, baseVehicle.MakeId);

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException(
                          $"There is already an open CR ID {changerequestid} for Make Name : {baseVehicle.Make.Name}.");
            }
            //Model
            changerequestid =
                await ChangeRequestBusinessService.ChangeRequestExist(typeof(Model).Name, baseVehicle.ModelId);

            if (changerequestid > 0)
            {
                {
                    throw new ChangeRequestExistException(
                              $"There is already an open CR ID {changerequestid} for Model Name: {baseVehicle.Model.Name}.");
                }
            }
        }
        private async Task ValidateBedConfigLookUpHasNoChangeRequest(BedConfig bedConfig)
        {
            // 3. Validate that there are no open CR for any of the items that make of configuration. Bed Type and Bed Length
            {
                // Bed length
                var changerequestid =
                    await
                    ChangeRequestBusinessService.ChangeRequestExist(typeof(BedLength).Name,
                                                                    bedConfig.BedLengthId);

                if (changerequestid > 0)
                {
                    throw new ChangeRequestExistException(
                              $"There is already an open CR ID {changerequestid} for Bed Length ID : {bedConfig.BedLengthId}.");
                }

                // Bed Type
                var changerequestID = await ChangeRequestBusinessService.ChangeRequestExist(typeof(BedType).Name, bedConfig.BedTypeId);

                ;
                if (changerequestID > 0)
                {
                    throw new ChangeRequestExistException(
                              $"There is already an open CR ID {changerequestID} for Bed Type ID : {bedConfig.BedTypeId}.");
                }
            }
        }
        private async Task ValidateBedConfigDependentHasNoChangeRequest(BedConfig bedConfig)
        {
            var changerequestid = await ChangeRequestBusinessService.ChangeRequestExist <VehicleToBedConfig>(x =>
                                                                                                             x.BedConfigId.Equals(bedConfig.Id));

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException("There is already an open CR ID " + changerequestid + " for Vehicle to Bed Configuration using this bed Config.");
            }
        }
Exemple #14
0
        private async Task ValidateVehicleTypeHasNoChangeRequest(Model model)
        {
            var changerequestid =
                await ChangeRequestBusinessService.ChangeRequestExist(typeof(VehicleType).Name, model.VehicleTypeId);

            if (changerequestid > 0)
            {
                throw new RecordAlreadyExist("Selected Vehicle Type exists in CR with CR ID " + changerequestid + ".");
            }
        }
Exemple #15
0
        private async Task ValidateRegionLookUpHasNoChangeRequest(Region region)
        {
            var changerequestid =
                await
                ChangeRequestBusinessService.ChangeRequestExist <Vehicle>(x => x.RegionId.Equals(region.Id));

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changerequestid} for Vehicle using this Region name.");
            }
        }
Exemple #16
0
        private async Task ValidateBodyNumDoorsLookUpHasNoChangeRequest(BodyNumDoors bodyNumDoors)
        {
            var changeRequestId =
                await ChangeRequestBusinessService.ChangeRequestExist <BodyStyleConfig>(x => x.BodyNumDoorsId.Equals(bodyNumDoors.Id));

            if (changeRequestId > 0)

            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changeRequestId} for Body Config using this BodyNumDoors.");
            }
        }
Exemple #17
0
        private async Task ValidateBrakeAbsLookUpHasNoChangeRequest(BrakeABS brakeAbs)
        {
            var changeRequestId =
                await ChangeRequestBusinessService.ChangeRequestExist <BrakeConfig>(x => x.BrakeABSId.Equals(brakeAbs.Id));

            if (changeRequestId > 0)

            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changeRequestId} for brake Config using this Brake ABS.");
            }
        }
Exemple #18
0
        private async Task ValidateBaseVehicleHasNoChangeRequest(Vehicle entity)
        {
            var changerequestid = await ChangeRequestBusinessService.ChangeRequestExist(typeof(BaseVehicle).Name,
                                                                                        entity.BaseVehicleId);

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException(
                          $"There is already an open CR ID {changerequestid} for Base Vehicle ID : {entity.BaseVehicleId}.");
            }
        }
Exemple #19
0
        private async Task ValidateModelLookUpHasNoChangeRequest(Model model)
        {
            var changeRequestId = await
                                  ChangeRequestBusinessService.ChangeRequestExist <BaseVehicle>(x => x.ModelId.Equals(model.Id));

            if (changeRequestId > 0)

            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changeRequestId} for base vehicle using this model.");
            }
        }
        private async Task ValidateWheelBaseDependentHasNoChangeRequest(WheelBase wheelBase)
        {
            // validate no open CR for vehicle to wheel base.
            var changerequestid = await ChangeRequestBusinessService.ChangeRequestExist <VehicleToWheelBase>(x =>
                                                                                                             x.WheelBaseId.Equals(wheelBase.Id));

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException("There is already an open CR ID " + changerequestid + " for Vehicle to Wheel Base using this wheel base.");
            }
        }
Exemple #21
0
        private async Task ValidateVehicleTypeLookUpHasNoChangeRequest(VehicleType vehicleType)
        {
            var changerequestid =
                await
                ChangeRequestBusinessService.ChangeRequestExist <Model>(x => x.VehicleTypeId.Equals(vehicleType.Id));

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changerequestid} for base Model using this Vehicle Type.");
            }
        }
        private async Task ValidateSubModelLookUpHasNoChangeRequest(SubModel subModel)
        {
            var changerequestid =
                await
                ChangeRequestBusinessService.ChangeRequestExist <Vehicle>(x => x.SubModelId.Equals(subModel.Id));

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR  ID {changerequestid} for Vehicle using this Sub Model.");
            }
        }
Exemple #23
0
        private async Task ValidateBrakeSystemLookUpHasNoChangeRequest(BrakeSystem brakeSystem)
        {
            var changerequestid =
                await
                ChangeRequestBusinessService.ChangeRequestExist <BrakeConfig>(
                    x => x.BrakeSystemId.Equals(brakeSystem.Id));

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID " + changerequestid + " for brake Config using this Brake System.");
            }
        }
Exemple #24
0
        private async Task ValidateFuelSystemDesignLookUpHasNoChangeRequest(FuelSystemDesign fuelSystemDesign)
        {
            // validate no CR for base vehicle using this FuelSystemDesign.
            var changerequestid =
                await
                ChangeRequestBusinessService.ChangeRequestExist <FuelDeliveryConfig>(x => x.FuelSystemDesignId == fuelSystemDesign.Id);

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changerequestid} for FuelDeliveryConfig using this FuelSystemDesign.");
            }
        }
Exemple #25
0
        private async Task ValidateMfrBodyCodeLookUpHasNoChangeRequest(MfrBodyCode mfrBodyCode)
        {
            // validate no CR for base vehicle using this MfrBodyCode.
            var changerequestid =
                await
                ChangeRequestBusinessService.ChangeRequestExist <VehicleToMfrBodyCode>(x => x.MfrBodyCode.Id == mfrBodyCode.Id);

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changerequestid} for Vehicle To Mfr Body Code using this MfrBodyCode.");
            }
        }
        private async Task ValidateBedTypeLookUpHasNoChangeRequest(BedType bedType)
        {
            var changerequestid =
                await
                ChangeRequestBusinessService.ChangeRequestExist <BedConfig>(
                    x => x.BedTypeId.Equals(bedType.Id));

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID " + changerequestid + " for bed Config using this Bed Type.");
            }
        }
Exemple #27
0
        private async Task ValidateEngineDesignationLookUpHasNoChangeRequest(EngineDesignation engineDesignation)
        {
            var changerequestid =
                await
                ChangeRequestBusinessService.ChangeRequestExist <EngineConfig>(
                    x => x.EngineDesignationId.Equals(engineDesignation.Id));

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID " + changerequestid + " for Engine Config using this Engine Designation.");
            }
        }
Exemple #28
0
        private async Task ValidateDriveTypeLookUpHasNoChangeRequest(DriveType driveType)
        {
            // validate no CR for base vehicle using this DriveType.
            var changerequestid =
                await
                ChangeRequestBusinessService.ChangeRequestExist <VehicleToDriveType>(x => x.DriveType.Id.Equals(driveType.Id));

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID {changerequestid} for Vehicle To DriveType using this DriveType.");
            }
        }
Exemple #29
0
        private async Task ValidateBrakeTypeLookUpHasNoChangeRequest(BrakeType brakeType)
        {
            var changerequestid =
                await
                ChangeRequestBusinessService.ChangeRequestExist <BrakeConfig>(
                    x => (x.FrontBrakeTypeId.Equals(brakeType.Id) || x.RearBrakeTypeId.Equals(brakeType.Id)));

            if (changerequestid > 0)
            {
                throw new ChangeRequestExistException($"There is already an open CR ID " + changerequestid + " for brake Config using this Brake Type.");
            }
        }
        private async Task ValidateNoChangeRequestExistsWithSameConfiguration(BedConfig bedConfig)
        {
            // 2. Validate that there is no open CR with same configuration
            var ChangeRequestID = await ChangeRequestBusinessService.ChangeRequestExist <BedConfig>(x =>
                                                                                                    x.BedTypeId.Equals(bedConfig.BedTypeId) &&
                                                                                                    x.BedLengthId.Equals(bedConfig.BedLengthId));

            if (ChangeRequestID > 0)
            {
                throw new ChangeRequestExistException("There is already an open CR ID " + ChangeRequestID + " with same bed configuration.");
            }
        }