using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using Common;
|
using Model;
|
|
namespace BLL.DAL
|
{
|
public class DAL_Alarm
|
{
|
public IList<WCSAlarmInfo> GetList(AjaxAlarmInfoList Json, ref PageInfo pageInfo)
|
{
|
try
|
{
|
StringBuilder strSql = new StringBuilder();
|
strSql.Append("Select * from WCSAlarmInfo where IsDel=0 ");
|
|
if (!string.IsNullOrWhiteSpace(Json.AlarmCode))
|
{
|
strSql.Append(" and AlarmCode like '%" + Json.AlarmCode + "%' ");
|
}
|
if (!string.IsNullOrWhiteSpace(Json.AlarmName))
|
{
|
strSql.Append(" and AlarmName like '%" + Json.AlarmName + "%' ");
|
}
|
DataTable dt = DataFactory.SqlDataBase().GetPageList(strSql.ToString(), null, "CreateTime", "Desc", ref pageInfo);
|
return ModelConvertHelper<WCSAlarmInfo>.DataTableToModel(dt);
|
}
|
catch
|
{
|
throw new NotImplementedException();
|
}
|
}
|
|
public bool AlarmDelete(string[] ID)
|
{
|
bool result = false;
|
try
|
{
|
int dt = DataFactory.SqlDataBase().IsExist("Alarm", "ID", ID);
|
if (dt >= ID.Length)
|
{
|
int i = 0;
|
while (i < ID.Length)
|
{
|
StringBuilder sql = new StringBuilder();
|
sql.Append("update Alarm set IsDel=1 where Id='" + ID[i] + "'");
|
int _ret = DataFactory.SqlDataBase().ExecuteBySql(sql);
|
if (_ret >= ID.Length) result = true;
|
i++;
|
}
|
|
}
|
return result;
|
|
}
|
catch
|
{
|
return result;
|
}
|
}
|
|
public bool AlarmDispose(string[] ID, string loginUser)
|
{
|
bool result = false;
|
try
|
{
|
int dt = DataFactory.SqlDataBase().IsExist("Alarm", "ID", ID);
|
if (dt >= ID.Length)
|
{
|
int i = 0;
|
while (i < ID.Length)
|
{
|
StringBuilder sql = new StringBuilder();
|
sql.Append("update Alarm set State = 1,UpdateUser = '" + loginUser + "',UpdateTime = getdate() where Id='" + ID[i] + "'");
|
int _ret = DataFactory.SqlDataBase().ExecuteBySql(sql);
|
if (_ret >= ID.Length) result = true;
|
i++;
|
}
|
|
}
|
return result;
|
|
}
|
catch
|
{
|
return result;
|
}
|
}
|
}
|
}
|