예제 #1
0
        public List <OnDecisionsRuleEntity> GetEntitiesByChoiceId(int choiceId)
        {
            List <OnDecisionsRuleEntity> entities = new List <OnDecisionsRuleEntity>();
            string query =
                "SELECT r.* FROM " + QuestionChoiceDb.TableName + " as c " +
                "JOIN " + ChoiceToRuleDb.TableName + " as cr " +
                "ON c." + QuestionChoiceDb.PK + " = cr." + KEY_CHOICE +
                " JOIN " + OnDecisionsRuleDb.TableName + " as r " +
                "ON cr." + KEY_RULE + " = r." + OnDecisionsRuleDb.PK +
                " WHERE c." + QuestionChoiceDb.PK + " = " + choiceId;
            IDataReader reader = dbHelper.ProcessGetQuery(query);

            while (reader.Read())
            {
                var entity = new OnDecisionsRuleEntity(
                    reader.GetInt32(0), reader.GetInt32(1),
                    reader.GetInt32(2), reader.GetInt32(3));
                entities.Add(entity);
            }
            reader.Close();
            return(entities);
        }
예제 #2
0
        public List <OnDecisionsRuleEntity> GetEntitiesByParameterIdAndValue(int paramId, string value)
        {
            List <OnDecisionsRuleEntity> entities = new List <OnDecisionsRuleEntity>();
            string query =
                "SELECT r.* FROM " + ParameterToRuleDb.TableName + " as cr " +
                "JOIN " + OnDecisionsRuleDb.TableName + " as r " +
                "ON cr." + KEY_RULE + " = r." + OnDecisionsRuleDb.PK +
                " WHERE cr." + KEY_PARAMETER + " = " + paramId + " AND cr." + KEY_PARAMETER_VALUE + " = '" + value + "'";

            Debug.Log(query);
            IDataReader reader = dbHelper.ProcessGetQuery(query);

            while (reader.Read())
            {
                var entity = new OnDecisionsRuleEntity(
                    reader.GetInt32(0), reader.GetInt32(1),
                    reader.GetInt32(2), reader.GetInt32(3));
                entities.Add(entity);
            }
            reader.Close();
            return(entities);
        }