コード例 #1
0
    protected void uxExportButton_Click(object sender, EventArgs e)
    {
        string             message, message1, filePhysicalPathName, fileNameLinkText, fileNameLinkURL;
        CustomerReportType customerReportType = ReportFilterUtilities.ConvertToCustomerReportType(uxReportDrop.SelectedValue);

        filePhysicalPathName = Server.MapPath("../");

        if (customerReportType == CustomerReportType.UserRegistration)
        {
            CustomerReportExporter exporter = new CustomerReportExporter();
            fileNameLinkURL = exporter.ExportCustomerReportData(
                customerReportType,
                ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue),
                filePhysicalPathName,
                _startOrderDate,
                _endOrderDate,
                out message,
                out message1,
                out fileNameLinkText);
        }

        else
        {
            CustomerReportExporter exporter = new CustomerReportExporter();
            fileNameLinkURL = exporter.ExportCustomerReportData(
                ReportFilterUtilities.ConvertToCustomerReportType(uxReportDrop.SelectedValue),
                ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue),
                uxNumberItemsDrop.SelectedItem.ToString(),
                filePhysicalPathName,
                _startOrderDate,
                _endOrderDate,
                out message,
                out message1,
                out fileNameLinkText);
        }

        if (String.IsNullOrEmpty(fileNameLinkURL))
        {
            uxMessage.DisplayError(message);
            uxMessage1.Visible         = false;
            uxFileNameLink.Text        = fileNameLinkText;
            uxFileNameLink.NavigateUrl = fileNameLinkURL;
        }
        else
        {
            uxMessage.DisplayMessage(message);
            uxMessage1.Visible = true;
            uxMessage1.DisplayMessageNoNewLIne(message1);
            uxFileNameLink.Text        = fileNameLinkText;
            uxFileNameLink.NavigateUrl = fileNameLinkURL;
            uxFileNameLink.Target      = "_blank";
        }

        if (uxReportDrop.SelectedItem.ToString() == "Customer Registration")
        {
            CreateChart();
        }
        setCustomDateDisplay();
    }
コード例 #2
0
    private void setCustomDateDisplay()
    {
        if (ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue) == PeriodType.Custom)
        {
            uxSetDate.Style.Add("display", "block");
        }
        else
        {
            uxSetDate.Style.Add("display", "none");
        }

        if (ReportFilterUtilities.ConvertToCustomerReportType(uxReportDrop.SelectedValue) != CustomerReportType.UserRegistration)
        {
            uxSetItems.Style.Add("display", "block");
        }
        else
        {
            uxSetItems.Style.Add("display", "none");
        }
    }
コード例 #3
0
    private void RefreshGrid()
    {
        if (!MainContext.IsPostBack)
        {
            uxPagingControl.ItemsPerPages = AdminConfig.OrderItemsPerPage;
        }
        int totalItems;

        _errorFlag = false;

        PeriodType         period             = ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue);
        CustomerReportType customerReportType = ReportFilterUtilities.ConvertToCustomerReportType(uxReportDrop.SelectedValue);

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


        CustomerReportBuilder customerReportBuilder = new CustomerReportBuilder();

        if (customerReportType != CustomerReportType.UserRegistration)
        {
            _table = customerReportBuilder.GetTopCustomerReportData(
                GridHelper1.GetFullSortText(),
                period,
                customerReportType,
                uxNumberItemsDrop.SelectedItem.ToString(),
                _startOrderDate,
                _endOrderDate,
                uxPagingControl.StartIndex,
                uxPagingControl.EndIndex,
                out totalItems);

            uxTopCustomerGrid.DataSource = _table;
            uxTopCustomerGrid.DataBind();
            uxTopCustomerGrid.Visible = true;
            uxGrid.Visible            = false;
            uxPadding.Visible         = false;

            if (_table.Rows.Count > 0)
            {
                uxTitleLabel.Visible = true;
                setTitle();
            }
            else
            {
                uxTitleLabel.Visible = false;
            }
        }
        else
        {
            _table = customerReportBuilder.GetCustomerReportData(
                GridHelper.GetFullSortText(),
                period,
                _startOrderDate,
                _endOrderDate,
                uxPagingControl.StartIndex,
                uxPagingControl.EndIndex,
                out totalItems);

            uxGrid.DataSource = _table;
            uxGrid.DataBind();
            uxGrid.Visible            = true;
            uxTopCustomerGrid.Visible = false;
            uxPadding.Visible         = true;
            uxTitleLabel.Visible      = false;
        }

        uxPagingControl.NumberOfPages = (int)Math.Ceiling((double)totalItems / uxPagingControl.ItemsPerPages);
        setCustomDateDisplay();
    }