コード例 #1
0
        public static void DeleteItemFromDatabase(Object obj)
        {
            string query = QueryGenerator.GenerateDeleteQuery(obj.GetType());
            Dictionary <string, string> parameters = QueryGenerator.GetValuesInADictionary(obj);

            dbWrapper.ExecuteCommand(query, parameters);
        }
コード例 #2
0
        public static void UpdateItem(Object oldObject, Object newObject)
        {
            if (oldObject.GetType() != newObject.GetType())
            {
                throw new AttributeException("The type of the current object and the new object doesn't match");
            }
            string query = QueryGenerator.GenerateUpdateQuery(oldObject.GetType());
            Dictionary <string, string> parameters = QueryGenerator.GetValuesInADictionary(oldObject, newObject);

            dbWrapper.ExecuteCommand(query, parameters);
        }
コード例 #3
0
 public static void AddData(Object obj)
 {
     try
     {
         QueryGenerator.ProcessOneToManyInsert(obj);
         string query = QueryGenerator.GenerateInsertQuery(obj.GetType());
         Dictionary <string, string> parameters = QueryGenerator.GetValuesInADictionary(obj);
         dbWrapper.ExecuteCommand(query, parameters);
     }catch (SQLiteException e)
     {
         throw new AttributeException("A row containing the same data already exists " + e.Message);
     }
 }