text:
/*
	File generated by NetTiers templates [www.nettiers.com]
	Important: Do not modify this file. Edit the file ProductModelIllustration.cs instead.
*/

#region Using Directives
using System;
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
using System.Security.Permissions;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Security;
using System.Data;

using Nettiers.AdventureWorks.Entities;
using Nettiers.AdventureWorks.Entities.Validation;
//using Entities = Nettiers.AdventureWorks.Entities;
using Nettiers.AdventureWorks.Data;
using Nettiers.AdventureWorks.Data.Bases;

using Microsoft.Practices.EnterpriseLibrary.Logging;

#endregion

namespace Nettiers.AdventureWorks.Services
{

	///
	/// An object representation of the 'ProductModelIllustration' table.
	///
	/// <remarks>
	/// IMPORTANT!!! You should not modify this partial  class, modify the ProductModelIllustration.cs file instead.
	/// All custom implementations should be done in the <see cref="ProductModelIllustration"/> class.
	/// </remarks>
	[DataObject]
	[CLSCompliant(true)]
	public partial class ProductModelIllustrationServiceBase : ServiceBase<ProductModelIllustration, ProductModelIllustrationKey>
	{

		#region Constructors
		///
		/// Creates a new <see cref="ProductModelIllustration"/> instance .
		///
		public ProductModelIllustrationServiceBase() : base()
		{
		}

		///
		/// A simple factory method to create a new <see cref="ProductModelIllustration"/> instance.
		///
		///<param name="_productModelId">Primary key. Foreign key to ProductModel.ProductModelID.</param>
		///<param name="_illustrationId">Primary key. Foreign key to Illustration.IllustrationID.</param>
		///<param name="_modifiedDate">Date and time the record was last updated.</param>
		public static ProductModelIllustration CreateProductModelIllustration(System.Int32 _productModelId, System.Int32 _illustrationId, System.DateTime _modifiedDate)
		{
			ProductModelIllustration newEntityProductModelIllustration = new ProductModelIllustration();
			newEntityProductModelIllustration.ProductModelId  = _productModelId;
			newEntityProductModelIllustration.IllustrationId  = _illustrationId;
			newEntityProductModelIllustration.ModifiedDate  = _modifiedDate;
			return newEntityProductModelIllustration;
		}
		#endregion Constructors

		#region Fields
		private static SecurityContext<ProductModelIllustration> securityContext = new SecurityContext<ProductModelIllustration>();
		private static readonly string layerExceptionPolicy = "ServiceLayerExceptionPolicy";
		private static readonly bool noTranByDefault = false;
		#endregion

		#region SecurityContext
		///
		/// Contains all necessary information to validate and authorize the
		/// call of the method with the Principal and Roles of the current user.
		///
		public static SecurityContext<ProductModelIllustration> SecurityContext
		{
			get
			{
				return securityContext;
			}
		}
		#endregion

		#region Data Access Methods

		#region GetByForeignKey Methods
		///
		/// 	public virtual method that Gets rows in a <see cref="TList{ProductModelIllustration}" /> from the datasource based on the FK_ProductModelIllustration_Illustration_IllustrationID key.
		///		FK_ProductModelIllustration_Illustration_IllustrationID Description: Foreign key constraint referencing Illustration.IllustrationID.
		///
		/// <param name="_illustrationId">Primary key. Foreign key to Illustration.IllustrationID.</param>
		/// <returns>Returns a generic collection of ProductModelIllustration objects.</returns>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual TList<ProductModelIllustration> GetByIllustrationId(System.Int32 _illustrationId)
		{

			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("GetByIllustrationId");
			#endregion Security check

			#region Initialisation
			TList<ProductModelIllustration> list = null;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				list = new TList<ProductModelIllustration>(dataProvider.ProductModelIllustrationProvider.GetByIllustrationId(transactionManager, _illustrationId));
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}
			return list;
		}

		///
		/// 	public virtual method that Gets rows in a <see cref="TList{ProductModelIllustration}" /> from the datasource based on the FK_ProductModelIllustration_Illustration_IllustrationID key.
		///		FK_ProductModelIllustration_Illustration_IllustrationID Description: Foreign key constraint referencing Illustration.IllustrationID.
		///
		/// <param name="_illustrationId">Primary key. Foreign key to Illustration.IllustrationID.</param>
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Page length of records you would like to retrieve</param>
		/// <param name="totalCount">Out parameter, number of total rows in given query.</param>
		/// <returns>Returns a collection <see cref="TList{ProductModelIllustration}" /> of <c>ProductModelIllustration</c> objects.</returns>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual TList<ProductModelIllustration> GetByIllustrationId(System.Int32 _illustrationId, int start, int pageLength, out int totalCount)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("GetByIllustrationId");
			#endregion Security check

			#region Initialisation
			totalCount = -1;
			TList<ProductModelIllustration> list = null;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				list = new TList<ProductModelIllustration>(dataProvider.ProductModelIllustrationProvider.GetByIllustrationId(transactionManager, _illustrationId, start, pageLength, out totalCount));
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}
			return list;
		}

		///
		/// 	public virtual method that Gets rows in a <see cref="TList{ProductModelIllustration}" /> from the datasource based on the FK_ProductModelIllustration_ProductModel_ProductModelID key.
		///		FK_ProductModelIllustration_ProductModel_ProductModelID Description: Foreign key constraint referencing ProductModel.ProductModelID.
		///
		/// <param name="_productModelId">Primary key. Foreign key to ProductModel.ProductModelID.</param>
		/// <returns>Returns a generic collection of ProductModelIllustration objects.</returns>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual TList<ProductModelIllustration> GetByProductModelId(System.Int32 _productModelId)
		{

			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("GetByProductModelId");
			#endregion Security check

			#region Initialisation
			TList<ProductModelIllustration> list = null;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				list = new TList<ProductModelIllustration>(dataProvider.ProductModelIllustrationProvider.GetByProductModelId(transactionManager, _productModelId));
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}
			return list;
		}

		///
		/// 	public virtual method that Gets rows in a <see cref="TList{ProductModelIllustration}" /> from the datasource based on the FK_ProductModelIllustration_ProductModel_ProductModelID key.
		///		FK_ProductModelIllustration_ProductModel_ProductModelID Description: Foreign key constraint referencing ProductModel.ProductModelID.
		///
		/// <param name="_productModelId">Primary key. Foreign key to ProductModel.ProductModelID.</param>
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Page length of records you would like to retrieve</param>
		/// <param name="totalCount">Out parameter, number of total rows in given query.</param>
		/// <returns>Returns a collection <see cref="TList{ProductModelIllustration}" /> of <c>ProductModelIllustration</c> objects.</returns>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual TList<ProductModelIllustration> GetByProductModelId(System.Int32 _productModelId, int start, int pageLength, out int totalCount)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("GetByProductModelId");
			#endregion Security check

			#region Initialisation
			totalCount = -1;
			TList<ProductModelIllustration> list = null;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				list = new TList<ProductModelIllustration>(dataProvider.ProductModelIllustrationProvider.GetByProductModelId(transactionManager, _productModelId, start, pageLength, out totalCount));
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}
			return list;
		}

		#endregion GetByForeignKey Methods

		#region GetByIndexes
		///
		/// 	Gets a row from the DataSource based on its primary key.
		///
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public override ProductModelIllustration Get(ProductModelIllustrationKey key)
		{
			return GetByProductModelIdIllustrationId(key.ProductModelId, key.IllustrationId);
		}

		///
		///  method that Gets rows in a <see cref="TList{ProductModelIllustration}" /> from the datasource based on the primary key PK_ProductModelIllustration_ProductModelID_IllustrationID index.
		///
		/// <param name="_productModelId">Primary key. Foreign key to ProductModel.ProductModelID.</param>
		/// <param name="_illustrationId">Primary key. Foreign key to Illustration.IllustrationID.</param>
		/// <returns>Returns an instance of the <see cref="ProductModelIllustration"/> class.</returns>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual ProductModelIllustration GetByProductModelIdIllustrationId(System.Int32 _productModelId, System.Int32 _illustrationId)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("GetByProductModelIdIllustrationId");
			#endregion Security check

			#region Initialisation
			ProductModelIllustration entity = null;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				entity = dataProvider.ProductModelIllustrationProvider.GetByProductModelIdIllustrationId(transactionManager, _productModelId, _illustrationId)   as ProductModelIllustration;
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}

			return entity;
		}

		///
		///  Method that Gets rows in a <see cref="TList{ProductModelIllustration}" /> from the datasource based on the primary key PK_ProductModelIllustration_ProductModelID_IllustrationID index.
		///
		/// <param name="_productModelId">Primary key. Foreign key to ProductModel.ProductModelID.</param>
		/// <param name="_illustrationId">Primary key. Foreign key to Illustration.IllustrationID.</param>
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Page length of records you would like to retrieve</param>
		/// <param name="totalCount">out parameter, number of total rows in given query.</param>
		/// <returns>Returns an instance of the <see cref="ProductModelIllustration"/> class.</returns>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual ProductModelIllustration GetByProductModelIdIllustrationId(System.Int32 _productModelId, System.Int32 _illustrationId, int start, int pageLength, out int totalCount)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("GetByProductModelIdIllustrationId");
			#endregion Security check

			#region Initialisation
			totalCount = -1;
			ProductModelIllustration entity = null;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				entity = dataProvider.ProductModelIllustrationProvider.GetByProductModelIdIllustrationId(transactionManager, _productModelId, _illustrationId, start, pageLength, out totalCount)   as ProductModelIllustration;
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}

			return entity;
		}

		#endregion GetByIndexes

		#region GetAll
		///
		/// Get a complete collection of <see cref="ProductModelIllustration" /> entities.
		///
		/// <returns></returns>
		public override TList<ProductModelIllustration> GetAll()
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("GetAll");
			#endregion Security check

			#region Initialisation
			TList<ProductModelIllustration> list = null;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				list = dataProvider.ProductModelIllustrationProvider.GetAll(transactionManager);
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}
			return list;
		}

		///
		/// Get a set portion of a complete list of <see cref="ProductModelIllustration" /> entities
		///
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="totalCount">out parameter, number of total rows in given query.</param>
		/// <returns>a <see cref="TList{ProductModelIllustration}"/> </returns>
		public virtual TList<ProductModelIllustration> GetAll(int start, int pageLength, out int totalCount)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("GetAll");
			#endregion Security check

			#region Initialisation
			totalCount = -1;
			TList<ProductModelIllustration> list = null;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				list = dataProvider.ProductModelIllustrationProvider.GetAll(transactionManager, start, pageLength, out totalCount);
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}
			return list;
		}
		#endregion GetAll

		#region GetPaged
		///
		/// Gets a page of <see cref="TList{ProductModelIllustration}" /> rows from the DataSource.
		///
		/// <param name="totalCount">Out Parameter, Number of rows in the DataSource.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of <c>ProductModelIllustration</c> objects.</returns>
		public virtual TList<ProductModelIllustration> GetPaged(out int totalCount)
		{
			return GetPaged(null, null, 0, int.MaxValue, out totalCount);
		}

		///
		/// Gets a page of <see cref="TList{ProductModelIllustration}" /> rows from the DataSource.
		///
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="totalCount">Number of rows in the DataSource.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of <c>ProductModelIllustration</c> objects.</returns>
		public virtual TList<ProductModelIllustration> GetPaged(int start, int pageLength, out int totalCount)
		{
			return GetPaged(null, null, start, pageLength, out totalCount);
		}

		///
		/// Gets a page of entity rows with a <see cref="TList{ProductModelIllustration}" /> from the DataSource with a where clause and order by clause.
		///
		/// <param name="whereClause">Specifies the condition for the rows returned by a query (Name='John Doe', Name='John Doe' AND Id='1', Name='John Doe' OR Id='1').</param>
		/// <param name="orderBy">Specifies the sort criteria for the rows in the DataSource (Name ASC; BirthDay DESC, Name ASC).</param>
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="totalCount">Out Parameter, Number of rows in the DataSource.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of <c>ProductModelIllustration</c> objects.</returns>
		public override TList<ProductModelIllustration> GetPaged(string whereClause,string orderBy, int start, int pageLength, out int totalCount)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("GetPaged");
			#endregion Security check

			#region Initialisation
			totalCount = -1;
			TList<ProductModelIllustration> list = null;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				list = dataProvider.ProductModelIllustrationProvider.GetPaged(transactionManager, whereClause, orderBy, start, pageLength, out totalCount);
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}
			return list;
		}

		///
		/// Gets the number of rows in the DataSource that match the specified whereClause.
		/// This method is only provided as a workaround for the ObjectDataSource's need to
		/// execute another method to discover the total count instead of using another param, like our out param.
		/// This method should be avoided if using the ObjectDataSource or another method.
		///
		/// <param name="whereClause">Specifies the condition for the rows returned by a query (Name='John Doe', Name='John Doe' AND Id='1', Name='John Doe' OR Id='1').</param>
		/// <param name="totalCount">Number of rows in the DataSource.</param>
		/// <returns>Returns the number of rows.</returns>
		public int GetTotalItems(string whereClause, out int totalCount)
		{
			GetPaged(whereClause, null, 0, int.MaxValue, out totalCount);
			return totalCount;
		}
		#endregion GetPaged

		#region Find

		#region Parsed Find Methods

		///
		/// Attempts to do a parameterized version of a simple whereclause.
		/// Returns rows meeting the whereClause condition from the DataSource.
		///
		/// <param name="whereClause">Specifies the condition for the rows returned by a query (Name='John Doe', Name='John Doe' AND Id='1', Name='John Doe' OR Id='1').</param>
		/// <remarks>Does NOT Support Advanced Operations such as SubSelects.  See GetPaged for that functionality.</remarks>
		/// <returns>Returns a typed collection of Entity objects.</returns>
		public virtual TList<ProductModelIllustration> Find(string whereClause)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Find");
			#endregion Security check

			#region Initialisation
			TList<ProductModelIllustration> list = null;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				list = dataProvider.ProductModelIllustrationProvider.Find(transactionManager, whereClause);
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}
			return list;
		}

		///
		/// Returns rows meeting the whereClause condition from the DataSource.
		///
		/// <param name="whereClause">Specifies the condition for the rows returned by a query (Name='John Doe', Name='John Doe' AND Id='1', Name='John Doe' OR Id='1').</param>
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="totalCount">out parameter to get total records for query</param>
		/// <remarks>Does NOT Support Advanced Operations such as SubSelects.  See GetPaged for that functionality.</remarks>
		/// <returns>Returns a typed collection TList{ProductModelIllustration} of <c>ProductModelIllustration</c> objects.</returns>
		public override TList<ProductModelIllustration> Find(string whereClause, int start, int pageLength, out int totalCount)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Find");
			#endregion Security check

			#region Initialisation
			totalCount = -1;
			TList<ProductModelIllustration> list = null;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				list = dataProvider.ProductModelIllustrationProvider.Find(transactionManager, whereClause, start, pageLength, out totalCount);
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}
			return list;
		}

		#endregion Parsed Find Methods

		#region Parameterized Find Methods

		///
		/// Returns rows from the DataSource that meet the parameter conditions.
		///
		/// <param name="parameters">A collection of <see cref="SqlFilterParameter"/> objects.</param>
		/// <returns>Returns a typed collection of <c>ProductModelIllustration</c> objects.</returns>
		public virtual TList<ProductModelIllustration> Find(IFilterParameterCollection parameters)
		{
			return Find(parameters, (string) null);
		}

		///
        /// Returns rows from the DataSource that meet the parameter conditions.
        ///
        /// <param name="parameters">A collection of <see cref="SqlFilterParameter"/> objects.</param>
        /// <param name="sortColumns">A collection of <see cref="SqlSortColumn"/> objects.</param>
        /// <returns>Returns a typed collection of <c>ProductModelIllustration</c> objects.</returns>
        public virtual TList<ProductModelIllustration> Find(IFilterParameterCollection parameters, ISortColumnCollection sortColumns)
        {
            return Find(parameters, sortColumns.ToString());
        }

		///
		/// 	Returns rows from the DataSource that meet the parameter conditions.
		///
		/// <param name="parameters">A collection of <see cref="SqlFilterParameter"/> objects.</param>
		/// <param name="orderBy">Specifies the sort criteria for the rows in the DataSource (Name ASC; BirthDay DESC, Name ASC);</param>
		/// <returns>Returns a typed collection of <c>ProductModelIllustration</c> objects.</returns>
		public virtual TList<ProductModelIllustration> Find(IFilterParameterCollection parameters, string orderBy)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Find");
			#endregion Security check

			#region Initialisation
			TransactionManager transactionManager = null;
			TList<ProductModelIllustration> list = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				list = dataProvider.ProductModelIllustrationProvider.Find(transactionManager, parameters, orderBy);
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}

			return list;
		}

		///
        /// Returns rows from the DataSource that meet the parameter conditions.
        ///
        /// <param name="parameters">A collection of <see cref="SqlFilterParameter"/> objects.</param>
        /// <param name="sortColumns">A collection of <see cref="SqlSortColumn"/> objects.</param>
        /// <param name="start">Row number at which to start reading.</param>
        /// <param name="pageLength">Number of rows to return.</param>
        /// <param name="count">out. The number of rows that match this query.</param>
        /// <returns>Returns a typed collection of <c>ProductModelIllustration</c> objects.</returns>
        public virtual TList<ProductModelIllustration> Find(IFilterParameterCollection parameters, ISortColumnCollection sortColumns, int start, int pageLength, out int count)
        {
            return Find(parameters, sortColumns.ToString(), start, pageLength, out count);
        }

		///
		/// 	Returns rows from the DataSource that meet the parameter conditions.
		///
		/// <param name="parameters">A collection of <see cref="SqlFilterParameter"/> objects.</param>
		/// <param name="orderBy">Specifies the sort criteria for the rows in the DataSource (Name ASC; BirthDay DESC, Name ASC);</param>
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out. The number of rows that match this query.</param>
		/// <returns>Returns a typed collection of <c>ProductModelIllustration</c> objects.</returns>
		public virtual TList<ProductModelIllustration> Find(IFilterParameterCollection parameters, string orderBy, int start, int pageLength, out int count)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Find");
			#endregion Security check

			#region Initialisation
			count = -1;
			TransactionManager transactionManager = null;
			TList<ProductModelIllustration> list = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				list = dataProvider.ProductModelIllustrationProvider.Find(transactionManager, parameters, orderBy, start, pageLength, out count);
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}

			return list;
		}

		#endregion Parameterized Find Methods

		#endregion

		#region Insert

		#region Insert Entity
		///
		/// public virtual method that Inserts a ProductModelIllustration object into the datasource using a transaction.
		///
		/// <param name="entity">ProductModelIllustration object to Insert.</param>
		/// <remarks>After Inserting into the datasource, the ProductModelIllustration object will be updated
		/// to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>
		/// <returns>Returns bool that the operation is successful.</returns>
		/// <example>
        /// The following code shows the usage of the Insert Method with an already open transaction.
        ///
		/// ProductModelIllustration entity = new ProductModelIllustration();
		/// entity.StringProperty = "foo";
		/// entity.IntProperty = 12;
		/// entity.ChildObjectSource.StringProperty = "bar";
		/// TransactionManager tm = null;
		/// try
        ///	{
		/// 	tm = ConnectionContext.CreateTransaction();
		///		//Insert Child entity, Then Parent Entity
		/// 	ChildObjectTypeService.Insert(entity.ChildObjectSource);
		///		ProductModelIllustrationService.Insert(entity);
		///	}
        ///	catch (Exception e)
        ///	{
		///		if (tm != null && tm.IsOpen) tm.Rollback();
        ///		if (DomainUtil.HandleException(e, name)) throw;
        ///	}
        ///
        /// </example>
		[DataObjectMethod(DataObjectMethodType.Insert)]
		public override bool Insert(ProductModelIllustration entity)
		{
			#region Security and validation check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Insert");

			if (!entity.IsValid)
				throw new EntityNotValidException(entity, "Insert", entity.Error);
			#endregion Security and validation check

			#region Initialisation
			bool result = false;
			bool isBorrowedTransaction = false;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider;
			#endregion Initialisation

			try
            {
				isBorrowedTransaction = ConnectionScope.Current.HasTransaction;
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				result = dataProvider.ProductModelIllustrationProvider.Insert(transactionManager, entity);

				if (!isBorrowedTransaction && transactionManager != null && transactionManager.IsOpen)
					transactionManager.Commit();
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}

			return result;
		}
		#endregion Insert Entity

		#region Insert Collection
		///
		/// public virtual method that Inserts rows in <see cref="TList{ProductModelIllustration}" /> to the datasource.
		///
		/// <param name="entityCollection"><c>ProductModelIllustration</c> objects in a <see cref="TList{ProductModelIllustration}" /> object to Insert.</param>
		/// <remarks>
		///		This function will only Insert entity objects marked as dirty
		///		and have an identity field equal to zero.
		///		Upon Inserting the objects, each dirty object will have the public
		///		method <c>Object.AcceptChanges()</c> called to make it clean.
		/// 	After Inserting into the datasource, the <c>ProductModelIllustration</c> objects will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		///</remarks>
		/// <returns>Returns the number of successful Insert.</returns>
		/// <example>
        /// The following code shows the usage of the Insert Method with a collection of ProductModelIllustration.
        /// <![CDATA[
		/// TList<ProductModelIllustration> list = new TList<ProductModelIllustration>();
		/// ProductModelIllustration entity = new ProductModelIllustration();
		/// entity.StringProperty = "foo";
		/// ProductModelIllustration entity2 = new ProductModelIllustration();
		/// entity.StringProperty = "bar";
		/// list.Add(entity);
		/// list.Add(entity2);
		///	ProductModelIllustrationService.Insert(list);
		///	}
        ///	catch (Exception e)
        ///	{
        ///		if (DomainUtil.HandleException(e, name)) throw;
        ///	}
        /// ]]>
        /// </example>
		[DataObjectMethod(DataObjectMethodType.Insert)]
		public virtual TList<ProductModelIllustration> Insert(TList<ProductModelIllustration> entityCollection)
		{
			#region Security and validation check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Insert");

			if (!entityCollection.IsValid)
			{
				throw new EntityNotValidException(entityCollection, "Insert", DomainUtil.GetErrorsFromList<ProductModelIllustration>(entityCollection));
			}
			#endregion Security and validation check

			#region Initialisation
			bool isBorrowedTransaction = false;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				isBorrowedTransaction = ConnectionScope.Current.HasTransaction;
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				dataProvider.ProductModelIllustrationProvider.Insert(transactionManager, entityCollection);

				if (!isBorrowedTransaction && transactionManager != null && transactionManager.IsOpen)
					transactionManager.Commit();
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
            }

			return entityCollection;
		}
		#endregion Insert Collection

		#endregion Insert

		#region Update

		#region Update Entity
		///
		/// public virtual method that Updates a ProductModelIllustration object into the datasource using a transaction.
		///
		/// <param name="entity">ProductModelIllustration object to Update.</param>
		/// <remarks>After Updateing into the datasource, the ProductModelIllustration object will be updated
		/// to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>
		/// <returns>Returns bool that the operation is successful.</returns>
		/// <example>
        /// The following code shows the usage of the Update Method with an already open transaction.
        ///
		///	ProductModelIllustration entity = ProductModelIllustrationService.GetByPrimaryKeyColumn(1234);
		/// entity.StringProperty = "foo";
		/// entity.IntProperty = 12;
		/// entity.ChildObjectSource.StringProperty = "bar";
		/// TransactionManager tm = null;
		/// try
        ///	{
		/// 	tm = ConnectionContext.CreateTransaction();
		///		//Update Child entity, Then Parent Entity
		/// 	ChildObjectTypeService.Update(entity.ChildObjectSource);
		///		ProductModelIllustrationService.Update(entity);
		///	}
        ///	catch (Exception e)
        ///	{
		///		if (tm != null && tm.IsOpen) tm.Rollback();
        ///		if (DomainUtil.HandleException(e, name)) throw;
        ///	}
        ///
        /// </example>
		[DataObjectMethod(DataObjectMethodType.Update)]
		public override bool Update(ProductModelIllustration entity)
		{
			#region Security and validation check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Update");

			if (!entity.IsValid)
				throw new EntityNotValidException(entity, "Update", entity.Error);
			#endregion Security and validation check

			#region Initialisation
			bool result = false;
			bool isBorrowedTransaction = false;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider;
			#endregion Initialisation

			try
            {
				isBorrowedTransaction = ConnectionScope.Current.HasTransaction;
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				result = dataProvider.ProductModelIllustrationProvider.Update(transactionManager, entity);

				if (!isBorrowedTransaction && transactionManager != null && transactionManager.IsOpen)
					transactionManager.Commit();
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}

			return result;
		}
		#endregion Update Entity

		#region Update Collection
		///
		/// public virtual method that Updates rows in <see cref="TList{ProductModelIllustration}" /> to the datasource.
		///
		/// <param name="entityCollection"><c>ProductModelIllustration</c> objects in a <see cref="TList{ProductModelIllustration}" /> object to Update.</param>
		/// <remarks>
		///		This function will only Update entity objects marked as dirty
		///		and have an identity field equal to zero.
		///		Upon Updateing the objects, each dirty object will have the public
		///		method <c>Object.AcceptChanges()</c> called to make it clean.
		/// 	After Updateing into the datasource, the <c>ProductModelIllustration</c> objects will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		///</remarks>
		/// <returns>Returns the number of successful Update.</returns>
		/// <example>
        /// The following code shows the usage of the Update Method with a collection of ProductModelIllustration.
        /// <![CDATA[
		/// TList<ProductModelIllustration> list = new TList<ProductModelIllustration>();
		/// ProductModelIllustration entity = new ProductModelIllustration();
		/// entity.StringProperty = "foo";
		/// ProductModelIllustration entity2 = new ProductModelIllustration();
		/// entity.StringProperty = "bar";
		/// list.Add(entity);
		/// list.Add(entity2);
		///	ProductModelIllustrationService.Update(list);
		///	}
        ///	catch (Exception e)
        ///	{
        ///		if (DomainUtil.HandleException(e, name)) throw;
        ///	}
        /// ]]>
        /// </example>
		[DataObjectMethod(DataObjectMethodType.Update)]
		public virtual TList<ProductModelIllustration> Update(TList<ProductModelIllustration> entityCollection)
		{
			#region Security and validation check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Update");

			if (!entityCollection.IsValid)
			{
				throw new EntityNotValidException(entityCollection, "Update", DomainUtil.GetErrorsFromList<ProductModelIllustration>(entityCollection));
			}
			#endregion Security and validation check

			#region Initialisation
			bool isBorrowedTransaction = false;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				isBorrowedTransaction = ConnectionScope.Current.HasTransaction;
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				dataProvider.ProductModelIllustrationProvider.Update(transactionManager, entityCollection);

				if (!isBorrowedTransaction && transactionManager != null && transactionManager.IsOpen)
					transactionManager.Commit();
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
            }

			return entityCollection;
		}
		#endregion Update Collection

		#endregion Update

		#region Save

		#region Save Entity
		///
		/// public virtual method that Saves a ProductModelIllustration object into the datasource using a transaction.
		///
		/// <param name="entity">ProductModelIllustration object to Save.</param>
		/// <remarks>After Saveing into the datasource, the ProductModelIllustration object will be updated
		/// to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>
		/// <returns>Returns bool that the operation is successful.</returns>
		/// <example>
        /// The following code shows the usage of the Save Method with an already open transaction.
        ///
		///	ProductModelIllustration entity = ProductModelIllustrationService.GetByPrimaryKeyColumn(1234);
		/// entity.StringProperty = "foo";
		/// entity.IntProperty = 12;
		/// entity.ChildObjectSource.StringProperty = "bar";
		/// TransactionManager tm = null;
		/// try
        ///	{
		/// 	tm = ConnectionContext.CreateTransaction();
		///		//Save Child entity, Then Parent Entity
		/// 	ChildObjectTypeService.Save(entity.ChildObjectSource);
		///		ProductModelIllustrationService.Save(entity);
		///	}
        ///	catch (Exception e)
        ///	{
		///		if (tm != null && tm.IsOpen) tm.Rollback();
        ///		if (DomainUtil.HandleException(e, name)) throw;
        ///	}
        ///
        /// </example>
		[DataObjectMethod(DataObjectMethodType.Update)]
		public override ProductModelIllustration Save(ProductModelIllustration entity)
		{
			#region Security and validation check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Save");

			if (!entity.IsValid)
				throw new EntityNotValidException(entity, "Save", entity.Error);
			#endregion Security and validation check

			#region Initialisation
			bool isBorrowedTransaction = false;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider;
			#endregion Initialisation

			try
            {
				isBorrowedTransaction = ConnectionScope.Current.HasTransaction;
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				dataProvider.ProductModelIllustrationProvider.Save(transactionManager, entity);

				if (!isBorrowedTransaction && transactionManager != null && transactionManager.IsOpen)
					transactionManager.Commit();
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}

			return entity;
		}
		#endregion Save Entity

		#region Save Collection
		///
		/// public virtual method that Saves rows in <see cref="TList{ProductModelIllustration}" /> to the datasource.
		///
		/// <param name="entityCollection"><c>ProductModelIllustration</c> objects in a <see cref="TList{ProductModelIllustration}" /> object to Save.</param>
		/// <remarks>
		///		This function will only Save entity objects marked as dirty
		///		and have an identity field equal to zero.
		///		Upon Saveing the objects, each dirty object will have the public
		///		method <c>Object.AcceptChanges()</c> called to make it clean.
		/// 	After Saveing into the datasource, the <c>ProductModelIllustration</c> objects will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		///</remarks>
		/// <returns>Returns the number of successful Save.</returns>
		/// <example>
        /// The following code shows the usage of the Save Method with a collection of ProductModelIllustration.
        /// <![CDATA[
		/// TList<ProductModelIllustration> list = new TList<ProductModelIllustration>();
		/// ProductModelIllustration entity = new ProductModelIllustration();
		/// entity.StringProperty = "foo";
		/// ProductModelIllustration entity2 = new ProductModelIllustration();
		/// entity.StringProperty = "bar";
		/// list.Add(entity);
		/// list.Add(entity2);
		///	ProductModelIllustrationService.Save(list);
		///	}
        ///	catch (Exception e)
        ///	{
        ///		if (DomainUtil.HandleException(e, name)) throw;
        ///	}
        /// ]]>
        /// </example>
		[DataObjectMethod(DataObjectMethodType.Update)]
		public virtual TList<ProductModelIllustration> Save(TList<ProductModelIllustration> entityCollection)
		{
			#region Security and validation check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Save");

			if (!entityCollection.IsValid)
			{
				throw new EntityNotValidException(entityCollection, "Save", DomainUtil.GetErrorsFromList<ProductModelIllustration>(entityCollection));
			}
			#endregion Security and validation check

			#region Initialisation
			bool isBorrowedTransaction = false;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				isBorrowedTransaction = ConnectionScope.Current.HasTransaction;
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				dataProvider.ProductModelIllustrationProvider.Save(transactionManager, entityCollection);

				if (!isBorrowedTransaction && transactionManager != null && transactionManager.IsOpen)
					transactionManager.Commit();
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
            }

			return entityCollection;
		}
		#endregion Save Collection

		#endregion Save

		#region Delete

		#region Delete Entity
		///
		/// public virtual method that Deletes a ProductModelIllustration object into the datasource using a transaction.
		///
		/// <param name="entity">ProductModelIllustration object to Delete.</param>
		/// <remarks>After Deleteing into the datasource, the ProductModelIllustration object will be updated
		/// to refelect any changes made by the datasource. (ie: identity or computed columns)
		/// </remarks>
		/// <returns>Returns bool that the operation is successful.</returns>
		/// <example>
        /// The following code shows the usage of the Delete Method with an already open transaction.
        ///
		///	ProductModelIllustration entity = ProductModelIllustrationService.GetByPrimaryKeyColumn(1234);
		/// entity.StringProperty = "foo";
		/// entity.IntProperty = 12;
		/// entity.ChildObjectSource.StringProperty = "bar";
		/// TransactionManager tm = null;
		/// try
        ///	{
		/// 	tm = ConnectionContext.CreateTransaction();
		///		//Delete Child entity, Then Parent Entity
		/// 	ChildObjectTypeService.Delete(entity.ChildObjectSource);
		///		ProductModelIllustrationService.Delete(entity);
		///	}
        ///	catch (Exception e)
        ///	{
		///		if (tm != null && tm.IsOpen) tm.Rollback();
        ///		if (DomainUtil.HandleException(e, name)) throw;
        ///	}
        ///
        /// </example>
		[DataObjectMethod(DataObjectMethodType.Delete)]
		public override bool Delete(ProductModelIllustration entity)
		{
			#region Security and validation check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Delete");

			if (!entity.IsValid)
				throw new EntityNotValidException(entity, "Delete", entity.Error);
			#endregion Security and validation check

			#region Initialisation
			bool result = false;
			bool isBorrowedTransaction = false;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider;
			#endregion Initialisation

			try
            {
				isBorrowedTransaction = ConnectionScope.Current.HasTransaction;
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				result = dataProvider.ProductModelIllustrationProvider.Delete(transactionManager, entity);

				if (!isBorrowedTransaction && transactionManager != null && transactionManager.IsOpen)
					transactionManager.Commit();
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
			}

			return result;
		}
		#endregion Delete Entity

		#region Delete Collection
		///
		/// public virtual method that Deletes rows in <see cref="TList{ProductModelIllustration}" /> to the datasource.
		///
		/// <param name="entityCollection"><c>ProductModelIllustration</c> objects in a <see cref="TList{ProductModelIllustration}" /> object to Delete.</param>
		/// <remarks>
		///		This function will only Delete entity objects marked as dirty
		///		and have an identity field equal to zero.
		///		Upon Deleteing the objects, each dirty object will have the public
		///		method <c>Object.AcceptChanges()</c> called to make it clean.
		/// 	After Deleteing into the datasource, the <c>ProductModelIllustration</c> objects will be updated
		/// 	to refelect any changes made by the datasource. (ie: identity or computed columns)
		///</remarks>
		/// <returns>Returns the number of successful Delete.</returns>
		/// <example>
        /// The following code shows the usage of the Delete Method with a collection of ProductModelIllustration.
        /// <![CDATA[
		/// TList<ProductModelIllustration> list = new TList<ProductModelIllustration>();
		/// ProductModelIllustration entity = new ProductModelIllustration();
		/// entity.StringProperty = "foo";
		/// ProductModelIllustration entity2 = new ProductModelIllustration();
		/// entity.StringProperty = "bar";
		/// list.Add(entity);
		/// list.Add(entity2);
		///	ProductModelIllustrationService.Delete(list);
		///	}
        ///	catch (Exception e)
        ///	{
        ///		if (DomainUtil.HandleException(e, name)) throw;
        ///	}
        /// ]]>
        /// </example>
		[DataObjectMethod(DataObjectMethodType.Delete)]
		public virtual TList<ProductModelIllustration> Delete(TList<ProductModelIllustration> entityCollection)
		{
			#region Security and validation check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Delete");

			if (!entityCollection.IsValid)
			{
				throw new EntityNotValidException(entityCollection, "Delete", DomainUtil.GetErrorsFromList<ProductModelIllustration>(entityCollection));
			}
			#endregion Security and validation check

			#region Initialisation
			bool isBorrowedTransaction = false;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				isBorrowedTransaction = ConnectionScope.Current.HasTransaction;
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				dataProvider.ProductModelIllustrationProvider.Delete(transactionManager, entityCollection);

				if (!isBorrowedTransaction && transactionManager != null && transactionManager.IsOpen)
					transactionManager.Commit();
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
            }

			return entityCollection;
		}
		#endregion Delete Collection

		#endregion Delete

		#region   Delete
		///
		/// 	Deletes a row from the DataSource.
		///
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(ProductModelIllustrationKey key)
		{
			return Delete(key.ProductModelId, key.IllustrationId );
		}

		///
		/// 	Deletes a row from the DataSource based on the PK'S System.Int32 _productModelId, System.Int32 _illustrationId
		///
		/// <param name="_productModelId">ProductModelIllustration pk id.</param>
		/// <param name="_illustrationId">ProductModelIllustration pk id.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		[DataObjectMethod(DataObjectMethodType.Delete)]
		public virtual bool Delete(System.Int32 _productModelId, System.Int32 _illustrationId)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("Delete");
			#endregion Security check

			#region Initialisation
			bool result = false;
			bool isBorrowedTransaction = false;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider;
			#endregion Initialisation

			try
            {
				isBorrowedTransaction = ConnectionScope.Current.HasTransaction;

				//since this is a read operation, don't create a tran by default, only use tran if provided to us for custom isolation level
				transactionManager = ConnectionScope.ValidateOrCreateTransaction();
				dataProvider = ConnectionScope.Current.DataProvider;

				result = dataProvider.ProductModelIllustrationProvider.Delete(transactionManager, _productModelId, _illustrationId);

				if (!isBorrowedTransaction && transactionManager != null && transactionManager.IsOpen)
					transactionManager.Commit();
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
            }

			return result;

		}
		#endregion

		#region  GetBy m:m Aggregate Relationships
		#endregion	N2N Relationships

		#region Custom Methods
		#endregion

		#region DeepLoad
		#region Deep Load By Entity Keys

		///
		/// public virtualDeep Loads the requested <see cref="ProductModelIllustration"/> by the entity keys.  The criteria of the child
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		///
		/// <param name="_productModelId">Primary key. Foreign key to ProductModel.ProductModelID.</param>
		/// <param name="_illustrationId">Primary key. Foreign key to Illustration.IllustrationID.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">ProductModelIllustration Property Collection Type Array To Include or Exclude from Load</param>
		/// <returns>Returns an instance of the <see cref="ProductModelIllustration"/> class and DeepLoaded.</returns>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual ProductModelIllustration DeepLoadByProductModelIdIllustrationId(System.Int32 _productModelId, System.Int32 _illustrationId, bool deep, DeepLoadType deepLoadType, params System.Type[] childTypes)
		{
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("DeepLoadByProductModelIdIllustrationId");
			bool isBorrowedTransaction = ConnectionScope.Current.HasTransaction;

			ProductModelIllustration entity = GetByProductModelIdIllustrationId(_productModelId, _illustrationId);

			//Check to see if entity is not null, before attempting to Deep Load
			if (entity != null)
				DeepLoad(entity, deep, deepLoadType, childTypes);

			return entity;
		}

		#endregion

		#region DeepLoad By Entity
		///
		/// public virtualDeep Load the IEntity object with all of the child
		/// property collections only 1 Level Deep.
		///
		/// <param name="entity">ProductModelIllustration Object</param>
		/// <remarks>
		/// <seealso cref="DeepLoad(ProductModelIllustration)"/> overloaded methods for a recursive N Level deep loading method.
		/// </remarks>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual void DeepLoad(ProductModelIllustration entity)
		{
			DeepLoad(entity, false, DeepLoadType.ExcludeChildren, System.Type.EmptyTypes);
		}

		///
		/// public virtualDeep Load the IEntity object with all of the child
		/// property collections only 1 Level Deep.
		///
		/// <remarks>
		/// <seealso cref="DeepLoad(ProductModelIllustration)"/> overloaded methods for a recursive N Level deep loading method.
		/// </remarks>
		/// <param name="entity">ProductModelIllustration Object</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual void DeepLoad(ProductModelIllustration entity, bool deep)
		{
			DeepLoad(entity, deep, DeepLoadType.ExcludeChildren, System.Type.EmptyTypes);
		}

		///
		/// public virtualDeep Loads the <see cref="IEntity"/> object with criteria based of the child
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		///
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="entity">The <see cref="ProductModelIllustration"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively load all Property Collections that are descendants of this instance.
		/// If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">ProductModelIllustration Property Collection Type Array To Include or Exclude from Load</param>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual void DeepLoad(ProductModelIllustration entity, bool deep, DeepLoadType deepLoadType, params System.Type[] childTypes)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("DeepLoad");
			#endregion Security check

			#region Initialisation
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				dataProvider.ProductModelIllustrationProvider.DeepLoad(transactionManager, entity, deep, deepLoadType, childTypes);
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
            }
			return;
		}
		#endregion

		#region DeepLoad By Entity Collection
		///
		/// Deep Loads the <see cref="TList{ProductModelIllustration}" /> object with all of the child
		/// property collections only 1 Level Deep.
		///
		/// <remarks>
		/// <seealso cref="DeepLoad(ProductModelIllustration)"/> overloaded methods for a recursive N Level deep loading method.
		/// </remarks>
		/// <param name="entityCollection">the <see cref="TList{ProductModelIllustration}" /> Object to deep loads.</param>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual void DeepLoad(TList<ProductModelIllustration> entityCollection)
		{
			DeepLoad(entityCollection, false, DeepLoadType.ExcludeChildren, System.Type.EmptyTypes);
		}

		///
		/// Deep Loads the <see cref="TList{ProductModelIllustration}" /> object.
		///
		/// <remarks>
		/// <seealso cref="DeepLoad(ProductModelIllustration)"/> overloaded methods for a recursive N Level deep loading method.
		/// </remarks>
		/// <param name="entityCollection">the <see cref="TList{ProductModelIllustration}" /> Object to deep loads.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		[DataObjectMethod(DataObjectMethodType.Select)]
		public virtual void DeepLoad(TList<ProductModelIllustration> entityCollection, bool deep)
		{
			DeepLoad(entityCollection, deep, DeepLoadType.ExcludeChildren, System.Type.EmptyTypes);
		}

		///
		/// Deep Loads the entire <see cref="TList{ProductModelIllustration}" /> object with criteria based of the child
		/// property collections only N Levels Deep based on the DeepLoadType.
		///
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire collection's object graph.
		/// </remarks>
		/// <param name="entityCollection">The <see cref="TList{ProductModelIllustration}" /> instance to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType"><see cref="DeepLoadType"/> Enumeration to Include/Exclude object property collections from Load.
		///		Use DeepLoadType.IncludeChildren, ExcludeChildren to traverse the entire object graph.
		///	</param>
		/// <param name="childTypes"><see cref="ProductModelIllustration"/> Property Collection Type Array To Include or Exclude from Load</param>
		[DataObjectMethod(DataObjectMethodType.Select, false)]
		public override void DeepLoad(TList<ProductModelIllustration> entityCollection, bool deep, DeepLoadType deepLoadType, params System.Type[] childTypes)
		{
			#region Security check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("DeepLoad");
			#endregion Security check

			#region Initialisation
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				transactionManager = ConnectionScope.ValidateOrCreateTransaction(noTranByDefault);
				dataProvider = ConnectionScope.Current.DataProvider;

				dataProvider.ProductModelIllustrationProvider.DeepLoad(transactionManager, entityCollection, deep, deepLoadType, childTypes);
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
            }
			return;
		}
		#endregion

		#endregion

		#region DeepSave

		#region DeepSave By Entity
		///
		/// public virtualDeep Saves the <see cref="ProductModelIllustration"/> object with all of the child
		/// property collections N Levels Deep.
		///
		/// <param name="entity">ProductModelIllustration Object</param>
		[DataObjectMethod(DataObjectMethodType.Update)]
		public override bool DeepSave(ProductModelIllustration entity)
		{
			return DeepSave(entity, DeepSaveType.ExcludeChildren, System.Type.EmptyTypes);
		}

		///
		/// public virtualDeep Saves the entire object graph of the ProductModelIllustration object with criteria based of the child
		/// Type property array and DeepSaveType.
		///
		/// <param name="entity">ProductModelIllustration Object</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes"><c>ProductModelIllustration</c> property Type Array To Include or Exclude from Save</param>
		[DataObjectMethod(DataObjectMethodType.Update)]
		public override bool DeepSave(ProductModelIllustration entity, DeepSaveType deepSaveType, params System.Type[] childTypes)
		{
			#region Security and validation check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("DeepSave");

			if (!entity.IsValid)
			{
				throw new EntityNotValidException(entity, "DeepSave");
			}
			#endregion Security and validation check

			#region Initialisation
			bool result = false;
			bool isBorrowedTransaction = false;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				isBorrowedTransaction = ConnectionScope.Current.HasTransaction;

				//since this is a read operation, don't create a tran by default, only use tran if provided to us for custom isolation level
				transactionManager = ConnectionScope.ValidateOrCreateTransaction();
				dataProvider = ConnectionScope.Current.DataProvider;

				result = dataProvider.ProductModelIllustrationProvider.DeepSave(transactionManager, entity, deepSaveType, childTypes);

				if (!isBorrowedTransaction && transactionManager != null && transactionManager.IsOpen)
					transactionManager.Commit();
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
            }
			return result;
		}
		#endregion

		#region DeepSave By Entity Collection
		///
		/// Deep Save the entire <see cref="TList{ProductModelIllustration}" /> object with all of the child
		/// property collections.
		///
		/// <param name="entityCollection">TList{ProductModelIllustration} Object</param>
		[DataObjectMethod(DataObjectMethodType.Update)]
		public virtual bool DeepSave(TList<ProductModelIllustration> entityCollection)
		{
			return DeepSave(entityCollection, DeepSaveType.ExcludeChildren, System.Type.EmptyTypes);
		}

		///
		/// Deep Save the entire object graph of the <see cref="TList{ProductModelIllustration}" /> object with criteria based of the child
		/// property collections.
		///
		/// <param name="entityCollection"><see cref="TList{ProductModelIllustration}" /> Object</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">ProductModelIllustration Property Collection Type Array To Include or Exclude from Save</param>
		[DataObjectMethod(DataObjectMethodType.Update)]
		public override bool DeepSave(TList<ProductModelIllustration> entityCollection, DeepSaveType deepSaveType, params System.Type[] childTypes)
		{
			#region Security and validation check
			// throws security exception if not authorized
			SecurityContext.IsAuthorized("DeepSave");

			if (!entityCollection.IsValid)
			{
				throw new EntityNotValidException(entityCollection, "DeepSave");
			}
			#endregion Security and validation check

			#region Initialisation
			bool result = false;
			bool isBorrowedTransaction = false;
			TransactionManager transactionManager = null;
			NetTiersProvider dataProvider = null;
			#endregion Initialisation

			try
            {
				isBorrowedTransaction = ConnectionScope.Current.HasTransaction;

				//since this is a read operation, don't create a tran by default, only use tran if provided to us for custom isolation level
				transactionManager = ConnectionScope.ValidateOrCreateTransaction();
				dataProvider = ConnectionScope.Current.DataProvider;

				result = dataProvider.ProductModelIllustrationProvider.DeepSave(transactionManager, entityCollection,  deepSaveType, childTypes);

				if (!isBorrowedTransaction && transactionManager != null && transactionManager.IsOpen)
					transactionManager.Commit();
			}
            catch (Exception exc)
            {
				#region Handle transaction rollback and exception
                if (transactionManager != null && transactionManager.IsOpen)
					transactionManager.Rollback();

				//Handle exception based on policy
                if (DomainUtil.HandleException(exc, layerExceptionPolicy))
					throw;
				#endregion Handle transaction rollback and exception
            }
			return result;
		}
		#endregion

		#endregion

		#endregion Data Access Methods

	}//End Class
} // end namespace


text:
import numpy as np
import tensorflow as tf
from dnc.controller import BaseController

"""
A 2-Layers feedforward neural network with 128, 256 nodes respectively
"""

class FeedforwardController(BaseController):

    def network_vars(self):
        initial_std = lambda in_nodes: np.min(1e-2, np.sqrt(2.0 / in_nodes))
        input_ = self.nn_input_size

        self.W1 = tf.Variable(tf.truncated_normal([input_, 128], stddev=initial_std(input_)), name='layer1_W')
        self.W2 = tf.Variable(tf.truncated_normal([128, 256], stddev=initial_std(128)), name='layer2_W')
        self.b1 = tf.Variable(tf.zeros([128]), name='layer1_b')
        self.b2 = tf.Variable(tf.zeros([256]), name='layer2_b')

    def network_op(self, X):
        l1_output = tf.matmul(X, self.W1) + self.b1
        l1_activation = tf.nn.relu(l1_output)

        l2_output = tf.matmul(l1_activation, self.W2) + self.b2
        l2_activation = tf.nn.relu(l2_output)

        return l2_activation

    def initials(self):
        initial_std = lambda in_nodes: np.min(1e-2, np.sqrt(2.0 / in_nodes))

        # defining internal weights of the controller
        self.interface_weights = tf.Variable(
            tf.truncated_normal([self.nn_output_size, self.interface_vector_size], stddev=initial_std(self.nn_output_size)),
            name='interface_weights'
        )
        self.nn_output_weights = tf.Variable(
            tf.truncated_normal([self.nn_output_size, self.output_size], stddev=initial_std(self.nn_output_size)),
            name='nn_output_weights'
        )
        self.mem_output_weights = tf.Variable(
            tf.truncated_normal([self.word_size * self.read_heads, self.output_size],  stddev=initial_std(self.word_size * self.read_heads)),
            name='mem_output_weights'
        )

redpajama_set_name: RedPajamaGithub


text:
/// @file network_tc_main.c

/// @brief Main Function for Network TestCase Example
#include <tinyara/config.h>
#include <stdio.h>
#include <semaphore.h>
#include "tc_internal.h"

int nw_total_pass = 0;
int nw_total_fail = 0;

extern sem_t tc_sem;
extern int working_tc;

/****************************************************************************
 * Name: network_tc_main
 ****************************************************************************/
#ifdef CONFIG_BUILD_KERNEL
int main(int argc, FAR char *argv[])
#else
int network_tc_main(int argc, char *argv[])
#endif
{
	sem_wait(&tc_sem);
	working_tc++;

	printf("=== TINYARA Network TC START! ===\n");

#ifdef CONFIG_TC_NET_SOCKET
	net_socket_main();
#endif
#ifdef CONFIG_TC_NET_SETSOCKOPT
	net_setsockopt_main();
#endif
#ifdef CONFIG_TC_NET_CONNECT
	net_connect_main();
#endif
#ifdef CONFIG_TC_NET_CLOSE
	net_close_main();
#endif
#ifdef CONFIG_TC_NET_BIND
	net_bind_main();
#endif
#ifdef CONFIG_TC_NET_LISTEN
	net_listen_main();
#endif
#ifdef CONFIG_TC_NET_GETSOCKNAME
	net_getsockname_main();
#endif
#ifdef CONFIG_TC_NET_GETSOCKOPT
	net_getsockopt_main();
#endif
#ifdef CONFIG_TC_NET_FCNTL
	net_fcntl_main();
#endif
#ifdef CONFIG_TC_NET_IOCTL
	net_ioctl_main();
#endif
#ifdef CONFIG_TC_NET_ACCEPT
	net_accept_main();
#endif
#ifdef CONFIG_TC_NET_SEND
	net_send_main();
#endif
#ifdef CONFIG_TC_NET_RECV
	net_recv_main();
#endif
#ifdef CONFIG_TC_NET_GETPEERNAME
	net_getpeername_main();
#endif
#ifdef CONFIG_TC_NET_SENDTO
	net_sendto_main();
#endif
#ifdef CONFIG_TC_NET_RECVFROM
	net_recvfrom_main();
#endif
#ifdef CONFIG_TC_NET_SHUTDOWN
	net_shutdown_main();
#endif
#ifdef CONFIG_TC_NET_DHCPC
	net_dhcpc_main();
#endif
#ifdef CONFIG_TC_NET_DHCPS
	net_dhcps_main();
#endif

	printf("\n=== TINYARA Network TC COMPLETE ===\n");
	printf("\t\tTotal pass : %d\n\t\tTotal fail : %d\n", nw_total_pass, nw_total_fail);

	working_tc--;
	sem_post(&tc_sem);

	return 0;
}


text:
from django.core.management import call_command
from django.test import TestCase

from councils.tests.factories import CouncilFactory

class LogTestMixin:
    def test_dc_logging(self):

        with self.assertLogs(level="DEBUG") as captured:
            self.client.get(
                f"/postcode/{self.test_dc_logging_postcode}/",
                {
                    "foo": "bar",
                    "utm_source": "test",
                    "utm_campaign": "better_tracking",
                    "utm_medium": "pytest",
                },
                HTTP_AUTHORIZATION="Token foo",
                follow=True,
            )

        for record in captured.records:
            if record.message.startswith("dc-postcode-searches"):
                logging_message = record

        assert logging_message

        assert (
            f'"postcode": "{self.test_dc_logging_postcode}"' in logging_message.message
        )
        assert '"dc_product": "WDIV"' in logging_message.message
        assert '"utm_source": "test"' in logging_message.message
        assert '"utm_campaign": "better_tracking"' in logging_message.message
        assert '"utm_medium": "pytest"' in logging_message.message

class HomeViewTestCase(TestCase):
    @classmethod
    def setUpTestData(cls):
        CouncilFactory(
            council_id="X01",
            identifiers=["X01"],
            geography__geography=None,
        )

        for fixture in [
            "test_routing.json",
            "test_multiple_addresses_single_polling_station.json",
        ]:
            call_command(  # Hack to avoid converting all fixtures to factories
                "loaddata",
                fixture,
                verbosity=0,
            )

    def test_get(self):
        response = self.client.get("/")
        self.assertEqual(200, response.status_code)

    def test_redirect(self):
        response = self.client.post(
            r"/?utm_source=foo&something=other", {"postcode": "CC1 1AA"}, follow=False
        )
        self.assertEqual(302, response.status_code)
        # The query string isn't preserved, because they've come from the home page, and it could be either uprn
        # for the postcode given (hence the [23])
        self.assertRegex(response["Location"], r"/address/10[23]/")

class PostCodeViewTestCase(TestCase, LogTestMixin):
    test_dc_logging_postcode = "AA11AA"

    @classmethod
    def setUpTestData(cls):
        CouncilFactory(
            council_id="X01",
            identifiers=["X01"],
            geography__geography=None,
        )

        for fixture in [
            "test_routing.json",
            "test_multiple_polling_stations.json",
            "test_single_address_single_polling_station.json",
        ]:
            call_command(  # Hack to avoid converting all fixtures to factories
                "loaddata",
                fixture,
                verbosity=0,
            )

    def test_redirect_if_should_be_other_view(self):
        # This should go to the address picker, because it's split over multiple polling districts
        response = self.client.get(
            "/postcode/DD11DD/?utm_source=foo&something=other", follow=False
        )
        self.assertEqual(302, response.status_code)
        self.assertEqual(response["Location"], "/address_select/DD11DD/?utm_source=foo")

class PostCodeViewNoStationTestCase(TestCase, LogTestMixin):
    test_dc_logging_postcode = "BB11BB"

    @classmethod
    def setUpTestData(cls):
        CouncilFactory(
            council_id="X01",
            name="Foo Council",
            electoral_services_phone_numbers=["01314 159265"],
            identifiers=["X01"],
            geography__geography=None,
        )

        for fixture in [
            "test_single_address_blank_polling_station.json",
            "test_postcode_not_in_addressbase.json",
        ]:
            call_command(  # Hack to avoid converting all fixtures to factories
                "loaddata",
                fixture,
                verbosity=0,
            )

    def test_polling_station_is_blank(self):
        response = self.client.get(
            "/postcode/BB11BB/?utm_source=foo&something=other", follow=False
        )
        self.assertEqual(200, response.status_code)
        self.assertContains(response, "ontact Foo Council")
        self.assertContains(response, "tel:01314 159265")

    def test_post_code_not_in_addressbase(self):
        response = self.client.get(
            "/postcode/HJ67KL/?utm_source=foo&something=other", follow=False
        )
        self.assertEqual(200, response.status_code)
        self.assertContains(response, "Contact Foo Council")
        self.assertContains(response, "tel:01314 159265")

class WeDontknowViewTestCase(TestCase):
    """
    'FF22FF' is a postcode with uprns in multiple councils and some polling stations.
    'GG22GG' is a postcode with uprns in multiple councils and no polling stations.
    'HH22HH' is a postcode with uprns in a single council and no polling stations.
    """

    def test_dc_logging(self):
        # This test case is for when user's address isn't in the list and the postcode
        # is split over multiple councils.
        with self.assertLogs(level="DEBUG") as captured:
            self.client.get(
                "/multiple_councils/FF22FF/",
                {
                    "foo": "bar",
                    "utm_source": "test",
                    "utm_campaign": "better_tracking",
                    "utm_medium": "pytest",
                },
                HTTP_AUTHORIZATION="Token foo",
                follow=True,
            )

        for record in captured.records:
            if record.message.startswith("dc-postcode-searches"):
                logging_message = record

        assert logging_message

        assert '"postcode": "FF22FF"' in logging_message.message
        assert '"dc_product": "WDIV"' in logging_message.message
        assert '"utm_source": "test"' in logging_message.message
        assert '"utm_campaign": "better_tracking"' in logging_message.message
        assert '"utm_medium": "pytest"' in logging_message.message

    @classmethod
    def setUpTestData(cls):
        CouncilFactory(
            council_id="FOO",
            name="Foo Council",
            identifiers=["X01"],
            geography__geography=None,
        )
        CouncilFactory(
            council_id="BAR",
            name="Bar Borough",
            identifiers=["X02"],
            geography__geography=None,
        )

        call_command(  # Hack to avoid converting all fixtures to factories
            "loaddata",
            "test_uprns_in_multiple_councils",
            verbosity=0,
        )

    def test_not_multiple_redirect(self):
        response = self.client.post(
            r"/?utm_source=foo&something=other", {"postcode": "HH2 2HH"}, follow=False
        )
        self.assertEqual(302, response.status_code)
        self.assertEqual(response["Location"], r"/postcode/HH22HH/")

    def test_home_redirect(self):
        response = self.client.post(
            r"/?utm_source=foo&something=other", {"postcode": "FF2 2FF"}, follow=False
        )
        self.assertEqual(302, response.status_code)
        self.assertEqual(response["Location"], r"/address_select/FF22FF/")

    def test_we_dont_know_redirect(self):
        response = self.client.get("/we_dont_know/FF22FF/", follow=False)

        self.assertEqual(302, response.status_code)
        self.assertEqual(response["Location"], r"/multiple_councils/FF22FF/")

    def test_multiple_councils_view(self):
        response = self.client.get("/multiple_councils/FF22FF/", follow=False)
        self.assertContains(
            response,
            "Residents in FF22FF may be in one of the following council areas:",
        )
        self.assertContains(response, "Foo Council")
        self.assertContains(response, "Bar Borough")

    def test_home_redirect_no_stations(self):
        response = self.client.post(
            r"/?utm_source=foo&something=other", {"postcode": "GG2 2GG"}, follow=False
        )
        self.assertEqual(302, response.status_code)
        self.assertEqual(response["Location"], r"/address_select/GG22GG/")

    def test_postcode_redirect_no_stations(self):
        response = self.client.get("/postcode/GG22GG/", follow=False)
        self.assertEqual(302, response.status_code)
        self.assertEqual(response["Location"], r"/address_select/GG22GG/")

    def test_multiple_councils_no_stations(self):
        response = self.client.get("/multiple_councils/GG22GG/", follow=False)
        self.assertContains(
            response,
            "Residents in GG22GG may be in one of the following council areas:",
        )
        self.assertContains(response, "Foo Council")
        self.assertContains(response, "Bar Borough")


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="description" content="Materialize is a modern responsive CSS framework based on Material Design by Google. ">
    <title>Tabs - Materialize</title>

    <link rel="apple-touch-icon-precomposed" href="images/favicon/apple-touch-icon-152x152.png">
    <meta name="msapplication-TileColor" content="#FFFFFF">
    <meta name="msapplication-TileImage" content="images/favicon/mstile-144x144.png">    <link rel="icon" href="images/favicon/favicon-32x32.ico" sizes="32x32">

    <meta name="theme-color" content="#ffa726">

    <link href="css/prism.css" rel="stylesheet">
    <link href="css/ghpages-materialize.css" type="text/css" rel="stylesheet" media="screen,projection">
    <link href="http://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet" type="text/css">

Tabs

About

Getting Started

CSS

Color

Grid

Helpers

Media

Sass

Shadow

Table

Typography

Components

Badges

Buttons

Cards

Collections

Footer

Forms

Icons

Navbar

Pagination

Preloader

JavaScript

Collapsible

Dialogs

Dropdown

Media

Modals

Parallax

Pushpin

ScrollFire

Scrollspy

SideNav

Tabs

Transitions

Waves

Blank

Introduction

The tabs structure consists of an unordered list of tabs that have hashes corresponding to tab ids. Then when you click on each tab, only the container with the corresponding tab id will become visible. You can add the class .disabled to make a tab inaccessible.

Test 1

Test 2

Disabled Tab

Test 4

Test 1

Test 2

Test 3

Test 4

Tabs HTML Structure

  <div class="row">
    <div class="col s12">
      <ul class="tabs">
        <li class="tab col s3"><a href="#test1">Test 1</a></li>
        <li class="tab col s3"><a class="active" href="#test2">Test 2</a></li>
        <li class="tab col s3 disabled"><a href="#test3">Disabled Tab</a></li>
        <li class="tab col s3"><a href="#test4">Test 4</a></li>
      </ul>
    </div>
    <div id="test1" class="col s12">Test 1</div>
    <div id="test2" class="col s12">Test 2</div>
    <div id="test3" class="col s12">Test 3</div>
    <div id="test4" class="col s12">Test 4</div>
  </div>

jQuery Plugin Initialization

Tabs are initialized automatically, but if you add tabs dynamically you will have to initialize them like this.

  $(document).ready(function(){
    $('ul.tabs').tabs();
  });

jQuery Plugin Methods

You can programmatically trigger a tab change with our select_tab method. You have to input the id of the tab you want to switch to. In the case of our demo it would be either test1, test2, test3, or test4.

  $(document).ready(function(){
    $('ul.tabs').tabs('select_tab', 'tab_id');
  });

Preselecting a tab

By default, the first tab is selected. But if this is not what you want, you can preselect a tab by either passing in the hash in the url ex:#test2. Or you can add the class active to the a tag.

  <li class="tab col s2"><a class="active" href="#test3">Test 3</a></li>

Introduction

Structure

Intialization

Methods

Preselecting

        © 2014-2015 CodeLarva, All rights reserved.


text:
<!doctype html>

  <meta charset="utf-8">
  <title>amp-geo example</title>
  <link rel="canonical" href="amps.html">
  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">

  <amp-geo layout="nodisplay">

  </amp-geo>

My article title

  The amp-geo config on this page is:

    <amp-geo layout="nodisplay">
      <script type="application/json">
        {
          "ISOCountryGroups": {
            "nafta": [ "ca", "mx", "us", "unknown" ],
            "waldo": [ "unknown" ],
            "anz": [ "au", "nz" ]
          }
        }
      </script>
    </amp-geo>

      This means that if your country is "unknown" you will appear in the
      "nafta" and "unknown" groups.  To change the country for testing
      append #amp-geo=<code> to the url and reload the page
      (eg #amp-geo=nz)

  <button on="tap:AMP.setState({myCountry: ampGeo.ISOCountry})">Where am I?</button>

There is an amp-pixel variable substitution example here

  <amp-pixel src="https://raw.githubusercontent.com/ampproject/amphtml/main/examples/img/ampicon.png?via=pixel&groups=AMP_GEO&country=AMP_GEO(ISOCountry)" layout="nodisplay"></amp-pixel>

There is an amp-analytics variable substitution example here

  <amp-analytics>

  </amp-analytics>


text:
#include "gm.h"
#include "SkColorPriv.h"
#include "SkGradientShader.h"
#include "SkImage.h"
#include "SkMathPriv.h"
#include "SkRandom.h"
#include "SkShader.h"
#include "SkSurface.h"

static sk_sp<SkImage> makebm(int w, int h) {
    SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
    auto surface(SkSurface::MakeRaster(info));
    SkCanvas* canvas = surface->getCanvas();

    const SkScalar wScalar = SkIntToScalar(w);
    const SkScalar hScalar = SkIntToScalar(h);

    const SkPoint     pt = { wScalar / 2, hScalar / 2 };

    const SkScalar    radius = 4 * SkMaxScalar(wScalar, hScalar);

    constexpr SkColor     colors[] = { SK_ColorRED, SK_ColorYELLOW,
                                          SK_ColorGREEN, SK_ColorMAGENTA,
                                          SK_ColorBLUE, SK_ColorCYAN,
                                          SK_ColorRED};

    constexpr SkScalar    pos[] = {0,
                                      SK_Scalar1 / 6,
                                      2 * SK_Scalar1 / 6,
                                      3 * SK_Scalar1 / 6,
                                      4 * SK_Scalar1 / 6,
                                      5 * SK_Scalar1 / 6,
                                      SK_Scalar1};

    SkASSERT(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(pos));
    SkPaint     paint;
    SkRect rect = SkRect::MakeWH(wScalar, hScalar);
    SkMatrix mat = SkMatrix::I();
    for (int i = 0; i < 4; ++i) {
        paint.setShader(SkGradientShader::MakeRadial(
                        pt, radius,
                        colors, pos,
                        SK_ARRAY_COUNT(colors),
                        SkShader::kRepeat_TileMode,
                        0, &mat));
        canvas->drawRect(rect, paint);
        rect.inset(wScalar / 8, hScalar / 8);
        mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4);
    }
    return surface->makeImageSnapshot();
}

constexpr int gSize = 1024;
constexpr int gSurfaceSize = 2048;

// This GM calls drawImageRect several times using the same texture. This is intended to exercise
// combining GrDrawOps during these calls.
class DrawMiniBitmapRectGM : public skiagm::GM {
public:
    DrawMiniBitmapRectGM(bool antiAlias) : fAA(antiAlias) {
        fName.set("drawminibitmaprect");
        if (fAA) {
            fName.appendf("_aa");
        }
    }

protected:
    SkString onShortName() override { return fName; }

    SkISize onISize() override { return SkISize::Make(gSize, gSize); }

    void onDraw(SkCanvas* canvas) override {
        if (nullptr == fImage) {
            fImage = makebm(gSurfaceSize, gSurfaceSize);
        }

        const SkRect dstRect = { 0, 0, SkIntToScalar(64), SkIntToScalar(64)};
        const int kMaxSrcRectSize = 1 << (SkNextLog2(gSurfaceSize) + 2);

        constexpr int kPadX = 30;
        constexpr int kPadY = 40;

        int rowCount = 0;
        canvas->translate(SkIntToScalar(kPadX), SkIntToScalar(kPadY));
        canvas->save();
        SkRandom random;

        SkPaint paint;
        paint.setAntiAlias(fAA);
        for (int w = 1; w <= kMaxSrcRectSize; w *= 3) {
            for (int h = 1; h <= kMaxSrcRectSize; h *= 3) {

                const SkIRect srcRect =
                        SkIRect::MakeXYWH((gSurfaceSize - w) / 2, (gSurfaceSize - h) / 2, w, h);
                canvas->save();
                switch (random.nextU() % 3) {
                    case 0:
                        canvas->rotate(random.nextF() * 10.f);
                        break;
                    case 1:
                        canvas->rotate(-random.nextF() * 10.f);
                        break;
                    case 2:
                        // rect stays rect
                        break;
                }
                canvas->drawImageRect(fImage.get(), srcRect, dstRect, &paint,
                                      SkCanvas::kFast_SrcRectConstraint);
                canvas->restore();

                canvas->translate(dstRect.width() + SK_Scalar1 * kPadX, 0);
                ++rowCount;
                if ((dstRect.width() + 2 * kPadX) * rowCount > gSize) {
                    canvas->restore();
                    canvas->translate(0, dstRect.height() + SK_Scalar1 * kPadY);
                    canvas->save();
                    rowCount = 0;
                }
            }
        }
        canvas->restore();
    }

private:
    bool            fAA;
    sk_sp<SkImage>  fImage;
    SkString        fName;

    typedef skiagm::GM INHERITED;
};

DEF_GM( return new DrawMiniBitmapRectGM(true); )
DEF_GM( return new DrawMiniBitmapRectGM(false); )