37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.IBLL.Wx;
|
|
using WX.CRM.Model.Entity;
|
|
|
|
namespace WX.CRM.BLL.Wx
|
|
{
|
|
public class WX_WORKACCOUNT_ONLINELOG_BL : DbContextRepository<WX_WORKACCOUNT_ONLINELOG>, IWX_WORKACCOUNT_ONLINELOG
|
|
{
|
|
public List<WX_WORKACCOUNT_ONLINELOG> GetList(string userName, string stime, string etime)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
var queryData = db.WX_WORKACCOUNT_ONLINELOG.AsQueryable();
|
|
if (!string.IsNullOrWhiteSpace(userName))
|
|
{
|
|
userName = userName.Trim();
|
|
queryData = queryData.Where(m => m.USERNAME == userName);
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(stime))
|
|
{
|
|
DateTime time1 = Convert.ToDateTime(stime);
|
|
queryData = queryData.Where(m => m.CTIME >= time1);
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(etime))
|
|
{
|
|
DateTime time2 = Convert.ToDateTime(etime).AddDays(1);
|
|
queryData = queryData.Where(m => m.CTIME < time2);
|
|
}
|
|
queryData = queryData.OrderByDescending(m => m.CTIME);
|
|
return queryData.ToList();
|
|
}
|
|
}
|
|
}
|
|
} |