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);
                    }
                }
            }
        }
        protected virtual void _(Events.RowSelected <EPEquipment> e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEquipment epEquipmentRow = (EPEquipment)e.Row;

            FSEquipment fsEquipmentRow = GetRelatedFSEquipmentRow(e.Cache.Graph);

            extendToSMEquipment.SetEnabled(e.Cache.GetStatus(epEquipmentRow) != PXEntryStatus.Inserted && fsEquipmentRow == null);
            viewInSMEquipment.SetEnabled(fsEquipmentRow != null);
        }
        protected void EPEquipment_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEquipment epEquipmentRow = (EPEquipment)e.Row;

            FSEquipment fsEquipmentRow = GetRelatedFSEquipmentRow(cache.Graph);

            extendToSMEquipment.SetEnabled(cache.GetStatus(epEquipmentRow) != PXEntryStatus.Inserted && fsEquipmentRow == null);
            viewInSMEquipment.SetEnabled(fsEquipmentRow != null);
        }
Example #4
0
 /// <summary>
 /// Update a EPEquipment record with the values in the FSEquipment record.
 /// </summary>
 /// <param name="cacheEPEquipment">The cache of the EPEquipment record.</param>
 /// <param name="epEquipmentRow">The EPEquipment record.</param>
 /// <param name="cacheFSEquipment">The cache of the FSEquipment record.</param>
 /// <param name="fsEquipmentRow">The FSEquipment record.</param>
 /// <returns>Returns true if some value changes, otherwise it returns false.</returns>
 public static bool UpdateEPEquipmentWithFSEquipment(PXCache cacheEPEquipment, EPEquipment epEquipmentRow, PXCache cacheFSEquipment, FSEquipment fsEquipmentRow)
 {
     return(CopyEPEquipmentFields(cacheEPEquipment, epEquipmentRow, cacheFSEquipment, fsEquipmentRow));
 }