Esempio n. 1
0
 public static void SetLastNumberField <Field>(PXCache sender, object row, Type lastNumberField)
     where Field : IBqlField
 {
     foreach (PXEventSubscriberAttribute attribute in sender.GetAttributes <Field>(row))
     {
         if (attribute is AutoNumberAttribute)
         {
             AutoNumberAttribute attr = (AutoNumberAttribute)attribute;
             attr.LastNumberField = lastNumberField;
             attr.CreateLastNumberCommand();
         }
     }
 }
Esempio n. 2
0
        protected virtual void Document_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            Document doc = (Document)e.Row;

            if (sender.GetStatus(doc) == PXEntryStatus.Inserted)
            {
                AutoNumberAttribute.SetLastNumberField <Document.docNbr>(
                    sender, doc,
                    doc.DocType == DocTypes.Recpt ?
                    typeof(Setup.receiptLastDocNbr) :
                    typeof(Setup.returnLastDocNbr));
                AutoNumberAttribute.SetPrefix <Document.docNbr>(
                    sender, doc,
                    doc.DocType == DocTypes.Retrn ? "RET" : null);
            }
        }