Exemplo n.º 1
0
 public EmployeeVacation GetByID(int _employeeVacationID)
 {
     EmployeeVacationDAC _employeeVacationComponent = new EmployeeVacationDAC();
      IDataReader reader = _employeeVacationComponent.GetByIDEmployeeVacation(_employeeVacationID);
      EmployeeVacation _employeeVacation = null;
      while(reader.Read())
      {
          _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;             }             reader.Close();
      return _employeeVacation;
 }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
0
 public bool Update(EmployeeVacation employeevacation ,int old_employeeVacationID)
 {
     EmployeeVacationDAC employeevacationComponent = new EmployeeVacationDAC();
     return employeevacationComponent.UpdateEmployeeVacation( employeevacation.EmployeeID,  employeevacation.VacationTypeID,  employeevacation.StartDate,  employeevacation.EndDate,  employeevacation.DurationInDays,  employeevacation.RequestDate,  employeevacation.ApprovalDate,  employeevacation.ApprovedBy,  old_employeeVacationID);
 }
Exemplo n.º 4
0
 public bool Insert(EmployeeVacation employeevacation)
 {
     int autonumber = 0;
     EmployeeVacationDAC employeevacationComponent = new EmployeeVacationDAC();
     bool endedSuccessfuly = employeevacationComponent.InsertNewEmployeeVacation( ref autonumber,  employeevacation.EmployeeID,  employeevacation.VacationTypeID,  employeevacation.StartDate,  employeevacation.EndDate,  employeevacation.DurationInDays,  employeevacation.RequestDate,  employeevacation.ApprovalDate,  employeevacation.ApprovedBy);
     if(endedSuccessfuly)
     {
         employeevacation.EmployeeVacationID = autonumber;
     }
     return endedSuccessfuly;
 }