示例#1
0
 public WorkItemController()
 {
     _context             = new AdenContext();
     _membershipService   = new MembershipService(_context);
     _idemService         = new IdemService();
     _currentUserFullName = User.Identity.Name;
     _currentUsername     = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type == ClaimTypes.Email)?.Value;
     _documentService     = new DocumentService(_context);
 }
示例#2
0
        public object AddGroupUser(UpdateGroupMemberDto model)
        {
            var group = _context.Groups.Include(u => u.Users).FirstOrDefault(x => x.Id == model.GroupId);

            if (group == null)
            {
                return(BadRequest("Group does not exists"));
            }

            var user = _context.Users.FirstOrDefault(x => x.IdentityGuid == model.IdentityGuid) ?? new UserProfile();

            var idemUser = new IdemService().GetUser(model.IdentityGuid);

            if (idemUser != null)
            {
                user.EmailAddress = idemUser.EmailAddress;
                user.FirstName    = idemUser.Firstname;
                user.LastName     = idemUser.Lastname;
                user.IdentityGuid = idemUser.IdentityGuid;
                user.FullName     = $"{user.FirstName} {user.LastName}";
            }

            _context.Users.AddOrUpdate(user);

            group.Users.Add(user);

            _context.SaveChanges();

            var applications = new IdemService().GetUserApplications(user.EmailAddress);

            if (!applications.Any(x => x.ApplicationViewKey == Constants.ApplicationName))
            {
                WorkEmailer.RequestAccess(user, _currentUsername);
            }


            return(Ok(user));
        }
示例#3
0
        public object Users(string username = null)
        {
            var users = new IdemService().FindUsers(username);

            return(Ok(users));
        }
示例#4
0
        public ActionResult EditFileSpecification(int id)
        {
            var model = _context.FileSpecifications
                        .Include(g => g.GenerationGroup.Users)
                        .Include(g => g.ApprovalGroup.Users)
                        .Include(g => g.SubmissionGroup.Users)
                        .FirstOrDefault(x => x.Id == id);

            var dto = Mapper.Map <UpdateFileSpecificationDto>(model);

            //TODO: Check for null file specification

            var dataGroups = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Value = "Data", Text = "Data"
                },
                new SelectListItem()
                {
                    Value = "Development", Text = "Development"
                },
                new SelectListItem()
                {
                    Value = "Section", Text = "Section"
                }
            };

            var collections = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Value = "Accumulator", Text = "Accumulator"
                },
                new SelectListItem()
                {
                    Value = "Assessment", Text = "Assessment"
                },
                new SelectListItem()
                {
                    Value = "AnnualDataReport", Text = "Annual Data Report"
                },
                new SelectListItem()
                {
                    Value = "Application", Text = "Application"
                },
                new SelectListItem()
                {
                    Value = "ChildCount", Text = "Child Count"
                },
                new SelectListItem()
                {
                    Value = "Financials", Text = "Financials"
                },
                new SelectListItem()
                {
                    Value = "EOY-9thMonth", Text = "EOY - 9th Month"
                },
                new SelectListItem()
                {
                    Value = "Fall-20Day", Text = "Fall-20 Day"
                },
                new SelectListItem()
                {
                    Value = "Manual", Text = "Manual"
                },
                new SelectListItem()
                {
                    Value = "SIR", Text = "SIR"
                },
                new SelectListItem()
                {
                    Value = "Schedules", Text = "Schedules"
                }
            };

            var applications = new IdemService().GetApplication().ConvertAll(a => new SelectListItem()
            {
                Text = a.Title, Value = a.Title
            });

            ViewBag.Groups = _context.Groups.OrderBy(g => g.Name).ToList()
                             .ConvertAll(a => new SelectListItem()
            {
                Text = a.Name, Value = a.Id.ToString()
            });


            ViewBag.Applications = applications;
            ViewBag.DataGroups   = dataGroups;
            ViewBag.Collections  = collections;
            return(PartialView("_FileSpecificationEditForm", dto));
        }