using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.DAL;
using QMAPP.FJC.Entity.InterfaceData;
using QMFrameWork.Data;
namespace QMAPP.FJC.DAL.InterfaceData
{
public class LeakInspectRecordDAL:BaseDAL
{
#region 插入信息
///
/// 插入信息(单表)
///
/// 信息
/// 插入行数
public int Insert(LeakInspectRecord model)
{
int count = 0;
try
{
if (this.BaseSession != null)
{
count = BaseSession.Insert(model);
}
else
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
//插入基本信息
count = session.Insert(model);
}
}
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
public LeakInspectRecord GetLastRecord(string productcode)
{
List parameters = new List();
try
{
StringBuilder sql = new StringBuilder();
sql.AppendLine("SELECT TOP 1 * ");
sql.AppendLine(" FROM T_ID_LEAKINSPECT_RECORD ");
sql.AppendLine(" WHERE PRODUCTCODE=@productcode ");
sql.AppendLine(" ORDER BY CREATEDATE DESC ");
parameters.Add(new DataParameter("productcode", productcode));
using (IDataSession session = AppDataFactory.CreateMainSession())
{
return session.Get(sql.ToString(), parameters.ToArray());
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}