public ActionResult RegisterUser()
      {
          Users user = CMSService.GetUserByUserName(username);



          CodeTable cT = new CodeTable();

          Session["CODETABLE"] = cT;


          viewUser newUser = new viewUser();

          if (user != null)
          {
              if (user.IsActive == true)
              {
                  using (var securityWCFServiceClient = new SecurityWCFServiceClient())
                  {
                      var nav = securityWCFServiceClient.GetDefaultNavigationByRole(applicationname, codeTable.UserRoleName);
                      return(RedirectToAction(nav.ActionName, nav.ControllerName, new { Area = areaname }));
                  }
              }
              else
              {
                  newUser = CMSService.GetUser(user.UserId);
                  newUser.UserContracts = newUser.UserContracts.Where(c => c.EndDate == null).ToList();
                  newUser.IsPending     = true;

                  if (newUser.UserConfidentiality == null || newUser.UserConfidentiality.UserSignatureDate == null)
                  {
                      return(RedirectToAction("UserConfidentiality", "Account", new { @userId = user.UserId }));
                  }
              }
          }
          else
          {
              newUser.UserName = username;

              newUser.Roles             = CMSService.GetRoles();
              newUser.PossibleContracts = CMSService.GetContracts();

              for (int i = 0; i < 3; i++)
              {
                  viewUserContract newContract = new viewUserContract();

                  newUser.UserContracts.Add(newContract);
              }

              newUser.PossiblePSAs = CMSService.GetPSAs();

              newUser.PossibleMCOs = CMSService.GetMCOs();

              newUser.IsAcceptCon = false;
          }



          return(View(newUser));
      }
Beispiel #2
0
        public ActionResult SupervisorAdmin()
        {
            Users user   = CMSService.GetUserByUserName(username);
            int   userId = 0;

            if (user != null)
            {
                userId = user.UserId;
            }
            List <int> ContractIds = new List <int>();

            ContractIds = CMSService.GetContractsByUserId(userId);

            UserAdministration ua = new UserAdministration();



            List <viewUser> UserList = CMSService.GetSupervisorAdmin(ContractIds);

            ua.UsersToReview    = UserList.Where(x => x.IsActive == false && x.IsApproved == false).ToList();
            ua.Users            = UserList.Where(x => x.IsActive == true && ContractIds.Any(c => x.UserContracts.Any(uc => uc.ContractId == c && uc.IsActive == true))).ToList();
            ua.UsersDisApproved = UserList.Where(x => x.IsDisApproved == true && x.IsActive == false).ToList();
            ua.UsersInactive    = UserList.Where(x => x.IsActive == false && x.IsApproved == true).ToList();
            List <int> SupervisorContractIds = CMSService.GetContractsByUserId(user.UserId);

            ua.Contracts = CMSService.GetContracts().Where(c => SupervisorContractIds.Contains(c.Id)).ToList();

            return(View(ua));
        }
      public ActionResult UserChangeAgency(int userId)
      {
          viewUser user = CMSService.GetUser(userId);

          user.IsPending = false;

          user.UserContracts = user.UserContracts.Where(c => c.EndDate == null).ToList();


          int u = 3 - user.UserContracts.Count();

          for (int i = 0; i < u; i++)
          {
              viewUserContract newContract = new viewUserContract();

              user.UserContracts.Add(newContract);
          }


          user.Roles             = CMSService.GetRoles();
          user.PossibleContracts = CMSService.GetContracts();
          user.PossiblePSAs      = CMSService.GetPSAs();

          user.PossibleMCOs = CMSService.GetMCOs();
          return(View(user));
      }
Beispiel #4
0
        public ActionResult EditUserSettings(int userId)
        {
            viewUser user = new viewUser();

            user = CMSService.GetUserSettings(userId);

            viewUserContract newContract = new viewUserContract();

            user.CountOfActiveContracts   = user.UserContracts.Where(u => u.IsActive == true).Count();
            user.CountOfExistingContracts = user.UserContracts.Count();

            List <int> contractsToRemove = new List <int>();

            contractsToRemove = user.UserContracts.Select(c => c.ContractId).ToList();

            for (int i = 0; i < 3; i++)
            {
                user.UserContracts.Add(newContract);
            }

            user.PossibleContracts = CMSService.GetContracts();
            user.PossibleContracts = user.PossibleContracts.Where(c => !contractsToRemove.Contains(c.Id)).ToList();
            user.PossibleMCOs      = CMSService.GetMCOs();
            user.PossiblePSAs      = CMSService.GetPSAs();
            user.Roles             = CMSService.GetRoles();

            return(View(user));
        }