Exemplo n.º 1
0
 //Clear All items, comboboxes, checkboxes etc...
 private void ClearListButton_Click(object sender, RoutedEventArgs e)
 {
     rtb.Document.Blocks.Clear();
     CarPrice.Clear();
     InsurancePrice.Clear();
     Brand.Clear();
     Type.Clear();
     SenderName.SelectedIndex          = 0;
     AssistanceType.SelectedIndex      = 0;
     AdreserType.SelectedIndex         = 0;
     GlassPrice.SelectedIndex          = 0;
     NnwPrice.SelectedIndex            = 0;
     ValType.SelectedIndex             = 0;
     AcDisc.SelectedIndex              = 0;
     OwnCont.SelectedIndex             = 0;
     GrNet.SelectedIndex               = 0;
     OcComboBox.SelectedIndex          = 0;
     ConstInsuranceValue.SelectedIndex = 0;
     OcCheckBox.IsChecked              = false;
     AcCheckBox.IsChecked              = false;
     NnwCheckBox.IsChecked             = false;
     GlassCheckBox.IsChecked           = false;
     AssCheckBox.IsChecked             = false;
     AtHomeLimit.IsChecked             = false;
     KmLimit.IsChecked     = false;
     BorderRange.IsChecked = false;
     InsuranceCompany      = "";
     Recpient                = "";
     CarBrand                = "";
     CarType                 = "";
     DiscountOC              = "";
     CarPriceAC              = "";
     GrossNetAC              = "";
     OwnContributionAC       = "";
     DiscountAC              = "";
     ValuationTypeAC         = "";
     NnwTypes                = "";
     AssistanceRange         = "";
     CarGlass                = "";
     InsurancePriceEnd       = "";
     Sender                  = "";
     AssistanceTypeCompany   = "";
     InsuranceChange         = "";
     FirstPartOfMail         = "";
     SecondPartOfMail        = "";
     ThirdPartOfMail         = "";
     FourthPartOfMail        = "";
     FourthAndHalfPartOFMail = "";
     FifthPartOfMail         = "";
     SixthPartOfMail         = "";
     SeventhPartOfMail       = "";
     EightPartOfMail         = "";
     AtHomeLimitation        = "";
     KmLimitation            = "";
     BorderRangePl           = "";
     id = 0;
 }
Exemplo n.º 2
0
 public static CarPriceDto ConvertModelDto(this CarPrice source)
 {
     return(new CarPriceDto()
     {
         id = source.id,
         companyId = source.companyId,
         price = source.price
     });
 }
        public CarPrice GetPrice(CarPricingForm form)
        {
            var key = $"{form.Make}-{form.Model}-{form.Year}";

            if (_bucket.Exists(key))
            {
                return(_bucket.Get <CarPrice>(key).Value);
            }

            Thread.Sleep(5000);
            var result = CarPrice.Generate();

            _bucket.Upsert(new Document <CarPrice>
            {
                Id      = key,
                Content = result,
                Expiry  = 60 * 1000   // 60 seconds
            });

            return(result);
        }
Exemplo n.º 4
0
        public CarPrice GetPrice(CarPricingForm form)
        {
            var key = $"{form.Make}-{form.Model}-{form.Year}";

            var cachedValue = _cache.Get <CarPrice>(key);

            if (cachedValue != null)
            {
                return(cachedValue);
            }

            Thread.Sleep(5000);
            var result = CarPrice.Generate();

            _cache.Set(key, result,
                       new DistributedCacheEntryOptions {
                SlidingExpiration = TimeSpan.FromSeconds(60)
            });

            return(result);
        }
        public async Task <List <CarPrice> > SearchCars(CarSearchRequest searchRequest, Supplier supplier)
        {
            var factory = new SupplierCarSearchFactory();
            var supplierSearchService = factory.GetSupplierCarSearchService(supplier.Id);
            var supplierCarPrice      = await supplierSearchService.SearchCars(searchRequest);

            var mappedResult = new List <CarPrice>();

            foreach (var sc in supplierCarPrice)
            {
                // do some mapping here to identify the car between supplier car and local car
                // Apply commission policy here, now just multiple 10% as an example
                var carPrice = new CarPrice()
                {
                    Car = new Car
                    {
                        Id       = new Random().Next(1, 100),
                        Name     = sc.SupplierCar.Name,
                        ImageUrl = sc.SupplierCar.ImageUrl
                    },
                    Price       = sc.SupplierBasePrice + (sc.SupplierBasePrice * 0.1M),
                    PriceRateId = Guid.NewGuid()

                                  //Supplier = supplier,
                                  //BookingDetail = new BookingRequestDetail {
                                  //    PickupDate = searchRequest.PickupDate,
                                  //    ReturnDate = searchRequest.ReturnDate,
                                  //    PickupLocation = new Location { Name = searchRequest.PickupLocation },
                                  //    ReturnLocation = new Location { Name = searchRequest.ReturnLocation }
                                  //}
                };

                mappedResult.Add(carPrice);
            }
            return(mappedResult);
        }
 public CarPrice GetPrice(CarPricingForm form)
 {
     Thread.Sleep(5000);
     return(CarPrice.Generate());
 }