コード例 #1
0
        public static int createDiscipline(
            string name,
            Measure measure,
            Category category
        )
        {
            executeSql(""
                + "INSERT INTO `" + tableName + "` "
                + "("
                    + "`" + field_name + "`, "
                    + "`" + field_measureId + "`, "
                    + "`" + field_categoryId + "`"
                + ") VALUES ("
                    + "'" + name + "', "
                    + (measure == null ? "NULL" : measure.MeasureId.ToString()) + ", "
                    + category.CategoryId
                + ")"
            );

            Dictionary<string, object> result = querySingleSql("SELECT MAX(`" + field_disciplineId + "`) AS `insertionId` FROM `" + tableName + "`");

            int insertionId = Convert.ToInt32(result["insertionId"]);

            return insertionId;
        }
コード例 #2
0
 public static void deleteMeasure(Measure measure)
 {
     executeSql(""
         + "DELETE FROM "
             + "`" + tableName + "` "
         + "WHERE "
             + "`" + field_measureId + " = " + measure.MeasureId + " "
         + "LIMIT 1"
     );
 }
コード例 #3
0
 public Discipline(
     int disciplineId,
     string name,
     Measure measure,
     Category category
 )
 {
     this.disciplineId = disciplineId;
     this.name = name;
     this.measure = measure;
     this.category = category;
 }
コード例 #4
0
 public Discipline(
     int disciplineId,
     string name,
     Measure measure,
     Category category,
     List<DisciplineSetDisciplineMapping> disciplineSetDisciplineMappings,
     List<Variant> variants
 )
 {
     this.disciplineId = disciplineId;
     this.name = name;
     this.measure = measure;
     this.category = category;
     this.disciplineSetDisciplineMappings = disciplineSetDisciplineMappings;
     this.variants = variants;
 }
コード例 #5
0
 public static void updateMeasure(Measure measure)
 {
     executeSql(""
         + "UPDATE "
             + "`" + tableName + "` "
         + "SET "
             + "`" + field_name + "` = " + measure.Name + ". "
             + "`" + field_shortcut + "` = " + measure.Shortcut + " "
         + "WHERE "
             + "`" + field_measureId + " = " + measure.MeasureId
     );
 }
コード例 #6
0
        public static Measure getMeasureById(int measureId)
        {
            Dictionary<string, object> result = querySingleSql(""
                + "SELECT "
                    + "* "
                + "FROM "
                    + "`" + tableName + "` "
                + "WHERE "
                    + "`" + field_measureId + "` = " + measureId
            );

            if (result == null)
            {
                return null;
            }

            Measure measure = new Measure(
                Convert.ToInt32(result[field_measureId]),
                Convert.ToString(result[field_name]),
                Convert.ToString(result[field_shortcut])
            );

            return measure;
        }