Exemple #1
0
        protected void ExportBySalesButton_Click(Object sender, EventArgs e)
        {
            GenericExportManager <CommerceBuilder.Reporting.ProductSummary> exportManager = GenericExportManager <CommerceBuilder.Reporting.ProductSummary> .Instance;
            GenericExportOptions <CommerceBuilder.Reporting.ProductSummary> options       = new GenericExportOptions <CommerceBuilder.Reporting.ProductSummary>();

            options.CsvFields = new string[] { "ProductId", "Name", "TotalPrice", "TotalQuantity" };

            CacheWrapper cacheWrapper = Cache[_SalesCacheKey] as CacheWrapper;
            Dictionary <string, object> salesData;
            IList <CommerceBuilder.Reporting.ProductSummary> productSales = null;
            DateTime localNow   = LocaleHelper.LocalNow;
            DateTime last60Days = (new DateTime(localNow.Year, localNow.Month, localNow.Day, 0, 0, 0)).AddDays(-60);

            if (cacheWrapper == null)
            {
                productSales = ReportDataSource.GetSalesByProduct(last60Days, DateTime.MaxValue, 8, 0, "TotalPrice DESC");

                //CACHE THE DATA
                salesData = new Dictionary <string, object>();
                salesData["DataSource"] = productSales;
                cacheWrapper            = new CacheWrapper(salesData);
                Cache.Remove(_SalesCacheKey);
                Cache.Add(_SalesCacheKey, cacheWrapper, null, DateTime.UtcNow.AddMinutes(5).AddSeconds(-1), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.High, null);
            }
            else
            {
                //USE CACHED VALUES
                salesData    = (Dictionary <string, object>)cacheWrapper.CacheValue;
                productSales = (List <CommerceBuilder.Reporting.ProductSummary>)salesData["DataSource"];
            }

            options.ExportData = productSales;
            options.FileTag    = string.Format("POPULAR_PRODUCTS_BY_SALES((from_{0}_to_{1})", localNow.ToShortDateString(), last60Days.ToShortDateString());
            exportManager.BeginExport(options);
        }
Exemple #2
0
        protected void ExportButton_Click(Object sender, EventArgs e)
        {
            GenericExportManager <SalesSummary> exportManager = GenericExportManager <SalesSummary> .Instance;
            GenericExportOptions <SalesSummary> options       = new GenericExportOptions <SalesSummary>();

            options.CsvFields = new string[] { "StartDate", "OrderCount", "ProductTotal", "CostOfGoodTotal", "ShippingTotal", "TaxTotal", "DiscountTotal", "CouponTotal", "GiftWrapTotal", "OtherTotal", "ProfitTotal", "GrandTotal" };

            DateTime fromDate = StartDate.SelectedStartDate;
            DateTime toDate   = EndDate.SelectedEndDate;

            if (_MonthlySales == null)
            {
                _MonthlySales = ReportDataSource.GetMonthlySales(fromDate, toDate);

                // FILTER OUT RESULTS FOR GRID DISPLAY
                for (int i = (_MonthlySales.Count - 1); i >= 0; i--)
                {
                    if (_MonthlySales[i].OrderCount == 0)
                    {
                        _MonthlySales.RemoveAt(i);
                    }
                }
            }

            options.ExportData = _MonthlySales;
            options.FileTag    = string.Format("SALES_OVER_TIME(from_{0}_to_{1})", fromDate.ToShortDateString(), toDate.ToShortDateString());
            exportManager.BeginExport(options);
        }
Exemple #3
0
        protected void ExportButton_Click(Object sender, EventArgs e)
        {
            GenericExportManager <SearchTermsSummary> exportManager = GenericExportManager <SearchTermsSummary> .Instance;
            GenericExportOptions <SearchTermsSummary> options       = new GenericExportOptions <SearchTermsSummary>();

            options.CsvFields = new string[] { "SearchTerm", "TotalCount" };

            IList <SearchTermsSummary> reportData = ReportDataSource.LoadSearchTermsSummary("TotalCount DESC");

            options.ExportData = reportData;
            options.FileTag    = "Customer_Search_History";
            exportManager.BeginExport(options);
        }
Exemple #4
0
        protected void ExportButton_Click(Object sender, EventArgs e)
        {
            DateTime fromDate = StartDate.SelectedStartDate;
            DateTime toDate   = EndDate.SelectedEndDate;
            IList <CouponSummary> couponSummaries = ReportDataSource.GetSalesByCoupon(fromDate, toDate, string.Empty, "OrderTotal DESC");

            GenericExportManager <CouponSummary> exportManager = GenericExportManager <CouponSummary> .Instance;
            GenericExportOptions <CouponSummary> options       = new GenericExportOptions <CouponSummary>();

            options.CsvFields  = new string[] { "CouponCode", "OrderCount", "OrderTotal" };
            options.ExportData = couponSummaries;
            options.FileTag    = string.Format("SALES_BY_COUPON(from:_{0}_to_{1})", fromDate.ToShortDateString(), toDate.ToShortDateString());
            exportManager.BeginExport(options);
        }
        protected void ExportButton_Click(Object sender, EventArgs e)
        {
            GenericExportManager <ReferrerSalesSummary> exportManager = GenericExportManager <ReferrerSalesSummary> .Instance;
            GenericExportOptions <ReferrerSalesSummary> options       = new GenericExportOptions <ReferrerSalesSummary>();

            options.CsvFields = new string[] { "Referrer", "OrderCount", "ProductSubtotal", "SalesTotal" };

            DateTime fromDate = AlwaysConvert.ToDateTime(HiddenStartDate.Value);
            DateTime toDate   = AlwaysConvert.ToDateTime(HiddenEndDate.Value);
            IList <ReferrerSalesSummary> reportData = ReportDataSource.GetSalesByReferrer(fromDate, toDate, "OrderCount DESC");

            options.ExportData = reportData;
            options.FileTag    = string.Format("SALES_BY_REFERRER(from_{0}_to_{1})", fromDate.ToShortDateString(), toDate.ToShortDateString());
            exportManager.BeginExport(options);
        }
Exemple #6
0
        protected void ExportButton_Click(Object sender, EventArgs e)
        {
            GenericExportManager <ProductBreakdownSummary> exportManager = GenericExportManager <ProductBreakdownSummary> .Instance;
            GenericExportOptions <ProductBreakdownSummary> options       = new GenericExportOptions <ProductBreakdownSummary>();

            options.CsvFields = new string[] { "Name", "Sku", "Vendor", "Quantity", "CostOfGoods", "Amount" };

            DateTime fromDate = StartDate.SelectedStartDate;
            DateTime toDate   = EndDate.SelectedEndDate;
            IList <ProductBreakdownSummary> reportData = ReportDataSource.GetProductBreakdownSummary(fromDate, toDate, AlwaysConvert.ToInt(VendorList.SelectedValue), "Amount DESC");

            options.ExportData = reportData;
            options.FileTag    = string.Format("SALES_BY_PRODUCT(from_{0}_to_{1})", fromDate.ToShortDateString(), toDate.ToShortDateString());
            exportManager.BeginExport(options);
        }
Exemple #7
0
        protected void ExportButton_Click(Object sender, EventArgs e)
        {
            GenericExportManager <AffiliateSalesSummary> exportManager = GenericExportManager <AffiliateSalesSummary> .Instance;
            GenericExportOptions <AffiliateSalesSummary> options       = new GenericExportOptions <AffiliateSalesSummary>();

            options.CsvFields = new string[] { "AffiliateName", "ReferralCount", "FormattedConversionRate", "OrderCount", "ProductSubtotal", "OrderTotal", "FormattedCommission" };

            DateTime fromDate = AlwaysConvert.ToDateTime(HiddenStartDate.Value);
            DateTime toDate   = AlwaysConvert.ToDateTime(HiddenEndDate.Value);
            IList <AffiliateSalesSummary> reportData = ReportDataSource.GetSalesByAffiliate(fromDate, toDate, 0);

            options.ExportData = reportData;
            options.FileTag    = string.Format("SALES_BY_AFFILIATE(from_{0}_to_{1})", fromDate.ToShortDateString(), toDate.ToShortDateString());
            exportManager.BeginExport(options);
        }
        protected void ExportButton_Click(Object sender, EventArgs e)
        {
            GenericExportManager <TaxReportSummaryItem> exportManager = GenericExportManager <TaxReportSummaryItem> .Instance;
            GenericExportOptions <TaxReportSummaryItem> options       = new GenericExportOptions <TaxReportSummaryItem>();

            options.CsvFields = new string[] { "TaxName", "LocCode", "TaxAmount" };

            DateTime fromDate     = StartDate.SelectedStartDate;
            DateTime toDate       = EndDate.SelectedEndDate;
            string   provinceCode = Province2.Visible ? Province2.SelectedValue : Province.Text.Trim();
            IList <TaxReportSummaryItem> taxes = TaxReportDataSource.LoadSummaries(CountryFilter.SelectedValue, provinceCode, AlwaysConvert.ToInt(ZoneFilter.SelectedValue), fromDate, toDate, "TaxName ASC");

            options.ExportData = taxes;
            options.FileTag    = string.Format("TAX_REPORT(from_{0}_to_{1})", fromDate.ToShortDateString(), toDate.ToShortDateString());
            exportManager.BeginExport(options);
        }
Exemple #9
0
        protected void ExportButton_Click(Object sender, EventArgs e)
        {
            GenericExportManager <CommerceBuilder.Reporting.OrderSummary> exportManager = GenericExportManager <CommerceBuilder.Reporting.OrderSummary> .Instance;
            GenericExportOptions <CommerceBuilder.Reporting.OrderSummary> options       = new GenericExportOptions <CommerceBuilder.Reporting.OrderSummary>();

            options.CsvFields = new string[] { "OrderNumber", "ProductTotal", "CostOfGoodTotal", "ShippingTotal", "TaxTotal", "DiscountTotal", "CouponTotal", "OtherTotal", "ProfitTotal", "GrandTotal" };

            DateTime reportDate = (DateTime)ViewState["ReportDate"];

            if (_DailySales == null)
            {
                _DailySales = ReportDataSource.GetDailySales(reportDate);
            }

            options.ExportData = _DailySales;
            options.FileTag    = string.Format("DAILY_SALES({0})", reportDate.ToShortDateString());
            exportManager.BeginExport(options);
        }
Exemple #10
0
        protected void ExportButton_Click(Object sender, EventArgs e)
        {
            GenericExportManager <InventorySummary> exportManager = GenericExportManager <InventorySummary> .Instance;
            GenericExportOptions <InventorySummary> options       = new GenericExportOptions <InventorySummary>();

            options.CsvFields = new string[] { "Name", "InStock", "InStockWarningLevel", "AvailabilityDate", "VisibilityId" };

            IList <ProductInventoryDetail> inventoryDetail    = ProductInventoryDataSource.GetLowProductInventory((InventoryLevel)AlwaysConvert.ToByte(InventoryLevel.SelectedValue), AlwaysConvert.ToInt(Manufacturers.SelectedValue), AlwaysConvert.ToInt(Vendors.SelectedValue));
            IList <InventorySummary>       inventorySummaries = new List <InventorySummary>();

            foreach (ProductInventoryDetail detailItem in inventoryDetail)
            {
                inventorySummaries.Add(new InventorySummary(GetName(detailItem), detailItem.InStock, detailItem.InStockWarningLevel, detailItem.AvailabilityDate, detailItem.VisibilityId));
            }

            options.ExportData = inventorySummaries;
            options.FileTag    = string.Format("PRODUCT_LOW_INVENTORY({0})", LocaleHelper.LocalNow.ToShortDateString());
            exportManager.BeginExport(options);
        }
        protected void ExportByViewsButton_Click(Object sender, EventArgs e)
        {
            GenericExportManager <CategoryViewSummary> exportManager = GenericExportManager <CategoryViewSummary> .Instance;
            GenericExportOptions <CategoryViewSummary> options       = new GenericExportOptions <CategoryViewSummary>();

            options.CsvFields = new string[] { "CategoryName", "Views" };

            SortableCollection <KeyValuePair <ICatalogable, int> > categoryViews = PageViewDataSource.GetViewsByCategory("ViewCount DESC");

            // CONVERT TO SUMMARY LIST TO GENERATE CSV
            IList <CategoryViewSummary> viewsSummay = new List <CategoryViewSummary>();

            foreach (KeyValuePair <ICatalogable, int> dataRow in categoryViews)
            {
                viewsSummay.Add(new CategoryViewSummary(dataRow.Key.Name, dataRow.Value));
            }

            options.ExportData = viewsSummay;
            options.FileTag    = "POPULAR_CATEGORIES_BY_VIEWS";
            exportManager.BeginExport(options);
        }
Exemple #12
0
        protected void ExportByViewsButton_Click(Object sender, EventArgs e)
        {
            GenericExportManager <ProductViewSummary> exportManager = GenericExportManager <ProductViewSummary> .Instance;
            GenericExportOptions <ProductViewSummary> options       = new GenericExportOptions <ProductViewSummary>();

            options.CsvFields = new string[] { "ProductName", "Views" };

            CacheWrapper cacheWrapper = Cache[_ViewsCacheKey] as CacheWrapper;
            SortableCollection <KeyValuePair <ICatalogable, int> > productViews;
            Dictionary <string, object> viewsDataWrapper = null;
            IList <ProductViewSummary>  viewsSummay      = new List <ProductViewSummary>();

            if (cacheWrapper == null)
            {
                //GET VIEWS
                productViews = PageViewDataSource.GetViewsByProduct(50, 0, "ViewCount DESC");
                //CACHE THE DATA
                viewsDataWrapper = new Dictionary <string, object>();
                viewsDataWrapper["DataSource"] = productViews;
                cacheWrapper = new CacheWrapper(viewsDataWrapper);
                Cache.Remove(_ViewsCacheKey);
                Cache.Add(_ViewsCacheKey, cacheWrapper, null, DateTime.UtcNow.AddMinutes(5).AddSeconds(-1), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.NotRemovable, null);
            }
            else
            {
                //USE CACHED VALUES
                viewsDataWrapper = (Dictionary <string, object>)cacheWrapper.CacheValue;
                productViews     = (SortableCollection <KeyValuePair <ICatalogable, int> >)viewsDataWrapper["DataSource"];
            }

            // CONVERT TO SUMMARY LIST TO GENERATE CSV
            foreach (KeyValuePair <ICatalogable, int> dataRow in productViews)
            {
                viewsSummay.Add(new ProductViewSummary(dataRow.Key.Name, dataRow.Value));
            }

            options.ExportData = viewsSummay;
            options.FileTag    = "POPULAR_PRODUCTS_BY_VIEWS";
            exportManager.BeginExport(options);
        }