Esempio n. 1
0
      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));
      }
Esempio n. 2
0
      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));
      }
Esempio n. 3
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));
        }