private static void ExtractProperties <K>(IContextContainer <K> context, IContextObject extractObj)
        {
            List <PropertyInfo> properties = cachedTypePropertyDic[extractObj.GetType()][ContextUsage.Extract];

            if (properties != null && properties.Count > 0)
            {
                foreach (var property in properties)
                {
                    if (typeof(IContextContainer <>).IsAssignableFrom(property.PropertyType))
                    {
                        throw new InvalidOperationException("Context can only be used with the InjectUsage.In option.");
                    }

                    var    attr       = property.GetCustomAttribute <ContextIEAttribute>();
                    object fieldValue = property.GetValue(extractObj);
                    if (!attr.Optional)
                    {
                        context.AddOrUpdate((K)attr.Key, fieldValue);
                    }
                    else if (fieldValue != null)
                    {
                        context.AddOrUpdate((K)attr.Key, fieldValue);
                    }
                }
            }
        }
 public ProductManager(IContextContainer container)
     : base(container)
 {
     _productDAO = new ProductDAO(container);
     _categoryDAO = new CategoryDAO(container);
     _attributeDAO = new AttributeDAO(container);
 }
Esempio n. 3
0
 public ProductManager(IContextContainer container)
     : base(container)
 {
     _productDAO   = new ProductDAO(container);
     _categoryDAO  = new CategoryDAO(container);
     _attributeDAO = new AttributeDAO(container);
 }
        private static void ExtractFields <K>(IContextContainer <K> context, IContextObject extractObj)
        {
            List <FieldInfo> fields = cachedTypeFieldDic[extractObj.GetType()][ContextUsage.Extract];

            if (fields != null && fields.Count > 0)
            {
                foreach (var field in fields)
                {
                    if (typeof(IContextContainer <>).IsAssignableFrom(field.FieldType))
                    {
                        throw new InvalidOperationException("Context can only be used with the InjectUsage.In option.");
                    }

                    var    attr  = field.GetCustomAttribute <ContextIEAttribute>();
                    object value = field.GetValue(extractObj);
                    if (!attr.Optional)
                    {
                        context.AddOrUpdate((K)attr.Key, value);
                    }
                    else if (value != null)
                    {
                        context.AddOrUpdate((K)attr.Key, value);
                    }
                }
            }
        }
Esempio n. 5
0
 public PaymentManager(IContextContainer container)
     : base(container)
 {
     _paypalPaymentDAO  = new PaypalPaymentDAO(container);
     _easyPayPaymentDAO = new EasyPayPaymentDAO(container);
     _cashPaymentDAO    = new CashPaymentDAO(container);
     _paymentDAO        = new PaymentDAO(container);
     _currencyDAO       = new CurrencyDAO(container);
 }
 public PaymentManager(IContextContainer container)
     : base(container)
 {
     _paypalPaymentDAO = new PaypalPaymentDAO(container);
     _easyPayPaymentDAO = new EasyPayPaymentDAO(container);
     _cashPaymentDAO = new CashPaymentDAO(container);
     _paymentDAO = new PaymentDAO(container);
     _currencyDAO = new CurrencyDAO(container);
 }
Esempio n. 7
0
 public OrderManager(IContextContainer container)
     : base(container)
 {
     _orderDAO       = new OrderDAO(container);
     _productDAO     = new ProductDAO(container);
     _bonusDAO       = new BonusDAO(container);
     _cartDAO        = new ShoppingCartDAO(container);
     _addressInfoDAO = new AddressInfoDAO(container);
     _customerDAO    = new CustomerDAO(container);
 }
Esempio n. 8
0
 public OrderManager(IContextContainer container)
     : base(container)
 {
     _orderDAO = new OrderDAO(container);
     _productDAO = new ProductDAO(container);
     _bonusDAO = new BonusDAO(container);
     _cartDAO = new ShoppingCartDAO(container);
     _addressInfoDAO = new AddressInfoDAO(container);
     _customerDAO = new CustomerDAO(container);
 }
 public ContextContainer()
 {
     if (HttpContext.Current == null)
     {
         _container = new ThreadContextContainer();
     }
     else
     {
         _container = new WebContextContainer();
     }
 }
Esempio n. 10
0
        private static void InjectFields <K>(IContextContainer <K> context, IContextObject injectObj)
        {
            List <FieldInfo> fields = cachedTypeFieldDic[injectObj.GetType()][ContextUsage.Inject];

            if (fields != null && fields.Count > 0)
            {
                foreach (var field in fields)
                {
                    var attr = field.GetCustomAttribute <ContextIEAttribute>();

                    if (!context.TryGet((K)attr.Key, out object value))
                    {
                        if (value == null && !attr.Optional)
                        {
                            throw new ContextValueNullException(attr.Key);
                        }
                    }
                    field.SetValue(injectObj, value);
                }
            }
        }
Esempio n. 11
0
        private static void InjectProperties <K>(IContextContainer <K> context, IContextObject injectObj)
        {
            List <PropertyInfo> properties = cachedTypePropertyDic[injectObj.GetType()][ContextUsage.Inject];

            if (properties != null && properties.Count > 0)
            {
                foreach (var property in properties)
                {
                    var attr = property.GetCustomAttribute <ContextIEAttribute>();

                    if (!context.TryGet((K)attr.Key, out object value))
                    {
                        if (value == null && !attr.Optional)
                        {
                            throw new ContextValueNullException(attr.Key);
                        }
                    }
                    property.SetValue(injectObj, value);
                }
            }
        }
Esempio n. 12
0
        public static void Inject <K>(IContextContainer <K> context, IContextObject injectObj)
        {
            if (injectObj == null || context == null)
            {
                throw new ArgumentNullException("argument is null.");
            }
            Type injectObjType = injectObj.GetType();

            if (!cachedTypeFieldDic.ContainsKey(injectObjType))
            {
                CachedFields(injectObjType);
            }

            if (!cachedTypePropertyDic.ContainsKey(injectObjType))
            {
                CachedProperties(injectObjType);
            }

            InjectFields(context, injectObj);
            InjectProperties(context, injectObj);
        }
Esempio n. 13
0
        public static void Extract <K>(IContextContainer <K> context, IContextObject extractObj)
        {
            if (extractObj == null || context == null)
            {
                throw new ArgumentNullException("ContextUtil::Extract->argument is null");
            }

            Type extractObjType = extractObj.GetType();

            if (!cachedTypeFieldDic.ContainsKey(extractObjType))
            {
                CachedFields(extractObjType);
            }

            if (!cachedTypePropertyDic.ContainsKey(extractObjType))
            {
                CachedProperties(extractObjType);
            }

            ExtractFields(context, extractObj);
            ExtractProperties(context, extractObj);
        }
Esempio n. 14
0
        private void CreateManagers()
        {
            var resourcesManagerFactory = new ResourcesManagerFactory();

            ResourcesManager = resourcesManagerFactory.Create();
            _managers.Add(ResourcesManager.Instance());

            var managerCanvasFactory = new ManagerCanvasFactory();

            ManagerCanvas = managerCanvasFactory.Create();
            _managers.Add(ManagerCanvas.Instance());

            var managerUi = new ManagerUiFactory();

            ManagerUi = managerUi.Create();
            _managers.Add(ManagerUi.Instance());

            var managerGameFactory = new ManagerGameFactory();

            ManagerGame = managerGameFactory.Create();
            _managers.Add(ManagerGame.Instance());
        }
        protected void InitializeView()
        {
            GameObject loadedObject = ObjectPoolManager.Instantiate(this._viewPrefabName);

            this._view = loadedObject.GetComponent <TView>();
            this._view.AddShowDismissEvents(this);

            CanvasUtil.ParentUIElementToCanvas(loadedObject, CanvasUtil.ScreenSpaceMainCanvas);

            IContextContainer contextContainer = this._view as IContextContainer;

            if (contextContainer == null)
            {
                Debug.LogError("InitializeView: view is not an IContextContainer, probably should be!");
            }
            else
            {
                contextContainer.ProvideContext(this);
            }

            this.OnViewInitialized();
        }
Esempio n. 16
0
 public InvitationDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 17
0
 public AddressInfoDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 18
0
 public MovieRatingService(IContextContainer contextContainer)
 {
     _contextContainer = contextContainer;
 }
Esempio n. 19
0
 public ReturnDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 20
0
   public AddressInfoDAO(IContextContainer container)
     : base(container)
 {
 }
 public CategoryManager(IContextContainer container)
     : base(container)
 {
     _categoryDAO = new CategoryDAO(container);
 }
Esempio n. 22
0
 public BaseManager(IContextContainer container)
 {
     Context = (privEntities)container.Current;
 }
Esempio n. 23
0
 public ProductDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 24
0
 public ReturnManager(IContextContainer container)
     : base(container)
 {
     _returnDAO = new ReturnDAO(container);
 }
Esempio n. 25
0
 public AttributeDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 26
0
 public CashPaymentDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 27
0
 public BrandManager(IContextContainer container)
     : base(container)
 {
     _brandDAO = new BrandDAO(container);
 }
Esempio n. 28
0
 public CurrencyDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 29
0
 public InvitationManager(IContextContainer container)
     : base(container)
 {
     _invititationDAO = new InvitationDAO(container);
 }
 protected ContextConnector(IContextContainer contextContainer)
     : this(contextContainer, false)
 {
 }
Esempio n. 31
0
  public CashPaymentDAO(IContextContainer container)
     : base(container)
 {
 }
 public CustomerManager(IContextContainer container)
     : base(container)
 {
     _customerDAO = new CustomerDAO(container);
 }
Esempio n. 33
0
 public UserDAO(IContextContainer container)
     : base(container)
 {
 }
 public ShoppingCartManager(IContextContainer container)
     : base(container)
 {
     _shoppingCartDAO = new ShoppingCartDAO(container);
     _productDAO = new ProductDAO(container);
 }
Esempio n. 35
0
 public CustomerManager(IContextContainer container)
     : base(container)
 {
     _customerDAO = new CustomerDAO(container);
 }
 public EasyPayPaymentDAO(IContextContainer container)
     : base(container)
 {
 }
 protected ContextConnector(IContextContainer contextContainer, bool useBulk)
 {
     ContextContainer = contextContainer;
     UseBulk          = useBulk;
 }
 public CampaignManager(IContextContainer container)
     : base(container)
 {
     _campaignDAO = new CampaignDAO(container);
 }
Esempio n. 39
0
 public CampaignManager(IContextContainer container)
     : base(container)
 {
     _campaignDAO = new CampaignDAO(container);
 }
Esempio n. 40
0
 public BonusManager(IContextContainer container) : base(container)
 {
     _bonusDAO = new BonusDAO(container);
 }
Esempio n. 41
0
 public CategoryDAO(IContextContainer container)
     : base(container)
 {
 }
 public AttributeManager(IContextContainer container)
     : base(container)
 {
     _attributeDAO = new AttributeDAO(container);
 }
Esempio n. 43
0
 public ReturnManager(IContextContainer container)
     : base(container)
 {
     _returnDAO = new ReturnDAO(container);
 }
Esempio n. 44
0
 public BrandDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 45
0
 public UnitOfWork(IContextContainer context)
 {
     ContextContainer = context;
 }
Esempio n. 46
0
 public UserManager(IContextContainer container)
     : base(container)
 {
     _userDAO = new UserDAO(container);
 }
Esempio n. 47
0
 public BonusDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 48
0
 public CampaignDAO(IContextContainer container)
     : base(container)
 {
 }
 public PaypalPaymentDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 50
0
 public UserManager(IContextContainer container)
     : base(container)
 {
     _userDAO = new UserDAO(container);
 }
 public ValidationService(IContextContainer contextContainer)
 {
     _contextContainer = contextContainer;
 }
 public ShoppingCartDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 53
0
 public ShoppingCartManager(IContextContainer container)
     : base(container)
 {
     _shoppingCartDAO = new ShoppingCartDAO(container);
     _productDAO      = new ProductDAO(container);
 }
Esempio n. 54
0
 public AttributeManager(IContextContainer container)
     : base(container)
 {
     _attributeDAO = new AttributeDAO(container);
 }
Esempio n. 55
0
 public BrandManager(IContextContainer container)
     : base(container)
 {
     _brandDAO = new BrandDAO(container);
 }
Esempio n. 56
0
 public CustomerDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 57
0
 public BaseDAO(IContextContainer container)
 {
     Context = (privEntities)container.Current;
 }
Esempio n. 58
0
 public CategoryDAO(IContextContainer container)
     : base(container)
 {
 }
Esempio n. 59
0
 public CelestialObjectConnector(IContextContainer contextContainer) :
     base(contextContainer)
 {
 }
 public InvitationManager(IContextContainer container)
     : base(container)
 {
     _invititationDAO = new InvitationDAO (container);
 }