Ejemplo n.º 1
0
    private void RefreshGrid()
    {
        PeriodType period = ReportFilterUtilities.ConvertToPeriodType(uxPeriodGraphicDrop.SelectedValue);

        ReportFilterUtilities.GetOrderDateRange(period, out _startOrderDate, out _endOrderDate);

        decimal           revenue       = 0;
        int               sumQuantity   = 0;
        decimal           sumTax        = 0;
        decimal           sumShipping   = 0;
        SaleReportBuilder reportBuilder = new SaleReportBuilder();
        DataTable         table         = reportBuilder.GetReportData(
            period,
            _startOrderDate,
            _endOrderDate,
            StoreID
            );

        foreach (DataRow row in table.Rows)
        {
            revenue     += Convert.ToDecimal(row["Total"]);
            sumQuantity += Convert.ToInt32(row["Quantity"]);
            sumTax      += Convert.ToDecimal(row["TotalTax"]);
            sumShipping += Convert.ToDecimal(row["TotalShippingCost"]);
        }

        uxRevenueValueLabel.Text  = revenue.ToString("F", CultureInfo.InvariantCulture);
        uxQuantityValueLabel.Text = sumQuantity.ToString("F", CultureInfo.InvariantCulture);
        uxTaxValueLabel.Text      = sumTax.ToString("F", CultureInfo.InvariantCulture);
        uxShippingValueLabel.Text = sumShipping.ToString("F", CultureInfo.InvariantCulture);
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        uxPagingControl.BubbleEvent += new EventHandler(uxGrid_RefreshHandler);

        if (!MainContext.IsPostBack)
        {
            HttpBrowserCapabilities browser = Request.Browser;
            string browserName = browser.Browser;

            PopulateControls();
            RefreshGrid();

            string script = "<script language='javascript'>CreateChart(document.getElementById('" +
                            uxPeriodDrop.ClientID + "').value,document.getElementById('" + uxReportDrop.ClientID + "').value," +
                            "'null','null','" + browserName + "','true','0')</script>";
            ScriptManager.RegisterStartupScript(this, GetType(), "startScript", script, false);
        }
        if (ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue) == PeriodType.Custom)
        {
            uxSetDate.Style.Add("display", "block");
        }
        else
        {
            uxSetDate.Style.Add("display", "none");
        }
    }
Ejemplo n.º 3
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();
    }
Ejemplo n.º 4
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();
    }
Ejemplo n.º 5
0
    private void RefreshGrid()
    {
        if (!MainContext.IsPostBack)
        {
            uxPagingControl.ItemsPerPages = AdminConfig.OrderItemsPerPage;
        }
        int totalItems;

        _errorFlag = false;

        PeriodType period = ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.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);
        }

        PaymentReportBuilder paymentReportBuilder = new PaymentReportBuilder();

        DataTable table = paymentReportBuilder.GetPaymentReportData(
            GridHelper.GetFullSortText(),
            period,
            _startOrderDate,
            _endOrderDate,
            uxPagingControl.StartIndex,
            uxPagingControl.EndIndex,
            out totalItems);

        if (table.Rows.Count == 0)
        {
            uxDisplayChart.Style.Add("Display", "none");
        }
        else
        {
            uxDisplayChart.Style.Add("Display", "");
        }

        uxPagingControl.NumberOfPages = (int)Math.Ceiling((double)totalItems / uxPagingControl.ItemsPerPages);
        uxGrid.DataSource             = table;
        uxGrid.DataBind();
        setCustomDateDisplay();
    }
Ejemplo n.º 6
0
    protected string GetDateTimeText(object registerPeriod)
    {
        DateTime startDate = DateTime.Now;
        DateTime endDate   = DateTime.Now;

        return(RepositoryDisplayFormatter.GetDateTimeText(
                   registerPeriod,
                   ReportFilterUtilities.ConvertToPeriodType(uxPeriodGraphicDrop.SelectedValue),
                   startDate,
                   endDate));
    }
Ejemplo n.º 7
0
 private void setCustomDateDisplay()
 {
     if (ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue) == PeriodType.Custom)
     {
         uxSetDate.Style.Add("display", "block");
     }
     else
     {
         uxSetDate.Style.Add("display", "none");
     }
 }
Ejemplo n.º 8
0
 private void setTitle()
 {
     if (ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue) == PeriodType.Custom)
     {
         uxTitleLabel.Text = uxReportDrop.SelectedItem.ToString() + " ( From " +
                             uxStartDateCalendarPopup.SelectedDate.ToShortDateString() + " To " +
                             uxEndDateCalendarPopUp.SelectedDate.ToShortDateString() + ")";
     }
     else
     {
         uxTitleLabel.Text = uxReportDrop.SelectedItem.ToString() + " (" +
                             uxPeriodDrop.SelectedItem.Text + ")";
     }
 }
Ejemplo n.º 9
0
    protected string GetDateTimeText(object registerPeriod)
    {
        DateTime startDate = DateTime.Now;
        DateTime endDate   = DateTime.Now;

        if (ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue) == PeriodType.Custom)
        {
            startDate = uxStartDateCalendarPopup.SelectedDate;
            endDate   = uxEndDateCalendarPopUp.SelectedDate;
        }
        return(RepositoryDisplayFormatter.GetDateTimeText(
                   registerPeriod,
                   ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue),
                   startDate,
                   endDate));
    }
Ejemplo n.º 10
0
    private void RefreshGrid()
    {
        if (!MainContext.IsPostBack)
        {
            uxPagingControl.ItemsPerPages = AdminConfig.OrderItemsPerPage;
        }

        int totalItems;

        _errorFlag = false;

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

        ReportFilterUtilities.GetOrderDateRange(period, out _startOrderDate, out _endOrderDate);

        SaleReportBuilder reportBuilder = new SaleReportBuilder();
        DataTable         table         = reportBuilder.GetReportData(
            GridHelper.GetFullSortText(),
            period,
            _startOrderDate,
            _endOrderDate,
            uxPagingControl.StartIndex,
            uxPagingControl.EndIndex,
            StoreID,
            out totalItems);

        uxPagingControl.NumberOfPages = (int)Math.Ceiling((double)totalItems / uxPagingControl.ItemsPerPages);
        uxGrid.DataSource             = table;
        uxGrid.DataBind();

        decimal revenue     = 0;
        int     sumQuantity = 0;
        decimal sumTax      = 0;
        decimal sumShipping = 0;

        foreach (DataRow row in table.Rows)
        {
            revenue     += Convert.ToDecimal(row["Total"]);
            sumQuantity += Convert.ToInt32(row["Quantity"]);
            sumTax      += Convert.ToDecimal(row["TotalTax"]);
            sumShipping += Convert.ToDecimal(row["TotalShippingCost"]);
        }
        uxRevenueValueLabel.Text  = revenue.ToString("F", CultureInfo.InvariantCulture);
        uxQuantityValueLabel.Text = sumQuantity.ToString("F", CultureInfo.InvariantCulture);
        uxTaxValueLabel.Text      = sumTax.ToString("F", CultureInfo.InvariantCulture);
        uxShippingValueLabel.Text = sumShipping.ToString("F", CultureInfo.InvariantCulture);
    }
Ejemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        uxPagingControl.BubbleEvent += new EventHandler(uxGrid_RefreshHandler);

        if (!MainContext.IsPostBack)
        {
            PopulateControls();
            RefreshGrid();
        }
        if (ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue) == PeriodType.Custom)
        {
            uxSetDate.Style.Add("display", "block");
        }
        else
        {
            uxSetDate.Style.Add("display", "none");
        }
    }
Ejemplo n.º 12
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");
        }
    }
Ejemplo n.º 13
0
    protected void uxExportButton_Click(object sender, EventArgs e)
    {
        string message, message1, filePhysicalPathName, fileNameLinkText, fileNameLinkURL;

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

        BestSellerReportExporter exporter = new BestSellerReportExporter(
            CurrencyUtilities.BaseCurrencySymbol, StoreContext.Culture.CultureID);

        fileNameLinkURL = exporter.ExportBestSellerReportData(
            ReportFilterUtilities.ConvertToBestSellReportType(uxReportDrop.SelectedValue),
            ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue),
            uxNumberItemsDrop.SelectedItem.ToString(),
            filePhysicalPathName,
            StoreContext.CurrentStore.StoreID,
            _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";
        }

        setCustomDateDisplay();
    }
Ejemplo n.º 14
0
    protected void uxExportButton_Click(object sender, EventArgs e)
    {
        string message, message1, filePhysicalPathName, fileNameLinkText, fileNameLinkURL;

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

        SaleReportExporter exporter = new SaleReportExporter(CurrencyUtilities.BaseCurrencySymbol);

        fileNameLinkURL = exporter.ExportSellReportData(
            ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue),
            filePhysicalPathName,
            _startOrderDate,
            _endOrderDate,
            "0",
            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";
        }
        RefreshGrid();
        CreateChart();
        setCustomDateDisplay();
    }
Ejemplo n.º 15
0
    private void CreateChart()
    {
        HttpBrowserCapabilities browser = Request.Browser;
        string browserName = browser.Browser;

        if (ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue) == PeriodType.Custom)
        {
            string script = "<script language='javascript'>CreateCustomerChart(document.getElementById('" +
                            uxPeriodDrop.ClientID + "').value,document.getElementById('" + uxReportDrop.ClientID + "').value, '" +
                            _startOrderDate.ToShortDateString() + "','" +
                            _endOrderDate.ToShortDateString() + "','" +
                            browserName +
                            "')</script>";
            ScriptManager.RegisterStartupScript(this, GetType(), "startScript", script, false);
        }
        else
        {
            string script = "<script language='javascript'>CreateCustomerChart(document.getElementById('" +
                            uxPeriodDrop.ClientID + "').value,document.getElementById('" + uxReportDrop.ClientID + "').value, " +
                            "'null','null','" + browserName + "')</script>";
            ScriptManager.RegisterStartupScript(this, GetType(), "startScript", script, false);
        }
    }
Ejemplo n.º 16
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();
    }