コード例 #1
0
 //Add to database
 private void ImportICB_AddToDb(data.importDS.icbCodeDataTable tbl, string fldName, bool haveDefitionFld, 
                                       data.baseDS.sysCodeDataTable sysCodeTbl,string category,string codeGroupFldName)
 {
     data.baseDS.sysCodeRow sysCodeRow;
     common.myKeyValueItem item;
     for (int idx = 0; idx < tbl.Count; idx++)
     {
         if (tbl[idx].RowState == DataRowState.Deleted) continue;
         item = libs.SplitKeyValue(tbl[idx][fldName].ToString()," ");
         if (item == null)
         {
             common.fileFuncs.WriteLog(tbl[idx][fldName].ToString() + " not found.");
             continue;
         }
         if (sysCodeTbl.FindBycategorycode(category, item.Key) == null)
         {
             sysCodeRow = sysCodeTbl.NewsysCodeRow();
             commonClass.AppLibs.InitData(sysCodeRow);
             sysCodeRow.category = category;
             sysCodeRow.code = item.Key;
             sysCodeRow.description1 = item.Value;
             sysCodeRow.tag1 = fldName;
             if (codeGroupFldName != null) sysCodeRow.inGroup = tbl[idx][codeGroupFldName].ToString();
             if (haveDefitionFld && !tbl[idx].IsdefinitionNull()) sysCodeRow.notes = tbl[idx].definition;
             sysCodeTbl.AddsysCodeRow(sysCodeRow);
         }
         tbl[idx][fldName] = item.Key;
     }
 }