Exemplo n.º 1
0
        public virtual ProductAffiliate UpdateProductAffiliate(ProductAffiliate entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            ProductAffiliate other = GetProductAffiliate(entity.ProductId);

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

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@ProductID", entity.ProductId)
                , new SqlParameter("@AffiliateID", entity.AffiliateId)
                , new SqlParameter("@DisplayOrder", entity.DisplayOrder)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetProductAffiliate(entity.ProductId));
        }
Exemplo n.º 2
0
        public virtual ProductAffiliate InsertProductAffiliate(ProductAffiliate entity)
        {
            ProductAffiliate other = new ProductAffiliate();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into ProductAffiliate ( [ProductID]
				,[AffiliateID]
				,[DisplayOrder]
				,[CreatedOn] )
				Values
				( @ProductID
				, @AffiliateID
				, @DisplayOrder
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@ProductID", entity.ProductId)
                    , new SqlParameter("@AffiliateID", entity.AffiliateId)
                    , 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(GetProductAffiliate(Convert.ToInt32(identity)));
            }
            return(entity);
        }
Exemplo n.º 3
0
        public virtual ProductAffiliate ProductAffiliateFromDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            ProductAffiliate entity = new ProductAffiliate();

            entity.ProductId    = (System.Int32)dr["ProductID"];
            entity.AffiliateId  = (System.Int32)dr["AffiliateID"];
            entity.DisplayOrder = (System.Int32)dr["DisplayOrder"];
            entity.CreatedOn    = (System.DateTime)dr["CreatedOn"];
            return(entity);
        }
Exemplo n.º 4
0
 public ProductAffiliate InsertProductAffiliate(ProductAffiliate entity)
 {
     return(_iProductAffiliateRepository.InsertProductAffiliate(entity));
 }
Exemplo n.º 5
0
 public ProductAffiliate UpdateProductAffiliate(ProductAffiliate entity)
 {
     return(_iProductAffiliateRepository.UpdateProductAffiliate(entity));
 }
Exemplo n.º 6
0
 public virtual ProductAffiliate DeleteProductAffiliate(ProductAffiliate entity)
 {
     this.DeleteProductAffiliate(entity.ProductId);
     return(entity);
 }