Example #1
0
        public void OnGet()
        {
            JuisteLijst();

            UserDetails = m_userManager.FindByNameAsync(User.Identity.Name).Result;
            if (m_userInCompanyService.GetUsersInCompany().FirstOrDefault(x => x.UserId == UserDetails.Id) == null)
            {
                Page();
            }
            else
            {
                CompanyDetails = GetCompanyDetails(UserDetails.Id);
                if (CompanyDetails.ContractLevel == ContractLevel.None)
                {
                    Docs = NoneMaps;
                }
                if (CompanyDetails.ContractLevel == ContractLevel.Bronze)
                {
                    Docs = BronzeMaps;
                }
                if (CompanyDetails.ContractLevel == ContractLevel.Silver)
                {
                    Docs = SilverMaps;
                }
                if (CompanyDetails.ContractLevel == ContractLevel.Gold)
                {
                    Docs = GoldMaps;
                }
            }
        }
        //onGet ticket by ID binnenhalen
        public IActionResult OnGet(int id)
        {
            CategoryList = m_ticketService.GetCategories();
            ApiKey       = m_userService.GetApiKeys(User.Identity.Name);


            var APIkey = m_userManager.Users.Include(x => x.ApiKeys).FirstOrDefault(x => x.UserName == User.Identity.Name).ApiKeys.ToList();

            if (APIkey.Count() == 0)
            {
                //hier kan je nog error handling voorzien
            }
            else
            {
                foreach (var item in APIkey)
                {
                    if (item.Source == Source.VSTS)
                    {
                        var token = item.VSTStoken;
                        m_VSTSService.GetAllBugs(token);
                    }
                    else
                    {
                        //hier kan je nog error handling voorzien
                    }
                }
            }

            Ticket = m_ticketService.GetTicketById(id);
            Input  = new InputModel()
            {
                TicketId = id
            };

            if (Ticket == null)
            {
                return(RedirectToPage("../Tickets/MyTickets"));
            }


            UserDetails = m_userService.GetUserByMail(Ticket.TicketRequestor);
            if (m_userInCompanyService.GetUsersInCompany().FirstOrDefault(x => x.UserId == UserDetails.Id) == null)
            {
                Page();
            }
            else
            {
                CompanyDetails = GetCompanyDetails(UserDetails.Id);
            }


            return(Page());
        }
        public IActionResult OnGet(string id)
        {
            UserDetails = m_userManager.FindByIdAsync(id).Result;
            var lijst = m_userManager.GetRolesAsync(UserDetails).Result;

            CurrentRole = lijst.FirstOrDefault();

            Companies = m_exactOnlineService.GetCompanies();

            UserInCompany = m_userInCompanyService.GetUsersInCompany().Find(x => x.UserId == UserDetails.Id);

            return(Page());
        }
Example #4
0
        public List <ApplicationUser> UsersInCompany(int id)
        {
            UserInCompany = m_userInCompanyService.GetUsersInCompany().FindAll(x => x.CompanyId == id).ToList();

            foreach (var item in UserInCompany)
            {
                var Gebruiker = m_userManager.FindByIdAsync(item.UserId).Result;
                UsersList.Add(Gebruiker);
            }

            return(UsersList);
        }
        public void CheckfornewItems(int none, int bronze, int silver, int gold)
        {
            //Als document levels geupdate worden moeten we mails sturen naar users in companies die hun meldingen aan hebben staan
            var link = Url.Documents(Request.Scheme);

            //alle gebruikers die gekoppeld zijn aan een bedrijf
            UserInCompanyList = m_userInCompanyService.GetUsersInCompany();
            foreach (var GebruikersInBedrijf in UserInCompanyList)
            {
                //user object oprvagen voor elke user in bedrijf
                var UserObject    = m_userManager.FindByIdAsync(GebruikersInBedrijf.UserId).Result;
                var CompanyObject = m_context.Company.FirstOrDefault(x => x.Id == GebruikersInBedrijf.CompanyId);

                if (CompanyObject.ContractLevel == ContractLevel.None)
                {
                    if (none != 0)
                    {
                        m_mailmanager.SendEmailNewDocument(UserObject.Email, link);
                    }
                }
                if (CompanyObject.ContractLevel == ContractLevel.Bronze)
                {
                    if (none != 0 || bronze != 0)
                    {
                        m_mailmanager.SendEmailNewDocument(UserObject.Email, link);
                    }
                }
                if (CompanyObject.ContractLevel == ContractLevel.Silver)
                {
                    if (none != 0 || bronze != 0 || silver != 0)
                    {
                        m_mailmanager.SendEmailNewDocument(UserObject.Email, link);
                    }
                }
                if (CompanyObject.ContractLevel == ContractLevel.Gold)
                {
                    if (none != 0 || bronze != 0 || silver != 0 || gold != 0)
                    {
                        m_mailmanager.SendEmailNewDocument(UserObject.Email, link);
                    }
                }
            }
        }