using CnasLocalIDAL;
using CnasSynchronousCommon;
using CnasSynchrousModel;
using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Linq;
using System.Text;
namespace SyncLocalDAL
{
public class UpLoadRecordDAL : LocalDBbase, IUpLoadRecord
{
///
/// 插入一条记录数据
///
///
///
public int InsertUpLoadRecord(UpLoadRecord record)
{
int iReturn = 0;
string strSql = @"INSERT INTO UpLoadRecord (GUID,LaboratoryTestGUID,UpLoadUser,UploadTime)
VALUES(@GUID,@LaboratoryTestGUID,@UpLoadUser,@UploadTime)";
try
{
//构建数据库连接
SQLiteHelper.SetConnectionString(ConnectString);
int index = 0;
SQLiteParameter[] parameters = new SQLiteParameter[record.GetType().GetProperties().Count()];
for (int i = 0; i < record.GetType().GetProperties().Count(); i++)
{
parameters[index] = new SQLiteParameter(record.GetType().GetProperties()[i].Name, record.GetType().GetProperties()[i].GetValue(record, null));
index++;
}
//执行SQL语句
iReturn += SQLiteHelper.ExecuteNonQuery(strSql, parameters);
}
catch (Exception ex)
{
AppLog.Error(ex.Message);
throw ex;
}
return iReturn;
}
}
}