using MESClassLibrary.DAL.Log;
using MESClassLibrary.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
namespace MESClassLibrary.BLL.Log
{
public class LogErrBLL
{
public DataTable SearchInfoByTime(string stime, string etime)
{
try
{
LogErrDAL db = new LogErrDAL();
DateTime startime = Convert.ToDateTime("1900-01-01 00:00:00");
DateTime endtime = Convert.ToDateTime("2100-12-31 23:59:59");
if (stime != "0")
{
startime = Convert.ToDateTime(stime);
}
if (etime != "0")
{
endtime = Convert.ToDateTime(etime);
}
return db.Search_InfoByTime(startime, endtime);
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
return null;
}
}
///
/// 新增错误信息
///
///
///
public static void AddInfo(string err,MethodBase mb)
{
try
{
LogErrDAL db = new LogErrDAL();
LogErrModel md = new LogErrModel();
md.ID = Guid.NewGuid().ToString();
md.ErrContent = err;
md.ErrSource = mb.DeclaringType.Name + "." + mb.Name;
db.Add_Info(md);
}
catch (Exception)
{
}
}
}
}