public virtual TaxClass UpdateTaxClass(TaxClass entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            TaxClass other = GetTaxClass(entity.TaxClassId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update TaxClass set  [TaxClassGUID]=@TaxClassGUID
							, [Name]=@Name
							, [TaxCode]=@TaxCode
							, [DisplayOrder]=@DisplayOrder
							, [CreatedOn]=@CreatedOn 
							 where TaxClassID=@TaxClassID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@TaxClassID", entity.TaxClassId)
                , new SqlParameter("@TaxClassGUID", entity.TaxClassGuid)
                , new SqlParameter("@Name", entity.Name)
                , new SqlParameter("@TaxCode", entity.TaxCode)
                , new SqlParameter("@DisplayOrder", entity.DisplayOrder)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetTaxClass(entity.TaxClassId));
        }
        public virtual TaxClass InsertTaxClass(TaxClass entity)
        {
            TaxClass other = new TaxClass();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into TaxClass ( [TaxClassGUID]
				,[Name]
				,[TaxCode]
				,[DisplayOrder]
				,[CreatedOn] )
				Values
				( @TaxClassGUID
				, @Name
				, @TaxCode
				, @DisplayOrder
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@TaxClassID", entity.TaxClassId)
                    , new SqlParameter("@TaxClassGUID", entity.TaxClassGuid)
                    , new SqlParameter("@Name", entity.Name)
                    , new SqlParameter("@TaxCode", entity.TaxCode)
                    , 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(GetTaxClass(Convert.ToInt32(identity)));
            }
            return(entity);
        }