Exemple #1
0
 private bool isInt(C_Property property)
 {
     if (property.Type == PropertyTypes.INT)
     {
         return(true);
     }
     else
     {
         throw new Exception("Property " + property.Key + " is not a integer");
     }
 }
Exemple #2
0
 private bool isString(C_Property property)
 {
     if (property.Type == PropertyTypes.STRING)
     {
         return(true);
     }
     else
     {
         throw new Exception("Property " + property.Key + " is not a string");
     }
 }
Exemple #3
0
 private bool isBool(C_Property property)
 {
     if (property.Type == PropertyTypes.BOOL)
     {
         return(true);
     }
     else
     {
         throw new Exception("Property " + property.Key + " is not a boolean");
     }
 }
Exemple #4
0
        public string getString(string key)
        {
            C_Property property = db.C_Properties.Find(key);

            if (property != null)
            {
                if (isString(property))
                {
                    return(property.Value);
                }
            }

            throw new Exception("Property " + key + "not found");
        }
Exemple #5
0
        public bool getBool(string key)
        {
            C_Property property = db.C_Properties.Find(key);

            if (property != null)
            {
                if (isBool(property))
                {
                    return(Boolean.Parse(property.Value));
                }
            }

            throw new Exception("Property " + key + "not found");
        }
Exemple #6
0
        public int getInt(string key)
        {
            C_Property property = db.C_Properties.Find(key);

            if (property != null)
            {
                if (isInt(property))
                {
                    return(Int32.Parse(property.Value));
                }
            }

            throw new Exception("Property " + key + "not found");
        }
Exemple #7
0
        public void setInt(string key, int value)
        {
            C_Property property = db.C_Properties.Find(key);

            if (property == null)
            {
                property = new C_Property {
                    Key = key, Type = PropertyTypes.INT, Value = value.ToString()
                };
                db.C_Properties.Add(property);
            }
            else
            {
                if (isInt(property))
                {
                    property.Value = value.ToString();;
                }
            }
            db.SaveChanges();
        }
Exemple #8
0
        public void setString(string key, string value)
        {
            C_Property property = db.C_Properties.Find(key);

            if (property == null)
            {
                property = new C_Property {
                    Key = key, Type = PropertyTypes.STRING, Value = value
                };
                db.C_Properties.Add(property);
            }
            else
            {
                if (isString(property))
                {
                    property.Value = value;
                }
            }
            db.SaveChanges();
        }
Exemple #9
0
        public void setBool(string key, bool value)
        {
            C_Property property = db.C_Properties.Find(key);

            if (property == null)
            {
                property = new C_Property {
                    Key = key, Type = PropertyTypes.BOOL, Value = value.ToString()
                };
                db.C_Properties.Add(property);
            }
            else
            {
                if (isBool(property))
                {
                    property.Value = value.ToString();
                }
            }
            db.SaveChanges();
        }