public void BindUserRolesForSelectedUser()
        {
            _boundUserRolesListForSelectedUser.Clear();

            using (MTIUserRolesEntityDataModel mtiUserRolesEntityDataModel = new MTIUserRolesEntityDataModel())
            {
                List<role> allRoles = (from allroles in mtiUserRolesEntityDataModel.roles
                                       select allroles).ToList();

                foreach (role userRole in allRoles)
                {
                    BoundUserRole boundUserRole = new BoundUserRole();
                    boundUserRole.RoleId = userRole.roleId;
                    boundUserRole.RoleName = userRole.roleName;

                    if ((SelectedUser != null) && (SelectedUser.userId != Guid.Empty))
                    {
                        userrole isUserInRole = (from alluserroles in mtiUserRolesEntityDataModel.userroles
                                                 where alluserroles.userId == SelectedUser.userId
                                                 where alluserroles.roleId == userRole.roleId
                                                 select alluserroles).FirstOrDefault();

                        if (isUserInRole != null)
                        {
                            boundUserRole.UserIsInRole = true;
                        }
                    }

                    _boundUserRolesListForSelectedUser.Add(boundUserRole);
                }
            }
        }
        public void SetSelectedUser(Guid userGuid)
        {
            using (MTIUserRolesEntityDataModel mtiUserRolesEntityDataModel = new MTIUserRolesEntityDataModel())
            {
                if (userGuid != Guid.Empty)
                {
                    _selectedUser = (from users in mtiUserRolesEntityDataModel.users
                                     where (users.userId == userGuid)
                                     select users).FirstOrDefault();

                    if (_selectedUser != null)
                    {
                        BindUserRolesForSelectedUser();
                        UnEncryptedPassword = Security.UserLogin.EncryptDecryptPassword(_selectedUser.password);
                    }
                }
            }
        }