protected virtual void _(Events.RowSelected <StaffScheduleFilter> e) { if (e.Row == null) { return; } string warningMessage = ""; bool warning = false; StaffScheduleFilter staffScheduleFilterRow = (StaffScheduleFilter)e.Row; warningMessage = SharedFunctions.WarnUserWithSchedulesWithoutNextExecution(this, e.Cache, fixSchedulesWithoutNextExecutionDate, out warning); if (warning == true) { e.Cache.RaiseExceptionHandling <StaffScheduleFilter.toDate>(staffScheduleFilterRow, staffScheduleFilterRow.ToDate, new PXSetPropertyException(warningMessage, PXErrorLevel.Warning)); } }
public virtual void OpenStaffContractScheduleProcess() { StaffContractScheduleProcess staffContractScheduleProcessGraph = PXGraph.CreateInstance <StaffContractScheduleProcess>(); StaffScheduleFilter filter = new StaffScheduleFilter(); filter.ScheduleID = StaffScheduleRecords.Current.ScheduleID; filter.BAccountID = StaffScheduleRecords.Current.EmployeeID; //FSStaffSchedule.StartDate implements the PXDBDateAndTime attribute allowing values of hour, month and minute be > 0. //So, the filter must cover all time possible values in the current date in order to show this schedule . if (StaffScheduleRecords.Current.EndDate != null) { filter.ToDate = new DateTime( StaffScheduleRecords.Current.EndDate.Value.Year, StaffScheduleRecords.Current.EndDate.Value.Month, StaffScheduleRecords.Current.EndDate.Value.Day, 23, 59, 59); } else { DateTime?dateTime_aux = StaffScheduleRecords.Current.StartDate.Value.AddYears(1); filter.ToDate = new DateTime( dateTime_aux.Value.Year, dateTime_aux.Value.Month, dateTime_aux.Value.Day, 23, 59, 59); } staffContractScheduleProcessGraph.Filter.Insert(filter); throw new PXRedirectRequiredException(staffContractScheduleProcessGraph, null) { Mode = PXBaseRedirectException.WindowMode.NewWindow }; }