Пример #1
0
        /// <summary>
        /// Returns an Order object with the specified ID
        /// </summary>
        public static Order GetOrderByID(int orderID)
        {
            Order  order = null;
            string key   = "Store_Order_" + orderID.ToString();

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                order = (Order)BizObject.Cache[key];
            }
            else
            {
                order = GetOrderFromOrderDetails(SiteProvider.Store.GetOrderByID(orderID));
                BaseStore.CacheData(key, order);
            }
            return(order);
        }
Пример #2
0
        /// <summary>
        /// Returns an Product object with the specified ID
        /// </summary>
        public static Product GetProductByID(int productID)
        {
            Product product = null;
            string  key     = "Store_Product_" + productID.ToString();

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                product = (Product)BizObject.Cache[key];
            }
            else
            {
                product = GetProductFromProductDetails(SiteProvider.Store.GetProductByID(productID));
                BaseStore.CacheData(key, product);
            }
            return(product);
        }
Пример #3
0
        /// <summary>
        /// Returns the number of total products
        /// </summary>
        public static int GetProductCount()
        {
            int    productCount = 0;
            string key          = "Store_ProductCount";

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                productCount = (int)BizObject.Cache[key];
            }
            else
            {
                productCount = SiteProvider.Store.GetProductCount();
                BaseStore.CacheData(key, productCount);
            }
            return(productCount);
        }
Пример #4
0
        /// <summary>
        /// Returns a OrderStatus object with the specified ID
        /// </summary>
        public static OrderStatus GetOrderStatusByID(int orderStatusID)
        {
            OrderStatus orderStatus = null;
            string      key         = "Store_OrderStatus_" + orderStatusID.ToString();

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                orderStatus = (OrderStatus)BizObject.Cache[key];
            }
            else
            {
                orderStatus = GetOrderStatusFromOrderStatusDetails(SiteProvider.Store.GetOrderStatusByID(orderStatusID));
                BaseStore.CacheData(key, orderStatus);
            }
            return(orderStatus);
        }
Пример #5
0
        /// <summary>
        /// Returns a ShippingMethod object with the specified ID
        /// </summary>
        public static ShippingMethod GetShippingMethodByID(int shippingMethodID)
        {
            ShippingMethod shippingMethod = null;
            string         key            = "Store_ShippingMethod_" + shippingMethodID.ToString();

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                shippingMethod = (ShippingMethod)BizObject.Cache[key];
            }
            else
            {
                shippingMethod = GetShippingMethodFromShippingMethodDetails(SiteProvider.Store.GetShippingMethodByID(shippingMethodID));
                BaseStore.CacheData(key, shippingMethod);
            }
            return(shippingMethod);
        }
Пример #6
0
        /// <summary>
        /// Returns a Department object with the specified ID
        /// </summary>
        public static Department GetDepartmentByID(int departmentID)
        {
            Department department = null;
            string     key        = "Store_Department_" + departmentID.ToString();

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                department = (Department)BizObject.Cache[key];
            }
            else
            {
                department = GetDepartmentFromDepartmentDetails(SiteProvider.Store.GetDepartmentByID(departmentID));
                BaseStore.CacheData(key, department);
            }
            return(department);
        }
Пример #7
0
        /***********************************
         * Static methods
         ************************************/

        /// <summary>
        /// Returns a collection with all the order statuses
        /// </summary>
        public static List <OrderStatus> GetOrderStatuses()
        {
            List <OrderStatus> orderStatuses = null;
            string             key           = "Store_OrderStatuses";

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                orderStatuses = (List <OrderStatus>)BizObject.Cache[key];
            }
            else
            {
                List <OrderStatusDetails> recordset = SiteProvider.Store.GetOrderStatuses();
                orderStatuses = GetOrderStatusListFromOrderStatusDetailsList(recordset);
                BaseStore.CacheData(key, orderStatuses);
            }
            return(orderStatuses);
        }
Пример #8
0
        /***********************************
         * Static methods
         ************************************/

        /// <summary>
        /// Returns a collection with all the shipping methods
        /// </summary>
        public static List <ShippingMethod> GetShippingMethods()
        {
            List <ShippingMethod> shippingMethods = null;
            string key = "Store_ShippingMethods";

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                shippingMethods = (List <ShippingMethod>)BizObject.Cache[key];
            }
            else
            {
                List <ShippingMethodDetails> recordset = SiteProvider.Store.GetShippingMethods();
                shippingMethods = GetShippingMethodListFromShippingMethodDetailsList(recordset);
                BaseStore.CacheData(key, shippingMethods);
            }
            return(shippingMethods);
        }
Пример #9
0
        /// <summary>
        /// Returns a collection with all the order for the specified customer
        /// </summary>
        public static List <Order> GetOrders(string customerName)
        {
            List <Order> orders = null;
            string       key    = "Store_Orders_" + customerName;

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                orders = (List <Order>)BizObject.Cache[key];
            }
            else
            {
                List <OrderDetails> recordset = SiteProvider.Store.GetOrders(customerName);
                orders = GetOrderListFromOrderDetailsList(recordset);
                BaseStore.CacheData(key, orders);
            }
            return(orders);
        }
Пример #10
0
        /***********************************
         * Static methods
         ************************************/

        /// <summary>
        /// Returns a collection with all the departments
        /// </summary>
        public static List <Department> GetDepartments()
        {
            List <Department> departments = null;
            string            key         = "Store_Departments";

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                departments = (List <Department>)BizObject.Cache[key];
            }
            else
            {
                List <DepartmentDetails> recordset = SiteProvider.Store.GetDepartments();
                departments = GetDepartmentListFromDepartmentDetailsList(recordset);
                BaseStore.CacheData(key, departments);
            }
            return(departments);
        }
Пример #11
0
        /***********************************
         * Static methods
         ************************************/

        /// <summary>
        /// Returns a collection with all the order in a specified state, and within
        /// the specified range of date
        /// </summary>
        public static List <Order> GetOrders(int statusID, DateTime fromDate, DateTime toDate)
        {
            toDate = toDate.AddDays(1).Subtract(new TimeSpan(toDate.Hour, toDate.Minute, toDate.Second));
            List <Order> orders = null;
            string       key    = "Store_Orders_" + statusID + "_" + fromDate.ToShortDateString() + "_" + toDate.ToShortDateString();

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                orders = (List <Order>)BizObject.Cache[key];
            }
            else
            {
                List <OrderDetails> recordset = SiteProvider.Store.GetOrders(statusID, fromDate, toDate);
                orders = GetOrderListFromOrderDetailsList(recordset);
                BaseStore.CacheData(key, orders);
            }
            return(orders);
        }
Пример #12
0
        /// <summary>
        /// Returns the number of total products for the specified department
        /// </summary>
        public static int GetProductCount(int departmentID)
        {
            if (departmentID <= 0)
            {
                return(GetProductCount());
            }

            int    productCount = 0;
            string key          = "Store_ProductCount_" + departmentID.ToString();

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                productCount = (int)BizObject.Cache[key];
            }
            else
            {
                productCount = SiteProvider.Store.GetProductCount(departmentID);
                BaseStore.CacheData(key, productCount);
            }
            return(productCount);
        }
Пример #13
0
        public static List <Product> GetProducts(string sortExpression, int startRowIndex, int maximumRows)
        {
            if (sortExpression == null)
            {
                sortExpression = "";
            }

            List <Product> products = null;
            string         key      = "Store_Products_" + sortExpression + "_" + startRowIndex.ToString() + "_" + maximumRows.ToString();

            if (BaseStore.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                products = (List <Product>)BizObject.Cache[key];
            }
            else
            {
                List <ProductDetails> recordset = SiteProvider.Store.GetProducts(
                    sortExpression, GetPageIndex(startRowIndex, maximumRows), maximumRows);
                products = GetProductListFromProductDetailsList(recordset);
                BaseStore.CacheData(key, products);
            }
            return(products);
        }