Sha256: 8c5e23ed6c19d60bfb2199f440364de47e508d7ef3e454f4c5a1992ba2e726b1

Contents?: true

Size: 1.93 KB

Versions: 6

Compression:

Stored size: 1.93 KB

Contents

# EXECUTE HumanResources.uspGetEmployees @FirstName = N'Pilar', @LastName = N'Ackerman';
module Toolhound

  # Class to parse GitHub repository owner and name from
  # URLs and to generate URLs
  class Job < Base


    # self.table_name   = :rental
    # self.primary_key  = :int_rental_id

    def default_selects
      {
        job:      [:int_job_id, :bol_active, :dte_created_date, :dte_modified_date],
        job_text: [:int_job_text_id, :var_job_number, :var_job]
      }
    end

    def default_joins
      arr = []
      arr << "INNER JOIN tblJobText ON (tblJobText.intJobID = tblJob.intJobID AND varLocaleID = '#{locale}')"
      # arr << "INNER JOIN tblRentalDetail ON (tblRentalDetail.intRentalDetailID = tblRentalItem.intRentalDetailID)"

      arr
    end

    def default_wheres
      [
        {"job.bol_active" => true}
      ]
    end


    def all(options = {})
      entity_id = options[:entity_id]

      wheres  = default_wheres
      selects = default_selects
      joins   = default_joins

      joins << "
        INNER JOIN (
          SELECT DISTINCT intJobID FROM tblRentalCharge WHERE tblRentalCharge.intEntityID = '#{entity_id}' AND tblRentalCharge.intJobID is NOT NULL
        ) AS tblAssignees ON tblAssignees.intJobID = tblJob.intJobID" if entity_id


      build_and_query(
        joins: joins,
        selects: selects,
        where: wheres
      )

      # joins << "INNER JOIN tblRentalCharge ON tblRentalCharge.intEntityID = '#{entity_id}' AND tblRentalCharge.intJobID is NOT NULL" if entity_id
      # SELECT DISTINCT intJobID FROM tblRentalCharge WHERE tblRentalCharge.intEntityID = '100044' AND tblRentalCharge.intJobID is NOT NULL;

    end

    def insert(variables = {})
      vars = {created_user_id: 1, modified_user_id: 1, active: true, job: nil, created_date: nil, modified_date: nil}
      # procedure("Job_Insert", vars)
    end

    def remove(job_id)
      # procedure("Job_Delete", {job_id: job_id})
    end


  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
toolhound-ruby-1.0.37 lib/toolhound-ruby/job.rb
toolhound-ruby-1.0.36 lib/toolhound-ruby/job.rb
toolhound-ruby-1.0.35 lib/toolhound-ruby/job.rb
toolhound-ruby-1.0.34 lib/toolhound-ruby/job.rb
toolhound-ruby-1.0.33 lib/toolhound-ruby/job.rb
toolhound-ruby-1.0.32 lib/toolhound-ruby/job.rb