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();
    }
Beispiel #2
0
        void RaisePrint(CustomerReportType reportType)
        {
            MainViewModel mainViewModel = ViewModelHelper.GetParentViewModel <MainViewModel>(this);

            if (mainViewModel != null)
            {
                mainViewModel.RaisePrint(reportType);
            }
        }
Beispiel #3
0
        Control GetSettingsEditor(CustomerReportType reportType)
        {
            switch (reportType)
            {
            case CustomerReportType.Profile:
                return(new ContactsControl(value => SetParameter(ParamContacts, value), (bool)ParamContacts.Value));

            case CustomerReportType.LocationsDirectory:
            case CustomerReportType.ContactDirectory:
            case CustomerReportType.SelectedContactDirectory:
                return(new SortOrderControl(value => SetParameter(ParamAscending, value), (bool)ParamAscending.Value));

            case CustomerReportType.SalesDetail:
            case CustomerReportType.SalesSummary:
                return(new SortFilterControl(value => SetParameter(ParamOrderDate, value), (bool)ParamOrderDate.Value,
                                             fromDate => SetParameter(ParamFromDate, fromDate), (DateTime)ParamFromDate.Value,
                                             toDate => SetParameter(ParamToDate, toDate), (DateTime)ParamToDate.Value));
            }
            return(null);
        }
Beispiel #4
0
        XtraReport CreateAndInitializeReport(CustomerReportType reportType)
        {
            var locator = GetService <Services.IReportLocator>();
            var report  = locator.GetReport(reportType) as XtraReport;

            switch (reportType)
            {
            case CustomerReportType.SelectedContactDirectory:
                report.DataSource = CollectionViewModel.SelectedEntity.Employees;
                break;

            case CustomerReportType.ContactDirectory:
                report.DataSource = ViewModel.CustomerEmployees;
                break;

            case CustomerReportType.LocationsDirectory:
                report.DataSource = CollectionViewModel.Entities;
                break;

            case CustomerReportType.SalesDetail:
                var orders = QueriesHelper.GetCustomerSaleDetails(CollectionViewModel.SelectedEntityKey, CollectionViewModel.GetOrderItems());
                //((CustomerSalesDetailReport)report).SetChartData(orders.SelectMany(x => x.OrderItems).ToArray());
                report.DataSource = orders;
                break;

            case CustomerReportType.Profile:
                report.DataSource = new List <Customer> {
                    CollectionViewModel.SelectedEntity
                };
                break;

            case CustomerReportType.SalesSummary:
                report.DataSource = QueriesHelper.GetCustomerSaleOrderItemDetails(CollectionViewModel.SelectedEntity.Id, CollectionViewModel.GetOrderItems());
                break;
            }
            return(report);
        }
Beispiel #5
0
        XtraReport CreateAndInitializeReport(CustomerReportType reportType)
        {
            var locator = GetService <Services.IReportLocator>();
            var report  = locator.GetReport(reportType) as XtraReport;

            switch (reportType)
            {
            case CustomerReportType.SelectedContactDirectory:
                report.DataSource = CollectionViewModel.SelectedEntity.Employees;
                break;

            case CustomerReportType.ContactDirectory:
                report.DataSource = ViewModel.CustomerEmployees;
                break;

            case CustomerReportType.LocationsDirectory:
                report.DataSource = CollectionViewModel.Entities;
                break;

            case CustomerReportType.SalesDetail:
                ((CustomerSalesDetail)report).SetChartData(ViewModel.GetOrderItems((Guid)CollectionViewModel.SelectedEntityKey));
                report.DataSource = ViewModel.GetOrders((Guid)CollectionViewModel.SelectedEntityKey);
                break;

            case CustomerReportType.Profile:
                report.DataSource = new List <Customer> {
                    CollectionViewModel.SelectedEntity
                };
                break;

            case CustomerReportType.SalesSummary:
                report.DataSource = ViewModel.GetOrderItems((Guid)CollectionViewModel.SelectedEntityKey);
                break;
            }
            return(report);
        }
Beispiel #6
0
 Control GetSettingsEditor(CustomerReportType reportType) {
     switch(reportType) {
         case CustomerReportType.Profile:
             return new ContactsControl(value => SetParameter(ParamContacts, value), (bool)ParamContacts.Value);
         case CustomerReportType.LocationsDirectory:
         case CustomerReportType.ContactDirectory:
         case CustomerReportType.SelectedContactDirectory:
             return new SortOrderControl(value => SetParameter(ParamAscending, value), (bool)ParamAscending.Value);
         case CustomerReportType.SalesDetail:
         case CustomerReportType.SalesSummary:
             return new SortFilterControl(value => SetParameter(ParamOrderDate, value), (bool)ParamOrderDate.Value,
                 fromDate => SetParameter(ParamFromDate, fromDate), (DateTime)ParamFromDate.Value,
                 toDate => SetParameter(ParamToDate, toDate), (DateTime)ParamToDate.Value);
     }
     return null;
 }
Beispiel #7
0
        XtraReport CreateAndInitializeReport(CustomerReportType reportType) {
            var locator = GetService<Services.IReportLocator>();
            var report = locator.GetReport(reportType) as XtraReport;

            switch(reportType) {
                case CustomerReportType.SelectedContactDirectory:
                    report.DataSource = CollectionViewModel.SelectedEntity.Employees;
                    break;
                case CustomerReportType.ContactDirectory:
                    report.DataSource = ViewModel.CustomerEmployees;
                    break;
                case CustomerReportType.LocationsDirectory:
                    report.DataSource = CollectionViewModel.Entities;
                    break;
                case CustomerReportType.SalesDetail:
                    ((CustomerSalesDetail)report).SetChartData(ViewModel.GetOrderItems((Guid)CollectionViewModel.SelectedEntityKey));
                    report.DataSource = ViewModel.GetOrders((Guid)CollectionViewModel.SelectedEntityKey);
                    break;
                case CustomerReportType.Profile:
                    report.DataSource = new List<Customer> { CollectionViewModel.SelectedEntity };
                    break;
                case CustomerReportType.SalesSummary:
                    report.DataSource = ViewModel.GetOrderItems((Guid)CollectionViewModel.SelectedEntityKey);
                    break;
            }
            return report;
        }
Beispiel #8
0
 public bool CanQuickReport(CustomerReportType reportType)
 {
     return(SelectedEntity != null);
 }
Beispiel #9
0
 public void QuickReport(CustomerReportType reportType)
 {
     RaisePrint(reportType);
 }
Beispiel #10
0
 void BindGalleryQuickReportsItem(int index, CustomerReportType parameter)
 {
     galleryQuickReports.Gallery.Groups[0].Items[index].BindCommand(() => ViewModel.QuickReport(parameter), ViewModel, () => parameter);
 }
    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();
    }
Beispiel #12
0
 void BindGalleryQuickReportsItem(int index, CustomerReportType parameter) {
     galleryQuickReports.Gallery.Groups[0].Items[index].BindCommand(() => ViewModel.QuickReport(parameter), ViewModel, () => parameter);
 }