using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.FJC.Entity.Operation;
using QMFrameWork.Data;
using QMAPP.DAL;
namespace QMAPP.FJC.DAL.Operation
{
public class MainMolderStatusDAL : BaseDAL
{
///
/// 通过设备号和模架号获取模架使用状态对象
///
///
///
public MainMolderStatus Get(MainMolderStatus condition)
{
MainMolderStatus entity = new MainMolderStatus();
string sql = "select * from T_AW_MAINMOLDERSTATUS where 1=1 ";
if (string.IsNullOrEmpty(condition.MACHINECODDE) == false)
{
sql += string.Format(" and MACHINECODDE='{0}'",condition.MACHINECODDE);
}
if (string.IsNullOrEmpty(condition.MOLDNUMBER) == false)
{
sql += string.Format(" and MOLDNUMBER='{0}'", condition.MOLDNUMBER);
}
using (IDataSession session = AppDataFactory.CreateMainSession())
{
entity = session.Get(sql, new List().ToArray());
}
return entity;
}
public void Update(MainMolderStatus condition)
{
string updateSql = string.Format("update T_AW_MAINMOLDERSTATUS set OPERATIONFLAG={0},BARCODE='{3}' where MACHINECODDE='{1}' and MOLDNUMBER='{2}'",
condition.OPERATIONFLAG, condition.MACHINECODDE, condition.MOLDNUMBER,condition.BARCODE);
if (BaseSession != null)
{
BaseSession.ExecuteSql(updateSql, new List().ToArray());
}
else
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.ExecuteSql(updateSql, new List().ToArray());
}
}
}
}
}