Пример #1
0
        protected virtual void FSVehicle_RowInserting(PXCache cache, PXRowInsertingEventArgs e)
        {
            if (e.Row == null || EPEquipmentRecords.Current == null)
            {
                return;
            }

            FSVehicle fsVehicleRow = (FSVehicle)e.Row;

            fsVehicleRow.RefNbr = EPEquipmentRecords.Current.EquipmentCD;
        }
Пример #2
0
        protected virtual void FSVehicle_VehicleTypeID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSVehicle fsVehicleRow = (FSVehicle)e.Row;

            cache.SetDefaultExt <FSVehicle.vehicleTypeCD>(fsVehicleRow);
        }
Пример #3
0
        protected virtual void _(Events.RowInserting <FSVehicle> e)
        {
            if (e.Row == null || EPEquipmentRecords.Current == null)
            {
                return;
            }

            FSVehicle fsVehicleRow = (FSVehicle)e.Row;

            fsVehicleRow.RefNbr = EPEquipmentRecords.Current.EquipmentCD;
        }
Пример #4
0
        protected virtual void _(Events.FieldUpdated <FSVehicle, FSVehicle.vehicleTypeID> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSVehicle fsVehicleRow = (FSVehicle)e.Row;

            e.Cache.SetDefaultExt <FSVehicle.vehicleTypeCD>(fsVehicleRow);
        }
Пример #5
0
        protected void FSVehicle_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSVehicle fsVehicleRow = (FSVehicle)e.Row;

            if (EquipmentHelper.UpdateEPEquipmentWithFSEquipment(EPEquipmentRecords.Cache, EPEquipmentRecords.Current, cache, fsVehicleRow))
            {
                EPEquipmentRecords.Cache.Update(EPEquipmentRecords.Current);
            }
        }
Пример #6
0
        protected virtual void _(Events.RowUpdated <FSVehicle> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSVehicle fsVehicleRow = (FSVehicle)e.Row;

            if (EquipmentHelper.UpdateEPEquipmentWithFSEquipment(EPEquipmentRecords.Cache, EPEquipmentRecords.Current, e.Cache, fsVehicleRow))
            {
                EPEquipmentRecords.Cache.Update(EPEquipmentRecords.Current);
            }
        }
Пример #7
0
        protected virtual void EPEquipment_RowInserted(PXCache cache, PXRowInsertedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEquipment epEquipmentRow = (EPEquipment)e.Row;

            // Inserting the corresponding Equipment record
            if (VehicleSelected.Current == null)
            {
                FSVehicle fsVehicleRow = new FSVehicle();
                fsVehicleRow          = VehicleSelected.Insert(fsVehicleRow);
                fsVehicleRow.SourceID = epEquipmentRow.EquipmentID;
                this.VehicleSelected.Cache.IsDirty = false;
            }
        }
        public static IEnumerable VehicleRecordsDelegate(PXGraph graph, SharedClasses.RouteSelected_view routeSelected, PXFilter <VehicleSelectionFilter> filter)
        {
            if (routeSelected.Current == null)
            {
                yield break;
            }

            List <object> args = new List <object>();

            PXSelectBase <FSVehicle> commandFilter = new PXSelectJoinGroupBy <FSVehicle,
                                                                              LeftJoin <FSRouteDocument,
                                                                                        On <
                                                                                            FSRouteDocument.vehicleID, Equal <FSVehicle.SMequipmentID>,
                                                                                            And <FSRouteDocument.date, Equal <Required <FSRouteDocument.date> > > > >,
                                                                              Where <
                                                                                  FSVehicle.isVehicle, Equal <True> >,
                                                                              Aggregate <
                                                                                  GroupBy <
                                                                                      FSVehicle.SMequipmentID> >,
                                                                              OrderBy <
                                                                                  Asc <FSServiceVehicleType.priorityPreference> > >(graph);

            args.Add(routeSelected.Current.Date);

            if (filter.Current.ShowUnassignedVehicles == true)
            {
                commandFilter.WhereAnd <Where <FSRouteDocument.routeID, IsNull> >();
            }

            var list = commandFilter.Select(args.ToArray());

            foreach (PXResult <FSVehicle, FSRouteDocument> bqlResult in list)
            {
                FSVehicle       fsEquipmentRow     = (FSVehicle)bqlResult;
                FSRouteDocument fsRouteDocumentRow = (FSRouteDocument)bqlResult;

                if (fsRouteDocumentRow != null && fsRouteDocumentRow.RouteID != null)
                {
                    fsEquipmentRow.Mem_UnassignedVehicle = true;
                }

                yield return(bqlResult);
            }
        }
Пример #9
0
        protected virtual void FSVehicle_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null || EPEquipmentRecords.Current == null)
            {
                return;
            }

            FSVehicle fsVehicleRow = (FSVehicle)e.Row;

            if (e.Operation != PXDBOperation.Delete && fsVehicleRow.IsVehicle == true)
            {
                LicenseHelper.CheckVehiclesLicense(cache.Graph, fsVehicleRow.SMEquipmentID, fsVehicleRow.Status);
            }

            if (e.Operation == PXDBOperation.Insert)
            {
                fsVehicleRow.RefNbr       = EPEquipmentRecords.Current.EquipmentCD;
                fsVehicleRow.SourceRefNbr = EPEquipmentRecords.Current.EquipmentCD;
            }
        }