Exemple #1
0
        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);
                }
            }
        }
Exemple #2
0
        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);
                    }
                }
            }
        }
Exemple #3
0
 public Business2FieldRepository()
 {
     _business2fields = _ds.Read();
 }