public virtual ProductVector UpdateProductVector(ProductVector entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            ProductVector other = GetProductVector(entity.ProductId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update ProductVector set  [VectorID]=@VectorID
							, [DisplayOrder]=@DisplayOrder
							, [CreatedOn]=@CreatedOn 
							 where ProductID=@ProductID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@ProductID", entity.ProductId)
                , new SqlParameter("@VectorID", entity.VectorId)
                , new SqlParameter("@DisplayOrder", entity.DisplayOrder)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetProductVector(entity.ProductId));
        }
        public virtual ProductVector InsertProductVector(ProductVector entity)
        {
            ProductVector other = new ProductVector();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into ProductVector ( [ProductID]
				,[VectorID]
				,[DisplayOrder]
				,[CreatedOn] )
				Values
				( @ProductID
				, @VectorID
				, @DisplayOrder
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@ProductID", entity.ProductId)
                    , new SqlParameter("@VectorID", entity.VectorId)
                    , new SqlParameter("@DisplayOrder", entity.DisplayOrder)
                    , new SqlParameter("@CreatedOn", entity.CreatedOn)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetProductVector(Convert.ToInt32(identity)));
            }
            return(entity);
        }
        public virtual ProductVector ProductVectorFromDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            ProductVector entity = new ProductVector();

            entity.ProductId    = (System.Int32)dr["ProductID"];
            entity.VectorId     = (System.Int32)dr["VectorID"];
            entity.DisplayOrder = (System.Int32)dr["DisplayOrder"];
            entity.CreatedOn    = (System.DateTime)dr["CreatedOn"];
            return(entity);
        }
 public virtual ProductVector DeleteProductVector(ProductVector entity)
 {
     this.DeleteProductVector(entity.ProductId);
     return(entity);
 }
 public ProductVector InsertProductVector(ProductVector entity)
 {
     return(_iProductVectorRepository.InsertProductVector(entity));
 }
 public ProductVector UpdateProductVector(ProductVector entity)
 {
     return(_iProductVectorRepository.UpdateProductVector(entity));
 }