示例#1
0
        public static int Update(JobPosting p)
        {
            DBAccess db = new DBAccess();

            db.Parameters.Add(new SqlParameter("@iPostingID", p.JobPostingID));
            db.Parameters.Add(new SqlParameter("@iCompanyID", p.CompanyID));
            db.Parameters.Add(new SqlParameter("@sContactPerson", p.ContactPerson));
            db.Parameters.Add(new SqlParameter("@sTitle", p.Title));
            db.Parameters.Add(new SqlParameter("@sDepartment", p.Department));
            db.Parameters.Add(new SqlParameter("@sJobCode", p.JobCode));
            db.Parameters.Add(new SqlParameter("@sCity", p.City));
            db.Parameters.Add(new SqlParameter("@iStateID", p.StateID));
            db.Parameters.Add(new SqlParameter("@iCountryID", p.CountryID));
            db.Parameters.Add(new SqlParameter("@iEducationLevelID", p.EducationLevelID));
            db.Parameters.Add(new SqlParameter("@iJobTypeID", p.JobTypeID));
            db.Parameters.Add(new SqlParameter("@curMinSalary", p.MinSalary));
            db.Parameters.Add(new SqlParameter("@curMaxSalary", p.MaxSalary));
            db.Parameters.Add(new SqlParameter("@sJobDescription", p.Description));
            db.Parameters.Add(new SqlParameter("@daPostingDate", p.PostingDate));
            db.Parameters.Add(new SqlParameter("@sPostedBy", p.PostedBy));

            int retval = db.ExecuteNonQuery("JobsDb_JobPostings_Update");
            return retval;
        }
示例#2
0
 public static JobPosting GetPosting(int id)
 {
     DBAccess db = new DBAccess();
     db.Parameters.Add(new SqlParameter("@iPostingID", id));
     SqlDataReader dr = (SqlDataReader)db.ExecuteReader("JobsDb_JobPostings_SelectOne");
     if (dr.HasRows)
     {
         JobPosting objJobPosting = new JobPosting();
         while (dr.Read())
         {
             objJobPosting.JobPostingID = dr.GetInt32(dr.GetOrdinal("PostingID"));
             objJobPosting.CompanyID = dr.GetInt32(dr.GetOrdinal("CompanyID"));
             objJobPosting.Title = dr.GetString(dr.GetOrdinal("Title"));
             objJobPosting.ContactPerson = dr.GetString(dr.GetOrdinal("ContactPerson"));
             objJobPosting.Department = dr.GetString(dr.GetOrdinal("Department"));
             objJobPosting.Description = dr.GetString(dr.GetOrdinal("JobDescription"));
             objJobPosting.City = dr.GetString(dr.GetOrdinal("City"));
             objJobPosting.StateID = dr.GetInt32(dr.GetOrdinal("StateID"));
             objJobPosting.CountryID = dr.GetInt32(dr.GetOrdinal("CountryID"));
             objJobPosting.EducationLevelID = dr.GetInt32(dr.GetOrdinal("EducationLevelID"));
             objJobPosting.JobTypeID = dr.GetInt32(dr.GetOrdinal("JobTypeID"));
             objJobPosting.JobCode = dr.GetString(dr.GetOrdinal("JobCode"));
             objJobPosting.MinSalary = dr.GetDecimal(dr.GetOrdinal("MinSalary"));
             objJobPosting.MaxSalary = dr.GetDecimal(dr.GetOrdinal("MaxSalary"));
             objJobPosting.PostingDate = dr.GetDateTime(dr.GetOrdinal("PostingDate"));
             objJobPosting.PostedBy = dr.GetString(dr.GetOrdinal("PostedBy"));
         }
         dr.Close();
         return objJobPosting;
     }
     else
     {
         dr.Close();
         return new JobPosting();
     }
 }
示例#3
0
        public static int Insert(JobPosting p)
        {
            DBAccess db = new DBAccess();

            SqlParameter objParam = new SqlParameter("@iPostingID", 0);
            objParam.Direction = ParameterDirection.Output;

            db.Parameters.Add(new SqlParameter("@iCompanyID", p.CompanyID));
            db.Parameters.Add(new SqlParameter("@sContactPerson", p.ContactPerson));
            db.Parameters.Add(new SqlParameter("@sTitle", p.Title));
            db.Parameters.Add(new SqlParameter("@sDepartment", p.Department));
            db.Parameters.Add(new SqlParameter("@sJobCode", p.JobCode));
            db.Parameters.Add(new SqlParameter("@sCity", p.City));
            db.Parameters.Add(new SqlParameter("@iStateID", p.StateID));
            db.Parameters.Add(new SqlParameter("@iCountryID", p.CountryID));
            db.Parameters.Add(new SqlParameter("@iEducationLevelID", p.EducationLevelID));
            db.Parameters.Add(new SqlParameter("@iJobTypeID", p.JobTypeID));
            db.Parameters.Add(new SqlParameter("@curMinSalary", p.MinSalary));
            db.Parameters.Add(new SqlParameter("@curMaxSalary", p.MaxSalary));
            db.Parameters.Add(new SqlParameter("@sJobDescription", p.Description));
            db.Parameters.Add(new SqlParameter("@daPostingDate", p.PostingDate));
            db.Parameters.Add(new SqlParameter("@sPostedBy", p.PostedBy));
            db.Parameters.Add(objParam);

            int retval = db.ExecuteNonQuery("JobsDb_JobPostings_Insert");
            if (retval == 1)
            {
                return int.Parse(objParam.Value.ToString());
            }
            else
            {
                return -1;
            }
        }
示例#4
0
 public static int Delete(JobPosting p)
 {
     DBAccess db = new DBAccess();
     db.Parameters.Add(new SqlParameter("@iPostingID", p.JobPostingID));
     int retval = db.ExecuteNonQuery("JobsDb_JobPostings_Delete");
     return retval;
 }