Beispiel #1
0
 public Bicycle(string manufacturer, string model, double weight, string frameMaterial, BrakeType brakes = BrakeType.VBrake)
 {
     this.manufacturer  = manufacturer;
     this.model         = model;
     this.weight        = weight;
     this.frameMaterial = frameMaterial;
     this.brakes        = brakes;
 }
Beispiel #2
0
 public Bicycle(int gearsNum, int wheelsDiameter, BrakeType brakeType,
                string name, int wheelsNum, double price) : base(name, wheelsNum, price)
 {
     this.GearsNum       = gearsNum;
     this.WheelsDiameter = wheelsDiameter;
     this.brakeType      = brakeType;
     this.Category       = TCategories.Bicycle;
 }
Beispiel #3
0
 public CarClass(CarClassEnum carClassEnum, String[] pCarsClassNames, int[] raceroomClassIds, BrakeType brakeType, TyreType defaultTyreType, float maxSafeWaterTemp,
                 float maxSafeOilTemp)
 {
     this.carClassEnum         = carClassEnum;
     this.pCarsClassNames      = pCarsClassNames;
     this.raceroomClassIds     = raceroomClassIds;
     this.brakeType            = brakeType;
     this.defaultTyreType      = defaultTyreType;
     this.maxSafeOilTemp       = maxSafeOilTemp;
     this.maxSafeWaterTemp     = maxSafeWaterTemp;
     this.minTyreCircumference = carMinTyreCircumference;
     this.maxTyreCircumference = carMaxTyreCircumference;
 }
        public async Task <IHttpActionResult> Post(int id, BrakeTypeInputModel model)
        {
            BrakeType brakeType = new BrakeType()
            {
                Id = model.Id, Name = model.Name
            };
            CommentsStagingModel comment = new CommentsStagingModel()
            {
                Comment = model.Comment
            };
            var attachments     = SetUpAttachmentsModels(model.Attachments);
            var changeRequestId = await _brakeTypeApplicationService.DeleteAsync(brakeType, id, CurrentUser.Email, comment, attachments);

            return(Ok(changeRequestId));
        }
Beispiel #5
0
        private static string getBrakeType(BrakeType hamulec)
        {
            switch (hamulec)
            {
            case BrakeType.VBrake:
                return("V-Brake");

            case BrakeType.MechanicalDisk:
                return("Disk, Mechanical");

            case BrakeType.HydraulicDisc:
                return("Disc, Hydraulic");

            default:
                return("");
            }
        }
        public async Task <IHttpActionResult> Put(int id, BrakeTypeInputModel brakeTypeInputModel)
        {
            BrakeType brakeType = new BrakeType()
            {
                Id   = brakeTypeInputModel.Id,
                Name = brakeTypeInputModel.Name,
                FrontBrakeConfigCount     = brakeTypeInputModel.FrontBrakeConfigCount,
                RearBrakeConfigCount      = brakeTypeInputModel.RearBrakeConfigCount,
                VehicleToBrakeConfigCount = brakeTypeInputModel.VehicleToBrakeConfigCount
            };
            CommentsStagingModel comment = new CommentsStagingModel()
            {
                Comment = brakeTypeInputModel.Comment
            };
            var attachments     = SetUpAttachmentsModels(brakeTypeInputModel.Attachments);
            var changeRequestId = await _brakeTypeApplicationService.UpdateAsync(brakeType, brakeType.Id, CurrentUser.Email, comment, attachments);

            return(Ok(changeRequestId));
        }
Beispiel #7
0
 public CarClass(CarClassEnum carClassEnum, String[] pCarsClassNames, int[] raceroomClassIds, BrakeType brakeType, TyreType defaultTyreType, float maxSafeWaterTemp,
    float maxSafeOilTemp)
 {
     this.carClassEnum = carClassEnum;
     this.pCarsClassNames = pCarsClassNames;
     this.raceroomClassIds = raceroomClassIds;
     this.brakeType = brakeType;
     this.defaultTyreType = defaultTyreType;
     this.maxSafeOilTemp = maxSafeOilTemp;
     this.maxSafeWaterTemp = maxSafeWaterTemp;
     this.minTyreCircumference = carMinTyreCircumference;
     this.maxTyreCircumference = carMaxTyreCircumference;
 }
Beispiel #8
0
        private async Task UpdateVehicleToBrakeConfigDocuments(BrakeType updatedBrakeType)
        {
            bool isEndReached = false;
            int  pageNumber   = 1;

            do
            {
                // get front brake type result
                var vehicleToBrakeConfigSearchResultFront =
                    await
                    _vehicletoBrakeConfigSearchService.SearchAsync(null,
                                                                   $"frontBrakeTypeId eq {updatedBrakeType.Id}", new SearchOptions()
                {
                    RecordCount = 1000, PageNumber = pageNumber
                });

                var existingVehicleToBrakeConfigDocumentsFront = vehicleToBrakeConfigSearchResultFront.Documents;

                if (existingVehicleToBrakeConfigDocumentsFront != null &&
                    existingVehicleToBrakeConfigDocumentsFront.Any())
                {
                    foreach (
                        var existingVehicleToBrakeConfigDocument in
                        existingVehicleToBrakeConfigDocumentsFront)
                    {
                        existingVehicleToBrakeConfigDocument.FrontBrakeTypeName = updatedBrakeType.Name;
                    }

                    await
                    this._vehicleToBrakeConfigIndexingService.UploadDocumentsAsync(
                        existingVehicleToBrakeConfigDocumentsFront.ToList());

                    pageNumber++;
                }
                else
                {
                    isEndReached = true;
                }
            } while (!isEndReached);

            // get rear brake type result
            isEndReached = false;
            pageNumber   = 1;
            do
            {
                var vehicleToBrakeConfigSearchResultRear =
                    await
                    _vehicletoBrakeConfigSearchService.SearchAsync(null,
                                                                   $"rearBrakeTypeId eq {updatedBrakeType.Id}", new SearchOptions()
                {
                    RecordCount = 1000, PageNumber = pageNumber
                });

                var existingVehicleToBrakeConfigDocumentsRear = vehicleToBrakeConfigSearchResultRear.Documents;

                if (existingVehicleToBrakeConfigDocumentsRear != null &&
                    existingVehicleToBrakeConfigDocumentsRear.Any())
                {
                    foreach (
                        var existingVehicleToBrakeConfigDocument in
                        existingVehicleToBrakeConfigDocumentsRear)
                    {
                        existingVehicleToBrakeConfigDocument.RearBrakeTypeName = updatedBrakeType.Name;
                    }

                    await
                    this._vehicleToBrakeConfigIndexingService.UploadDocumentsAsync(
                        existingVehicleToBrakeConfigDocumentsRear.ToList());

                    pageNumber++;
                }
                else
                {
                    isEndReached = true;
                }
            } while (!isEndReached);
        }
Beispiel #9
0
        public override async Task <long> SubmitAddChangeRequestAsync(BrakeConfig entity, string requestedBy,
                                                                      List <ChangeRequestItemStaging> changeRequestItemStagings = null, CommentsStagingModel comment = null,
                                                                      List <AttachmentsModel> attachmentsStagingModels          = null, string changeContent = null)
        {
            if (entity.BrakeSystemId.Equals(default(int)) ||
                entity.BrakeABSId.Equals(default(int)) ||
                entity.FrontBrakeTypeId.Equals(default(int)) ||
                entity.RearBrakeTypeId.Equals(default(int)))
            {
                throw new ArgumentException(nameof(entity));
            }

            changeRequestItemStagings = new List <ChangeRequestItemStaging>();
            // Validation check for insert of new brake config

            await ValidateConfigurationDoesNotMatchWithExistingBrakeConfig(entity);
            await ValidateNoChangeRequestExistsWithSameConfiguration(entity);
            await ValidateBrakeConfigLookUpHasNoChangeRequest(entity);


            changeRequestItemStagings.Add(new ChangeRequestItemStaging()
            {
                ChangeType      = ChangeType.Add,
                EntityId        = entity.Id.ToString(),
                CreatedDateTime = DateTime.UtcNow,
                Entity          = typeof(BrakeConfig).Name,
                Payload         = base.Serializer.Serialize(entity)
            });

            var brakeTypeRepositoryService   = Repositories.GetRepositoryService <BrakeType>() as IVcdbSqlServerEfRepositoryService <BrakeType>;
            var brakeAbsRepositoryService    = Repositories.GetRepositoryService <BrakeABS>() as IVcdbSqlServerEfRepositoryService <BrakeABS>;
            var brakeSystemRepositoryService = Repositories.GetRepositoryService <BrakeSystem>() as IVcdbSqlServerEfRepositoryService <BrakeSystem>;

            BrakeType   frontBrakeType = null;
            BrakeType   rearBrakeType  = null;
            BrakeABS    brakeAbs       = null;
            BrakeSystem brakeSystem    = null;

            if (brakeTypeRepositoryService != null && brakeAbsRepositoryService != null && brakeSystemRepositoryService != null)
            {
                var frontBrakeTypes = await brakeTypeRepositoryService.GetAsync(m => m.Id == entity.FrontBrakeTypeId && m.DeleteDate == null, 1);

                if (frontBrakeTypes != null && frontBrakeTypes.Any())
                {
                    frontBrakeType = frontBrakeTypes.First();
                }
                var rearBrakeTypes = await brakeTypeRepositoryService.GetAsync(m => m.Id == entity.RearBrakeTypeId && m.DeleteDate == null, 1);

                if (rearBrakeTypes != null && rearBrakeTypes.Any())
                {
                    rearBrakeType = rearBrakeTypes.First();
                }
                var brakeAbses = await brakeAbsRepositoryService.GetAsync(m => m.Id == entity.BrakeABSId && m.DeleteDate == null, 1);

                if (brakeAbses != null && brakeAbses.Any())
                {
                    brakeAbs = brakeAbses.First();
                }
                var brakeSystems = await brakeSystemRepositoryService.GetAsync(m => m.Id == entity.BrakeSystemId && m.DeleteDate == null, 1);

                if (brakeSystems != null && brakeSystems.Any())
                {
                    brakeSystem = brakeSystems.First();
                }

                changeContent = string.Format("{0} / {1} / {2} / {3}", frontBrakeType.Name, rearBrakeType.Name, brakeAbs.Name, brakeSystem.Name);
            }

            // NOTE: change-request-comments-staging perfomed on base

            return(await base.SubmitAddChangeRequestAsync(entity, requestedBy, changeRequestItemStagings, comment, attachmentsStagingModels, changeContent));
        }
Beispiel #10
0
 public void AddBrakes(BrakeType type)
 {
     BrakeType = type;
 }