public override void Persist()
        {
            if (Header.Cache.IsDirty && Detail.Select().Count == 0 && Header.Current != null)
            {
                throw new PXException(Messages.DimensionIsEmpty);
            }

            var dimension = Header.Current;

            if (dimension == null)
            {
                base.Persist();
            }
            else
            {
                try
                {
                    using (PXTransactionScope tscope = new PXTransactionScope())
                    {
                        if (Header.Cache.GetStatus(dimension) != PXEntryStatus.Deleted)
                        {
                            InsertNumberingValue(Header.Current);
                            CorrectChildDimensions();
                        }

                        var oldLength = (short?)Header.Cache.GetValueOriginal <Dimension.length>(dimension);

                        if (dimension.Length < oldLength)
                        {
                            if (dimension.DimensionID == "SUBACCOUNT")
                            {
                                CheckLongerSubKeysDoNotExist(dimension.Length);

                                PXUpdate <Set <Sub.subCD, Substring <Sub.subCD, int1, CurrentValue <Dimension.length> > >,
                                          Sub>
                                .Update(this);
                            }

                            ValidateDimensionForKeyDuplication(dimension);
                        }

                        PXDimensionAttribute.Clear();
                        base.Persist();
                        Header.Current = dimension;
                        PXDimensionAttribute.Clear();

                        tscope.Complete();
                    }
                }
                catch (PXDatabaseException e)
                {
                    if (e.ErrorCode == PXDbExceptions.DeleteForeignKeyConstraintViolation)
                    {
                        throw new PXException(Messages.SegmentHasValues, e.Keys[1]);
                    }
                    throw;
                }
            }
            PXPageCacheUtils.InvalidateCachedPages();
        }
Exemple #2
0
 public override void Persist()
 {
     populateNeighbours <PX.SM.Users>(Users);
     populateNeighbours <INSite>(Site);
     populateNeighbours <PX.SM.Users>(Users);
     base.Persist();
     PXSelectorAttribute.ClearGlobalCache <PX.SM.Users>();
     PXSelectorAttribute.ClearGlobalCache <PX.Objects.IN.INSite>();
     PXDimensionAttribute.Clear();
 }
 public override void Persist()
 {
     populateNeighbours <PX.SM.Users>(Users);
     populateNeighbours <PMProject>(Project);
     populateNeighbours <PX.SM.Users>(Users);
     base.Persist();
     PXSelectorAttribute.ClearGlobalCache <PX.SM.Users>();
     PXSelectorAttribute.ClearGlobalCache <PMProject>();
     PXDimensionAttribute.Clear();
 }
Exemple #4
0
 public override void Persist()
 {
     populateNeighbours <PX.SM.Users>(Users);
     populateNeighbours <InventoryItem>(Item);
     populateNeighbours <INItemClass>(Class);
     populateNeighbours <InventoryItem>(Item);
     populateNeighbours <PX.SM.Users>(Users);
     base.Persist();
     PXSelectorAttribute.ClearGlobalCache <PX.SM.Users>();
     PXSelectorAttribute.ClearGlobalCache <PX.Objects.IN.INItemClass>();
     PXSelectorAttribute.ClearGlobalCache <PX.Objects.IN.InventoryItem>();
     PXDimensionAttribute.Clear();
 }
Exemple #5
0
 public override void Persist()
 {
     try
     {
         PXDimensionAttribute.Clear();
         base.Persist();
         PXDimensionAttribute.Clear();
     }
     catch (PXDatabaseException e)
     {
         if (e.ErrorCode == PXDbExceptions.DeleteForeignKeyConstraintViolation)
         {
             throw new PXException(Messages.SegmentHasValues, e.Keys[1]);
         }
         throw;
     }
 }
Exemple #6
0
        public override void Persist()
        {
            if (Header.Cache.IsDirty && Detail.Select().Count == 0 && Header.Current != null)
            {
                throw new PXException(Messages.DimensionIsEmpty);
            }

            var current = Header.Current;

            if (current == null)
            {
                base.Persist();
            }
            else
            {
                try
                {
                    if (Header.Cache.GetStatus(current) != PXEntryStatus.Deleted)
                    {
                        InsertNumberingValue(Header.Current);
                        CorrectChildDimensions();
                    }

                    if (Header.Current.DimensionID == IN.SubItemAttribute.DimensionName)
                    {
                        ValidateSubItems();
                    }


                    PXDimensionAttribute.Clear();
                    base.Persist();
                    Header.Current = current;
                    PXDimensionAttribute.Clear();
                }
                catch (PXDatabaseException e)
                {
                    if (e.ErrorCode == PXDbExceptions.DeleteForeignKeyConstraintViolation)
                    {
                        throw new PXException(Messages.SegmentHasValues, e.Keys[1]);
                    }
                    throw;
                }
            }
            PXPageCacheUtils.InvalidateCachedPages();
        }