ExternalEntityHandlers.cs 1.85 KB
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using DirRX.Storage.ExternalEntity;

namespace DirRX.Storage
{
  partial class ExternalEntityClientHandlers
  {

    public override void Refresh(Sungero.Presentation.FormRefreshEventArgs e)
    {
      // Если запись открывается из Внешнего справочника, сделать нередактируемыми родительские реквизиты.
      if (CallContext.CalledFrom(Storage.ExternalSystems.Info))
        _obj.State.Properties.ExternalSystem.IsEnabled = false;
      
      _obj.State.Properties.AcceptWithoutConfirmation.IsVisible = _obj.MappingMode.HasValue && _obj.MappingMode.Value == MappingMode.Auto;      
    }

    public virtual void MappingModeValueInput(Sungero.Presentation.EnumerationValueInputEventArgs e)
    {
      _obj.State.Properties.AcceptWithoutConfirmation.IsEnabled = e.NewValue.HasValue && e.NewValue.Value == MappingMode.Auto;
      if (!_obj.State.Properties.AcceptWithoutConfirmation.IsEnabled && _obj.AcceptWithoutConfirmation == true)
        _obj.AcceptWithoutConfirmation = false;
    }

    public virtual void AcceptWithoutConfirmationValueInput(Sungero.Presentation.BooleanValueInputEventArgs e)
    {
      
    }

    public override void Showing(Sungero.Presentation.FormShowingEventArgs e)
    {
      // Если запись открывается из Внешнего справочника, сделать нередактируемыми родительские реквизиты.
      if (CallContext.CalledFrom(Storage.ExternalSystems.Info))
        _obj.State.Properties.ExternalSystem.IsEnabled = false;
      
      _obj.State.Properties.AcceptWithoutConfirmation.IsVisible = _obj.MappingMode.HasValue && _obj.MappingMode.Value == MappingMode.Auto;
    }
  }

}