/// <summary>
        /// Exports the report.
        /// </summary>
        /// <param name="exportType">Type of the export.</param>
        private void ExportReport(ReportTypes exportType)
        {
            Data.Project project = GetBL <Logic.Business.Project.ProjectBL>().GetProject(ProjectId);
            if (project != null)
            {
                string sortExpression = gvItems.MasterTableView.SortExpressions.GetSortString();
                int    itemTypeId     = projectItemTypes.SelectedItemTypeId;
                budgetList.ItemTypeID = itemTypeId;

                BudgetSummaryReportParameters parameters = new BudgetSummaryReportParameters();
                parameters.SortExpression = sortExpression;
                parameters.ItemTypeId     = projectItemTypes.SelectedItemTypeId;
                parameters.UserId         = this.UserID;
                parameters.CultureName    = CultureName;
                parameters.ProjectId      = this.ProjectId;

                string fileName = string.Format("{0}_BudgetSummaryReport", project.ProjectName);

                string fileNameExtension;
                string encoding;
                string mimeType;

                byte[] reportBytes = UserWebReportHandler.GenerateBudgetSummaryReport(parameters, exportType,
                                                                                      out fileNameExtension, out encoding, out mimeType);
                Utils.ExportReport(reportBytes, mimeType, fileNameExtension, fileName);
            }
        }
Exemple #2
0
        /// <summary>
        /// Generates the project budget summary report.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="folderPath">The folder path.</param>
        private void GenerateProjectBudgetSummaryReport(Project project, int userId, string folderPath)
        {
            BudgetSummaryReportParameters parameters = new BudgetSummaryReportParameters();

            parameters.SortExpression = string.Empty;
            parameters.ItemTypeId     = -1;
            parameters.UserId         = userId;
            parameters.CultureName    = Utils.GetCultureName(project.Country.CountryCode);
            parameters.ProjectId      = project.ProjectId;

            string fileName = string.Format("{0} - Budget Summary Report", Utils.Ellipsize(project.ProjectName, 50));

            string fileNameExtension;
            string encoding;
            string mimeType;

            byte[] reportBytes = UserWebReportHandler.GenerateBudgetSummaryReport(parameters, ReportTypes.Excel,
                                                                                  out fileNameExtension, out encoding, out mimeType);
            FileHandler.SaveFileToDisk(reportBytes, string.Format("{0}.{1}", fileName, fileNameExtension), folderPath).Wait();
        }