コード例 #1
0
 internal void UpdateCustomer(CustomerOrganisation customer, bool isNewCustomer = false)
 {
     customer.Name = Name;
     customer.ParentCustomerOrganisationId = ParentId;
     customer.EmailDomain                = EmailDomain;
     customer.OrganisationNumber         = OrganisationNumber;
     customer.PeppolId                   = PeppolId;
     customer.UseOrderAgreementsFromDate = ShowUseOrderAgreementsFromDate ? UseOrderAgreementsFromDate : null;
     if (isNewCustomer)
     {
         customer.PriceListType           = PriceListType.Value;
         customer.OrganisationPrefix      = OrganisationPrefix;
         customer.TravelCostAgreementType = TravelCostAgreementType.Value;
         customer.CustomerSettings.AddRange(CustomerSettings.Select(c => new CustomerSetting {
             CustomerSettingType = c.CustomerSettingType, Value = c.Value
         }).ToList());
     }
 }
コード例 #2
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;
            }
        }