/// <summary>
        /// Returns true if the specified customer exists in the
        /// repository, or false if it is not.
        /// </summary>
        public bool ContainsCustomer(Customer customer)
        {
            if (customer == null)
                throw new ArgumentNullException("customer");

            return _customers.Contains(customer);
        }
        public CustomerViewModel(Customer customer, CustomerRepository customerRepository)
        {
            if (customer == null)
                throw new ArgumentNullException("customer");

            if (customerRepository == null)
                throw new ArgumentNullException("customerRepository");

            _customer = customer;
            _customerRepository = customerRepository;
            _customerType = Strings.CustomerViewModel_CustomerTypeOption_NotSpecified;
        }
        /// <summary>
        /// Places the specified customer into the repository.
        /// If the customer is already in the repository, an
        /// exception is not thrown.
        /// </summary>
        public void AddCustomer(Customer customer)
        {
            if (customer == null)
                throw new ArgumentNullException("customer");

            if (!_customers.Contains(customer))
            {
                _customers.Add(customer);

                if (this.CustomerAdded != null)
                    this.CustomerAdded(this, new CustomerAddedEventArgs(customer));
            }
        }
Esempio n. 4
0
		public CustomerViewModel( Customer customer, CustomerRepository customerRepository )
		{
			if ( customer == null )
				throw new ArgumentNullException( "customer" );

			if ( customerRepository == null )
				throw new ArgumentNullException( "customerRepository" );

			_customer = customer;
			_customerRepository = customerRepository;
			_customerType = Strings.CustomerViewModel_CustomerTypeOption_NotSpecified;

			if ( !IsNewCustomer )
			{
				if ( customer.IsCompany )
					CustomerType = Strings.CustomerViewModel_CustomerTypeOption_Company;
				else
					CustomerType = Strings.CustomerViewModel_CustomerTypeOption_Person;
			}
		}
 public CustomerAddedEventArgs(Customer newCustomer)
 {
     this.NewCustomer = newCustomer;
 }