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));
      }
      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 #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));
        }
Beispiel #4
0
        public ActionResult ApproveUser(viewUser user)
        {
            CMSService.ApproveUser(user);
            viewUser getUser = CMSService.GetUser(user.UserId);

            if (user.IsDisApproved != true)
            {
                if (getUser != null)
                {
                    string AMRoleName = CMSService.GetRoles().Where(r => r.Id == getUser.RoleId).FirstOrDefault().Description;


                    CustomRoleProvider crp = new CustomRoleProvider();


                    string appName = ConfigurationManager.AppSettings["ApplicationName"];

                    string un = getUser.UserName;

                    rsac.AddUsersToRoles(appName, un, AMRoleName);
                }


                List <MailAddress> EMails = new List <MailAddress>();

                EMails.Add(new MailAddress(getUser.Email, "to"));

                string Message = "Registration for the user " + getUser.UserName + " has been approved.";

                string Subject = "APS Case Management System Registration: Approved";

                SendEmail(EMails, Message, Subject);
            }
            else
            {
                List <MailAddress> EMails = new List <MailAddress>();

                EMails.Add(new MailAddress(getUser.Email, "to"));

                string Message = "For user:"******". Your access to the Illinois Department on Aging Office (IDoA) of Adult Protective Services Case Management System has been denied for the following reason: " + user.DisApprovalMessage + ". Please contact either your Supervisor or if you are a Supervisor contact your IDoA liaison.";



                string Subject = "APS Case Management System Registration: Denied";

                SendEmail(EMails, Message, Subject);
            }

            return(RedirectToAction("UserAdmin"));
        }
Beispiel #5
0
        public ActionResult SaveUserSettings(viewUser user)
        {
            viewUser getUser = CMSService.GetUser(user.UserId);

            if (getUser.RoleId != user.RoleId)
            {
                //remove

                var username = user.UserName;
                var allroles = rsac.GetAllRoles(applicationname);

                foreach (var role in allroles)
                {
                    if (rsac.IsUserInRole(applicationname, username, role) == 1)
                    {
                        rsac.RemoveUsersFromRoles(applicationname, username, role);
                    }
                }


                //add



                string AMRoleName = CMSService.GetRoles().Where(r => r.Id == user.RoleId).FirstOrDefault().Description;


                CustomRoleProvider crp = new CustomRoleProvider();


                string appName = ConfigurationManager.AppSettings["ApplicationName"];

                string un = user.UserName;

                rsac.AddUsersToRoles(appName, un, AMRoleName);
            }



            CMSService.SaveUserSettings(user);



            return(RedirectToAction("UserAdmin"));
        }
Beispiel #6
0
        public ActionResult ReActivateUser(viewUser user)
        {
            CMSService.ReActivateUser(user);


            viewUser getUser = CMSService.GetUser(user.UserId);

            if (getUser != null)
            {
                string AMRoleName = CMSService.GetRoles().Where(r => r.Id == getUser.RoleId).FirstOrDefault().Description;


                CustomRoleProvider crp = new CustomRoleProvider();


                string appName = ConfigurationManager.AppSettings["ApplicationName"];

                string un = getUser.UserName;

                rsac.AddUsersToRoles(appName, un, AMRoleName);
            }

            return(RedirectToAction("UserAdmin"));
        }