private void Update(List <string> fields, int businessID) { using (TechCareerFair.DAL.Business2FieldDAL.Business2FieldDatabaseDataService ds = new Business2FieldDAL.Business2FieldDatabaseDataService()) { List <business2field> b2fs = ds.Read(); foreach (string name in fields) { business2field b2f = new business2field(); int fieldIndex = DatabaseHelper.GetFieldIndex(name); b2f.Business = businessID; b2f.Field = fieldIndex; ds.Update(b2f); } } }
private void Insert(List <string> fields, int businessID) { //insert field ID and business ID into new record of mapping table business2field using (TechCareerFair.DAL.Business2FieldDAL.Business2FieldDatabaseDataService ds = new Business2FieldDAL.Business2FieldDatabaseDataService()) { List <business2field> b2fs = ds.Read(); foreach (string name in fields) { business2field b2f = new business2field(); int fieldIndex = DatabaseHelper.GetFieldIndex(name); b2f.Business = businessID; b2f.Field = fieldIndex; if (b2fs.Where(b => b.Field == fieldIndex).Where(b => b.Business == businessID).Count() == 0) { ds.Insert(b2f); } } } }
private void RemoveAll(int businessID) { using (TechCareerFair.DAL.Business2FieldDAL.Business2FieldDatabaseDataService ds = new Business2FieldDAL.Business2FieldDatabaseDataService()) { ds.RemoveAll(businessID); } }
public void Dispose() { _business2fields = null; _ds = null; }