public static List<EmployeeWithSupervisorName> GetEmployeeWithSupervisorNameCollectionFromReader(this IDataReader returnData)
        {
            List<EmployeeWithSupervisorName> colEmployee = new List<EmployeeWithSupervisorName>();

            while (returnData.Read())
            {
                EmployeeWithSupervisorName newEmployee = new EmployeeWithSupervisorName
                {
                    EmployeeID = returnData["EmployeeId"] == System.DBNull.Value ? 0 : (Int32)returnData["EmployeeId"],
                    FirstName = returnData["FirstName"] == System.DBNull.Value ? null : (String)returnData["FirstName"],
                    LastName = returnData["LastName"] == System.DBNull.Value ? null : (String)returnData["LastName"],
                    SupervisorFirstName = returnData["SupervisorFirstName"] == System.DBNull.Value ? null : (String)returnData["SupervisorFirstName"],
                    SupervisorLastName = returnData["SupervisorLastName"] == System.DBNull.Value ? null : (String)returnData["SupervisorLastName"],
                };

                //adding to the collection
                colEmployee.Add(newEmployee);
            }

            //returns the collection of objects
            return (colEmployee);
        }
示例#2
0
 /// <summary>
 /// Create a new EmployeeWithSupervisorName object.
 /// </summary>
 /// <param name="employeeID">Initial value of the EmployeeID property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="supervisorFirstName">Initial value of the SupervisorFirstName property.</param>
 /// <param name="supervisorLastName">Initial value of the SupervisorLastName property.</param>
 public static EmployeeWithSupervisorName CreateEmployeeWithSupervisorName(global::System.Int32 employeeID, global::System.String firstName, global::System.String lastName, global::System.String supervisorFirstName, global::System.String supervisorLastName)
 {
     EmployeeWithSupervisorName employeeWithSupervisorName = new EmployeeWithSupervisorName();
     employeeWithSupervisorName.EmployeeID = employeeID;
     employeeWithSupervisorName.FirstName = firstName;
     employeeWithSupervisorName.LastName = lastName;
     employeeWithSupervisorName.SupervisorFirstName = supervisorFirstName;
     employeeWithSupervisorName.SupervisorLastName = supervisorLastName;
     return employeeWithSupervisorName;
 }