Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public string Compress(string text)
        {
            // 空值不處理
            if (string.IsNullOrEmpty(text))
            {
                return(string.Empty);
            }

            byte[] buffer = Encoding.UTF8.GetBytes(text);

            MemoryStream ms = new MemoryStream();

            using (GZipStream zip = new GZipStream(ms, CompressionMode.Compress, true))
            {
                zip.Write(buffer, 0, buffer.Length);
            }

            ms.Position = 0;
            MemoryStream outStream = new MemoryStream();

            byte[] compressed = new byte[ms.Length];
            ms.Read(compressed, 0, compressed.Length);

            byte[] gzBuffer = new byte[compressed.Length + 4];
            System.Buffer.BlockCopy(compressed, 0, gzBuffer, 4, compressed.Length);
            System.Buffer.BlockCopy(BitConverter.GetBytes(buffer.Length), 0, gzBuffer, 0, 4);
            return(UtilityFactory.Instance().HexUtility.ConvertToHex(gzBuffer));
        }
Example #2
0
        public AccessorFactory(AmbientContext context, UtilityFactory utilityFactory) : base(context)
        {
            // NOTE: this is here to ensure the factories from the Manager are propogated down to the other factories
            _utilityFactory = utilityFactory ?? new UtilityFactory(Context);

            AddType <IProjectAccess>(typeof(ProjectAccess));
        }
Example #3
0
        /// <summary>
        /// ObjectDeserializeJsonStr
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="data"></param>
        /// <returns></returns>
        public string ObjectDeserializeJsonStr <T>(T data)
        {
            StringBuilder result = new StringBuilder();

            try
            {
                Type         objectType = typeof(T);
                var          properties = objectType.GetProperties().Where(prop => prop.CanRead && prop.CanWrite);
                StringWriter sw         = new StringWriter(result);
                if (properties != null && properties.Count() > 0)
                {
                    using (JsonWriter writer = new JsonTextWriter(sw))
                    {
                        writer.Formatting = Formatting.Indented;
                        writer.WriteStartObject();
                        foreach (var prop in properties)
                        {
                            var name  = prop.Name;
                            var value = prop.GetValue(data, null);
                            writer.WritePropertyName(name);
                            writer.WriteValue(UtilityFactory.Instance().StringUtility.IIF(value));
                        }
                        writer.WriteEndObject();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(result.ToString());
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="compressedText"></param>
        /// <returns></returns>
        public string Decompress(string compressedText)
        {
            // 空值不處理
            if (string.IsNullOrEmpty(compressedText))
            {
                return(string.Empty);
            }

            byte[] gzBuffer = UtilityFactory.Instance().HexUtility.ConvertToBytes(compressedText);
            using (MemoryStream ms = new MemoryStream())
            {
                int msgLength = BitConverter.ToInt32(gzBuffer, 0);
                ms.Write(gzBuffer, 4, gzBuffer.Length - 4);

                byte[] buffer = new byte[msgLength];

                ms.Position = 0;
                using (GZipStream zip = new GZipStream(ms, CompressionMode.Decompress))
                {
                    zip.Read(buffer, 0, buffer.Length);
                }

                return(Encoding.UTF8.GetString(buffer));
            }
        }
Example #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting Notifications Service");

            while (true)
            {
                var utilityFactory = new UtilityFactory(new AmbientContext());
                var asyncUtility   = utilityFactory.CreateUtility <IAsyncUtility>();
                var item           = asyncUtility.CheckForNewItem();
                if (item != null)
                {
                    // If the queued message contains a Context then pass it along instead of creating a new one
                    var managerFactory      = new ManagerFactory(item.AmbientContext ?? new AmbientContext());
                    var notificationManager = managerFactory.CreateManager <INotificationManager>();

                    if (item.EventType == AsyncEventTypes.OrderSubmitted)
                    {
                        notificationManager.SendNewOrderNotices(item.EventId);
                    }
                    if (item.EventType == AsyncEventTypes.OrderShipped)
                    {
                        notificationManager.SendOrderFulfillmentNotices(item.EventId);
                    }
                }

                Thread.Sleep(5000); // sleep 5 seconds
            }
        }
Example #6
0
        public T CreateEngine <T>(AccessorFactory accessorFactory, UtilityFactory utilityFactory) where T : class
        {
            _accessorFactory = accessorFactory ?? _accessorFactory;
            _utilityFactory  = utilityFactory ?? _utilityFactory;

            T result = GetInstanceForType <T>();


            if (_utilityFactory == null)
            {
                _utilityFactory = new UtilityFactory(Context);
            }

            if (_accessorFactory == null)
            {
                _accessorFactory = new AccessorFactory(Context, _utilityFactory);
            }

            // configure the context and the accessor factory if the result is not a mock
            if (result is EngineBase)
            {
                (result as EngineBase).Context         = Context;
                (result as EngineBase).AccessorFactory = _accessorFactory;
                (result as EngineBase).UtilityFactory  = _utilityFactory;
            }

            return(result);
        }
        public T CreateManager <T>(
            EngineFactory engineFactory, AccessorFactory accessorFactory, UtilityFactory utilityFactory) where T : class
        {
            if (Context == null)
            {
                throw new InvalidOperationException("Context cannot be null");
            }

            utilityFactory ??= new UtilityFactory(Context);
            accessorFactory ??= new AccessorFactory(Context, utilityFactory);
            engineFactory ??= new EngineFactory(Context, accessorFactory, utilityFactory);

            T result = GetInstanceForType <T>();

            if (result is ManagerBase)
            {
                (result as ManagerBase).Context         = Context;
                (result as ManagerBase).EngineFactory   = engineFactory;
                (result as ManagerBase).AccessorFactory = accessorFactory;
                (result as ManagerBase).UtilityFactory  = utilityFactory;
            }
            else
            {
                // mocking of the manager factory is not supported so every result should implement ManagerBase
                throw new InvalidOperationException($"{typeof(T).Name} does not implement ManagerBase");
            }

            return(result);
        }
Example #8
0
        public AccessorFactory(AmbientContext context, UtilityFactory utilityFactory) : base(context)
        {
            // NOTE: this is here to ensure the factories from the Manager are propogated down to the other factories
            _utilityFactory = utilityFactory ?? new UtilityFactory(Context);

            //AddType<IShippingRulesAccessor>(typeof(ShippingRulesAccessor));
        }
        private UtilityFactory SetupMockUtilityFactory()
        {
            var            mockAsyncUtility = new MockAsyncUtility(mockData);
            UtilityFactory utilFactory      = new UtilityFactory(this.mockData.Context);

            utilFactory.AddOverride <IAsyncUtility>(mockAsyncUtility);
            return(utilFactory);
        }
        public UtilityFactory SetupMockUtilityFactory()
        {
            UtilityFactory      utilFactory  = new UtilityFactory(mockData.Context);
            MockSecurityUtility mockSecurity = new MockSecurityUtility(mockData);

            utilFactory.AddOverride <ISecurityUtility>(mockSecurity);
            return(utilFactory);
        }
Example #11
0
        public void TestCreate()
        {
            UtilityFactory ut = new UtilityFactory();
            Utility        u;

            u = ut.create("Utility");
            Assert.AreEqual("Utility", u.getName());
        }
Example #12
0
        BackOffice.OrderDataResponse BackOffice.IBackOfficeRemittanceManager.Totals()
        {
            try
            {
                // authenticate the user as a seller
                if (UtilityFactory.CreateUtility <ISecurityUtility>().BackOfficeAdminAuthenticated())
                {
                    var sellerOrderData = AccessorFactory.CreateAccessor <IRemittanceAccessor>()
                                          .SalesTotal();

                    if (sellerOrderData != null && sellerOrderData.Length > 0)
                    {
                        var result = new BackOffice.OrderDataResponse();
                        var items  = new List <BackOffice.SellerOrderData>();

                        foreach (var item in sellerOrderData)
                        {
                            var mapped = DTOMapper.Map <BackOffice.SellerOrderData>(item);

                            var calcResult = EngineFactory.CreateEngine <IRemittanceCalculationEngine>()
                                             .CalculateFee(mapped.SellerId, mapped.OrderTotal);

                            mapped.FeeAmount        = calcResult.FeeAmount;
                            mapped.RemittanceAmount = calcResult.RemittanceAmount;

                            items.Add(mapped);
                        }

                        result.Success         = true;
                        result.SellerOrderData = items.ToArray();
                        return(result);
                    }
                    else
                    {
                        return(new BackOffice.OrderDataResponse()
                        {
                            Success = false,
                            Message = "No orders"
                        });
                    }
                }
                return(new BackOffice.OrderDataResponse()
                {
                    Success = false,
                    Message = "BackOfficeAdmin not authenticated"
                });
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(new BackOffice.OrderDataResponse()
                {
                    Success = false,
                    Message = "There was a problem accessing sellers orders"
                });
            }
        }
        public EngineFactory(AmbientContext context, AccessorFactory accessorFactory, UtilityFactory utilityFactory)
            : base(context)
        {
            // NOTE: this is here to ensure the factories from the Manager are propogated down to the other factories
            _utilityFactory  = utilityFactory ?? new UtilityFactory(Context);
            _accessorFactory = accessorFactory ?? new AccessorFactory(Context, _utilityFactory);

            //AddType<IRemittanceCalculationEngine>(typeof(RemittanceCalculationEngine));
        }
Example #14
0
        /// <summary>
        /// 取得指定比較日期的週期(月)相對日
        /// </summary>
        /// <param name="referenceDate">基準日</param>
        /// <param name="compareDate">比較日</param>
        /// <param name="cycleMonth">週期(月份)</param>
        /// <returns></returns>
        public string GetRelativeDateByCycle(string referenceDate, string compareDate, string cycleMonth)
        {
            string relativeDate = "";

            try
            {
                if (string.IsNullOrEmpty(referenceDate) || string.IsNullOrEmpty(compareDate))
                {
                    return(string.Empty);
                }
                else
                {
                    // Note: 先設定相對日為基準日
                    DateTime relativeDT = new DateTime();

                    // Note: 比較日
                    DateTime compareDT = new DateTime();

                    if (DateTime.TryParse(referenceDate, out relativeDT) && DateTime.TryParse(compareDate, out compareDT))
                    {
                        bool isComplete = false;

                        // Note: 開始依週期計算相對日,重複計算直到大於等於比較日停止
                        while (!isComplete)
                        {
                            relativeDT = relativeDT.AddMonths(UtilityFactory.Instance().NumberUtility.ParseToInt(cycleMonth));

                            // 計算出來的[相對日]>[比較日]時,因[比較日]為週期的起日,所以迄日即為[相對日]
                            if (relativeDT.CompareTo(compareDT) > 0)
                            {
                                isComplete = true;
                            }
                            // 計算出來的[相對日]=[比較日]時,因[比較日]為週期的起日,則[相對日]須再+1個月
                            else if (relativeDT.CompareTo(compareDT) == 0)
                            {
                                relativeDT = relativeDT.AddMonths(1);
                                isComplete = true;
                            }
                            else
                            {
                                continue;
                            }
                        }
                        if (relativeDT != null && relativeDT != DateTime.MinValue && relativeDT != DateTime.MaxValue)
                        {
                            relativeDate = relativeDT.ToString("yyyy/MM/dd");
                        }
                    }
                }
            }
            catch (Exception)
            {
                relativeDate = "";
                throw;
            }
            return(relativeDate);
        }
        private EngineFactory CreateFactory()
        {
            var context         = new AmbientContext();
            var utilityFactory  = new UtilityFactory(context);
            var accessorFactory = new AccessorFactory(context, utilityFactory);

            var engineFactory = new EngineFactory(context, accessorFactory, utilityFactory);

            return(engineFactory);
        }
 public void testUtility()
 {
     //create instance of factory
     UtilityFactory f = new UtilityFactory();
     //create instance from factory
     Utility p = f.create("Utility");
     //check that it is right type
     Type t = new Utility().GetType();
     Assert.IsInstanceOfType(t, p);
 }
        public void test_utility()
        {
            //create instance of factory
            UtilityFactory f = new UtilityFactory();
            //create instance from factory
            Utility p = f.create("Utility");
            //check that it is right type
            Type t = new Utility().GetType();

            Assert.IsInstanceOfType(t, p);
        }
Example #18
0
        private T GetManager <T>(AmbientContext context) where T : class
        {
            // replace the AsyncUtility with a mock to avoid usage of queue IFX in tests
            var mockAsyncUtility = new MockAsyncUtility(this.mockData);

            UtilityFactory utilFactory = new UtilityFactory(context);

            utilFactory.AddOverride <IAsyncUtility>(mockAsyncUtility);

            var managerFactory = new ManagerFactory(context);

            return(managerFactory.CreateManager <T>(null, null, utilFactory));
        }
Example #19
0
        public EngineFactory(AmbientContext context, AccessorFactory accessorFactory, UtilityFactory utilityFactory)
            : base(context)
        {
            // NOTE: this is here to ensure the factories from the Manager are propogated down to the other factories
            _utilityFactory  = utilityFactory ?? new UtilityFactory(Context);
            _accessorFactory = accessorFactory ?? new AccessorFactory(Context, _utilityFactory);

            AddType <ICartPricingEngine>(typeof(PricingEngine));
            AddType <IEmailFormattingEngine>(typeof(EmailFormattingEngine));
            AddType <ITaxCalculationEngine>(typeof(TaxCalculationEngine));
            AddType <IOrderValidationEngine>(typeof(ValidationEngine));
            AddType <IRemittanceCalculationEngine>(typeof(RemittanceCalculationEngine));
        }
        public void CreateProperties()
        {
            var resFactory     = new ResidentialFactory();
            var transFactory   = new TransportFactory();
            var utilFactory    = new UtilityFactory();
            var genericFactory = new PropertyFactory();
            var luckFactory    = new LuckFactory();


            try
            {
                var propertyDetails = _fileReader.ReadPropertyDetailsFromCSV();

                // Add the properties to the board
                foreach (var propertyDetail in propertyDetails)
                {
                    switch (propertyDetail.Type.ToLower())
                    {
                    case "luck":
                        Board.Access()
                        .AddProperty(luckFactory.create(propertyDetail.Name, propertyDetail.IsPenalty,
                                                        propertyDetail.Amount));
                        break;

                    case "residential":
                        Board.Access()
                        .AddProperty(resFactory.create(propertyDetail.Name, propertyDetail.Price,
                                                       propertyDetail.Rent, propertyDetail.HouseCost, propertyDetail.HouseColour));
                        break;

                    case "transport":
                        Board.Access().AddProperty(transFactory.create(propertyDetail.Name));
                        break;

                    case "utility":
                        Board.Access().AddProperty(utilFactory.create(propertyDetail.Name));
                        break;

                    case "generic":
                        Board.Access().AddProperty(genericFactory.Create(propertyDetail.Name));
                        break;
                    }
                }

                Console.WriteLine("Properties have been setup");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Oops, something went wrong setting up the properties: {0}", ex.Message);
            }
        }
Example #21
0
        private void btnBackup_Click(object sender, EventArgs e)
        {
            DBArtifact db = new DBArtifact()
            {
                ServerName   = cmbServer.Text,
                DatabaseName = GetSelectedDatabase()
            };

            IUtility utility = UtilityFactory.Instance(UtilityType.Backup, db);

            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += (obj, ea) => Backup(utility);
            worker.RunWorkerAsync();
        }
Example #22
0
        public T CreateAccessor <T>(UtilityFactory utilityFactory) where T : class
        {
            _utilityFactory = utilityFactory ?? _utilityFactory;

            T result = base.GetInstanceForType <T>();

            // Configure the context if the result is not a mock
            if (result is AccessorBase)
            {
                (result as AccessorBase).Context        = Context;
                (result as AccessorBase).UtilityFactory = _utilityFactory;
            }

            return(result);
        }
        public ActionResult Edit(ActivitiesViewModel model)
        {
            if (ModelState.IsValid)
            {
                string successMessage = "Activity successfully edited.";
                string errorMessage   = "Unable to edit the activity.";

                try
                {
                    // Get co-ordianates of address
                    IGeolocationService geolocationService = UtilityFactory.GetGeolocationService();
                    Location            location           = geolocationService.GetCoordinates(
                        String.Format("{0}, {1}, {2}", model.Address, model.PackageCity, model.PackageState.ToString()));

                    Activity activity = new Activity()
                    {
                        ActivityId  = model.ActivityId,
                        Name        = model.ActivityName,
                        Description = model.Description,
                        Address     = model.Address,
                        Status      = PackageStatusEnum.Available,
                        PackageId   = model.PackageId,
                        Latitude    = location.Latitude,
                        Longitude   = location.Longitude
                    };

                    ResultEnum result = activityService.UpdateActivity(activity);

                    if (result == ResultEnum.Success)
                    {
                        model.SuccessMessage = successMessage;
                    }
                    else
                    {
                        model.ErrorMessage = errorMessage;
                    }

                    return(View(model));
                }
                catch
                {
                    model.ErrorMessage = errorMessage;
                }
            }

            return(View(model));
        }
Example #24
0
 public AccessorFactory(AmbientContext context, UtilityFactory utilityFactory) : base(context)
 {
     // NOTE: this is here to ensure the factories from the Manager are propogated down to the other factories
     _utilityFactory = utilityFactory ?? new UtilityFactory(Context);
     AddType <ICartAccessor>(typeof(CartAccessor));
     AddType <ICatalogAccessor>(typeof(CatalogAccessor));
     AddType <IEmailAccessor>(typeof(EmailAccessor));
     AddType <IOrderAccessor>(typeof(OrderAccessor));
     AddType <IEmailAccessor>(typeof(EmailAccessor));
     AddType <IPaymentAccessor>(typeof(PaymentAccessor));
     AddType <IShippingAccessor>(typeof(ShippingAccessor));
     AddType <ISellerAccessor>(typeof(SellerAccessor));
     AddType <IRemittanceAccessor>(typeof(RemittanceAccessor));
     AddType <IShippingRulesAccessor>(typeof(ShippingRulesAccessor));
     AddType <ITaxRateAccessor>(typeof(TaxRateAccessor));
     AddType <ISearchAccessor>(typeof(SearchAccessor));
 }
Example #25
0
        private void btnRestore_Click(object sender, EventArgs e)
        {
            DBArtifact db = new DBArtifact()
            {
                ServerName   = cmbServer.Text,
                DatabaseName = GetSelectedDatabase(),
                FileName     = txtFilename.Text
            };

            if (MessageBox.Show(string.Format("{0} file will be restored with the name {1} on server {2}. Do you want to continue?", db.FileName, db.DatabaseName, db.ServerName), "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                IUtility         utility = UtilityFactory.Instance(UtilityType.Restore, db);
                BackgroundWorker worker  = new BackgroundWorker();
                worker.DoWork += (obj, ea) => Restore(utility);
                worker.RunWorkerAsync();
            }
        }
Example #26
0
        Admin.AdminCatalogResponse Admin.IAdminCatalogManager.ShowCatalog(int catalogId)
        {
            try
            {
                // authenticate the user as a seller
                if (UtilityFactory.CreateUtility <ISecurityUtility>().SellerAuthenticated())
                {
                    var catalog = AccessorFactory.CreateAccessor <ICatalogAccessor>()
                                  .Find(catalogId);

                    if (catalog != null)
                    {
                        if (catalog.SellerId == Context.SellerId)
                        {
                            Admin.WebStoreCatalog result = new Admin.WebStoreCatalog();
                            DTOMapper.Map(catalog, result);

                            return(new Admin.AdminCatalogResponse()
                            {
                                Success = true,
                                Catalog = result
                            });
                        }
                    }
                    return(new Admin.AdminCatalogResponse()
                    {
                        Success = false,
                        Message = "Catalog not found"
                    });
                }
                return(new Admin.AdminCatalogResponse()
                {
                    Success = false,
                    Message = "Seller not authenticated"
                });
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(new Admin.AdminCatalogResponse()
                {
                    Success = false,
                    Message = "There was a problem accessing the catalog"
                });
            }
        }
Example #27
0
        Admin.AdminCatalogResponse Admin.IAdminCatalogManager.SaveCatalog(Admin.WebStoreCatalog catalog)
        {
            try
            {
                // authenticate the user as a seller
                if (UtilityFactory.CreateUtility <ISecurityUtility>().SellerAuthenticated())
                {
                    // map to the accessor DTO
                    DTO.WebStoreCatalog accCatalog = new DTO.WebStoreCatalog();
                    DTOMapper.Map(catalog, accCatalog);

                    accCatalog = AccessorFactory.CreateAccessor <ICatalogAccessor>().SaveCatalog(accCatalog);

                    if (accCatalog != null)
                    {
                        Admin.WebStoreCatalog result = new Admin.WebStoreCatalog();
                        DTOMapper.Map(accCatalog, result);

                        return(new Admin.AdminCatalogResponse()
                        {
                            Success = true,
                            Catalog = result
                        });
                    }
                    return(new Admin.AdminCatalogResponse()
                    {
                        Success = false,
                        Message = "Catalog not saved"
                    });
                }
                return(new Admin.AdminCatalogResponse()
                {
                    Success = false,
                    Message = "Seller not authenticated"
                });
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(new Admin.AdminCatalogResponse()
                {
                    Success = false,
                    Message = "There was a problem saving the catalog"
                });
            }
        }
        static void Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Console()
                         .CreateLogger();

            var bot = UtilityFactory.GetBot();

            try
            {
                bot.RunAsync().GetAwaiter().GetResult();
            }
            catch (Exception e)
            {
                Log.Error(e, "Main process terminated!");
            }
        }
Example #29
0
        Admin.AdminProductResponse Admin.IAdminCatalogManager.SaveProduct(int catalogId, Admin.Product product)
        {
            try
            {
                // authenticate the user as a seller
                if (UtilityFactory.CreateUtility <ISecurityUtility>().SellerAuthenticated())
                {
                    // map to the accessor DTO
                    DTO.Product accProduct = new DTO.Product();
                    DTOMapper.Map(product, accProduct);

                    accProduct = AccessorFactory.CreateAccessor <ICatalogAccessor>().SaveProduct(catalogId, accProduct);

                    if (accProduct != null)
                    {
                        Admin.Product result = new Admin.Product();
                        DTOMapper.Map(accProduct, result);

                        return(new Admin.AdminProductResponse()
                        {
                            Success = true,
                            Product = result
                        });
                    }
                    return(new Admin.AdminProductResponse()
                    {
                        Success = false,
                        Message = "Product not saved"
                    });
                }
                return(new Admin.AdminProductResponse()
                {
                    Success = false,
                    Message = "Seller not authenticated"
                });
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(new Admin.AdminProductResponse()
                {
                    Success = false,
                    Message = "There was a problem saving the product"
                });
            }
        }
Example #30
0
        Admin.AdminProductResponse Admin.IAdminCatalogManager.ShowProduct(int catalogId, int productId)
        {
            try
            {
                //authenticate the seller
                if (UtilityFactory.CreateUtility <ISecurityUtility>().SellerAuthenticated())
                {
                    var product = AccessorFactory.CreateAccessor <ICatalogAccessor>()
                                  .FindProduct(productId);

                    if (product != null)
                    {
                        if (product.CatalogId == catalogId)
                        {
                            Admin.Product result = new Admin.Product();
                            DTOMapper.Map(product, result);

                            return(new Admin.AdminProductResponse()
                            {
                                Success = true,
                                Product = result
                            });
                        }
                    }
                    return(new Admin.AdminProductResponse()
                    {
                        Success = false,
                        Message = "Product not found"
                    });
                }
                return(new Admin.AdminProductResponse()
                {
                    Success = false,
                    Message = "Seller not authenticated"
                });
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(new Admin.AdminProductResponse()
                {
                    Success = false,
                    Message = "There was a problem accessing the product"
                });
            }
        }
Example #31
0
        public ManagerFactory(AmbientContext context, EngineFactory engineFactory = null, AccessorFactory accessorFactory = null, UtilityFactory utilityFactory = null)
            : base(context)
        {
            // NOTE: this is here to ensure the factories from the Manager are propogated down to the other factories
            _utilityFactory  = utilityFactory ?? new UtilityFactory(Context);
            _accessorFactory = accessorFactory ?? new AccessorFactory(Context, _utilityFactory);
            _engineFactory   = engineFactory ?? new EngineFactory(Context, _accessorFactory, _utilityFactory);

            AddType <IWebStoreCartManager>(typeof(OrderManager));
            AddType <IWebStoreOrderManager>(typeof(OrderManager));
            AddType <IReturnsManager>(typeof(OrderManager));
            AddType <IWebStoreCatalogManager>(typeof(Catalog.CatalogManager));
            AddType <IAdminCatalogManager>(typeof(Catalog.CatalogManager));
            AddType <INotificationManager>(typeof(NotificationManager));
            AddType <IBackOfficeRemittanceManager>(typeof(RemittanceManager));
            AddType <IAdminRemittanceManager>(typeof(RemittanceManager));
            AddType <IAdminFulfillmentManager>(typeof(OrderManager));
        }