public ActionResult ForgotPassword(Account user)
 {
     if (ModelState.IsValid)
     {
         try
         {
             user.ForgotPassword(user.UserName);
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
     return View(user);
 }
        /// <summary>
        /// Gets all the Roles from SDK and sets them in the String Role Array
        /// </summary>
        /// <returns>String Role Array</returns>
        public override string[] GetAllRoles()
        {
            string[] roles = new string[500];
            int count = 0;

            Account account = new Account();
            account.GetAllAdminGroups();

            foreach (ClientPersonnelAdminGroups groups in account.AdminGroup)
            {
                roles[count] = groups.GroupName.ToString();
                count++;
            }

            return roles;
        }
        public ActionResult Login(Account user)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (user.LogIn(user.UserName, user.Password))
                    {
                        user.LoginResultDetails = SDKHelper.GetUserSession<AquariumUserManagement.LoggedOnUserResult>("User");
                        FormsAuthentication.SetAuthCookie(user.LoginResultDetails.User.FirstName, user.RememberMe);

                        if (user.LoginResultDetails.User.ClientPersonnelAdminGroupID == 148)
                            return RedirectToAction("Index", "iDiary");
                        else
                            return RedirectToAction("Index", "Home");
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return View(user);
        }
예제 #4
0
 /// <summary>
 /// Get All users from Accounts class
 /// </summary>
 public void GetAllUsers()
 {
     Users = new Account();
     Users.GetAllUsers();
 }
        public ActionResult Logout()
        {
            Account user = new Account();

            //try
            //{
                user.LogOff();
                Session.Clear();
                Session.Abandon();
                FormsAuthentication.SignOut();
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}

            return RedirectToAction("Index", "Home");
        }
 public ActionResult Register(Account user)
 {
     if (ModelState.IsValid)
     {
         if (user.Register())
         {
             ModelState.Clear();
             try
             {
                 user.LoginResultDetails.User = new AquariumUserManagement.User();
                 user.GetAllTitles();
                 user.GetAllClientOffices();
                 user.GetAllAdminGroups();
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         }
     }
     return View(user);
 }
        public ActionResult Register()
        {
            Account user = new Account();
            try
            {
                user.GetAllTitles();
                user.GetAllClientOffices();
                user.GetAllAdminGroups();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return View(user);
        }
        public ActionResult Password(Account user)
        {
            try
            {
                user.ChangePassword();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return View(user);
        }
        public ActionResult MyProfile(Account Account)
        {
            if (Account.LoginResultDetails.User.ClientPersonnelID != 0)
            {
                try
                {
                    Account.UpdateUser();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            Account.GetUser();

            return View(Account);
        }
        public ActionResult MyProfile()
        {
            Account user = new Account();

            try
            {
                user.GetUser();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return View(user);
        }
        /// <summary>
        /// Search User in Role and return the RoleName. Used to compare User with Role
        /// </summary>
        /// <param name="username">The username to search</param>
        /// <returns>RoleName(s)</returns>
        public override string[] GetRolesForUser(string username)
        {
            int count = 0;
            LoggedOnUserResult user = SDKHelper.GetUserSession<AquariumUserManagement.LoggedOnUserResult>("User");
            Account account = new Account();
            account.GetAllAdminGroups();
            List<ClientPersonnelAdminGroups> roles = account.AdminGroup.FindAll(delegate(ClientPersonnelAdminGroups adrole) { if (adrole.ClientPersonnelAdminGroupID == user.User.ClientPersonnelAdminGroupID) { return true; } else { return false; } });
            string[] roleslist = new string[roles.Count];
            foreach (ClientPersonnelAdminGroups groups in roles)
            {
                roleslist[count] = groups.GroupName;
            }

            return roleslist;
        }