生如夏花

这是一个多美丽又遗憾的世界,我们就这样抱着笑着还流着泪 我从远方赶来赴你一面之约,痴迷流连人间我为她而狂野
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

示例

Posted on 2007-07-30 22:44  陈欠扁  阅读(190)  评论(0)    收藏  举报

using System;
using System.Collections.Generic;
using System.Text;

namespace HardwareDistributor.Business
{
    public class Customer
    {
        private int _customerId;
        private string _customerName;
        private string _streetAddress;
        private string _city;
        private string _stateProvince;
        private string _postalCode;
        private string _contactName;
        private string _contactPhone;
        private int _routeId;

        public Customer() { }

        public Customer(int customerId, string customerName, string streetAddress,
                        string city, string stateProvince, string postalCode,
                        string contactName, string contactPhone, int routeId)
        {
            this._customerId = customerId;
            this._customerName = customerName;
            this._streetAddress = streetAddress;
            this._city = city;
            this._stateProvince = stateProvince;
            this._postalCode = postalCode;
            this._contactName = contactName;
            this._contactPhone = contactPhone;
            this._routeId = routeId;
        }


        /// <summary>
        /// Customer's phone number
        /// </summary>
        public string ContactPhone
        {
            get
            {
                return _contactPhone;
            }
            set
            {
                _contactPhone = value;
            }
        }


        /// <summary>
        /// Point of contact at Customer's company
        /// </summary>
        public string ContactName
        {
            get
            {
                return _contactName;
            }
            set
            {
                _contactName = value;
            }
        }


        /// <summary>
        /// Customer's postal/zip code
        /// </summary>
        public string PostalCode
        {
            get
            {
                return _postalCode;
            }
            set
            {
                _postalCode = value;
            }
        }


        /// <summary>
        /// State or Province where customer resides
        /// </summary>
        public string StateProvince
        {
            get
            {
                return _stateProvince;
            }
            set
            {
                _stateProvince = value;
            }
        }


        /// <summary>
        /// City where customer resides
        /// </summary>
        public string City
        {
            get
            {
                return _city;
            }
            set
            {
                _city = value;
            }
        }


        /// <summary>
        /// Address of Customer's place of business
        /// </summary>
        public string StreetAddress
        {
            get
            {
                return _streetAddress;
            }
            set
            {
                _streetAddress = value;
            }
        }


        /// <summary>
        /// Id of the route this customer belongs to
        /// </summary>
        public int RouteId
        {
            get
            {
                return _routeId;
            }
            set
            {
                _routeId = value;
            }
        }


        /// <summary>
        /// Customer's unique Id
        /// </summary>
        public int CustomerId
        {
            get
            {
                return _customerId;
            }
            set
            {
                _customerId = value;
            }
        }

       
        /// <summary>
        /// Customer's company name
        /// </summary>
        public string CustomerName
        {
            get
            {
                return _customerName;
            }
            set
            {
                _customerName = value;
            }
        }


    }
}


using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;


namespace HardwareDistributor.Business
{
    public class CustomerCollection : CollectionBase
    {

        /// <summary>
        /// Collection indexer
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public Customer this[int index]
        {
            get
            {
                return (Customer)List[index];
            }
            set
            {
                List[index] = value;
            }
        }


        /// <summary>
        /// Adds an object to the collection
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public int Add(Customer value)
        {
            return (List.Add(value));
        }


        /// <summary>
        /// Returns the index of the passed-in object
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public int IndexOf(Customer value)
        {
            return (List.IndexOf(value));
        }


        /// <summary>
        /// Inserts an object into a specfic index of the collection
        /// </summary>
        /// <param name="index"></param>
        /// <param name="value"></param>
        public void Insert(int index, Customer value)
        {
            List.Insert(index, value);
        }


        /// <summary>
        /// Removes an object from the collection
        /// </summary>
        /// <param name="value"></param>
        public void Remove(Customer value)
        {
            List.Remove(value);
        }


        /// <summary>
        /// Tells you if this collection
        /// contains the passed-in object
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public bool Contains(Customer value)
        {
            return (List.Contains(value));
        }

    }
}


/Files/chenaspx/daabcf.zip