Beispiel #1
0
        public int UpdateFuzzySet(FuzzySetBLL set)
        {
            try
            {
                int result = 0;

                if (IsExistFSName(set.FuzzySetName))//Update value
                {
                    var _set = db.MotherLibraries.SingleOrDefault(name => name.LanguisticLabel == set.FuzzySetName);

                    //Only update value
                    _set.FuzzySet = ConvertToString(set.FuzzySet);

                    return result = db.SaveChanges(true);
                }
                else//Mean add new object to DB
                {
                    MotherLibrary mother = new MotherLibrary();
                    mother.ID = GetId();
                    mother.LanguisticLabel = set.FuzzySetName;
                    mother.FuzzySet = ConvertToString(set.FuzzySet);

                    db.AddToMotherLibraries(mother);
                    return result = db.SaveChanges(true);
                }
            }
            catch (SQLiteException ex)
            {
                //throw new Exception(ex.Message);
                return -1;
            }
        }
Beispiel #2
0
        public int DeleteFuzzySet(FuzzySetBLL set)
        {
            try
            {
                int result = 0;

                if (IsExistFSName(set.FuzzySetName))//Delete object
                {
                    var _set = db.MotherLibraries.SingleOrDefault(name => name.LanguisticLabel == set.FuzzySetName);

                    db.DeleteObject(_set);//Need some check some references
                    return result = db.SaveChanges(true);
                }
                else//Nothing to delete
                {
                    return result = -1;
                }
            }
            catch (SQLiteException ex)
            {
                return -1;
            }
        }