84 lines
3.2 KiB
C#
84 lines
3.2 KiB
C#
using Core.Web.App_Start;
|
|
using Core.Web.WebHelper;
|
|
using CRM.Core.BLL;
|
|
using CRM.Core.BLL.Base;
|
|
using CRM.Core.BLL.Soft;
|
|
using CRM.Core.BLL.Util;
|
|
using CRM.Core.Common.Layui;
|
|
using CRM.Core.Model.Entity;
|
|
using System;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using WX.CRM.Common;
|
|
|
|
namespace Core.Web.Controllers
|
|
{
|
|
public class SoftUserGetLogController : BaseController
|
|
{
|
|
Soft_User_GetCheck_BL _order = new Soft_User_GetCheck_BL();
|
|
Bas_CompanyVirtual_BL _companyvirtual = new Bas_CompanyVirtual_BL();
|
|
CACHE_BL _cache = new CACHE_BL();
|
|
[AuthorizeRedirect(RightsConfig.CONST_用户名申请日志, ToolBarConfig.CONST_NotButton, true)]
|
|
public ActionResult Index()
|
|
{
|
|
ViewBag.rightCode = RightsConfig.CONST_用户名申请日志;
|
|
ViewBag.companyList = _cache.GetCompanyVirtual();
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
[AuthorizeRedirect(RightsConfig.CONST_用户名申请日志, ToolBarConfig.CONST_NotButton, false)]
|
|
public JsonResult Index(Laypage pager, int? status, string companyCode, string softusername, DateTime? sTime, DateTime? eTime, string resid)
|
|
{
|
|
|
|
|
|
var where = PredicateExtensionses.True<Soft_User_GetCheck>();
|
|
if (status.HasValue)
|
|
where = where.And(p => p.status == status);
|
|
if (!string.IsNullOrWhiteSpace(companyCode))
|
|
where = where.And(p => companyCode.Contains(p.deptcode));
|
|
if (!string.IsNullOrWhiteSpace(softusername))
|
|
where = where.And(p => p.softusername == softusername);
|
|
if (sTime.HasValue)
|
|
where = where.And(p => p.ctime >= sTime.Value);
|
|
if (eTime.HasValue)
|
|
{
|
|
eTime = eTime.Value.AddDays(1);
|
|
where = where.And(p => p.ctime < eTime);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(resid))
|
|
where = where.And(p => p.resid == resid);
|
|
|
|
|
|
var list = _order.GetList(where, p => p.id, pager, sortOrder: SortOrder.Descending).ToList();
|
|
//var sumList = _order.GetList(where, p => p.id, new Laypage() { page = 1, limit = int.MaxValue });
|
|
|
|
var compay = _companyvirtual.GetList();
|
|
foreach (var item in list)
|
|
{
|
|
var source = compay.FirstOrDefault(m => m.CompanyCode.Contains(item.source));
|
|
if (source != null)
|
|
{
|
|
item.source = source.CompanyName;
|
|
}
|
|
var dept = compay.FirstOrDefault(m => m.CompanyCode.Contains(item.deptcode));
|
|
if (dept != null)
|
|
{
|
|
item.deptcode = dept.CompanyName;
|
|
}
|
|
}
|
|
var data = new { msg = "数据加载成功!", count = pager.count, code = 0, data = list };
|
|
return Json(data, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
[AuthorizeRedirect(RightsConfig.CONST_用户名申请日志, ToolBarConfig.CONST_Check, false)]
|
|
public JsonResult Check(int id)
|
|
{
|
|
ValidationErrors errors = new ValidationErrors();
|
|
bool result = _order.CheckSoftUser(id, ref errors);
|
|
return JsonResult(errors);
|
|
}
|
|
}
|
|
} |