예제 #1
0
 /*
  * 根据ID获取文件类型
  */
 public static int getCateByCaseID(int id)
 {
     SqlTransaction trans = null;
     DB db = null;
     try
     {
         db = new DB();
         trans = db.conn.BeginTransaction(IsolationLevel.ReadCommitted);
         SqlParameter[] parms = {
             new SqlParameter("@ID", id)
         };
         int cate = (int)db.ExecuteScalar(trans, "Command_GetCateByCaseID", parms);
         trans.Commit();
         db.Close();
         return cate;
     }
     catch
     {
         if (trans != null)
             trans.Rollback();
         if (db != null)
             db.Close();
         return 0;
     }
 }
예제 #2
0
 /*
  * 获取某一知识点出现的文件数目
  */
 public static int getFileNumByKName(string kName, string courseName)
 {
     SqlTransaction trans = null;
     DB db = null;
     try
     {
         db = new DB();
         trans = db.conn.BeginTransaction(IsolationLevel.ReadCommitted);
         SqlParameter[] parms = {
             new SqlParameter("@KName", kName),
             new SqlParameter("@CourseName", courseName)
         };
         int num = (int)db.ExecuteScalar(trans, "Command_GetFileNumByKName", parms);
         trans.Commit();
         db.Close();
         return num;
     }
     catch
     {
         if (trans != null)
             trans.Rollback();
         if (db != null)
             db.Close();
         return 0;
     }
 }