/// <summary> /// Safely adds a recently viewed key to the CustomerContext. /// </summary> /// <param name="context"> /// The context. /// </param> /// <param name="product"> /// The product. /// </param> internal static void AddRecentKey(this ICustomerContext context, IProductContent product) { var recent = context.DeserializeRecentlyViewed(); recent.AddKey(product.Key); recent.Store(context); }
public CustomerControllerBase(ICustomerContext db, IEntityState entityStateSetter, IRequestProxy requestProxy) { _db = db; _entityStateSetter = entityStateSetter; _requestProxy = requestProxy; }
public CustomerCreationServiceTests() { _context = TestEntityFactory.SetupContext(); var entityFactory = TestEntityFactory.SetupEntityFactory(_context); _validationProvider = new Mock <IValidationProvider>(); _service = new CustomerCreationService(entityFactory, _validationProvider.Object); }
/// <summary> /// Initializes the controller. /// </summary> private void Initialize() { var storeSettingsService = this._merchelloContext.Services.StoreSettingService; var storeSetting = storeSettingsService.GetByKey(Core.Constants.StoreSettingKeys.CurrencyCodeKey); _customerContext = PluggableObjectHelper.GetInstance <CustomerContextBase>("CustomerContext", UmbracoContext); _currency = storeSettingsService.GetCurrencyByCode(storeSetting.Value); _isInitialized = true; }
public OrderManagementService(IOrderCatalogueContext orderCatalogueContext, ICustomerContext customerContext, IManagerContext managerContext, IProductStoreContext productStoreContext) { _orderCatalogueContext = orderCatalogueContext ?? throw new ArgumentNullException(nameof(orderCatalogueContext)); _customerContext = customerContext ?? throw new ArgumentNullException(nameof(customerContext)); _managerContext = managerContext ?? throw new ArgumentNullException(nameof(managerContext)); _productStoreContext = productStoreContext ?? throw new ArgumentNullException(nameof(productStoreContext)); }
// This constructor requires the two original implementations, and an ICustomerContext. // The ICustomerContext allows requesting information about public CustomerProcessProxy( RetailCustomer retail, CommercialCustomer commercial, ICustomerContext context) { this.retail = retail; this.commercial = commercial; // Important note: in the constructor you should ONLY store incoming dependencies, // but never use them. That's why we won't call context.IsRetailCustomer here. this.context = context; }
/// <summary> /// deserialize recently viewed. /// </summary> /// <param name="context"> /// The context. /// </param> /// <returns> /// The <see cref="RecentlyViewed"/>. /// </returns> private static RecentlyViewed DeserializeRecentlyViewed(this ICustomerContext context) { var value = context.GetValue("rviewed"); return(value.IsNullOrWhiteSpace() ? new RecentlyViewed() : new RecentlyViewed() { Keys = value.Split(',').Select(x => new Guid(x)) }); }
protected virtual void Dispose(bool disposing) { if (disposing) { if (this.Context != null) { this.Context.Dispose(); this.Context = null; } } }
static void Main(string[] args) { customerFileName = getFilePath() + "Data\\CustomerInvoicingData.csv"; purchaseFileName = getFilePath() + "Data\\SmallGroup-SalesData.csv"; stateRepository = new StateRepository(StateRepository.GetStates()); purchaseRepository = new PurchaseRepository(PurchaseRepository.GetPurchases(purchaseFileName, stateRepository), purchaseFileName); customerRepository = new CustomerRepository(CustomerRepository.GetCustomers(customerFileName, purchaseRepository, stateRepository), customerFileName); customerContext = new CustomerContext(customerRepository, purchaseRepository); displayMenu(); }
public void SetState(ICustomerContext context, object entity, EntityState state) { if (state == EntityState.Modified) { var customerEntity = entity as TEntity; if (customerEntity != null) { var entityInList = _entities.SingleOrDefault(p => p.Id == customerEntity.Id); entityInList.Apply(customerEntity); } } }
/// <summary> /// Initializes a new instance of the <see cref="CareBuilderControllerManager" /> class. /// </summary> /// <param name="healthLibraryService">The health library service.</param> /// <param name="vitalsService"></param> /// <param name="authDataStorage">The authentication data storage.</param> /// <param name="customerContext">The customer context.</param> public CareBuilderControllerManager( IHealthLibraryService healthLibraryService, IVitalsService vitalsService, IAuthDataStorage authDataStorage, ICustomerContext customerContext) { this.healthLibraryService = healthLibraryService; this.vitalsService = vitalsService; this.authDataStorage = authDataStorage; this.customerContext = customerContext; this.logger = NLog.LogManager.GetCurrentClassLogger(); }
private static void displayTaxSummary(IStateRepository statesRepository, ICustomerContext customerContext) { Console.Clear(); Console.WriteLine("\n................. TAX SUMMARY REPORT BY STATE ..................\n"); foreach (var state in statesRepository.States) { var sumForState = customerContext.SumTotalTaxByState(state.StateCode); Console.WriteLine($"Total {state.StateName} State Tax Owed: {sumForState.ToString("C")}"); } returnToMainMenu(); return; }
public InitialisationHandler(IFilmContext filmRepo, ReviewFilter reviewRepo, CommentFilter commentRepo, ShowingService showRepo, ICustomerContext userRepo, IAdminContext adminRepo, IAccessTokenContext accessTokenContext, AccountCreationService accountCreationService, ExistingUserService existingUserService) { _filmRepo = filmRepo; _reviewHandler = reviewRepo; _commentRepo = commentRepo; _showRepo = showRepo; _userRepo = userRepo; _adminRepo = adminRepo; _accessTokenContext = accessTokenContext; _existingUserService = existingUserService; _accountCreationService = accountCreationService; }
/// <summary> /// Gets the list of recently viewed items. /// </summary> /// <param name="context"> /// The context. /// </param> /// <param name="siteAlias"> /// The site alias. /// </param> /// <returns> /// The <see> /// <cref>IEnumerable</cref> /// </see> /// . /// </returns> internal static IEnumerable <ProductBoxModel> GetRecentlyViewedProducts(this ICustomerContext context, string siteAlias = "Bazaar") { var keys = context.DeserializeRecentlyViewed().Keys; // Get the Merchello helper var merchelloHelper = new MerchelloHelper(); // Get the products as IProductContent var listOfIProductContent = keys.Select( x => merchelloHelper.TypedProductContent(x)) .Reverse(); return(BazaarContentHelper.GetProductBoxModels(listOfIProductContent)); }
public CustomerDetailsController(ICustomerContext dbContext) { db = dbContext; }
public CustomerController(ICustomerContext repo) { this.repo = repo; }
public CompanyController(ICustomerContext db, IEntityState state, IRequestProxy requestProxy) : base(db, state, requestProxy) { }
/// <summary> /// Initializes the controller. /// </summary> private void Initialize() { var storeSettingsService = this._merchelloContext.Services.StoreSettingService; var storeSetting = storeSettingsService.GetByKey(Core.Constants.StoreSettingKeys.CurrencyCodeKey); _customerContext = PluggableObjectHelper.GetInstance<CustomerContextBase>("CustomerContext", UmbracoContext); _currency = storeSettingsService.GetCurrencyByCode(storeSetting.Value); _isInitialized = true; }
public CustomerRepository(ICustomerContext context) { _context = context; }
public CustomerRepository(ICustomerContext _context) { this.context = _context; }
public CustomerRepository(ICustomerContext context) : base(context) { customerContext = context; }
public ExistingUserService(ICustomerContext customerContext, SecurityService securityService, IAdminContext adminContext) { _customerContext = customerContext; _securityService = securityService; _adminContext = adminContext; }
public CustomerService(ICustomerContext db, IMapper mapper) { _dB = db; _mapper = mapper; }
public void SetState(ICustomerContext context, object entity, EntityState state) { context.Entry(entity).State = state; }
/// <summary> /// Initializes the controller. /// </summary> private void Initialize() { _customerContext = PluggableObjectHelper.GetInstance <CustomerContextBase>("CustomerContext", UmbracoContext); _basket = _customerContext.CurrentCustomer.Basket(); _preparation = new Lazy <IBasketSalePreparation>(() => _basket.SalePreparation()); }
public AccountCreationService(ICustomerContext customerContext, SecurityService securityService, IAdminContext adminContext) { _customerContext = customerContext; _securityService = securityService; _adminContext = adminContext; }
/// <summary> /// Serializes the keys to a CSV list for cookie storage. /// </summary> /// <param name="recent"> /// The recent. /// </param> /// <param name="context"> /// The <see cref="ICustomerContext"/>. /// </param> internal static void Store(this RecentlyViewed recent, ICustomerContext context) { context.SetValue("rviewed", string.Join(",", recent.Keys)); }
public CustomerRepository() { Custctx = new SQLConnect(); }
public CustomerService(IBaseContext baseContext, ICustomerContext customerContext) : base(baseContext) { this._customerContext = customerContext; }
public CustomerManagementService(ICustomerContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public CustomerRepository(ICustomerContext customerContext) => this.customerContext = customerContext;