예제 #1
0
    private void RefreshGrid()
    {
        if (!MainContext.IsPostBack)
        {
            uxPagingControl.ItemsPerPages = AdminConfig.OrderItemsPerPage;
        }
        int totalItems;

        PeriodType period = ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue);

        if (period == PeriodType.Custom)
        {
            string errorMessage;
            if (VerifyCustomInput(out errorMessage))
            {
                LoadCustomInput();
            }
            else
            {
                uxMessage.DisplayError(errorMessage);
                uxMessage1.Visible = false;
                return;
            }
        }
        else
        {
            ReportFilterUtilities.GetOrderDateRange(period, out _startOrderDate, out _endOrderDate);
        }

        BestSellingReportBuilder bestSellingReportBuilder = new BestSellingReportBuilder();
        DataTable table = bestSellingReportBuilder.GetBestSellingReportData(
            GridHelper.GetFullSortText(),
            StoreContext.Culture.CultureID,
            period,
            ReportFilterUtilities.ConvertToBestSellReportType(uxReportDrop.SelectedValue),
            uxNumberItemsDrop.SelectedItem.ToString(),
            StoreContext.CurrentStore.StoreID,
            _startOrderDate,
            _endOrderDate,
            uxPagingControl.StartIndex,
            uxPagingControl.EndIndex,
            out totalItems);

        if (table.Rows.Count > 0)
        {
            uxTitleLabel.Visible = true;
            setTitle();
        }
        else
        {
            uxTitleLabel.Visible = false;
        }

        uxPagingControl.NumberOfPages = (int)Math.Ceiling((double)totalItems / uxPagingControl.ItemsPerPages);
        uxGrid.DataSource             = table;
        uxGrid.DataBind();
        setCustomDateDisplay();
    }
예제 #2
0
    protected void RefreshGrid()
    {
        IList <Order> orderList = DataAccessContext.OrderRepository.GetLastestOrder(5);

        uxLastestOrderGrid.DataSource = orderList;
        uxLastestOrderGrid.DataBind();

        BestSellingReportBuilder bestSellingReportBuilder = new BestSellingReportBuilder();
        DataTable tablebestSelling = bestSellingReportBuilder.GetBestSellingReportData(
            "ProductPrice DESC",
            StoreContext.Culture.CultureID,
            PeriodType.Custom,
            BestSellReportType.NumberOfProduct,
            "5",
            "0",
            DateTime.Now.AddYears(-100),
            DateTime.Now);

        uxBestSellerGrid.DataSource = tablebestSelling;
        uxBestSellerGrid.DataBind();

        uxGridCustomer.DataSource = DataAccessContext.CustomerRepository.GetLastestCustomers(5);
        uxGridCustomer.DataBind();
    }