// //////////////////////////////////////////////////////////////////////// // PRIVATE METHODS // /// GetNewRefId /// </summary> /// <param name="employeeId">employeeId</param> /// <param name="companyId">companyId</param> /// <returns>New ID</returns> public int GetNewRefId(int employeeId, int companyId) { int newRefId = 0; if (Table.Rows.Count == 0) { EmployeeAddTypeHistoryGateway rr = new EmployeeAddTypeHistoryGateway(); rr.LoadAllByEmployeeId(employeeId, companyId); foreach (EmployeesAddTDS.EmployeeAddTypeHistoryRow row1 in (EmployeesAddTDS.EmployeeAddTypeHistoryDataTable)rr.Table) { if (newRefId < row1.RefID) { newRefId = row1.RefID; } } } else { foreach (EmployeesAddTDS.EmployeeAddTypeHistoryRow row2 in (EmployeesAddTDS.EmployeeAddTypeHistoryDataTable)Table) { if (newRefId < row2.RefID) { newRefId = row2.RefID; } } } newRefId++; return newRefId; }
/// <summary> /// Save /// </summary> /// <param name="employeeId">employeeId</param> public void Save(int employeeId) { EmployeesAddTDS employeeAddTypeHistoryChanges = (EmployeesAddTDS)Data.GetChanges(); if (employeeAddTypeHistoryChanges != null) { if (employeeAddTypeHistoryChanges.EmployeeAddTypeHistory.Rows.Count > 0) { EmployeeAddTypeHistoryGateway employeeAddTypeHistoryGateway = new EmployeeAddTypeHistoryGateway(employeeAddTypeHistoryChanges); foreach (EmployeesAddTDS.EmployeeAddTypeHistoryRow row in (EmployeesAddTDS.EmployeeAddTypeHistoryDataTable)employeeAddTypeHistoryChanges.EmployeeAddTypeHistory) { // Insert new subcontractor hours if ((!row.Deleted) && (!row.InDatabase)) { EmployeeTypeHistory employeeTypeHistory = new EmployeeTypeHistory(null); employeeTypeHistory.InsertDirect(employeeId, row.RefID, row.Date, row.Type, row.Deleted, row.COMPANY_ID); } } } } }
// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS - DATASET // /// <summary> /// LoadAllByEmployeeId /// </summary> /// <param name="employeeId">employeeId</param> /// <param name="companyId">companyId</param> public void LoadAllByEmployeeId(int employeeId, int companyId) { EmployeeAddTypeHistoryGateway employeeAddTypeHistoryGateway = new EmployeeAddTypeHistoryGateway(Data); employeeAddTypeHistoryGateway.LoadAllByEmployeeId(employeeId, companyId); }