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_LogInUser { public IList GetList(AjaxLogInUserList Json, ref PageInfo pageInfo) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("select Top(1000) * from Login_Log where Id >0 "); if (!string.IsNullOrWhiteSpace(Json.UserCode)) { strSql.Append(" and UserCode like '%" + Json.UserCode + "%' "); } if (!string.IsNullOrWhiteSpace(Json.UserName)) { strSql.Append(" and UserName like '%" + Json.UserName + "%' "); } if (!string.IsNullOrWhiteSpace(Json.LoginIp)) { strSql.Append(" and LoginIp like '%" + Json.LoginIp + "%' "); } if (Json.BeginTime != null && Json.BeginTime != DateTime.MinValue && Json.BeginTime != DateTime.MaxValue) { strSql.Append($"and LoginTime >= '{Convert.ToDateTime(Json.BeginTime).ToShortDateString()}' "); } if (Json.BeginTime != null && Json.EndTime != DateTime.MinValue && Json.EndTime != DateTime.MaxValue) { strSql.Append($"and LoginTime <= '{Convert.ToDateTime(Json.EndTime).ToShortDateString() + " 23:59:59.999"}' "); } strSql.Append(" Order by LoginTime desc"); DataTable dt = DataFactory.SqlDataBase().GetPageList(strSql.ToString(), null, "LoginTime", "Desc", ref pageInfo); return ModelConvertHelper.DataTableToModel(dt); } catch { throw new NotImplementedException(); } } } }