/// <summary>
 /// Deprecated Method for adding a new object to the DiscreteLibaries EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDiscreteLibaries(DiscreteLibary discreteLibary)
 {
     base.AddObject("DiscreteLibaries", discreteLibary);
 }
 /// <summary>
 /// Create a new DiscreteLibary object.
 /// </summary>
 /// <param name="languisticLabel">Initial value of the LanguisticLabel property.</param>
 public static DiscreteLibary CreateDiscreteLibary(global::System.String languisticLabel)
 {
     DiscreteLibary discreteLibary = new DiscreteLibary();
     discreteLibary.LanguisticLabel = languisticLabel;
     return discreteLibary;
 }
示例#3
0
        public int UpdateDiscreteFS(DiscreteFuzzySetBLL disc)
        {
            try
            {
                int result = 0;

                if (!IsExistFSName(disc.FuzzySetName))//Add new object
                {
                    //Insert mother library (contens both discrete library and continuous library)
                    //FuzzySetBLL mother = new FuzzySetBLL(disc.FuzzySetName, disc.FuzzySet);

                    //if (new FuzzySetDAL().UpdateFuzzySet(mother) == 1)
                    //{
                    //Insert child library
                    DiscreteLibary child = new DiscreteLibary();
                    child.LanguisticLabel = disc.FuzzySetName;
                    child.Values = ConvertToString(disc.ValueSet);
                    child.Memberships = ConvertToString(disc.MembershipSet);

                    db.AddToDiscreteLibaries(child);
                    return result = db.SaveChanges(true);
                    //}
                    //else
                    //{
                    //    return -1;
                    //}
                }
                else//Just update values and memberships
                {
                    var _disc = db.DiscreteLibaries.FirstOrDefault(id => id.LanguisticLabel == disc.FuzzySetName);
                    //_disc.LanguisticLabel = disc.FuzzySetName;
                    _disc.Values = ConvertToString(disc.ValueSet);
                    _disc.Memberships = ConvertToString(disc.MembershipSet);

                    return result = db.SaveChanges();
                }
            }
            catch (SQLiteException ex)
            {
                //throw new Exception(ex.Message);
                return -1;
            }
        }