コード例 #1
0
        public void UpdateCustomerSettingsAndHistory(DateTimeOffset changedAt, int userId, IEnumerable <CustomerSetting> updatedCustomerSettings)
        {
            var customerSettings = CustomerSettings.Select(c => new CustomerSettingHistoryEntry {
                CustomerSettingType = c.CustomerSettingType, Value = c.Value
            });

            CustomerChangeLogEntries.Add(new CustomerChangeLogEntry
            {
                LoggedAt                         = changedAt,
                UpdatedByUserId                  = userId,
                CustomerChangeLogType            = CustomerChangeLogType.Settings,
                CustomerSettingHistories         = customerSettings.ToList(),
                CustomerOrganisationHistoryEntry = new CustomerOrganisationHistoryEntry(this)
            });
            foreach (CustomerSetting cs in updatedCustomerSettings.ToList())
            {
                CustomerSettings.SingleOrDefault(c => c.CustomerSettingType == cs.CustomerSettingType).Value = cs.Value;
            }
        }