public override void SaveModuleObjects() { HRTimeSheetsInfo timeSheet = (HRTimeSheetsInfo)MainObject; //Save employee time sheet list EmployeeTimeSheetsList.SaveItemObjects(); //Create entry for time sheet HRTimeSheetEntrysController objTimeSheetEntrysController = new HRTimeSheetEntrysController(); HREmployeeTimeSheetOTDetailsController objEmployeeTimeSheetOTDetailsController = new HREmployeeTimeSheetOTDetailsController(); foreach (HREmployeeTimeSheetsInfo objEmployeeTimeSheetsInfo in EmployeeTimeSheetsList) { objTimeSheetEntrysController.DeleteByForeignColumn("FK_HREmployeeTimeSheetID", objEmployeeTimeSheetsInfo.HREmployeeTimeSheetID); foreach (HRTimeSheetEntrysInfo entry in objEmployeeTimeSheetsInfo.HRTimeSheetEntrysList) { if (entry.FK_HRTimeSheetParamID == 0) { continue; } entry.FK_HRTimeSheetID = timeSheet.HRTimeSheetID; entry.FK_HREmployeeTimeSheetID = objEmployeeTimeSheetsInfo.HREmployeeTimeSheetID; objTimeSheetEntrysController.CreateObject(entry); } objEmployeeTimeSheetOTDetailsController.DeleteByForeignColumn("FK_HREmployeeTimeSheetID", objEmployeeTimeSheetsInfo.HREmployeeTimeSheetID); foreach (HREmployeeTimeSheetOTDetailsInfo obj in objEmployeeTimeSheetsInfo.HREmployeeTimeSheetOTDetailsList) { obj.FK_HREmployeeTimeSheetID = objEmployeeTimeSheetsInfo.HREmployeeTimeSheetID; objEmployeeTimeSheetOTDetailsController.CreateObject(obj); } } }
public override void InvalidateModuleObjects(int iObjectID) { HRTimeSheetEntrysController objTimeSheetEntrysController = new HRTimeSheetEntrysController(); HREmployeeTimeSheetsController objEmployeeTimeSheetsController = new HREmployeeTimeSheetsController(); HREmployeeTimeSheetOTDetailsController objEmployeeTimeSheetOTDetailsController = new HREmployeeTimeSheetOTDetailsController(); List <HREmployeeTimeSheetsInfo> employeeTimeSheetsList = objEmployeeTimeSheetsController.GetEmployeeTimeSheetByTimeSheetIDAndUserGroup(iObjectID, VinaApp.CurrentUserInfo.FK_ADUserGroupID); EmployeeTimeSheetsList.Invalidate(employeeTimeSheetsList); foreach (HREmployeeTimeSheetsInfo employeeTimeSheet in EmployeeTimeSheetsList) { employeeTimeSheet.HRTimeSheetEntrysList = objTimeSheetEntrysController.GetTimeSheetEntryByTimeSheetIDAndEmployeeTimeSheetID( employeeTimeSheet.FK_HRTimeSheetID, employeeTimeSheet.HREmployeeTimeSheetID); employeeTimeSheet.HREmployeeTimeSheetOTDetailsList = objEmployeeTimeSheetOTDetailsController.GetListTimeSheetOTDetailByEmployeeTimeSheet(employeeTimeSheet.HREmployeeTimeSheetID); SetEmployeeTimeSheetValue(employeeTimeSheet); } }