<commit_before>﻿Namespace AW.Types

    Public Class Employees
        Private Shared Function Employees() As IQueryable(Of Employee)
            Return ThreadLocals.Container.Instances(Of Employee)
        End Function
        Public Shared Function ActionListAllDepartments() As ArrayList
            Return GenericMenuFunctions.ListAll(Of Department).ToArrayList()
        End Function

        Public Shared Function ActionRandomEmployee() As Employee
            Return GenericMenuFunctions.Random(Of Employee)()
        End Function

        Public Shared Function ActionAllEmployees() As IQueryable(Of Employee)
            Return GenericMenuFunctions.ListAll(Of Employee)()
        End Function

        Public Shared Function ActionFindEmployeeByName(firstName As TextString, lastName As TextString) As ArrayList
            Return (From e In Employees()
                    Where e.PersonDetails.mappedLastName.ToUpper().StartsWith(lastName.Value) AndAlso
                       (firstName.Value Is "" OrElse e.PersonDetails.mappedFirstName.ToUpper().StartsWith(firstName.Value))).ToArrayList()
        End Function

        Public Shared Function ActionFindEmployeeByNationalIDNumber(nationalIDNumber As TextString) As Employee
            Return (From e In Employees()
                    Where e.mappedNationalIDNumber = nationalIDNumber.Value).FirstOrDefault()
        End Function

        Public Shared Function CreateNewDepartment(name As TextString, groupName As TextString) As Department
            Dim container = ThreadLocals.Container
            Dim d As Department = CType(container.CreateTransientInstance(GetType(Department)), Department)
            d.Name.Value = name.Value
            d.GroupName.Value = groupName.Value
            container.MakePersistent(d)
            Return d
        End Function

        Public Shared Function SharedMenuOrder() As Menu
            Dim main = New Menu("Employees")
            main.AddAction(NameOf(ActionRandomEmployee)) _
            .AddAction(NameOf(ActionAllEmployees)) _
            .AddAction(NameOf(ActionFindEmployeeByName).ToLower()) _ 'To test case insensitivity
            .AddAction(NameOf(ActionFindEmployeeByNationalIDNumber))

            main.AddSubMenu("Organisation").AddAction(NameOf(ActionListAllDepartments))
            Return main
        End Function

    End Class
End Namespace
<commit_msg>Update Employees.vb<commit_after>﻿Namespace AW.Types

    Public Class Employees
        Private Shared Function Employees() As IQueryable(Of Employee)
            Return ThreadLocals.Container.Instances(Of Employee)
        End Function
        Public Shared Function ActionListAllDepartments() As ArrayList
            Return GenericMenuFunctions.ListAll(Of Department).ToArrayList()
        End Function

        Public Shared Function ActionRandomEmployee() As Employee
            Return GenericMenuFunctions.Random(Of Employee)()
        End Function

        Public Shared Function ActionAllEmployees() As IQueryable(Of Employee)
            Return GenericMenuFunctions.ListAll(Of Employee)()
        End Function

        Public Shared Function ActionFindEmployeeByName(firstName As TextString, lastName As TextString) As ArrayList
            Return (From e In Employees()
                    Where e.PersonDetails.mappedLastName.ToUpper().StartsWith(lastName.Value) AndAlso
                       (firstName.Value Is "" OrElse e.PersonDetails.mappedFirstName.ToUpper().StartsWith(firstName.Value))).ToArrayList()
        End Function

        Public Shared Function ActionFindEmployeeByNationalIDNumber(nationalIDNumber As TextString) As Employee
            Return (From e In Employees()
                    Where e.mappedNationalIDNumber = nationalIDNumber.Value).FirstOrDefault()
        End Function

        Public Shared Function ActionCreateNewDepartment(name As TextString, groupName As TextString) As Department
            Dim container = ThreadLocals.Container
            Dim d As Department = CType(container.CreateTransientInstance(GetType(Department)), Department)
            d.Name.Value = name.Value
            d.GroupName.Value = groupName.Value
            container.MakePersistent(d)
            Return d
        End Function

        Public Shared Function SharedMenuOrder() As Menu
            Dim main = New Menu("Employees")
            main.AddAction(NameOf(ActionRandomEmployee)) _
            .AddAction(NameOf(ActionAllEmployees)) _
            .AddAction(NameOf(ActionFindEmployeeByName).ToLower()) _ 'To test case insensitivity
            .AddAction(NameOf(ActionFindEmployeeByNationalIDNumber))

            main.AddSubMenu("Organisation") _
            .AddAction(NameOf(ActionListAllDepartments)) _
            .AddAction(NameOf(ActionCreateNewDepartment))
            Return main
        End Function

    End Class
End Namespace

{'fraction_non_alphanumeric': 0.062050544483254574, 'fraction_numerical': 0.0, 'mean_word_length': 2.7446153846153845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1865', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1097, 'n_words': 303}