Esempio n. 1
0
        /// <summary>
        /// Exports the report.
        /// </summary>
        /// <param name="exportType">Type of the export.</param>
        private void ExportReport(ReportTypes exportType)
        {
            string cultureName = string.Empty;

            Data.Project project = GetBL <Logic.Business.Project.ProjectBL>().GetProject(ProjectId);
            if (project != null)
            {
                cultureName = Support.GetCultureName(project.Country.CountryCode);

                string fileNameExtension;
                string encoding;
                string mimeType;
                string fileName = string.Format("{0}_Active_TaskList", project.ProjectName);

                ActiveTaskListReportParameters parameters = new ActiveTaskListReportParameters
                {
                    CultureName = cultureName,
                    ItemTypeId  = projectItemTypes.SelectedItemTypeId,
                    ProjectId   = ProjectId,
                    UserId      = this.UserID
                };

                byte[] reportBytes = UserWebReportHandler.GenerateActiveTaskListReport(parameters, exportType,
                                                                                       out fileNameExtension, out encoding, out mimeType);
                Utils.ExportReport(reportBytes, mimeType, fileNameExtension, fileName);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Generates the active task report.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="itemTypeName">Name of the item type.</param>
        /// <param name="itemTypeId">The item type identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="folderPath">The folder path.</param>
        private void GenerateActiveTaskReport(Project project, string itemTypeName, int itemTypeId, int userId, string folderPath)
        {
            string fileNameExtension;
            string encoding;
            string mimeType;
            string fileName = string.Format("{0} - Tasks", itemTypeName);

            ActiveTaskListReportParameters parameters = new ActiveTaskListReportParameters
            {
                CultureName = Utils.GetCultureName(project.Country.CountryCode),
                ItemTypeId  = itemTypeId,
                ProjectId   = project.ProjectId,
                UserId      = userId
            };

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