/// <summary> /// Verifies if the specified recurrence dates match the Route's definition. /// </summary> /// <param name="cache">PXCache instance.</param> /// <param name="fsRouteContractScheduleRow">FSRouteContractSchedule object row.</param> private void ValidateDays(PXCache cache, FSRouteContractSchedule fsRouteContractScheduleRow) { FSScheduleRoute fsScheduleRouteRow = ScheduleRoutes.Current; if (fsScheduleRouteRow == null || fsScheduleRouteRow.DfltRouteID == null) { return; } FSRoute fsRouteRow = PXSelect <FSRoute, Where < FSRoute.routeID, Equal <Required <FSRoute.routeID> > > > .Select(this, fsScheduleRouteRow.DfltRouteID); if (fsRouteRow != null && fsRouteContractScheduleRow.FrequencyType == ID.Schedule_FrequencyType.WEEKLY && ((fsRouteContractScheduleRow.WeeklyOnMon == true && fsRouteRow.ActiveOnMonday == false) || (fsRouteContractScheduleRow.WeeklyOnThu == true && fsRouteRow.ActiveOnThursday == false) || (fsRouteContractScheduleRow.WeeklyOnWed == true && fsRouteRow.ActiveOnWednesday == false) || (fsRouteContractScheduleRow.WeeklyOnTue == true && fsRouteRow.ActiveOnTuesday == false) || (fsRouteContractScheduleRow.WeeklyOnFri == true && fsRouteRow.ActiveOnFriday == false) || (fsRouteContractScheduleRow.WeeklyOnSat == true && fsRouteRow.ActiveOnSaturday == false) || (fsRouteContractScheduleRow.WeeklyOnSun == true && fsRouteRow.ActiveOnSunday == false))) { throw new PXException(TX.Error.RECURRENCE_DAYS_ROUTE_DAYS_MISMATCH); } }
//@TODO SD-7694 public static IEnumerable RouteRecordsDelegate( PXFilter <RouteAppointmentAssignmentFilter> filter, PXSelectBase <FSRouteDocument> cmd) { if (filter.Current == null) { yield break; } foreach (PXResult <FSRouteDocument, FSRoute> bqlResult in cmd.Select()) { FSRouteDocument fsRouteDocumentRow = (FSRouteDocument)bqlResult; FSRoute fsRouteRow = (FSRoute)bqlResult; if (filter.Current.RouteDate.HasValue == true) { if (!fsRouteDocumentRow.TimeBegin.HasValue) { fsRouteDocumentRow.TimeBegin = AppointmentCore.GetDateTimeEnd(fsRouteDocumentRow.Date, 0, 0, 0); } if (fsRouteDocumentRow.Date.Value.Date >= filter.Current.RouteDate.Value.Date && fsRouteDocumentRow.Date.Value.Date <= AppointmentCore.GetDateTimeEnd(filter.Current.RouteDate.Value.Date, 23, 59, 59)) { yield return(bqlResult); } } else { yield return(bqlResult); } } }
public virtual void openVehicleSelector() { if (Routes.Current != null && VehicleFilter.Current != null && Routes.Current.Status != ID.Status_Route.CANCELED) { FSRoute fsRouteRow = PXSelectJoin <FSRoute, InnerJoin <FSRouteDocument, On <FSRoute.routeID, Equal <FSRouteDocument.routeID> > >, Where < FSRouteDocument.routeDocumentID, Equal <Required <FSRouteDocument.routeDocumentID> > > > .Select(this, Routes.Current.RouteDocumentID); VehicleFilter.Current.RouteDocumentID = Routes.Current.RouteDocumentID; VehicleRouteSelected.Current = VehicleRouteSelected.Search <FSRouteDocument.routeDocumentID>(Routes.Current.RouteDocumentID); if (VehicleRouteSelected.AskExt() == WebDialogResult.OK && VehicleRecords.Current != null && Routes.Current.VehicleID != VehicleRecords.Current.SMEquipmentID) { Routes.Current.VehicleID = VehicleRecords.Current.SMEquipmentID; UpdateRoute(Routes.Current); } } }
/// <summary> /// Allows to reset the Route field values when the VehicleTypeID selected in the header changes. /// </summary> private void ResetRouteFields(FSRouteContractSchedule fsScheduleRow) { if (ScheduleRoutes.Current == null) { return; } FSRoute fsRouteRow = PXSelect <FSRoute> .Select(this); if (fsRouteRow == null || ScheduleRoutes.Current.DfltRouteID != fsRouteRow.RouteID) { ScheduleRoutes.Cache.SetValueExt <FSScheduleRoute.dfltRouteID>(ScheduleRoutes.Current, null); } if (fsRouteRow == null || ScheduleRoutes.Current.RouteIDSunday != fsRouteRow.RouteID) { ScheduleRoutes.Cache.SetValueExt <FSScheduleRoute.routeIDSunday>(ScheduleRoutes.Current, null); } if (fsRouteRow == null || ScheduleRoutes.Current.RouteIDMonday != fsRouteRow.RouteID) { ScheduleRoutes.Cache.SetValueExt <FSScheduleRoute.routeIDMonday>(ScheduleRoutes.Current, null); } if (fsRouteRow == null || ScheduleRoutes.Current.RouteIDTuesday != fsRouteRow.RouteID) { ScheduleRoutes.Cache.SetValueExt <FSScheduleRoute.routeIDTuesday>(ScheduleRoutes.Current, null); } if (fsRouteRow == null || ScheduleRoutes.Current.RouteIDWednesday != fsRouteRow.RouteID) { ScheduleRoutes.Cache.SetValueExt <FSScheduleRoute.routeIDWednesday>(ScheduleRoutes.Current, null); } if (fsRouteRow == null || ScheduleRoutes.Current.RouteIDThursday != fsRouteRow.RouteID) { ScheduleRoutes.Cache.SetValueExt <FSScheduleRoute.routeIDThursday>(ScheduleRoutes.Current, null); } if (fsRouteRow == null || ScheduleRoutes.Current.RouteIDFriday != fsRouteRow.RouteID) { ScheduleRoutes.Cache.SetValueExt <FSScheduleRoute.routeIDFriday>(ScheduleRoutes.Current, null); } if (fsRouteRow == null || ScheduleRoutes.Current.RouteIDSaturday != fsRouteRow.RouteID) { ScheduleRoutes.Cache.SetValueExt <FSScheduleRoute.routeIDSaturday>(ScheduleRoutes.Current, null); } }