/// <summary>
 /// 执行插入语句
 /// </summary>
 /// <param name="bookid"></param>
 public void Insert(string bookid)
 {
     string sql = "insert into " + DBTablesName.T_YEAR_FEE + "(subject_id,fee,bookid,parentid) select subject_id,0,'" + bookid + "',parent_id from "
         + DBTablesName.T_SUBJECT;
     bool flag = db.Excute(sql);
     if (!flag)
     {
         List<string> list = new List<string>();
         ExcelReader er = new ExcelReader();
         DirectoryInfo theFolder = new DirectoryInfo("Data\\科目");
         List<Model_BalanceSheet> BalanceSheetDatas = new List<Model_BalanceSheet>();
         BalanceSheetDatas = er.ReadBalanceSheet(theFolder.GetFiles()[Int32.Parse(CommonInfo.制度索引)].FullName);
         string baseTableName = "T_SUBJECT";
         string table_Sql = new Helper.SQLHelper.SQLReader().ReadSQL(2, baseTableName, DBTablesName.T_SUBJECT);
         list.Add(table_Sql);
         foreach (Model_BalanceSheet m in BalanceSheetDatas)
         {
             string sql1 = "insert into " + DBTablesName.T_SUBJECT
                 + "(subject_id,subject_type,subject_name) values ('" + m.Number + "'," + m.Type + ",'" + m.Name + "')";
             list.Add(sql1);
         }
         flag = db.BatchOperate(list);
         if (flag)
         {
             db.Excute(sql);
         }
     }
 }
예제 #2
0
 private List<string> GetSubjectSqlList()
 {
     List<string> list = new List<string>();
     ExcelReader er = new ExcelReader();
     DirectoryInfo theFolder = new DirectoryInfo("Data\\科目");
     int i = 0;
     foreach (FileInfo newFile in theFolder.GetFiles())
     {
         List<Model_BalanceSheet> BalanceSheetDatas = new List<Model_BalanceSheet>();
         BalanceSheetDatas = er.ReadBalanceSheet(newFile.FullName);
         string baseTableName = "T_SUBJECT";
         string tableName = baseTableName + "_" + i;
         string table_Sql = new Helper.SQLHelper.SQLReader().ReadSQL(2, baseTableName,tableName);
         list.Add(table_Sql);
         foreach (Model_BalanceSheet m in BalanceSheetDatas)
         {
             string sql = "insert into " + tableName + "(subject_id,subject_type,subject_name) values ('" + m.Number + "'," + m.Type + ",'" + m.Name + "')";
             list.Add(sql);
         }
         i++;
     }
     return list;
 }