예제 #1
0
        public override void BeforeSaveHistory(Sungero.Domain.HistoryEventArgs e)
        {
            base.BeforeSaveHistory(e);

            if (_obj.State.Properties.Deadline.IsChanged)
            {
                e.Operation = new Enumeration(Constants.FreeApprovalReworkAssignment.Operation.DeadlineExtend);
            }
        }
예제 #2
0
        public override void BeforeSaveHistory(Sungero.Domain.HistoryEventArgs e)
        {
            var isExchangeBoxesAction = _obj.State.Properties.ExchangeBoxes.IsChanged;

            // Изменять историю только для изменения эл. обмена.
            if (!isExchangeBoxesAction)
            {
                return;
            }

            var exchangeBoxes = _obj.ExchangeBoxes.ToList();

            foreach (var exchangeBox in exchangeBoxes)
            {
                if (exchangeBox.State.Properties.Status.IsChanged)
                {
                    var operation = e.Operation;
                    if (exchangeBox.Status == Sungero.Parties.CounterpartyExchangeBoxes.Status.Active)
                    {
                        operation = new Enumeration(Constants.Counterparty.ExchangeWithCAActivated);
                    }
                    else if (exchangeBox.Status == Sungero.Parties.CounterpartyExchangeBoxes.Status.Closed)
                    {
                        operation = new Enumeration(Constants.Counterparty.ExchangeWithCAClosed);
                    }
                    else if (exchangeBox.Status == Sungero.Parties.CounterpartyExchangeBoxes.Status.ApprovingByCA)
                    {
                        operation = new Enumeration(Constants.Counterparty.InvitationSentToCA);
                    }
                    else if (exchangeBox.Status == Sungero.Parties.CounterpartyExchangeBoxes.Status.ApprovingByUs)
                    {
                        operation = new Enumeration(Constants.Counterparty.InvitationSentToUs);
                    }
                    else
                    {
                        return;
                    }

                    var operationDetailed =
                        new Enumeration(Constants.Counterparty.StatusChanged);
                    var comment = string.Format("{0}|{1}", exchangeBox.Box.BusinessUnit, exchangeBox.Box.ExchangeService);
                    e.Write(operation, operationDetailed, comment);
                }
            }
        }