Exemplo n.º 1
0
        protected virtual void _(Events.RowPersisted <EPEquipment> e)
        {
            if (e.Row == null)
            {
                return;
            }

            if (e.TranStatus == PXTranStatus.Open)
            {
                EPEquipment epEquipmentRow = (EPEquipment)e.Row;
                FSEquipment fsEquipmentRow = GetRelatedFSEquipmentRow(e.Cache.Graph);

                if (fsEquipmentRow != null)
                {
                    PXCache <FSEquipment> cacheFSEquipment = new PXCache <FSEquipment>(Base);

                    // This is to prevent an error on the FSEquipment cache trying to change a common field (status, description)
                    // after extending an equipment to FSEquipment.
                    cacheFSEquipment.Graph.SelectTimeStamp();

                    if (EquipmentHelper.UpdateFSEquipmentWithEPEquipment(cacheFSEquipment, fsEquipmentRow, e.Cache, epEquipmentRow))
                    {
                        cacheFSEquipment.Update(fsEquipmentRow);
                        cacheFSEquipment.Persist(PXDBOperation.Update);
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected virtual void EPEquipment_FixedAssetID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEquipment epEquipmentRow = (EPEquipment)e.Row;

            if (epEquipmentRow.FixedAssetID != null)
            {
                EquipmentHelper.SetDefaultValuesFromFixedAsset(VehicleSelected.Cache, VehicleSelected.Current, epEquipmentRow.FixedAssetID);
            }
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
        protected virtual void _(Events.FieldUpdated <EPEquipment, EPEquipment.fixedAssetID> e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEquipment epEquipmentRow = (EPEquipment)e.Row;

            if (epEquipmentRow.FixedAssetID != null)
            {
                EquipmentHelper.SetDefaultValuesFromFixedAsset(VehicleSelected.Cache, VehicleSelected.Current, epEquipmentRow.FixedAssetID);
            }
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
0
        public virtual void ExtendToSMEquipment()
        {
            SMEquipmentMaint graphSMEquipmentMaint = PXGraph.CreateInstance <SMEquipmentMaint>();
            FSEquipment      fsEquipmentRow        = new FSEquipment();

            fsEquipmentRow.SourceID     = Base.Equipment.Current.EquipmentID;
            fsEquipmentRow.SourceRefNbr = Base.Equipment.Current.EquipmentCD;
            fsEquipmentRow.SourceType   = ID.SourceType_Equipment.EP_EQUIPMENT;

            fsEquipmentRow.RequireMaintenance = false;
            fsEquipmentRow.ResourceEquipment  = true;

            graphSMEquipmentMaint.EquipmentRecords.Current = graphSMEquipmentMaint.EquipmentRecords.Insert(fsEquipmentRow);
            EquipmentHelper.UpdateFSEquipmentWithEPEquipment(graphSMEquipmentMaint.EquipmentRecords.Cache, graphSMEquipmentMaint.EquipmentRecords.Current, Base.Equipment.Cache, Base.Equipment.Current);
            EquipmentHelper.SetDefaultValuesFromFixedAsset(graphSMEquipmentMaint.EquipmentRecords.Cache, graphSMEquipmentMaint.EquipmentRecords.Current, Base.Equipment.Current.FixedAssetID);

            throw new PXRedirectRequiredException(graphSMEquipmentMaint, null)
                  {
                      Mode = PXBaseRedirectException.WindowMode.NewWindow
                  };
        }