ExternalEntityLinkHandlers.cs 1.22 KB
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using DirRX.LongTermArchive.ExternalEntityLink;

namespace DirRX.LongTermArchive
{
  partial class ExternalEntityLinkClientHandlers
  {

    public override void Showing(Sungero.Presentation.FormShowingEventArgs e)
    {
      base.Showing(e);
      
      // Если запись открывается из Внешнего справочника, сделать нередактируемой всю запись (для авто режима), либо только родительские реквизиты (для ручного метода).
      if (CallContext.CalledFrom(Storage.ExternalEntities.Info))
      {
        if (Storage.PublicFunctions.Module.Remote.GetMappingMode(CallContext.GetCallerEntityId(Storage.ExternalEntities.Info)) == Storage.ExternalEntity.MappingMode.Auto)
        {
          _obj.State.IsEnabled = false;
          e.Params.Add("ViewMode", true);
        }
        else
        {
          var prop = _obj.State.Properties;
          prop.ExtSystemId.IsEnabled = false;
          prop.ExtEntityType.IsEnabled = false;
          prop.EntityType.IsEnabled = false;
        }
      }
    }

  }
}