private void LoadCategoriesApproveTimesheets(int employeeID) { EmployeeInformationCategoryApproveTimesheetsInformationGateway employeeInformationCategoryApproveTimesheetsInformationGateway = new EmployeeInformationCategoryApproveTimesheetsInformationGateway(employeeInformationTDS); if (employeeInformationCategoryApproveTimesheetsInformationGateway.Table.Rows.Count > 0) { ckbxField.Checked = employeeInformationCategoryApproveTimesheetsInformationGateway.GetApproveTimesheets(employeeID, "Field"); ckbxField44.Checked = employeeInformationCategoryApproveTimesheetsInformationGateway.GetApproveTimesheets(employeeID, "Field 44"); ckbxOfficeAdmin.Checked = employeeInformationCategoryApproveTimesheetsInformationGateway.GetApproveTimesheets(employeeID, "Office/Admin"); ckbxMechanicManufactoring.Checked = employeeInformationCategoryApproveTimesheetsInformationGateway.GetApproveTimesheets(employeeID, "Mechanic/Manufactoring"); ckbxSpecialForces.Checked = employeeInformationCategoryApproveTimesheetsInformationGateway.GetApproveTimesheets(employeeID, "Special Forces"); } }
/// <summary> /// Save all categories approve timesheets to database (direct) /// </summary> public void Save() { EmployeeInformationTDS categoryApproveTimesheetsInformationChanges = (EmployeeInformationTDS)Data.GetChanges(); if (categoryApproveTimesheetsInformationChanges.CategoryApproveTimesheetsInformation.Rows.Count > 0) { EmployeeInformationCategoryApproveTimesheetsInformationGateway employeeInformationCategoryApproveTimesheetsInformationGateway = new EmployeeInformationCategoryApproveTimesheetsInformationGateway(categoryApproveTimesheetsInformationChanges); foreach (EmployeeInformationTDS.CategoryApproveTimesheetsInformationRow row in (EmployeeInformationTDS.CategoryApproveTimesheetsInformationDataTable)categoryApproveTimesheetsInformationChanges.CategoryApproveTimesheetsInformation) { int employeeId = row.EmployeeID; string category = row.Category; bool deleted = false; // original values bool originalApproveTimesheets = employeeInformationCategoryApproveTimesheetsInformationGateway.GetApproveTimesheetsOriginal(employeeId, category); // new values bool newApproveTimesheets = employeeInformationCategoryApproveTimesheetsInformationGateway.GetApproveTimesheets(employeeId, category); EmployeeCategoryApproveTimesheets employeeCategoryApproveTimesheets = new EmployeeCategoryApproveTimesheets(null); int rowsAffected = employeeCategoryApproveTimesheets.UpdateDirect(employeeId, category, originalApproveTimesheets, deleted, employeeId, category, newApproveTimesheets, deleted); if (rowsAffected == 0) { employeeCategoryApproveTimesheets.InsertDirect(employeeId, category, newApproveTimesheets, deleted); } } } }