Esempio n. 1
0
        public virtual void Update(Dealer dealer, DealerType dealerType, Region region, City city, Town town, bool updateStatus)
        {
            Address    = dealer.Address;
            PostalCode = dealer.PostalCode;
            Region     = region;
            City       = city;
            Town       = town;
            DealerType = dealerType;
            Longitude  = dealer.Longitude;
            Latitude   = dealer.Latitude;

            dealer.DealerLocalization
            .ToList()
            .ForEach(dealerLocalization =>
            {
                if (DealerLocalization.ContainsKey(dealerLocalization.Key))
                {
                    DealerLocalization[dealerLocalization.Key].Update(dealerLocalization.Value.ToString());
                }
                else
                {
                    DealerLocalization.Add(dealerLocalization.Key, new DealerLocalization(dealerLocalization.Value.ToString()));
                }
            });

            if (dealer.DealerEmailAddresses != null)
            {
                foreach (var dealerEmailAddress in dealer.DealerEmailAddresses)
                {
                    DealerEmailAddresses.Add(new DealerEmailAddress(this, dealerEmailAddress.IsDefault, dealerEmailAddress.EmailAddress));
                }

                DealerEmailAddresses.ToList()
                .ForEach(dealerEmailAddress =>
                {
                    if (!dealer.DealerEmailAddresses.Select(x => x.EmailAddress).Contains(dealerEmailAddress.EmailAddress))
                    {
                        DealerEmailAddresses.Remove(dealerEmailAddress);
                    }
                });
            }

            if (dealer.DealerPhoneNumbers != null)
            {
                foreach (var dealerPhoneNumber in dealer.DealerPhoneNumbers)
                {
                    DealerPhoneNumbers.Add(new DealerPhoneNumber(this, dealerPhoneNumber.IsDefault, dealerPhoneNumber.PhoneNumber));
                }

                DealerPhoneNumbers.ToList()
                .ForEach(dealerPhoneNumber =>
                {
                    if (!dealer.DealerPhoneNumbers.Select(x => x.PhoneNumber).Contains(dealerPhoneNumber.PhoneNumber))
                    {
                        DealerPhoneNumbers.Remove(dealerPhoneNumber);
                    }
                });
            }

            if (updateStatus)
            {
                SetStatus(dealer.Status);
            }
        }
Esempio n. 2
0
 private void ExpandSubDealersRecursively(Dealer dealer, ICollection <Dealer> dealers)
 {
     dealers.Add(dealer);
     dealer.SubDealers.ToList().ForEach(x => ExpandSubDealersRecursively(x, dealers));
 }
Esempio n. 3
0
 public virtual void SetProxyOwner(Dealer proxyOwnerDealer)
 {
     ProxyOwnerDealer = proxyOwnerDealer;
 }
Esempio n. 4
0
 public virtual void UpdateParentDealer(Dealer parentDealer, DealerHierarchy dealerHierarchy)
 {
     ParentDealer     = parentDealer;
     ParentDealerCode = parentDealer.DealerCode;
     DealerHierarchy  = dealerHierarchy;
 }