/// <summary> /// Save all data to database (direct) /// </summary> /// <param name="companyId">companyId</param> public void Save(int companyId) { ProjectNavigatorTDS workFunctionChanges = (ProjectNavigatorTDS)Data.GetChanges(); if (workFunctionChanges != null) { if (workFunctionChanges.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE.Rows.Count > 0) { ProjectNavigatorProjectWorkFunctionFairWageGateway projectNavigatorProjectWorkFunctionFairWageGateway = new ProjectNavigatorProjectWorkFunctionFairWageGateway(workFunctionChanges); foreach (ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGERow row in (ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable)workFunctionChanges.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE) { // Insert new work function fair wage if ((!row.Deleted) && (!row.InDatabase)) { ProjectWorkFunctionFairWage projectWorkFunctionFairWage = new ProjectWorkFunctionFairWage(null); projectWorkFunctionFairWage.InsertDirect(row.ProjectID, row.Work_, row.Function_, row.RefID, row.IsFairWage, row.Deleted, row.COMPANY_ID); } // Update work function fair wage if ((!row.Deleted) && (row.InDatabase)) { int projectId = row.ProjectID; string work_ = row.Work_; string function = row.Function_; int refId = row.RefID; bool originalDeleted = false; int originalCompanyId = companyId; // original values bool originalIsFairWage = projectNavigatorProjectWorkFunctionFairWageGateway.GetIsFairWageOriginal(projectId, work_, function, refId); // new values bool newIsFairWage = projectNavigatorProjectWorkFunctionFairWageGateway.GetIsFairWage(projectId, work_, function, refId); ProjectWorkFunctionFairWage projectWorkFunctionFairWage = new ProjectWorkFunctionFairWage(null); projectWorkFunctionFairWage.UpdateDirect(projectId, work_, function, refId, originalIsFairWage, originalDeleted, originalCompanyId, projectId, work_, function, refId, newIsFairWage, originalDeleted, originalCompanyId); } // Delete work function fair wage if ((row.Deleted) && (row.InDatabase)) { ProjectWorkFunctionFairWage projectWorkFunctionFairWage = new ProjectWorkFunctionFairWage(null); projectWorkFunctionFairWage.DeleteDirect(row.ProjectID, row.Work_, row.Function_, row.RefID, row.IsFairWage, row.Deleted, row.COMPANY_ID); } } } } }
// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// LoadAllByProjectId /// </summary> /// <param name="projectId">projectId</param> public void LoadAllByProjectId(int projectId) { ProjectNavigatorProjectWorkFunctionFairWageGateway projectNavigatorProjectWorkFunctionFairWageGateway = new ProjectNavigatorProjectWorkFunctionFairWageGateway(Data); projectNavigatorProjectWorkFunctionFairWageGateway.LoadAllByProjectId(projectId); }