public override List <ParentCategory> GetParentCategoryList(int categoryID)
        {
            List <ParentCategory> list = new List <ParentCategory>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                using (SqlCommand command = new SqlCommand("SuCommerce_ParentCategoriesByID_Get", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@categoryID", SqlDbType.Int, 4).Value = categoryID;
                    connection.Open();
                    using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                    {
                        ParentCategory category = null;
                        while (reader.Read())
                        {
                            category = new ParentCategory();
                            CommerceDataProvider.PopulateParentCategoryList(reader, category);
                            list.Add(category);
                        }
                        reader.Close();
                        connection.Close();
                    }
                    return(list);
                }
            }
        }
        public override PaymentService GetPaymentService(int _paymentServiceID, bool _getPrimaryService)
        {
            PaymentService service = new PaymentService();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                SqlCommand command = new SqlCommand("SuCommerce_PaymentService_Get", connection)
                {
                    CommandType = CommandType.StoredProcedure
                };
                command.Parameters.Add("@paymentServiceID", SqlDbType.Int, 4).Value  = _paymentServiceID;
                command.Parameters.Add("@getPrimaryService", SqlDbType.Bit, 1).Value = _getPrimaryService;
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (reader.Read())
                    {
                        CommerceDataProvider.PopulatePaymentServiceList(reader, service, true);
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(service);
        }
        public override List <ProductLicense> GetLicensesByTransaction(string transactionXID)
        {
            List <ProductLicense> list = new List <ProductLicense>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                SqlCommand command = new SqlCommand("select * from SuCommerce_vw_Licenses where transactionXID = '" + transactionXID + "'", connection)
                {
                    CommandType = CommandType.Text
                };
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    ProductLicense license = null;
                    while (reader.Read())
                    {
                        license = new ProductLicense();
                        CommerceDataProvider.PopulateProductLicenseList(reader, license);
                        list.Add(license);
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(list);
        }
        public override List <ProductPackage> GetProductPackageList()
        {
            List <ProductPackage> list = new List <ProductPackage>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                string     cmdText = "select * from SuCommerce_ProductPackage";
                SqlCommand command = new SqlCommand(cmdText, connection)
                {
                    CommandType = CommandType.Text
                };
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    ProductPackage package = null;
                    while (reader.Read())
                    {
                        package = new ProductPackage();
                        CommerceDataProvider.PopulateProductPackageList(reader, package);
                        list.Add(package);
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(list);
        }
        public override List <PaymentService> GetPaymentServiceList()
        {
            List <PaymentService> list = new List <PaymentService>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                string     cmdText = "select * from SuCommerce_PaymentServices where paymentServiceID > 0 order by PaymentServiceID";
                SqlCommand command = new SqlCommand(cmdText, connection)
                {
                    CommandType = CommandType.Text
                };
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    PaymentService service = null;
                    while (reader.Read())
                    {
                        service = new PaymentService();
                        CommerceDataProvider.PopulatePaymentServiceList(reader, service, false);
                        list.Add(service);
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(list);
        }
        public override List <PurchaseTypeItem> GetPurchaseTypeItemList()
        {
            List <PurchaseTypeItem> list = new List <PurchaseTypeItem>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                string     cmdText = "select * from SuCommerce_PurchaseTypes where IsDisplayed = 1";
                SqlCommand command = new SqlCommand(cmdText, connection)
                {
                    CommandType = CommandType.Text
                };
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    PurchaseTypeItem item = null;
                    while (reader.Read())
                    {
                        item = new PurchaseTypeItem();
                        CommerceDataProvider.PopulatePurchaseTypeItemList(reader, item);
                        list.Add(item);
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(list);
        }
        public override List <ProductPurchase> GetProductPurchaseList()
        {
            List <ProductPurchase> list = new List <ProductPurchase>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                int        activityReportNum = CommerceSettings.Instance.ActivityReportNum;
                SqlCommand command           = new SqlCommand("select top " + activityReportNum + " * from SuCommerce_vw_Purchases order by PurchaseDateTime desc", connection)
                {
                    CommandType = CommandType.Text
                };
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    ProductPurchase purchase = null;
                    while (reader.Read())
                    {
                        purchase = new ProductPurchase();
                        CommerceDataProvider.PopulateProductPurchaseList(reader, purchase);
                        list.Add(purchase);
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(list);
        }
        public override List <ProductPurchase> GetUserPurchases(int userID)
        {
            List <ProductPurchase> list = new List <ProductPurchase>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                SqlCommand command = new SqlCommand("select * from SuCommerce_vw_Purchases where userID = " + userID + " order by PurchaseDateTime desc", connection)
                {
                    CommandType = CommandType.Text
                };
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    ProductPurchase purchase = null;
                    while (reader.Read())
                    {
                        purchase = new ProductPurchase();
                        CommerceDataProvider.PopulateProductPurchaseList(reader, purchase);
                        list.Add(purchase);
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(list);
        }
Example #9
0
        public static int CreateSueetieProduct(SueetieProduct sueetieProduct)
        {
            int num = CommerceDataProvider.LoadProvider().CreateSueetieProduct(sueetieProduct);

            CommerceCommon.ClearMarketplaceCache();
            return(num);
        }
        public override List <SueetieProduct> GetSueetieProductsByCategoryTree(int categoryID)
        {
            List <SueetieProduct> list = new List <SueetieProduct>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                using (SqlCommand command = new SqlCommand("SuCommerce_ProductsByCategory_Get", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@categoryID", SqlDbType.Int, 4).Value    = categoryID;
                    command.Parameters.Add("@contentTypeID", SqlDbType.Int, 4).Value = 0x12;
                    connection.Open();
                    using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                    {
                        SueetieProduct product = null;
                        while (reader.Read())
                        {
                            product = new SueetieProduct();
                            CommerceDataProvider.PopulateSueetieProductList(reader, product);
                            list.Add(product);
                        }
                        reader.Close();
                        connection.Close();
                    }
                    return(list);
                }
            }
        }
        public override List <CartLink> GetCartLinkList()
        {
            List <CartLink> list = new List <CartLink>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                string     cmdText = "select * from SuCommerce_vw_CartLinks";
                SqlCommand command = new SqlCommand(cmdText, connection)
                {
                    CommandType = CommandType.Text
                };
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    CartLink link = null;
                    while (reader.Read())
                    {
                        link = new CartLink();
                        CommerceDataProvider.PopulateCartLinkList(reader, link);
                        list.Add(link);
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(list);
        }
Example #12
0
 public static List <SueetieProduct> GetSueetieProductList(bool getCached)
 {
     if (getCached)
     {
         return(GetSueetieProductList());
     }
     return(CommerceDataProvider.LoadProvider().GetSueetieProductList());
 }
Example #13
0
        public static int RecordPurchase(ProductPurchase productPurchase)
        {
            int num = -1;

            num = CommerceDataProvider.LoadProvider().RecordPurchase(productPurchase);
            ClearProductPurchaseListCache();
            return(num);
        }
Example #14
0
        public static int AddPhoto(ProductPhoto productPhoto)
        {
            int num = -1;

            num = CommerceDataProvider.LoadProvider().AddPhoto(productPhoto);
            ClearProductPhotoListCache();
            return(num);
        }
        public static bool RemoveProductCategory(int categoryID)
        {
            int num = 0;

            if (categoryID != 0)
            {
                num = CommerceDataProvider.LoadProvider().RemoveCategory(categoryID);
            }
            return(num > 0);
        }
Example #16
0
        public static List <PurchaseTypeItem> GetPurchaseTypeItemList()
        {
            string key = PurchaseTypeItemListCacheKey();
            List <PurchaseTypeItem> purchaseTypeItemList = SueetieCache.Current[key] as List <PurchaseTypeItem>;

            if (purchaseTypeItemList == null)
            {
                purchaseTypeItemList = CommerceDataProvider.LoadProvider().GetPurchaseTypeItemList();
                SueetieCache.Current.Insert(key, purchaseTypeItemList);
            }
            return(purchaseTypeItemList);
        }
Example #17
0
        public static PaymentService GetPrimaryPaymentService()
        {
            string         key            = PaymentServiceCacheKey();
            PaymentService paymentService = SueetieCache.Current[key] as PaymentService;

            if (paymentService == null)
            {
                paymentService = CommerceDataProvider.LoadProvider().GetPaymentService(-1, true);
                SueetieCache.Current.Insert(key, paymentService);
            }
            return(paymentService);
        }
Example #18
0
        public static void SetAdPreviewPhoto(int productID, int photoID)
        {
            CommerceDataProvider provider     = CommerceDataProvider.LoadProvider();
            ProductPhoto         productPhoto = new ProductPhoto
            {
                PhotoID   = photoID,
                ProductID = productID
            };

            provider.SetPreviewPhoto(productPhoto);
            CommerceCommon.ClearMarketplaceCache();
        }
Example #19
0
        public static List <CartLink> GetCartLinkList()
        {
            string          key          = CartLinkListCacheKey();
            List <CartLink> cartLinkList = SueetieCache.Current[key] as List <CartLink>;

            if (cartLinkList == null)
            {
                cartLinkList = CommerceDataProvider.LoadProvider().GetCartLinkList();
                SueetieCache.Current.Insert(key, cartLinkList);
            }
            return(cartLinkList);
        }
Example #20
0
        public static List <ActionTypeItem> GetActionTypeItemList()
        {
            string key = ActionTypeItemListCacheKey();
            List <ActionTypeItem> actionTypeItemList = SueetieCache.Current[key] as List <ActionTypeItem>;

            if (actionTypeItemList == null)
            {
                actionTypeItemList = CommerceDataProvider.LoadProvider().GetActionTypeItemList();
                SueetieCache.Current.Insert(key, actionTypeItemList);
            }
            return(actionTypeItemList);
        }
Example #21
0
        public static List <SueetieProduct> GetSueetieProductList()
        {
            string key = SueetieProductListCacheKey();
            List <SueetieProduct> sueetieProductList = SueetieCache.Current[key] as List <SueetieProduct>;

            if (sueetieProductList == null)
            {
                sueetieProductList = CommerceDataProvider.LoadProvider().GetSueetieProductList();
                SueetieCache.Current.Insert(key, sueetieProductList);
            }
            return(sueetieProductList);
        }
Example #22
0
        public static List <ProductPurchase> GetProductPurchaseList()
        {
            string key = ProductPurchaseListCacheKey();
            List <ProductPurchase> productPurchaseList = SueetieCache.Current[key] as List <ProductPurchase>;

            if (productPurchaseList == null)
            {
                productPurchaseList = CommerceDataProvider.LoadProvider().GetProductPurchaseList();
                SueetieCache.Current.Insert(key, productPurchaseList);
            }
            return(productPurchaseList);
        }
Example #23
0
        public static List <SueetieProduct> GetSueetieProductsByCategoryTree(int categoryID)
        {
            string key = SueetieProductListTreeCacheKey(categoryID);
            List <SueetieProduct> sueetieProductsByCategoryTree = SueetieCache.Current[key] as List <SueetieProduct>;

            if (sueetieProductsByCategoryTree == null)
            {
                sueetieProductsByCategoryTree = CommerceDataProvider.LoadProvider().GetSueetieProductsByCategoryTree(categoryID);
                SueetieCache.Current.Insert(key, sueetieProductsByCategoryTree);
            }
            return(sueetieProductsByCategoryTree.LicensedProductListByCategory());
        }
Example #24
0
 public static CommerceDataProvider LoadProvider()
 {
     _provider = SueetieCache.Current[providerKey] as CommerceDataProvider;
     if (_provider == null)
     {
         lock (_lock)
         {
             if (_provider == null)
             {
                 SueetieConfiguration configuration = SueetieConfiguration.Get();
                 SueetieProvider      provider      = configuration.SueetieProviders.Find(sp => sp.Name == "MarketplaceSqlDataProvider");
                 _provider = Activator.CreateInstance(Type.GetType(provider.ProviderType), new object[] { provider.ConnectionString }) as CommerceDataProvider;
                 SueetieCache.Current.InsertMax(providerKey, _provider, new CacheDependency(configuration.ConfigPath));
             }
         }
     }
     return(_provider);
 }
        public override ProductPurchase GetProductPurchase(int purchaseID)
        {
            ProductPurchase purchase = new ProductPurchase();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                SqlCommand command = new SqlCommand("select * from SuCommerce_vw_Purchases where purchaseID = " + purchaseID, connection)
                {
                    CommandType = CommandType.Text
                };
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (reader.Read())
                    {
                        CommerceDataProvider.PopulateProductPurchaseList(reader, purchase);
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(purchase);
        }
 public static int AddProductCategory(ProductCategory productCategory)
 {
     return(CommerceDataProvider.LoadProvider().AddProductCategory(productCategory));
 }
Example #27
0
 public static List <ProductPurchase> GetUserPurchases(int userID)
 {
     return(CommerceDataProvider.LoadProvider().GetUserPurchases(userID));
 }
Example #28
0
 public static List <ProductPurchase> GetPurchasesByTransaction(string transactionXID)
 {
     return(CommerceDataProvider.LoadProvider().GetPurchasesByTransaction(transactionXID));
 }
Example #29
0
 public static ProductPurchase GetProductPurchase(int purchaseID)
 {
     return(CommerceDataProvider.LoadProvider().GetProductPurchase(purchaseID));
 }
 public static void UpdateProductCategory(ProductCategory productCategory)
 {
     CommerceDataProvider.LoadProvider().UpdateProductCategory(productCategory);
 }