public static IQueryable <SalesPerson> FindSalesPersonByName(
            [Optionally] string firstName, string lastName, IContext context)
        {
            IQueryable <Person> matchingPersons = Person_MenuFunctions.FindContactByName(firstName, lastName, context);

            return(from sp in context.Instances <SalesPerson>()
                   from person in matchingPersons
                   where sp.BusinessEntityID == person.BusinessEntityID
                   orderby sp.EmployeeDetails.PersonDetails.LastName, sp.EmployeeDetails.PersonDetails.FirstName
                   select sp);
        }
示例#2
0
        public static IQueryable <Employee> FindEmployeeByName(
            [Optionally] string firstName,
            string lastName,
            IContext context)
        {
            var matchingContacts = Person_MenuFunctions.FindContactByName(firstName, lastName, context);

            var query = from emp in context.Instances <Employee>()
                        from contact in matchingContacts
                        where emp.PersonDetails.BusinessEntityID == contact.BusinessEntityID
                        orderby emp.PersonDetails.LastName
                        select emp;

            return(query);
        }