Esempio n. 1
0
        public override void BeforeSaveHistory(Sungero.Content.DocumentHistoryEventArgs e)
        {
            var isCreateAction     = e.Action == Sungero.CoreEntities.History.Action.Create;
            var isChangeTypeAction = e.Action == Sungero.CoreEntities.History.Action.ChangeType;

            if (!isCreateAction && !isChangeTypeAction)
            {
                base.BeforeSaveHistory(e);
            }
            else
            {
                // Изменение суммы или валюты.
                var sumWasChanged = _obj.State.Properties.TotalAmount.IsChanged || (_obj.State.Properties.Currency.IsChanged && _obj.TotalAmount.HasValue);
                if (sumWasChanged)
                {
                    // Локализация для операции в ресурсах OfficialDocument.
                    var operation         = new Enumeration(Sungero.Docflow.Constants.OfficialDocument.Operation.TotalAmountChange);
                    var operationDetailed = _obj.TotalAmount.HasValue ? operation : new Enumeration(Sungero.Docflow.Constants.OfficialDocument.Operation.TotalAmountClear);
                    var currency          = (_obj.Currency == null) ? string.Empty : _obj.Currency.AlphaCode;
                    var comment           = _obj.TotalAmount.HasValue ? string.Join("|", _obj.TotalAmount.Value, currency) : string.Empty;

                    e.Write(operation, operationDetailed, comment);
                }
            }
        }
        public override void BeforeSaveHistory(Sungero.Content.DocumentHistoryEventArgs e)
        {
            base.BeforeSaveHistory(e);

            // Добавить комментарий к записи создания в истории.
            if (e.Action == Sungero.CoreEntities.History.Action.Create)
            {
                e.OperationDetailed = new Enumeration(Sungero.Docflow.Constants.OfficialDocument.Operation.FromExchangeService);
                e.Comment           = _obj.BusinessUnitBox.ExchangeService.Name;
            }
        }
Esempio n. 3
0
        public override void BeforeSaveHistory(Sungero.Content.DocumentHistoryEventArgs e)
        {
            base.BeforeSaveHistory(e);

            var isUpdateAction        = e.Action == Sungero.CoreEntities.History.Action.Update;
            var isCreateAction        = e.Action == Sungero.CoreEntities.History.Action.Create;
            var isVersionCreateAction = e.Action == Sungero.CoreEntities.History.Action.Update &&
                                        e.Operation == new Enumeration(Constants.OfficialDocument.Operation.CreateVersion);
            var properties = _obj.State.Properties;

            // Изменять историю только для изменения и создания документа.
            if (!isUpdateAction && !isCreateAction)
            {
                return;
            }

            // Добавить комментарий к записи создания в истории о том, что титул продавца получен через СО.
            if (_obj.IsFormalized == true && isCreateAction && _obj.SellerTitleId.HasValue && _obj.ExchangeState != null)
            {
                var info = Exchange.PublicFunctions.ExchangeDocumentInfo.Remote.GetExDocumentInfoFromVersion(_obj, _obj.SellerTitleId.Value);
                if (info != null)
                {
                    e.OperationDetailed = new Enumeration(Sungero.Docflow.Constants.OfficialDocument.Operation.SellerTitleFromExchangeService);
                    e.Comment           = ExchangeCore.PublicFunctions.BoxBase.GetExchangeService(info.Box).Name;
                }
            }

            // Добавить комментарий к записи создания в истории о том, что заполнен титул покупателя.
            if (_obj.IsFormalized == true && isVersionCreateAction && _obj.ExchangeState != null)
            {
                e.OperationDetailed = new Enumeration(Sungero.Docflow.Constants.OfficialDocument.Operation.BuyerTitle);
            }

            // Изменение суммы или валюты.
            var sumWasChanged = _obj.State.Properties.TotalAmount.IsChanged || (_obj.State.Properties.Currency.IsChanged && _obj.TotalAmount.HasValue);

            if (sumWasChanged)
            {
                // Локализация для операции в ресурсах OfficialDocument.
                var operation         = new Enumeration(Constants.OfficialDocument.Operation.TotalAmountChange);
                var operationDetailed = _obj.TotalAmount.HasValue ? operation : new Enumeration(Constants.OfficialDocument.Operation.TotalAmountClear);
                var currency          = (_obj.Currency == null) ? string.Empty : _obj.Currency.AlphaCode;
                var comment           = _obj.TotalAmount.HasValue ? string.Join("|", _obj.TotalAmount.Value, currency) : string.Empty;

                e.Write(operation, operationDetailed, comment);
            }
        }