示例#1
0
        protected virtual void OnAfterDelete()
        {
            var displayOrderRow = Row as IDisplayOrderRow;

            if (displayOrderRow != null)
            {
                var filter = GetDisplayOrderFilter();
                DisplayOrderHelper.ReorderValues(Connection, displayOrderRow, filter, -1, 1, false);
            }
        }
        protected virtual void OnAfterUndelete()
        {
            var displayOrderRow = Row as IDisplayOrderRow;

            if (displayOrderRow != null)
            {
                var filter = GetDisplayOrderFilter();
                DisplayOrderHelper.ReorderValues(Connection, displayOrderRow, filter,
                                                 Row.IdField[Row].Value, displayOrderRow.DisplayOrderField[Row].Value, false);
            }
        }
        protected virtual void OnAfterDelete()
        {
            if (Row as IDisplayOrderRow != null)
            {
                var filter = GetDisplayOrderFilter();
                DisplayOrderHelper.ReorderValues(Connection, Row as IDisplayOrderRow, filter, -1, 1, false);
            }

            foreach (var behavior in behaviors.Value)
                behavior.OnAfterDelete(this);
        }
        protected virtual void HandleDisplayOrder(bool afterSave)
        {
            var displayOrderRow = Row as IDisplayOrderRow;

            if (displayOrderRow == null)
            {
                return;
            }

            if (IsCreate && !afterSave)
            {
                var value = displayOrderRow.DisplayOrderField.AsObject(Row);
                if (value == null || Convert.ToInt32(value) <= 0)
                {
                    var filter = GetDisplayOrderFilter();
                    displayOrderRow.DisplayOrderField.AsObject(Row,
                                                               DisplayOrderHelper.GetNextValue(Connection, displayOrderRow, filter));
                }
                else
                {
                    displayOrderFix = true;
                }
            }
            else if (afterSave &&
                     ((IsCreate && displayOrderFix) ||
                      (IsUpdate && displayOrderRow.DisplayOrderField[Old] != displayOrderRow.DisplayOrderField[Row])))
            {
                DisplayOrderHelper.ReorderValues(
                    connection: Connection,
                    row: displayOrderRow,
                    filter: GetDisplayOrderFilter(),
                    recordID: ((Field)Row.IdField).AsObject(Row),
                    newDisplayOrder: displayOrderRow.DisplayOrderField[Row].Value,
                    hasUniqueConstraint: false);
            }
        }