private void Update(List <string> fields, int applicantID) { using (TechCareerFair.DAL.Applicant2FieldDAL.Applicant2FieldDatabaseDataService ds = new Applicant2FieldDAL.Applicant2FieldDatabaseDataService()) { List <applicant2field> a2fs = ds.Read(); foreach (string name in fields) { applicant2field a2f = new applicant2field(); int fieldIndex = DatabaseHelper.GetFieldIndex(name); a2f.Applicant = applicantID; a2f.Field = fieldIndex; ds.Update(a2f); } } }
private void Insert(List <string> fields, int applicantID) { //insert field ID and applicant ID into new record of mapping table applicant2field using (TechCareerFair.DAL.Applicant2FieldDAL.Applicant2FieldDatabaseDataService ds = new Applicant2FieldDAL.Applicant2FieldDatabaseDataService()) { List <applicant2field> a2fs = ds.Read(); foreach (string name in fields) { applicant2field a2f = new applicant2field(); int fieldIndex = DatabaseHelper.GetFieldIndex(name); a2f.Applicant = applicantID; a2f.Field = fieldIndex; if (a2fs.Where(a => a.Field == fieldIndex).Where(a => a.Applicant == applicantID).Count() == 0) { ds.Insert(a2f); } } } }
private void RemoveAll(int applicantID) { using (TechCareerFair.DAL.Applicant2FieldDAL.Applicant2FieldDatabaseDataService ds = new Applicant2FieldDAL.Applicant2FieldDatabaseDataService()) { ds.RemoveAll(applicantID); } }
public void Dispose() { _applicant2fields = null; _ds = null; }