Esempio n. 1
-1
 /// <summary>
 /// 不显示三级科目
 /// </summary>
 /// <param name="condition"></param>
 /// <param name="id"></param>
 /// <param name="isTwo"></param>
 /// <returns></returns>
 public List<string> GetChildSubjectList(string condition, string id, bool isTwo)
 {
     list = new List<string>();
     string sql1 = string.Empty;
     string sql2 = string.Empty;
     sql = "select subject_id,subject_name from " + DBTablesName.T_SUBJECT;
     if (isTwo)
     {
         sql1 = " where parent_id = '" + id + "'";
     }
     else
     {
         sql1 = " where parent_id like '" + id + "%'";
     }
     if (!string.IsNullOrEmpty(condition))
     {
         sql2 = " and subject_id like '" + condition + "%'";
     }
     sql += sql1 + sql2 + " order by subject_id";
     DataBase db = new DataBase();
     DataTable dt = db.Query(sql).Tables[0];
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         string str = dt.Rows[i][0] + "\t" + dt.Rows[i][1];
         list.Add(str);
     }
     return list;
 }
Esempio n. 2
-1
 /// <summary>
 /// 获取所有科目的最低级科目(子细目)
 /// </summary>
 /// <returns></returns>
 public List<string> GetChildSubjectList(string condition)
 {
     List<string> lists = new List<string>();
     string parm = string.Empty;
     if (!string.IsNullOrEmpty(condition))
     {
         parm = " and a.subject_id like '" + condition + "%'";
     }
     string sql  = " SELECT                                                                  "
                 + "     a.SUBJECT_ID,                                                       "
                 + "     a.subject_name,                                                     "
                 + "     b.SUBJECT_ID ParentID,                                              "
                 + "     b.subject_name ParentName,                                          "
                 + "     c.SUBJECT_ID ParentID,                                              "
                 + "     c.subject_name ParentName,                                          "
                 + "     d.SUBJECT_ID ParentID,                                              "
                 + "     d.subject_name ParentName                                           "
                 + " FROM                                                                    "
                 + DBTablesName.T_SUBJECT
                 + " a LEFT JOIN "
                 + DBTablesName.T_SUBJECT
                 + " b ON substr(a.SUBJECT_ID, 0, 4) = b.SUBJECT_ID    "
                 + " LEFT JOIN "
                 + DBTablesName.T_SUBJECT
                 + "  c ON substr(a.SUBJECT_ID, 0, 6) = c.SUBJECT_ID    "
                 + " LEFT JOIN "
                 + DBTablesName.T_SUBJECT
                 + "  d ON substr(a.SUBJECT_ID, 0, 8) = d.SUBJECT_ID    "
                 + " WHERE                                                                   "
                 + "     a.SUBJECT_ID NOT IN (                                               "
                 + "         SELECT                                                          "
                 + "             PARENT_ID                                                   "
                 + "         FROM                                                            "
                 + "             T_SUBJECT_0                                                 "
                 + "         GROUP BY                                                        "
                 + "             PARENT_ID                                                   "
                 + "     )                                                                   "
                 + parm
                 + " ORDER BY                                                                "
                 + "     a.SUBJECT_ID                                                        ";
     DataBase db = new DataBase();
     DataTable dt = db.Query(sql).Tables[0];
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         string str  = dt.Rows[i][0] + "\t"
                     + dt.Rows[i][1] + "\t"  //name
                     + dt.Rows[i][2] + "\t"
                     + dt.Rows[i][3] + "\t"  //name
                     + dt.Rows[i][4] + "\t"
                     + dt.Rows[i][5] + "\t"  //name
                     + dt.Rows[i][6] + "\t"
                     + dt.Rows[i][7];        //name
         lists.Add(str);
     }
     return lists;
 }
Esempio n. 3
-1
 public List<string> GetSubjectList(string condition)
 {
     list = new List<string>();
     if (string.IsNullOrEmpty(condition))
     {
         sql = "select subject_id,subject_name from " + DBTablesName.T_SUBJECT + " where used_mark=0 and parent_id=0 order by id";
     }
     else
     {
         sql = "select subject_id,subject_name from " + DBTablesName.T_SUBJECT + " where used_mark=0 " + "and subject_id like '" + condition +
                 "%' and parent_id=0  order by id";
     }
     DataBase db = new DataBase();
     DataTable dt = db.Query(sql).Tables[0];
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         string str = dt.Rows[i][0]+"\t"+dt.Rows[i][1];
         list.Add(str);
     }
     return list;
 }