ExternalEntityHandlers.cs
1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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;
    }
  }
}