天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.DAL;
using QMFrameWork.Data;
using QMAPP.FJC.Entity.Operation;
using System.Data;
namespace QMAPP.FJC.DAL.Operation
{
public class CastCounterDAL : BaseDAL
{
public void UpdateCounter()
{
try
{
string updatesql = string.Format("UPDATE T_AW_CASTCOUNTER SET COUNTERVALUE=COUNTERVALUE+1,UPDATEDATE='{0}' ",System.DateTime.Now);
if (this.BaseSession != null)
{
this.BaseSession.ExecuteSql(updatesql, new List<DataParameter>().ToArray());
}
else
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.ExecuteSql(updatesql, new List<DataParameter>().ToArray());
}
}
}
catch (Exception)
{
throw;
}
}
/// <summary>
/// 更新配置信息
/// </summary>
/// <param name="entity"></param>
public void UpdateConfig(CastCounter entity)
{
try
{
string updatesql = string.Format("UPDATE T_AW_CASTCOUNTER SET ISCOUNTER=@ISCOUNTER,COUNTERINTERNAL=@COUNTERINTERNAL ");
List<DataParameter> list = new List<DataParameter>();
list.Add(new DataParameter() { ParameterName = "ISCOUNTER", Value = entity.ISCOUNTER, DataType = DbType.Int32 });
list.Add(new DataParameter() { ParameterName = "COUNTERINTERNAL", Value = entity.COUNTERINTERNAL, DataType = DbType.Int32 });
using (IDataSession session = AppDataFactory.CreateMainSession())
{
session.ExecuteSql(updatesql, list.ToArray());
}
}
catch (Exception)
{
throw;
}
}
public CastCounter Get()
{
try
{
CastCounter cast = new CastCounter();
string sql = string.Format("select ISCOUNTER,COUNTERINTERNAL,COUNTERVALUE from T_AW_CASTCOUNTER");
using (IDataSession session = AppDataFactory.CreateMainSession())
{
cast = session.Get<CastCounter>(sql, new List<DataParameter>().ToArray());
}
return cast;
}
catch (Exception ex)
{
throw;
}
}
}
}