CNAS取数仪器端升级
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

UpLoadRecordDAL.cs 1.4KB

5 yıl önce
12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using CnasLocalIDAL;
  2. using CnasSynchronousCommon;
  3. using CnasSynchrousModel;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data.SQLite;
  7. using System.Linq;
  8. using System.Text;
  9. namespace SyncLocalDAL
  10. {
  11. public class UpLoadRecordDAL : LocalDBbase, IUpLoadRecord
  12. {
  13. public int InsertUpLoadRecord(UpLoadRecord record)
  14. {
  15. int iReturn = 0;
  16. string strSql = @"INSERT INTO UpLoadRecord (GUID,LaboratoryTestGUID,UpLoadUser,UploadTime)
  17. VALUES(@GUID,@LaboratoryTestGUID,@UpLoadUser,@UploadTime)";
  18. try
  19. {
  20. //构建数据库连接
  21. SQLiteHelper.SetConnectionString(ConnectString);
  22. int index = 0;
  23. SQLiteParameter[] parameters = new SQLiteParameter[record.GetType().GetProperties().Count()];
  24. for (int i = 0; i < record.GetType().GetProperties().Count(); i++)
  25. {
  26. parameters[index] = new SQLiteParameter(record.GetType().GetProperties()[i].Name, record.GetType().GetProperties()[i].GetValue(record, null));
  27. index++;
  28. }
  29. //执行SQL语句
  30. iReturn += SQLiteHelper.ExecuteNonQuery(strSql, parameters);
  31. }
  32. catch (Exception ex)
  33. {
  34. AppLog.Error(ex.Message);
  35. throw ex;
  36. }
  37. return iReturn;
  38. }
  39. }
  40. }