Ejemplo n.º 1
0
        public static OrderItem Load(Int32 orderItemId, bool useCache)
        {
            if (orderItemId == 0)
            {
                return(null);
            }
            OrderItem orderItem = null;
            string    key       = "OrderItem_" + orderItemId.ToString();

            if (useCache)
            {
                orderItem = ContextCache.GetObject(key) as OrderItem;
                if (orderItem != null)
                {
                    return(orderItem);
                }
            }
            orderItem = new OrderItem();
            if (orderItem.Load(orderItemId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, orderItem);
                }
                return(orderItem);
            }
            return(null);
        }
        public static Manufacturer Load(Int32 manufacturerId, bool useCache)
        {
            if (manufacturerId == 0)
            {
                return(null);
            }
            Manufacturer manufacturer = null;
            string       key          = "Manufacturer_" + manufacturerId.ToString();

            if (useCache)
            {
                manufacturer = ContextCache.GetObject(key) as Manufacturer;
                if (manufacturer != null)
                {
                    return(manufacturer);
                }
            }
            manufacturer = new Manufacturer();
            if (manufacturer.Load(manufacturerId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, manufacturer);
                }
                return(manufacturer);
            }
            return(null);
        }
Ejemplo n.º 3
0
        public static Store Load(Int32 storeId, bool useCache)
        {
            if (storeId == 0)
            {
                return(null);
            }
            Store  store = null;
            string key   = "Store_" + storeId.ToString();

            if (useCache)
            {
                store = ContextCache.GetObject(key) as Store;
                if (store != null)
                {
                    return(store);
                }
            }
            store = new Store();
            if (store.Load(storeId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, store);
                }
                return(store);
            }
            return(null);
        }
Ejemplo n.º 4
0
        public static UserSetting Load(Int32 userSettingId, bool useCache)
        {
            if (userSettingId == 0)
            {
                return(null);
            }
            UserSetting userSetting = null;
            string      key         = "UserSetting_" + userSettingId.ToString();

            if (useCache)
            {
                userSetting = ContextCache.GetObject(key) as UserSetting;
                if (userSetting != null)
                {
                    return(userSetting);
                }
            }
            userSetting = new UserSetting();
            if (userSetting.Load(userSettingId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, userSetting);
                }
                return(userSetting);
            }
            return(null);
        }
        public static Link Load(Int32 linkId, bool useCache)
        {
            if (linkId == 0)
            {
                return(null);
            }
            Link   link = null;
            string key  = "Link_" + linkId.ToString();

            if (useCache)
            {
                link = ContextCache.GetObject(key) as Link;
                if (link != null)
                {
                    return(link);
                }
            }
            link = new Link();
            if (link.Load(linkId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, link);
                }
                return(link);
            }
            return(null);
        }
        public static Special Load(Int32 specialId, bool useCache)
        {
            if (specialId == 0)
            {
                return(null);
            }
            Special special = null;
            string  key     = "Special_" + specialId.ToString();

            if (useCache)
            {
                special = ContextCache.GetObject(key) as Special;
                if (special != null)
                {
                    return(special);
                }
            }
            special = new Special();
            if (special.Load(specialId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, special);
                }
                return(special);
            }
            return(null);
        }
        public static PaymentMethod Load(Int32 paymentMethodId, bool useCache)
        {
            if (paymentMethodId == 0)
            {
                return(null);
            }
            PaymentMethod paymentMethod = null;
            string        key           = "PaymentMethod_" + paymentMethodId.ToString();

            if (useCache)
            {
                paymentMethod = ContextCache.GetObject(key) as PaymentMethod;
                if (paymentMethod != null)
                {
                    return(paymentMethod);
                }
            }
            paymentMethod = new PaymentMethod();
            if (paymentMethod.Load(paymentMethodId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, paymentMethod);
                }
                return(paymentMethod);
            }
            return(null);
        }
        public static User Load(Int32 userId, bool useCache)
        {
            if (userId == 0)
            {
                return(null);
            }
            User   user = null;
            string key  = "User_" + userId.ToString();

            if (useCache)
            {
                user = ContextCache.GetObject(key) as User;
                if (user != null)
                {
                    return(user);
                }
            }
            user = new User();
            if (user.Load(userId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, user);
                }
                return(user);
            }
            return(null);
        }
        public static Role Load(Int32 roleId, bool useCache)
        {
            if (roleId == 0)
            {
                return(null);
            }
            Role   role = null;
            string key  = "Role_" + roleId.ToString();

            if (useCache)
            {
                role = ContextCache.GetObject(key) as Role;
                if (role != null)
                {
                    return(role);
                }
            }
            role = new Role();
            if (role.Load(roleId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, role);
                }
                return(role);
            }
            return(null);
        }
Ejemplo n.º 10
0
        public static GiftCertificateTransaction Load(Int32 giftCertificateTransactionId, bool useCache)
        {
            if (giftCertificateTransactionId == 0)
            {
                return(null);
            }
            GiftCertificateTransaction giftCertificateTransaction = null;
            string key = "GiftCertificateTransaction_" + giftCertificateTransactionId.ToString();

            if (useCache)
            {
                giftCertificateTransaction = ContextCache.GetObject(key) as GiftCertificateTransaction;
                if (giftCertificateTransaction != null)
                {
                    return(giftCertificateTransaction);
                }
            }
            giftCertificateTransaction = new GiftCertificateTransaction();
            if (giftCertificateTransaction.Load(giftCertificateTransactionId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, giftCertificateTransaction);
                }
                return(giftCertificateTransaction);
            }
            return(null);
        }
        public static Basket Load(Int32 basketId, bool useCache)
        {
            if (basketId == 0)
            {
                return(null);
            }
            Basket basket = null;
            string key    = "Basket_" + basketId.ToString();

            if (useCache)
            {
                basket = ContextCache.GetObject(key) as Basket;
                if (basket != null)
                {
                    return(basket);
                }
            }
            basket = new Basket();
            if (basket.Load(basketId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, basket);
                }
                return(basket);
            }
            return(null);
        }
Ejemplo n.º 12
0
        public static AuditEvent Load(Int32 auditEventId, bool useCache)
        {
            if (auditEventId == 0)
            {
                return(null);
            }
            AuditEvent auditEvent = null;
            string     key        = "AuditEvent_" + auditEventId.ToString();

            if (useCache)
            {
                auditEvent = ContextCache.GetObject(key) as AuditEvent;
                if (auditEvent != null)
                {
                    return(auditEvent);
                }
            }
            auditEvent = new AuditEvent();
            if (auditEvent.Load(auditEventId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, auditEvent);
                }
                return(auditEvent);
            }
            return(null);
        }
        public static ShipMethod Load(Int32 shipMethodId, bool useCache)
        {
            if (shipMethodId == 0)
            {
                return(null);
            }
            ShipMethod shipMethod = null;
            string     key        = "ShipMethod_" + shipMethodId.ToString();

            if (useCache)
            {
                shipMethod = ContextCache.GetObject(key) as ShipMethod;
                if (shipMethod != null)
                {
                    return(shipMethod);
                }
            }
            shipMethod = new ShipMethod();
            if (shipMethod.Load(shipMethodId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, shipMethod);
                }
                return(shipMethod);
            }
            return(null);
        }
Ejemplo n.º 14
0
        public static ProductTemplateField Load(Int32 productTemplateFieldId, bool useCache)
        {
            if (productTemplateFieldId == 0)
            {
                return(null);
            }
            ProductTemplateField productTemplateField = null;
            string key = "ProductTemplateField_" + productTemplateFieldId.ToString();

            if (useCache)
            {
                productTemplateField = ContextCache.GetObject(key) as ProductTemplateField;
                if (productTemplateField != null)
                {
                    return(productTemplateField);
                }
            }
            productTemplateField = new ProductTemplateField();
            if (productTemplateField.Load(productTemplateFieldId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, productTemplateField);
                }
                return(productTemplateField);
            }
            return(null);
        }
Ejemplo n.º 15
0
        public static StoreSetting Load(Int32 storeSettingId, bool useCache)
        {
            if (storeSettingId == 0)
            {
                return(null);
            }
            StoreSetting storeSetting = null;
            string       key          = "StoreSetting_" + storeSettingId.ToString();

            if (useCache)
            {
                storeSetting = ContextCache.GetObject(key) as StoreSetting;
                if (storeSetting != null)
                {
                    return(storeSetting);
                }
            }
            storeSetting = new StoreSetting();
            if (storeSetting.Load(storeSettingId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, storeSetting);
                }
                return(storeSetting);
            }
            return(null);
        }
Ejemplo n.º 16
0
        public static SharedPersonalization Load(Int32 personalizationPathId, bool useCache)
        {
            if (personalizationPathId == 0)
            {
                return(null);
            }
            SharedPersonalization sharedPersonalization = null;
            string key = "SharedPersonalization_" + personalizationPathId.ToString();

            if (useCache)
            {
                sharedPersonalization = ContextCache.GetObject(key) as SharedPersonalization;
                if (sharedPersonalization != null)
                {
                    return(sharedPersonalization);
                }
            }
            sharedPersonalization = new SharedPersonalization();
            if (sharedPersonalization.Load(personalizationPathId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, sharedPersonalization);
                }
                return(sharedPersonalization);
            }
            return(null);
        }
        public static Vendor Load(Int32 vendorId, bool useCache)
        {
            if (vendorId == 0)
            {
                return(null);
            }
            Vendor vendor = null;
            string key    = "Vendor_" + vendorId.ToString();

            if (useCache)
            {
                vendor = ContextCache.GetObject(key) as Vendor;
                if (vendor != null)
                {
                    return(vendor);
                }
            }
            vendor = new Vendor();
            if (vendor.Load(vendorId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, vendor);
                }
                return(vendor);
            }
            return(null);
        }
        public static Order Load(Int32 orderId, bool useCache)
        {
            if (orderId == 0)
            {
                return(null);
            }
            Order  order = null;
            string key   = "Order_" + orderId.ToString();

            if (useCache)
            {
                order = ContextCache.GetObject(key) as Order;
                if (order != null)
                {
                    return(order);
                }
            }
            order = new Order();
            if (order.Load(orderId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, order);
                }
                return(order);
            }
            return(null);
        }
Ejemplo n.º 19
0
        public static Transaction Load(Int32 transactionId, bool useCache)
        {
            if (transactionId == 0)
            {
                return(null);
            }
            Transaction transaction = null;
            string      key         = "Transaction_" + transactionId.ToString();

            if (useCache)
            {
                transaction = ContextCache.GetObject(key) as Transaction;
                if (transaction != null)
                {
                    return(transaction);
                }
            }
            transaction = new Transaction();
            if (transaction.Load(transactionId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, transaction);
                }
                return(transaction);
            }
            return(null);
        }
Ejemplo n.º 20
0
        public static InputChoice Load(Int32 inputChoiceId, bool useCache)
        {
            if (inputChoiceId == 0)
            {
                return(null);
            }
            InputChoice inputChoice = null;
            string      key         = "InputChoice_" + inputChoiceId.ToString();

            if (useCache)
            {
                inputChoice = ContextCache.GetObject(key) as InputChoice;
                if (inputChoice != null)
                {
                    return(inputChoice);
                }
            }
            inputChoice = new InputChoice();
            if (inputChoice.Load(inputChoiceId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, inputChoice);
                }
                return(inputChoice);
            }
            return(null);
        }
        public static ProductDigitalGood Load(Int32 productDigitalGoodId, bool useCache)
        {
            if (productDigitalGoodId == 0)
            {
                return(null);
            }
            ProductDigitalGood productDigitalGood = null;
            string             key = "ProductDigitalGood_" + productDigitalGoodId.ToString();

            if (useCache)
            {
                productDigitalGood = ContextCache.GetObject(key) as ProductDigitalGood;
                if (productDigitalGood != null)
                {
                    return(productDigitalGood);
                }
            }
            productDigitalGood = new ProductDigitalGood();
            if (productDigitalGood.Load(productDigitalGoodId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, productDigitalGood);
                }
                return(productDigitalGood);
            }
            return(null);
        }
        public static Redirect Load(Int32 redirectId, bool useCache)
        {
            if (redirectId == 0)
            {
                return(null);
            }
            Redirect redirect = null;
            string   key      = "Redirect_" + redirectId.ToString();

            if (useCache)
            {
                redirect = ContextCache.GetObject(key) as Redirect;
                if (redirect != null)
                {
                    return(redirect);
                }
            }
            redirect = new Redirect();
            if (redirect.Load(redirectId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, redirect);
                }
                return(redirect);
            }
            return(null);
        }
Ejemplo n.º 23
0
        public static Currency Load(Int32 currencyId, bool useCache)
        {
            if (currencyId == 0)
            {
                return(null);
            }
            Currency currency = null;
            string   key      = "Currency_" + currencyId.ToString();

            if (useCache)
            {
                currency = ContextCache.GetObject(key) as Currency;
                if (currency != null)
                {
                    return(currency);
                }
            }
            currency = new Currency();
            if (currency.Load(currencyId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, currency);
                }
                return(currency);
            }
            return(null);
        }
        public static TrackingNumber Load(Int32 trackingNumberId, bool useCache)
        {
            if (trackingNumberId == 0)
            {
                return(null);
            }
            TrackingNumber trackingNumber = null;
            string         key            = "TrackingNumber_" + trackingNumberId.ToString();

            if (useCache)
            {
                trackingNumber = ContextCache.GetObject(key) as TrackingNumber;
                if (trackingNumber != null)
                {
                    return(trackingNumber);
                }
            }
            trackingNumber = new TrackingNumber();
            if (trackingNumber.Load(trackingNumberId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, trackingNumber);
                }
                return(trackingNumber);
            }
            return(null);
        }
        public static DigitalGood Load(Int32 digitalGoodId, bool useCache)
        {
            if (digitalGoodId == 0)
            {
                return(null);
            }
            DigitalGood digitalGood = null;
            string      key         = "DigitalGood_" + digitalGoodId.ToString();

            if (useCache)
            {
                digitalGood = ContextCache.GetObject(key) as DigitalGood;
                if (digitalGood != null)
                {
                    return(digitalGood);
                }
            }
            digitalGood = new DigitalGood();
            if (digitalGood.Load(digitalGoodId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, digitalGood);
                }
                return(digitalGood);
            }
            return(null);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Loads a Coupon object for the given coupon code
        /// </summary>
        /// <param name="couponCode">Coupon code for which to load the coupon</param>
        /// <returns>The Coupon object loaded</returns>
        public static Coupon LoadForCouponCode(string couponCode)
        {
            couponCode = couponCode.ToUpperInvariant();
            string key    = "Coupon_" + couponCode;
            Coupon coupon = ContextCache.GetObject(key) as Coupon;

            if (coupon != null)
            {
                return(coupon);
            }
            //CREATE THE DYNAMIC SQL TO LOAD OBJECT
            StringBuilder selectQuery = new StringBuilder();

            selectQuery.Append("SELECT CouponId");
            selectQuery.Append(" FROM ac_Coupons");
            selectQuery.Append(" WHERE CouponCode = @couponCode");
            selectQuery.Append(" AND StoreId = @storeId");
            Database  database      = Token.Instance.Database;
            DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString());

            database.AddInParameter(selectCommand, "@couponCode", System.Data.DbType.String, couponCode);
            database.AddInParameter(selectCommand, "@storeId", System.Data.DbType.Int32, Token.Instance.StoreId);
            int couponId = AlwaysConvert.ToInt(database.ExecuteScalar(selectCommand));

            if (couponId != 0)
            {
                coupon = CouponDataSource.Load(couponId);
                ContextCache.SetObject(key, coupon);
                return(coupon);
            }
            return(null);
        }
        public static VolumeDiscount Load(Int32 volumeDiscountId, bool useCache)
        {
            if (volumeDiscountId == 0)
            {
                return(null);
            }
            VolumeDiscount volumeDiscount = null;
            string         key            = "VolumeDiscount_" + volumeDiscountId.ToString();

            if (useCache)
            {
                volumeDiscount = ContextCache.GetObject(key) as VolumeDiscount;
                if (volumeDiscount != null)
                {
                    return(volumeDiscount);
                }
            }
            volumeDiscount = new VolumeDiscount();
            if (volumeDiscount.Load(volumeDiscountId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, volumeDiscount);
                }
                return(volumeDiscount);
            }
            return(null);
        }
Ejemplo n.º 28
0
        public static WishlistItem Load(Int32 wishlistItemId, bool useCache)
        {
            if (wishlistItemId == 0)
            {
                return(null);
            }
            WishlistItem wishlistItem = null;
            string       key          = "WishlistItem_" + wishlistItemId.ToString();

            if (useCache)
            {
                wishlistItem = ContextCache.GetObject(key) as WishlistItem;
                if (wishlistItem != null)
                {
                    return(wishlistItem);
                }
            }
            wishlistItem = new WishlistItem();
            if (wishlistItem.Load(wishlistItemId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, wishlistItem);
                }
                return(wishlistItem);
            }
            return(null);
        }
        public static WrapGroup Load(Int32 wrapGroupId, bool useCache)
        {
            if (wrapGroupId == 0)
            {
                return(null);
            }
            WrapGroup wrapGroup = null;
            string    key       = "WrapGroup_" + wrapGroupId.ToString();

            if (useCache)
            {
                wrapGroup = ContextCache.GetObject(key) as WrapGroup;
                if (wrapGroup != null)
                {
                    return(wrapGroup);
                }
            }
            wrapGroup = new WrapGroup();
            if (wrapGroup.Load(wrapGroupId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, wrapGroup);
                }
                return(wrapGroup);
            }
            return(null);
        }
Ejemplo n.º 30
0
        public static Subscription Load(Int32 subscriptionId, bool useCache)
        {
            if (subscriptionId == 0)
            {
                return(null);
            }
            Subscription subscription = null;
            string       key          = "Subscription_" + subscriptionId.ToString();

            if (useCache)
            {
                subscription = ContextCache.GetObject(key) as Subscription;
                if (subscription != null)
                {
                    return(subscription);
                }
            }
            subscription = new Subscription();
            if (subscription.Load(subscriptionId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, subscription);
                }
                return(subscription);
            }
            return(null);
        }