bklLiudl
2024-07-23 675b8bcc4a3630d95e3d0b97d933e63442075ecb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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<WCSLogInUser> 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<WCSLogInUser>.DataTableToModel(dt);
            }
            catch
            {
                throw new NotImplementedException();
            }
        }
    }
}