예제 #1
0
 public List<EmployeeVacation> GetAll()
 {
     EmployeeVacationDAC _employeeVacationComponent = new EmployeeVacationDAC();
      IDataReader reader =  _employeeVacationComponent.GetAllEmployeeVacation().CreateDataReader();
      List<EmployeeVacation> _employeeVacationList = new List<EmployeeVacation>();
      while(reader.Read())
      {
      if(_employeeVacationList == null)
          _employeeVacationList = new List<EmployeeVacation>();
          EmployeeVacation _employeeVacation = new EmployeeVacation();
          if(reader["EmployeeVacationID"] != DBNull.Value)
              _employeeVacation.EmployeeVacationID = Convert.ToInt32(reader["EmployeeVacationID"]);
          if(reader["EmployeeID"] != DBNull.Value)
              _employeeVacation.EmployeeID = Convert.ToInt32(reader["EmployeeID"]);
          if(reader["VacationTypeID"] != DBNull.Value)
              _employeeVacation.VacationTypeID = Convert.ToInt32(reader["VacationTypeID"]);
          if(reader["StartDate"] != DBNull.Value)
              _employeeVacation.StartDate = Convert.ToDateTime(reader["StartDate"]);
          if(reader["EndDate"] != DBNull.Value)
              _employeeVacation.EndDate = Convert.ToDateTime(reader["EndDate"]);
          if(reader["DurationInDays"] != DBNull.Value)
              _employeeVacation.DurationInDays = Convert.ToInt32(reader["DurationInDays"]);
          if(reader["RequestDate"] != DBNull.Value)
              _employeeVacation.RequestDate = Convert.ToDateTime(reader["RequestDate"]);
          if(reader["ApprovalDate"] != DBNull.Value)
              _employeeVacation.ApprovalDate = Convert.ToDateTime(reader["ApprovalDate"]);
          if(reader["ApprovedBy"] != DBNull.Value)
              _employeeVacation.ApprovedBy = Convert.ToInt32(reader["ApprovedBy"]);
      _employeeVacation.NewRecord = false;
      _employeeVacationList.Add(_employeeVacation);
      }             reader.Close();
      return _employeeVacationList;
 }