예제 #1
0
        public ChangeAgreementEvent CreateChangeAgreementEvent(int agrId, Dictionary <string, int> changes, int valeur)
        {
            if (!Agreements.Any(x => x.Id.Equals(agrId)))
            {
                return(null);
            }
            var ce = new ChangeAgreementEvent(agrId, changes, valeur);

            AgreementEvents.Add(ce);
            return(ce);
        }
예제 #2
0
        private Agreement ApplyChange(Agreement result, ChangeAgreementEvent evt)
        {
            result = new Agreement(new Dictionary <string, int>(result.Values), evt.ValeurDate)
            {
                Id = Id
            };

            foreach (var change in evt.Changes)
            {
                if (result.Values.ContainsKey(change.Key))
                {
                    result.Values[change.Key] = change.Value;
                }
                else
                {
                    result.Values.Add(change.Key, change.Value);
                }
            }
            return(result);
        }