public PaymentPage() { InitializeComponent(); //this.BackgroundColor = Color.FromRgb(0, 200, 255); this.BackgroundColor = Color.White; paymentLabel.FontFamily = Device.RuntimePlatform == Device.iOS ? "Cabin-Bold" : "Cabin-Bold.ttf#Cabin-Bold"; if (Device.RuntimePlatform == Device.Android) { NavigationPage.SetHasBackButton(this, false); } ExceptionModel.ExceptionModelInstance = new ExceptionModel(); pricingManager = new PricingManager(); manager = new BookingsManager(); emailService = new EmailService(); var viewModel = new PaymentPageViewModel(new StripeRepository(), new APIRepository()); this.BindingContext = viewModel; }
public void GetsPriceOnInstantiation() { //Arrange PricingManager manager = new PricingManager(1.00); //Act Terminal terminal = new Terminal(manager); //Assert Assert.AreEqual(1.0, terminal.FuelPrice); }
public void GetsPriceOnInstantiation() { //Arrange PricingManager manager = new PricingManager(1.00); //Act FuelPriceDisplay display = new FuelPriceDisplay(manager); //Assert Assert.AreEqual(1.0, display.FuelPrice); }
public CartController(CartManager cartManager, CommerceUserContext commerceUserContext, CartCacheHelper cartCacheHelper, PricingManager pricingManager, CurrencyManager currencyManager, StorefrontContext storefrontContext) { Assert.ArgumentNotNull(cartManager, nameof(cartManager)); CartManager = cartManager; CommerceUserContext = commerceUserContext; CartCacheHelper = cartCacheHelper; PricingManager = pricingManager; CurrencyManager = currencyManager; StorefrontContext = storefrontContext; }
public void AddObserverAddsObserver() { //Arrange PricingManager manager = new PricingManager(); FuelPriceDisplay display = new FuelPriceDisplay(manager); //Act manager.AddObserver(display); //Assert Assert.AreEqual(1, manager.Observers.Count); }
public void GetsNotifiedonFuelPriceChange() { //Arrange PricingManager manager = new PricingManager(); Terminal terminal = new Terminal(manager); manager.AddObserver(terminal); //Act manager.UpdateFuelPrice(1.78); //Assert Assert.AreEqual(1.78, terminal.FuelPrice); }
public void GetsNotifiedonFuelPriceChange() { //Arrange PricingManager manager = new PricingManager(); FuelPriceDisplay display = new FuelPriceDisplay(manager); manager.AddObserver(display); //Act manager.UpdateFuelPrice(1.78); //Assert Assert.AreEqual(1.78, display.FuelPrice); }
public PricingManagerTests() { var connectServiceProvider = Substitute.For <IConnectServiceProvider>(); this.pricingServiceProvider = Substitute.For <PricingServiceProvider>(); this.logService = Substitute.For <ILogService <CommonLog> >(); connectServiceProvider.GetPricingServiceProvider().Returns(this.pricingServiceProvider); this.fixture = new Fixture(); this.pricingManager = Substitute.For <PricingManager>(connectServiceProvider, this.logService); }
public void RemoveObserverRemovesObserver() { //Arrange PricingManager manager = new PricingManager(); FuelPriceDisplay display = new FuelPriceDisplay(manager); Terminal terminal = new Terminal(manager); //Act manager.AddObserver(display); manager.AddObserver(terminal); manager.RemoveObserver(display); //Assert Assert.AreEqual(1, manager.Observers.Count); }
public JsonResult SwitchCurrency(string currency) { try { if (!string.IsNullOrWhiteSpace(currency)) { PricingManager.CurrencyChosenPageEvent(CurrencyManager.CurrencyContext.CurrencyCode); CartManager.UpdateCartCurrency(CommerceUserContext.Current.UserId, CurrencyManager.CurrencyContext.CurrencyCode); } } catch (Exception e) { return(Json(new ErrorApiModel("SwitchCurrency", e), JsonRequestBehavior.AllowGet)); } return(new JsonResult()); }
public PaymentPage() { InitializeComponent(); //this.BackgroundColor = Color.FromRgb(0, 200, 255); this.BackgroundColor = Color.White; ExceptionModel.ExceptionModelInstance = new ExceptionModel(); pricingManager = new PricingManager(); manager = new BookingsManager(); emailService = new EmailService(); var viewModel = new PaymentPageViewModel(new StripeRepository(), new APIRepository()); this.BindingContext = viewModel; }
public ActionResult BySupplier(List <PricingModel> models) { var prices = models.Select(model => new Pricing() { ID = model.ID, CompanyID = model.CompanyID, MaterialID = model.MaterialID, SupplierID = model.SupplierID, CreatedOn = model.CreatedOn, ModifiedOn = model.ModifiedOn, CreatedBy = model.CreatedBy, ModifiedBy = model.ModifiedBy, Price = model.Price }).Where(m => m.Price.GetValueOrDefault() > 0 || m.ID > 0).ToList(); using (var pm = new PricingManager()) { var result = pm.UpdatePrices(prices); } return(RedirectToAction("Index")); }
public ActionResult Change(Price price) { ViewData["title"] = "Precios"; try { var pm = new PricingManager(); var ddpMan = new DDPVersionManager(); var cfgMan = new ConfigurationManager(); var queMan = new QueueManager(); var pud = new DataCenterLogic.DataCenterTypesIDE.PricingUpdateType(); pud.DDPVersionNum = DDPVersionManager.currentDDP(); pud.Message = "Price changed"; pud.MessageId = MessageIdManager.Generate("1005"); pud.MessageType = DataCenterLogic.DataCenterTypesIDE.messageTypeType7.Item15; pud.PricingFile = pm.GeneratePriceFile(price); pud.ReferenceId = ""; pud.schemaVersion = decimal.Parse(cfgMan.Configuration.SchemaVersion); pud.test = DataCenterLogic.DataCenterTypesIDE.testType.Item0; pud.TimeStamp = DateTime.UtcNow; Message msgout = new Message(pud); msgout.Label = "pricingUpdate"; string outQueue = System.Configuration.ConfigurationManager.AppSettings["CoreOutQueue"]; QueueManager.Instance().SetOut(outQueue); QueueManager.Instance().EnqueueOut(msgout); FlashOK("El mensaje fue encolado con exito"); } catch (Exception ex) { FlashOK(string.Format("Hubo un problema al enviar el mensaje => {0}", ex.Message)); } return(View()); }
public ActionResult BySupplier(int id) { List <Pricing> prices; List <Material> materials; int supplierID = id; using (var um = new UserManager()) { // any user tied to a supplier can only see their supplier rates var currentUser = um.ByUsername(User.Identity.Name); if (currentUser.SupplierID != null) { supplierID = currentUser.SupplierID.GetValueOrDefault(); } } using (var mm = new MaterialsManager()) { materials = mm.BySupplier(supplierID).ToList(); } using (var pm = new PricingManager()) { prices = pm.BySupplier(supplierID).ToList(); } // populate the model List <PricingModel> model = new List <PricingModel>(); foreach (var mat in materials) { var m = new PricingModel(); if (prices.Any(p => p.MaterialID == mat.ID)) { var price = prices.FirstOrDefault(p => p.MaterialID == mat.ID); m.ID = price.ID; m.CompanyID = price.CompanyID; m.MaterialID = price.MaterialID; m.SupplierID = price.SupplierID; m.CreatedOn = price.CreatedOn; m.CreatedBy = price.CreatedBy; m.ModifiedBy = price.ModifiedBy; m.ModifiedOn = price.ModifiedOn; m.Price = price.Price; m.MaterialName = mat.Name; } else { m.ID = 0; m.MaterialID = mat.ID; m.SupplierID = supplierID; m.CreatedOn = DateTime.Now; m.CreatedBy = User.Identity.Name; m.ModifiedBy = User.Identity.Name; m.ModifiedOn = DateTime.Now; m.MaterialName = mat.Name; } model.Add(m); } return(View("PricingList", model)); }
public CatalogController(InventoryManager inventoryManager, ContactFactory contactFactory, ProductViewModelFactory productViewModelFactory, AccountManager accountManager, CatalogManager catalogManager, GiftCardManager giftCardManager, PricingManager pricingManager, CartManager cartManager, CommerceUserContext commerceUserContext, CatalogItemContext catalogItemContext, CatalogUrlService catalogUrlRepository, StorefrontContext storefrontContext, CategoryViewModelFactory categoryViewModelFactory, GetChildProductsService getChildProductsService) { InventoryManager = inventoryManager; ProductViewModelFactory = productViewModelFactory; CatalogManager = catalogManager; GiftCardManager = giftCardManager; CommerceUserContext = commerceUserContext; CatalogItemContext = catalogItemContext; StorefrontContext = storefrontContext; CategoryViewModelFactory = categoryViewModelFactory; GetChildProductsService = getChildProductsService; }