public List<EmployeeDocument> GetAll() { EmployeeDocumentDAC _employeeDocumentComponent = new EmployeeDocumentDAC(); IDataReader reader = _employeeDocumentComponent.GetAllEmployeeDocument().CreateDataReader(); List<EmployeeDocument> _employeeDocumentList = new List<EmployeeDocument>(); while(reader.Read()) { if(_employeeDocumentList == null) _employeeDocumentList = new List<EmployeeDocument>(); EmployeeDocument _employeeDocument = new EmployeeDocument(); if(reader["EmployeeDocumentID"] != DBNull.Value) _employeeDocument.EmployeeDocumentID = Convert.ToInt32(reader["EmployeeDocumentID"]); if(reader["EmployeeDocumentTypeID"] != DBNull.Value) _employeeDocument.EmployeeDocumentTypeID = Convert.ToInt32(reader["EmployeeDocumentTypeID"]); if(reader["EmployeeID"] != DBNull.Value) _employeeDocument.EmployeeID = Convert.ToInt32(reader["EmployeeID"]); if(reader["Name"] != DBNull.Value) _employeeDocument.Name = Convert.ToString(reader["Name"]); if(reader["Path"] != DBNull.Value) _employeeDocument.Path = Convert.ToString(reader["Path"]); _employeeDocument.NewRecord = false; _employeeDocumentList.Add(_employeeDocument); } reader.Close(); return _employeeDocumentList; }
public bool Insert(EmployeeDocument employeedocument) { int autonumber = 0; EmployeeDocumentDAC employeedocumentComponent = new EmployeeDocumentDAC(); bool endedSuccessfuly = employeedocumentComponent.InsertNewEmployeeDocument( ref autonumber, employeedocument.EmployeeDocumentTypeID, employeedocument.EmployeeID, employeedocument.Name, employeedocument.Path); if(endedSuccessfuly) { employeedocument.EmployeeDocumentID = autonumber; } return endedSuccessfuly; }
public EmployeeDocument GetByID(int _employeeDocumentID) { EmployeeDocumentDAC _employeeDocumentComponent = new EmployeeDocumentDAC(); IDataReader reader = _employeeDocumentComponent.GetByIDEmployeeDocument(_employeeDocumentID); EmployeeDocument _employeeDocument = null; while(reader.Read()) { _employeeDocument = new EmployeeDocument(); if(reader["EmployeeDocumentID"] != DBNull.Value) _employeeDocument.EmployeeDocumentID = Convert.ToInt32(reader["EmployeeDocumentID"]); if(reader["EmployeeDocumentTypeID"] != DBNull.Value) _employeeDocument.EmployeeDocumentTypeID = Convert.ToInt32(reader["EmployeeDocumentTypeID"]); if(reader["EmployeeID"] != DBNull.Value) _employeeDocument.EmployeeID = Convert.ToInt32(reader["EmployeeID"]); if(reader["Name"] != DBNull.Value) _employeeDocument.Name = Convert.ToString(reader["Name"]); if(reader["Path"] != DBNull.Value) _employeeDocument.Path = Convert.ToString(reader["Path"]); _employeeDocument.NewRecord = false; } reader.Close(); return _employeeDocument; }
public bool Update(EmployeeDocument employeedocument ,int old_employeeDocumentID) { EmployeeDocumentDAC employeedocumentComponent = new EmployeeDocumentDAC(); return employeedocumentComponent.UpdateEmployeeDocument( employeedocument.EmployeeDocumentTypeID, employeedocument.EmployeeID, employeedocument.Name, employeedocument.Path, old_employeeDocumentID); }