Наследование: VIndividualCustomerBase
Пример #1
0
        ///<summary>
        ///  Returns a Typed VIndividualCustomerBase Entity
        ///</summary>
        public virtual VIndividualCustomerBase Copy()
        {
            //shallow copy entity
            VIndividualCustomer copy = new VIndividualCustomer();

            copy.CustomerId        = this.CustomerId;
            copy.Title             = this.Title;
            copy.FirstName         = this.FirstName;
            copy.MiddleName        = this.MiddleName;
            copy.LastName          = this.LastName;
            copy.Suffix            = this.Suffix;
            copy.Phone             = this.Phone;
            copy.EmailAddress      = this.EmailAddress;
            copy.EmailPromotion    = this.EmailPromotion;
            copy.AddressType       = this.AddressType;
            copy.AddressLine1      = this.AddressLine1;
            copy.AddressLine2      = this.AddressLine2;
            copy.City              = this.City;
            copy.StateProvinceName = this.StateProvinceName;
            copy.PostalCode        = this.PostalCode;
            copy.CountryRegionName = this.CountryRegionName;
            copy.Demographics      = this.Demographics;
            copy.AcceptChanges();
            return((VIndividualCustomer)copy);
        }
Пример #2
0
        /// <summary>
        /// Gets the property value by name.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="propertyName">Name of the property.</param>
        /// <returns></returns>
        public static object GetPropertyValueByName(VIndividualCustomer entity, string propertyName)
        {
            switch (propertyName)
            {
            case "CustomerId":
                return(entity.CustomerId);

            case "Title":
                return(entity.Title);

            case "FirstName":
                return(entity.FirstName);

            case "MiddleName":
                return(entity.MiddleName);

            case "LastName":
                return(entity.LastName);

            case "Suffix":
                return(entity.Suffix);

            case "Phone":
                return(entity.Phone);

            case "EmailAddress":
                return(entity.EmailAddress);

            case "EmailPromotion":
                return(entity.EmailPromotion);

            case "AddressType":
                return(entity.AddressType);

            case "AddressLine1":
                return(entity.AddressLine1);

            case "AddressLine2":
                return(entity.AddressLine2);

            case "City":
                return(entity.City);

            case "StateProvinceName":
                return(entity.StateProvinceName);

            case "PostalCode":
                return(entity.PostalCode);

            case "CountryRegionName":
                return(entity.CountryRegionName);

            case "Demographics":
                return(entity.Demographics);
            }
            return(null);
        }
Пример #3
0
        ///<summary>
        /// A simple factory method to create a new <see cref="VIndividualCustomer"/> instance.
        ///</summary>
        ///<param name="_customerId"></param>
        ///<param name="_title"></param>
        ///<param name="_firstName"></param>
        ///<param name="_middleName"></param>
        ///<param name="_lastName"></param>
        ///<param name="_suffix"></param>
        ///<param name="_phone"></param>
        ///<param name="_emailAddress"></param>
        ///<param name="_emailPromotion"></param>
        ///<param name="_addressType"></param>
        ///<param name="_addressLine1"></param>
        ///<param name="_addressLine2"></param>
        ///<param name="_city"></param>
        ///<param name="_stateProvinceName"></param>
        ///<param name="_postalCode"></param>
        ///<param name="_countryRegionName"></param>
        ///<param name="_demographics"></param>
        public static VIndividualCustomer CreateVIndividualCustomer(System.Int32 _customerId, System.String _title, System.String _firstName, System.String _middleName, System.String _lastName, System.String _suffix, System.String _phone, System.String _emailAddress, System.Int32 _emailPromotion, System.String _addressType, System.String _addressLine1, System.String _addressLine2, System.String _city, System.String _stateProvinceName, System.String _postalCode, System.String _countryRegionName, string _demographics)
        {
            VIndividualCustomer newVIndividualCustomer = new VIndividualCustomer();

            newVIndividualCustomer.CustomerId        = _customerId;
            newVIndividualCustomer.Title             = _title;
            newVIndividualCustomer.FirstName         = _firstName;
            newVIndividualCustomer.MiddleName        = _middleName;
            newVIndividualCustomer.LastName          = _lastName;
            newVIndividualCustomer.Suffix            = _suffix;
            newVIndividualCustomer.Phone             = _phone;
            newVIndividualCustomer.EmailAddress      = _emailAddress;
            newVIndividualCustomer.EmailPromotion    = _emailPromotion;
            newVIndividualCustomer.AddressType       = _addressType;
            newVIndividualCustomer.AddressLine1      = _addressLine1;
            newVIndividualCustomer.AddressLine2      = _addressLine2;
            newVIndividualCustomer.City              = _city;
            newVIndividualCustomer.StateProvinceName = _stateProvinceName;
            newVIndividualCustomer.PostalCode        = _postalCode;
            newVIndividualCustomer.CountryRegionName = _countryRegionName;
            newVIndividualCustomer.Demographics      = _demographics;
            return(newVIndividualCustomer);
        }
		/// <summary>
		/// Deserialize the mock VIndividualCustomer entity from a temporary file.
		/// </summary>
		private void Step_7_DeserializeEntity_Generated()
		{
			string fileName = "temp_VIndividualCustomer.xml";
		
			XmlSerializer mySerializer = new XmlSerializer(typeof(VIndividualCustomer)); 
			System.IO.FileStream myFileStream = new System.IO.FileStream(fileName,  System.IO.FileMode.Open); 
			mock = (VIndividualCustomer) mySerializer.Deserialize(myFileStream);
			myFileStream.Close();
			System.IO.File.Delete(fileName);
			
			System.Console.WriteLine("mock correctly deserialized from a temporary file.");
		}
		///<summary>
		///  Returns a Typed VIndividualCustomer Entity with mock values.
		///</summary>
		static public VIndividualCustomer CreateMockInstance()
		{		
			VIndividualCustomer mock = new VIndividualCustomer();
						
			mock.CustomerId = TestUtility.Instance.RandomNumber();
			mock.Title = TestUtility.Instance.RandomString(8, false);;
			mock.FirstName = TestUtility.Instance.RandomString(24, false);;
			mock.MiddleName = TestUtility.Instance.RandomString(24, false);;
			mock.LastName = TestUtility.Instance.RandomString(24, false);;
			mock.Suffix = TestUtility.Instance.RandomString(10, false);;
			mock.Phone = TestUtility.Instance.RandomString(11, false);;
			mock.EmailAddress = TestUtility.Instance.RandomString(24, false);;
			mock.EmailPromotion = TestUtility.Instance.RandomNumber();
			mock.AddressType = TestUtility.Instance.RandomString(24, false);;
			mock.AddressLine1 = TestUtility.Instance.RandomString(29, false);;
			mock.AddressLine2 = TestUtility.Instance.RandomString(29, false);;
			mock.City = TestUtility.Instance.RandomString(14, false);;
			mock.StateProvinceName = TestUtility.Instance.RandomString(24, false);;
			mock.PostalCode = TestUtility.Instance.RandomString(6, false);;
			mock.CountryRegionName = TestUtility.Instance.RandomString(24, false);;
			mock.Demographics = "<test></test>";
		   return (VIndividualCustomer)mock;
		}
		///<summary>
		///  Returns a Typed VIndividualCustomerBase Entity 
		///</summary>
		public virtual VIndividualCustomerBase Copy()
		{
			//shallow copy entity
			VIndividualCustomer copy = new VIndividualCustomer();
				copy.CustomerId = this.CustomerId;
				copy.Title = this.Title;
				copy.FirstName = this.FirstName;
				copy.MiddleName = this.MiddleName;
				copy.LastName = this.LastName;
				copy.Suffix = this.Suffix;
				copy.Phone = this.Phone;
				copy.EmailAddress = this.EmailAddress;
				copy.EmailPromotion = this.EmailPromotion;
				copy.AddressType = this.AddressType;
				copy.AddressLine1 = this.AddressLine1;
				copy.AddressLine2 = this.AddressLine2;
				copy.City = this.City;
				copy.StateProvinceName = this.StateProvinceName;
				copy.PostalCode = this.PostalCode;
				copy.CountryRegionName = this.CountryRegionName;
				copy.Demographics = this.Demographics;
			copy.AcceptChanges();
			return (VIndividualCustomer)copy;
		}
		///<summary>
		/// A simple factory method to create a new <see cref="VIndividualCustomer"/> instance.
		///</summary>
		///<param name="_customerId"></param>
		///<param name="_title"></param>
		///<param name="_firstName"></param>
		///<param name="_middleName"></param>
		///<param name="_lastName"></param>
		///<param name="_suffix"></param>
		///<param name="_phone"></param>
		///<param name="_emailAddress"></param>
		///<param name="_emailPromotion"></param>
		///<param name="_addressType"></param>
		///<param name="_addressLine1"></param>
		///<param name="_addressLine2"></param>
		///<param name="_city"></param>
		///<param name="_stateProvinceName"></param>
		///<param name="_postalCode"></param>
		///<param name="_countryRegionName"></param>
		///<param name="_demographics"></param>
		public static VIndividualCustomer CreateVIndividualCustomer(System.Int32 _customerId, System.String _title, System.String _firstName, System.String _middleName, System.String _lastName, System.String _suffix, System.String _phone, System.String _emailAddress, System.Int32 _emailPromotion, System.String _addressType, System.String _addressLine1, System.String _addressLine2, System.String _city, System.String _stateProvinceName, System.String _postalCode, System.String _countryRegionName, string _demographics)
		{
			VIndividualCustomer newVIndividualCustomer = new VIndividualCustomer();
			newVIndividualCustomer.CustomerId = _customerId;
			newVIndividualCustomer.Title = _title;
			newVIndividualCustomer.FirstName = _firstName;
			newVIndividualCustomer.MiddleName = _middleName;
			newVIndividualCustomer.LastName = _lastName;
			newVIndividualCustomer.Suffix = _suffix;
			newVIndividualCustomer.Phone = _phone;
			newVIndividualCustomer.EmailAddress = _emailAddress;
			newVIndividualCustomer.EmailPromotion = _emailPromotion;
			newVIndividualCustomer.AddressType = _addressType;
			newVIndividualCustomer.AddressLine1 = _addressLine1;
			newVIndividualCustomer.AddressLine2 = _addressLine2;
			newVIndividualCustomer.City = _city;
			newVIndividualCustomer.StateProvinceName = _stateProvinceName;
			newVIndividualCustomer.PostalCode = _postalCode;
			newVIndividualCustomer.CountryRegionName = _countryRegionName;
			newVIndividualCustomer.Demographics = _demographics;
			return newVIndividualCustomer;
		}
		/// <summary>
		/// Gets the property value by name.
		/// </summary>
		/// <param name="entity">The entity.</param>
		/// <param name="propertyName">Name of the property.</param>
		/// <returns></returns>
		public static object GetPropertyValueByName(VIndividualCustomer entity, string propertyName)
		{
			switch (propertyName)
			{
				case "CustomerId":
					return entity.CustomerId;
				case "Title":
					return entity.Title;
				case "FirstName":
					return entity.FirstName;
				case "MiddleName":
					return entity.MiddleName;
				case "LastName":
					return entity.LastName;
				case "Suffix":
					return entity.Suffix;
				case "Phone":
					return entity.Phone;
				case "EmailAddress":
					return entity.EmailAddress;
				case "EmailPromotion":
					return entity.EmailPromotion;
				case "AddressType":
					return entity.AddressType;
				case "AddressLine1":
					return entity.AddressLine1;
				case "AddressLine2":
					return entity.AddressLine2;
				case "City":
					return entity.City;
				case "StateProvinceName":
					return entity.StateProvinceName;
				case "PostalCode":
					return entity.PostalCode;
				case "CountryRegionName":
					return entity.CountryRegionName;
				case "Demographics":
					return entity.Demographics;
			}
			return null;
		}
		/// <summary>
		/// Convert a nettiers collection to the ws proxy collection.
		/// </summary>
		public static VIndividualCustomer Convert(WsProxy.VIndividualCustomer item)
		{			
			VIndividualCustomer outItem = new VIndividualCustomer();			
			outItem.CustomerId = item.CustomerId;
			outItem.Title = item.Title;
			outItem.FirstName = item.FirstName;
			outItem.MiddleName = item.MiddleName;
			outItem.LastName = item.LastName;
			outItem.Suffix = item.Suffix;
			outItem.Phone = item.Phone;
			outItem.EmailAddress = item.EmailAddress;
			outItem.EmailPromotion = item.EmailPromotion;
			outItem.AddressType = item.AddressType;
			outItem.AddressLine1 = item.AddressLine1;
			outItem.AddressLine2 = item.AddressLine2;
			outItem.City = item.City;
			outItem.StateProvinceName = item.StateProvinceName;
			outItem.PostalCode = item.PostalCode;
			outItem.CountryRegionName = item.CountryRegionName;
			outItem.Demographics = item.Demographics;
							
			outItem.AcceptChanges();			
			return outItem;
		}