public override void LeadingDocumentChanged(Sungero.Docflow.Shared.OfficialDocumentLeadingDocumentChangedEventArgs e)
        {
            base.LeadingDocumentChanged(e);

            if (Equals(e.NewValue, e.OldValue))
            {
                return;
            }

            if (e.NewValue != null && _obj.Counterparty == null)
            {
                _obj.Counterparty = AccountingDocumentBases.Is(e.NewValue)
          ? Docflow.AccountingDocumentBases.As(e.NewValue).Counterparty
          : Contracts.ContractualDocuments.As(e.NewValue).Counterparty;
            }

            if (e.NewValue != null && _obj.BusinessUnit == null)
            {
                _obj.BusinessUnit = e.NewValue.BusinessUnit;
            }

            if (e.NewValue != null)
            {
                Docflow.PublicFunctions.OfficialDocument.CopyProjects(e.NewValue, _obj);
            }

            FillName();
            _obj.Relations.AddFromOrUpdate(Contracts.PublicConstants.Module.AccountingDocumentsRelationName, e.OldValue, e.NewValue);
        }
Esempio n. 2
0
        public override void LeadingDocumentChanged(Sungero.Docflow.Shared.OfficialDocumentLeadingDocumentChangedEventArgs e)
        {
            base.LeadingDocumentChanged(e);

            if (Equals(e.NewValue, e.OldValue))
            {
                return;
            }

            if (e.NewValue != null)
            {
                var document = e.NewValue;
                if (document.BusinessUnit != null)
                {
                    _obj.BusinessUnit = document.BusinessUnit;
                }

                Docflow.PublicFunctions.OfficialDocument.CopyProjects(e.NewValue, _obj);

                foreach (var acr in document.AccessRights.Current)
                {
                    if (_obj.AccessRights.CanGrant(acr.AccessRightsType))
                    {
                        _obj.AccessRights.Grant(acr.Recipient, acr.AccessRightsType);
                    }
                }
            }

            FillName();
            _obj.Relations.AddFromOrUpdate(Constants.Module.AddendumRelationName, e.OldValue, e.NewValue);
        }
Esempio n. 3
0
        public override void LeadingDocumentChanged(Sungero.Docflow.Shared.OfficialDocumentLeadingDocumentChangedEventArgs e)
        {
            base.LeadingDocumentChanged(e);

            if (Equals(e.NewValue, e.OldValue))
            {
                return;
            }

            if (e.NewValue != null)
            {
                var contract = ContractBases.As(e.NewValue);
                _obj.Counterparty = contract.Counterparty;
                _obj.BusinessUnit = contract.BusinessUnit;

                Docflow.PublicFunctions.OfficialDocument.CopyProjects(e.NewValue, _obj);
            }

            FillName();
            _obj.Relations.AddFromOrUpdate(Constants.Module.SupAgreementRelationName, e.OldValue, e.NewValue);
        }