public static List <JobCategory> GetJobCatFromPref(int contractorId) { //Get All of Contractor's Skills from Database try { DAL dal = new DAL(); string queryString = "Select * from contractorskill where contractorid = " + contractorId + " and active = 1;"; DataTable dtConJobCatDB = dal.ReadRecords(queryString); DataTable dt; List <JobCategory> tempJobCatCollection = new List <JobCategory>(); foreach (DataRow drConJobCat in dtConJobCatDB.Rows) { queryString = "Select * from jobcategory where jobcategoryid = " + Convert.ToInt32(drConJobCat["jobcategoryid"]) + " and active = 1;"; dt = dal.ReadRecords(queryString); foreach (DataRow dr in dt.Rows) { JobCategory newJobCat = new JobCategory(dr); tempJobCatCollection.Add(newJobCat); } } return(tempJobCatCollection); } catch (Exception e) { MessageBox.Show("Something went wrong. Please try again later. " + e.Message, "Unsuccessful", MessageBoxButton.OK, MessageBoxImage.Error); throw; } }
public void SetJobCategory(JobCategory changeJobCategory) { this.Description = changeJobCategory.Description; this.Active = changeJobCategory.Active; }