Exemplo n.º 1
0
        protected virtual void EPEmployeeClass_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            if (EmployeeClass.Cache.GetStatus(e.Row) == PXEntryStatus.Inserted)
            {
                EPVendorClass e1 = PXSelect <EPVendorClass, Where <EPVendorClass.vendorClassID, Equal <Current <EPEmployeeClass.vendorClassID> > > > .SelectSingleBound(this, new object[] { e.Row });

                if (e1 != null)
                {
                    sender.IsDirty = false;
                    e.Cancel       = true;
                    throw new PXRowPersistingException(typeof(EPEmployeeClass.vendorClassID).Name, null, Messages.VendorClassExists);
                }
            }
        }
Exemplo n.º 2
0
        protected virtual System.Collections.IEnumerable Cancel(PXAdapter a)
        {
            foreach (EPEmployeeClass e in (new PXCancel <EPEmployeeClass>(this, "Cancel")).Press(a))
            {
                if (EmployeeClass.Cache.GetStatus(e) == PXEntryStatus.Inserted)
                {
                    EPVendorClass e1 = PXSelect <EPVendorClass, Where <EPVendorClass.vendorClassID, Equal <Required <EPVendorClass.vendorClassID> > > > .Select(this, e.VendorClassID);

                    if (e1 != null)
                    {
                        EmployeeClass.Cache.RaiseExceptionHandling <EPEmployeeClass.vendorClassID>(e, e.VendorClassID, new PXSetPropertyException(Messages.VendorClassExists));
                    }
                }
                yield return(e);
            }
        }