Exemple #1
0
        public ActionResult Create()
        {
            var issueEditViewModel = new IssueEditViewModel()
            {
                Issue = new IssueDTO()
            };

            var projectNameList = projectFacade.GetProjects
                                      (new ProjectFilter {
                Owner = User.Identity.Name
            })
                                  .Select(y => y.Name).ToList();

            List <SelectListItem> sel = new List <SelectListItem>();

            foreach (string entry in projectNameList)
            {
                sel.Add(new SelectListItem {
                    Text = entry
                });
            }

            ViewBag.ListOfProjects = sel;
            ViewBag.CurrentPerson  = personFacade.GetPeople
                                         (new PersonFilter {
                Email = User.Identity.Name
            }).First();
            return(View(issueEditViewModel));
        }
Exemple #2
0
        public ActionResult Projects(char?sortOrder, string userName)
        {
            ProjectViewModel projectViewModel = new ProjectViewModel();

            projectViewModel.Projects = projectFacade.GetProjects(new ProjectFilter {
                Owner = userName
            });

            switch (sortOrder)
            {
            case 'n':
                projectViewModel.Projects = projectViewModel.Projects.OrderBy(y => y.Name);
                break;

            case 'o':
                projectViewModel.Projects = projectViewModel.Projects.OrderBy(y => y.OwnerEmail);
                break;

            default:
                projectViewModel.Projects = projectViewModel.Projects.OrderBy(y => y.Name);
                break;
            }

            ViewBag.CurrentPerson = personFacade
                                    .GetPeople(new PersonFilter {
                Email = User.Identity.Name
            }).First();
            return(View(projectViewModel));
        }
Exemple #3
0
        public async Task <FileContentResult> Get(ProjectState state)
        {
            var projects = await projectFacade.GetProjects(state);

            var workBook = new XSSFWorkbook();
            var sheet    = workBook.CreateSheet();

            CreateProjectHeader(sheet);

            var rowIdx = 1;

            foreach (var project in projects)
            {
                WriteSubProject(sheet, project, rowIdx++);
                foreach (var subProject in project.SubProjects)
                {
                    WriteSubProject(sheet, subProject, rowIdx++);
                }
            }

            using var memoryStream = new MemoryStream();
            workBook.Write(memoryStream);
            return(File(memoryStream.ToArray(), "application/octet-stream", $"ProjectsReport_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx"));
        }