Esempio n. 1
0
        public List <Entities.Concrete.Employee.Employee> GetAllEmployees()
        {
            List <Entities.Concrete.Employee.Employee> employeeList = new List <Entities.Concrete.Employee.Employee>();

            using (var conn = GetConnection())
            {
                using (SqlCommand command = new SqlCommand("[dbo].[stpEmployeeSelect]", (SqlConnection)conn))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    SqlDataReader reader = command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            var lclEmployeee = EmployeeMapper.SqlDataReaderToEntity(reader);
                            employeeList.Add(lclEmployeee);
                        }
                    }
                }
                conn.Close();
            }
            return(employeeList);
        }
Esempio n. 2
0
 public Entities.Concrete.Employee.Employee GetEmployeeByCompanyID(long prmCompanyID)
 {
     Entities.Concrete.Employee.Employee employee = null;
     using (var conn = GetConnection())
     {
         using (SqlCommand command = new SqlCommand("[dbo].[stpEmployeeSelectByCompanyID]", (SqlConnection)conn))
         {
             command.CommandType = CommandType.StoredProcedure;
             command.Parameters.Add(new SqlParameter {
                 ParameterName = "@prmCompanyID", SqlDbType = SqlDbType.BigInt, Direction = ParameterDirection.Input, Value = prmCompanyID
             });
             SqlDataReader reader = command.ExecuteReader();
             if (reader.HasRows)
             {
                 while (reader.Read())
                 {
                     employee = EmployeeMapper.SqlDataReaderToEntity(reader);
                 }
             }
         }
         conn.Close();
     }
     return(employee);
 }