protected virtual void Dimension_RowUpdating(PXCache cache, PXRowUpdatingEventArgs e) { Dimension newRow = (Dimension)e.NewRow; Dimension currow = (Dimension)Header.Current; int maxLength = PXDimensionAttribute.GetMaxLength(currow.DimensionID); if (newRow.Length > maxLength) { cache.RaiseExceptionHandling <Dimension.length>(e.Row, newRow.Length, new PXSetPropertyException <Dimension.length>(Messages.DimensionLengthOutOfRange)); } }
protected virtual void Dimension_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } Dimension dim = (Dimension)e.Row; dim.MaxLength = PXDimensionAttribute.GetMaxLength(dim.DimensionID); PXUIFieldAttribute.SetEnabled <Dimension.length>(cache, dim, false); PXUIFieldAttribute.SetVisible <Dimension.maxLength>(cache, dim, HasMaxLength(dim)); PXUIFieldAttribute.SetEnabled <Dimension.segments>(cache, dim, false); bool numberingIDEnabled = true; bool specificModule = true; bool validateEnabled = false; Detail.Cache.AllowInsert = true; Detail.Cache.AllowUpdate = true; Detail.Cache.AllowDelete = true; switch (dim.DimensionID) { case SubItemAttribute.DimensionName: validateEnabled = true; PXUIFieldAttribute.SetEnabled <Segment.autoNumber>(Detail.Cache, null, false); break; case SubAccountAttribute.DimensionName: validateEnabled = true; break; case AccountAttribute.DimensionName: break; case AR.CustomerAttribute.DimensionName: case AR.SalesPersonAttribute.DimensionName: case IN.InventoryAttribute.DimensionName: case IN.SiteAttribute.DimensionName: case IN.LocationAttribute.DimensionName: case AP.VendorAttribute.DimensionName: case AR.CustomerRawAttribute.DimensionName: case EP.EmployeeRawAttribute.DimensionName: case CR.LeadRawAttribute.DimensionName: validateEnabled = dim.Validate == false; PXUIFieldAttribute.SetEnabled <Segment.autoNumber>(Detail.Cache, null, true); PXUIFieldAttribute.SetVisible <Segment.isCosted>(Detail.Cache, null, false); break; default: validateEnabled = true; break; } cache.AllowDelete = dim.Internal != true; PXUIFieldAttribute.SetVisible <Segment.consolOrder>(Detail.Cache, null, dim.DimensionID == SubAccountAttribute.DimensionName); PXUIFieldAttribute.SetVisible <Segment.consolNumChar>(Detail.Cache, null, dim.DimensionID == SubAccountAttribute.DimensionName); PXUIFieldAttribute.SetVisible <Segment.isCosted>(Detail.Cache, null, dim.DimensionID == SubItemAttribute.DimensionName); bool hasParent = dim.ParentDimensionID != null; Detail.Cache.AllowInsert &= !hasParent; PXUIFieldAttribute.SetVisible <Segment.inherited>(Detail.Cache, null, hasParent); PXUIFieldAttribute.SetVisible <Segment.isOverrideForUI>(Detail.Cache, null, hasParent); PXUIFieldAttribute.SetEnabled <Dimension.numberingID>(cache, e.Row, numberingIDEnabled); PXUIFieldAttribute.SetEnabled <Dimension.specificModule>(cache, e.Row, specificModule); PXUIFieldAttribute.SetEnabled <Dimension.validate>(cache, e.Row, validateEnabled); }