예제 #1
0
        public void DeleteRelatedEntityAnswer <TCache>(CSAttributeGroup attributeGroup)
            where TCache : IBqlTable
        {
            var entityAttribute = GetRelatedEntityAttribute <TCache>(
                attributeGroup.AttributeID, attributeGroup.EntityClassID);

            if (entityAttribute != null)
            {
                CSAttributeGroupList <IBqlTable, TCache> .DeleteAttributesForGroup(graph, entityAttribute);
            }
        }
예제 #2
0
        /// <summary>
        /// Deletes answers related to the primary attribute group. Should be used on RowDeleting event.
        /// </summary>
        public void DeleteAnswersIfRequired <TPrimaryCache>(Events.RowDeleting <CSAttributeGroup> args)
            where TPrimaryCache : IBqlTable
        {
            var attributeGroup = args.Row;

            if (attributeGroup.IsActive == true)
            {
                throw new PXSetPropertyException(CrMessages.AttributeCannotDeleteActive);
            }
            if (IsDeleteConfirmed())
            {
                CSAttributeGroupList <IBqlTable, TPrimaryCache> .DeleteAttributesForGroup(graph, attributeGroup);
            }
            else
            {
                args.Cancel = true;
            }
        }
예제 #3
0
        protected virtual void CSAttributeGroup_RowDeleting(PXCache sender, PXRowDeletingEventArgs e)
        {
            var attributeGroup = (CSAttributeGroup)e.Row;

            if (attributeGroup == null)
            {
                return;
            }
            if (attributeGroup.IsActive == true)
            {
                throw new PXSetPropertyException(CR.Messages.AttributeCannotDeleteActive);
            }

            if (Mapping.Ask("Warning", CR.Messages.AttributeDeleteWarning, MessageButtons.OKCancel) != WebDialogResult.OK)
            {
                e.Cancel = true;
                return;
            }
            CSAttributeGroupList <CSAttributeGroup, CSAttributeGroup> .DeleteAttributesForGroup(this, attributeGroup);
        }