Esempio n. 1
0
        public static UserInfo GetCurrentUser()
        {
            UserInfo user = null;

            if (AuthTicket != null)
            {
                esUsers usersService = new esUsers();
                ConfigureEnterpriseServerProxy(usersService);

                user = usersService.GetUserByUsername(AuthTicket.Name);
            }

            return user;
        }
Esempio n. 2
0
        public static int ChangeUserStatus(int userId, UserStatus status)
        {
            esUsers usersService = new esUsers();
            ConfigureEnterpriseServerProxy(usersService, true);

            try
            {
                // add user to WebsitePanel server
                return usersService.ChangeUserStatus(userId, status);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public static int DeleteUserAccount(int userId)
        {
            esUsers usersService = new esUsers();
            ConfigureEnterpriseServerProxy(usersService, true);

            try
            {
                // add user to WebsitePanel server
                return usersService.DeleteUser(userId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        public static int AddUserAccount(List<string> log, UserInfo user, bool sendLetter, string password)
        {
            esUsers usersService = new esUsers();
            ConfigureEnterpriseServerProxy(usersService, true);

            try
            {
                // add user to WebsitePanel server
                return usersService.AddUser(user, sendLetter, password);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
        public static int UpdateUserAccount(string taskId, UserInfo user)
        {
            esUsers usersService = new esUsers();
            ConfigureEnterpriseServerProxy(usersService, true);

            try
            {
                // update user in WebsitePanel
                return usersService.UpdateUserTask(taskId, user);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 6
0
        public static int ChangeUserPassword(int userId, string newPassword)
        {
            // load user account
            esUsers usersService = new esUsers();
            ConfigureEnterpriseServerProxy(usersService, true);

            try
            {
                UserInfo user = usersService.GetUserById(userId);

                // change WebsitePanel account password
                int result = usersService.ChangeUserPassword(userId, newPassword);
                if (result < 0)
                    return result;

                // change auth cookie
                if (String.Compare(user.Username, AuthTicket.Name, true) == 0)
                {
                    FormsAuthenticationTicket ticket = CreateAuthTicket(user.Username, newPassword, user.Role, AuthTicket.IsPersistent);
                    SetAuthTicket(ticket, AuthTicket.IsPersistent);
                }
                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }