定时任务
This commit is contained in:
@@ -1,26 +1,20 @@
|
||||
using FineUIPro;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Printing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
public static class InterFaceLogService
|
||||
|
||||
public static class InterFaceLogService
|
||||
{
|
||||
public static Model.CNPCDB db = Funs.DB;
|
||||
|
||||
public const string Type1 = "上报";
|
||||
public const string Type2= "下发";
|
||||
public const string Type2 = "下发";
|
||||
public const string Type3 = "回调";
|
||||
|
||||
#region 获取列表
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
@@ -29,25 +23,25 @@ namespace BLL
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public static List<Model.InterFaceLog> GetInterFaceLogByModle(Model.InterFaceLog table)
|
||||
{
|
||||
var q= from x in db.InterFaceLog
|
||||
where
|
||||
( string.IsNullOrEmpty(table.InterFaceLogId)||x.InterFaceLogId.Contains(table.InterFaceLogId)) &&
|
||||
( string.IsNullOrEmpty(table.UserId)||x.UserId.Contains(table.UserId)) &&
|
||||
( string.IsNullOrEmpty(table.UnitId)||x.UnitId.Contains(table.UnitId)) &&
|
||||
( string.IsNullOrEmpty(table.InterFaceName)||x.InterFaceName.Contains(table.InterFaceName)) &&
|
||||
( string.IsNullOrEmpty(table.InterFaceUrl)||x.InterFaceUrl.Contains(table.InterFaceUrl)) &&
|
||||
( string.IsNullOrEmpty(table.InterFaceMehtod)||x.InterFaceMehtod.Contains(table.InterFaceMehtod)) &&
|
||||
( string.IsNullOrEmpty(table.InterFaceBody)||x.InterFaceBody.Contains(table.InterFaceBody)) &&
|
||||
( string.IsNullOrEmpty(table.InterFaceReturnData)||x.InterFaceReturnData.Contains(table.InterFaceReturnData)) &&
|
||||
( string.IsNullOrEmpty(table.InterFaceType)||x.InterFaceType.Contains(table.InterFaceType)) &&
|
||||
( string.IsNullOrEmpty(table.IP)||x.IP.Contains(table.IP))
|
||||
orderby x.InterFaceLogDate descending
|
||||
select x
|
||||
;
|
||||
|
||||
return q.ToList();
|
||||
public static IQueryable<Model.InterFaceLog> GetInterFaceLogByModle(Model.InterFaceLog table)
|
||||
{
|
||||
var q = from x in db.InterFaceLog
|
||||
where
|
||||
(string.IsNullOrEmpty(table.InterFaceLogId) || x.InterFaceLogId.Contains(table.InterFaceLogId)) &&
|
||||
(string.IsNullOrEmpty(table.UserId) || x.UserId.Contains(table.UserId)) &&
|
||||
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
|
||||
(string.IsNullOrEmpty(table.InterFaceName) || x.InterFaceName.Contains(table.InterFaceName)) &&
|
||||
(string.IsNullOrEmpty(table.InterFaceUrl) || x.InterFaceUrl.Contains(table.InterFaceUrl)) &&
|
||||
(string.IsNullOrEmpty(table.InterFaceMehtod) || x.InterFaceMehtod.Contains(table.InterFaceMehtod)) &&
|
||||
(string.IsNullOrEmpty(table.InterFaceBody) || x.InterFaceBody.Contains(table.InterFaceBody)) &&
|
||||
(string.IsNullOrEmpty(table.InterFaceReturnData) || x.InterFaceReturnData.Contains(table.InterFaceReturnData)) &&
|
||||
(string.IsNullOrEmpty(table.InterFaceType) || x.InterFaceType.Contains(table.InterFaceType)) &&
|
||||
(string.IsNullOrEmpty(table.IP) || x.IP.Contains(table.IP))
|
||||
orderby x.InterFaceLogDate descending
|
||||
select x
|
||||
;
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
/// 获取分页列表
|
||||
@@ -57,62 +51,60 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getListData(Model.InterFaceLog table, Grid Grid1)
|
||||
{
|
||||
var q= GetInterFaceLogByModle(table);
|
||||
var q = GetInterFaceLogByModle(table);
|
||||
count = q.Count();
|
||||
if (count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
q = q.Skip(Grid1.PageSize * (Grid1.PageIndex)).Take(Grid1.PageSize).ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
q = q.Skip(Grid1.PageSize * (Grid1.PageIndex)).Take(Grid1.PageSize);
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return (from x in q
|
||||
select new
|
||||
{
|
||||
x.InterFaceLogId,
|
||||
x.UserId,
|
||||
x.UnitId,
|
||||
x.InterFaceName,
|
||||
x.InterFaceUrl,
|
||||
x.InterFaceMehtod,
|
||||
x.InterFaceBody,
|
||||
x.InterFaceReturnData,
|
||||
x.InterFaceLogDate,
|
||||
x.InterFaceType,
|
||||
x.LogSate,
|
||||
x.IP,
|
||||
|
||||
});
|
||||
select new
|
||||
{
|
||||
x.InterFaceLogId,
|
||||
x.UserId,
|
||||
x.UnitId,
|
||||
x.InterFaceName,
|
||||
x.InterFaceUrl,
|
||||
x.InterFaceMehtod,
|
||||
x.InterFaceBody,
|
||||
x.InterFaceReturnData,
|
||||
x.InterFaceLogDate,
|
||||
x.InterFaceType,
|
||||
x.LogSate,
|
||||
x.IP,
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static Model.InterFaceLog GetInterFaceLogById(string InterFaceLogId)
|
||||
{
|
||||
return db.InterFaceLog.FirstOrDefault(x=>x.InterFaceLogId==InterFaceLogId);
|
||||
public static Model.InterFaceLog GetInterFaceLogById(string InterFaceLogId)
|
||||
{
|
||||
return db.InterFaceLog.FirstOrDefault(x => x.InterFaceLogId == InterFaceLogId);
|
||||
}
|
||||
|
||||
|
||||
public static void AddInterFaceLog(Model.InterFaceLog newtable)
|
||||
{
|
||||
|
||||
|
||||
Model.InterFaceLog table = new Model.InterFaceLog{
|
||||
InterFaceLogId=newtable.InterFaceLogId,
|
||||
UserId=newtable.UserId,
|
||||
UnitId=newtable.UnitId,
|
||||
InterFaceName=newtable.InterFaceName,
|
||||
InterFaceUrl=newtable.InterFaceUrl,
|
||||
InterFaceMehtod=newtable.InterFaceMehtod,
|
||||
InterFaceBody=newtable.InterFaceBody,
|
||||
InterFaceReturnData=newtable.InterFaceReturnData,
|
||||
InterFaceLogDate=newtable.InterFaceLogDate,
|
||||
InterFaceType=newtable.InterFaceType,
|
||||
LogSate=newtable.LogSate,
|
||||
IP=newtable.IP,
|
||||
Model.InterFaceLog table = new Model.InterFaceLog
|
||||
{
|
||||
InterFaceLogId = newtable.InterFaceLogId,
|
||||
UserId = newtable.UserId,
|
||||
UnitId = newtable.UnitId,
|
||||
InterFaceName = newtable.InterFaceName,
|
||||
InterFaceUrl = newtable.InterFaceUrl,
|
||||
InterFaceMehtod = newtable.InterFaceMehtod,
|
||||
InterFaceBody = newtable.InterFaceBody,
|
||||
InterFaceReturnData = newtable.InterFaceReturnData,
|
||||
InterFaceLogDate = newtable.InterFaceLogDate,
|
||||
InterFaceType = newtable.InterFaceType,
|
||||
LogSate = newtable.LogSate,
|
||||
IP = newtable.IP,
|
||||
};
|
||||
Funs.DB.InterFaceLog.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
public static void WriteInterFaceLog(string InterFaceSetlId, string InterFaceBody, string ReturnData, string InterFaceType,bool isSuccess)
|
||||
public static void WriteInterFaceLog(string InterFaceSetlId, string InterFaceBody, string ReturnData, string InterFaceType, bool isSuccess)
|
||||
{
|
||||
var InterfaceSetModel = InterFaceSetService.GetInterFaceSetById(InterFaceSetlId);
|
||||
Model.InterFaceLog table = new Model.InterFaceLog();
|
||||
@@ -131,7 +123,7 @@ namespace BLL
|
||||
table.UnitId = InterfaceSetModel.UnitId;
|
||||
table.InterFaceUrl = InterfaceSetModel.InterFaceUrl;
|
||||
table.InterFaceMehtod = InterfaceSetModel.UrlReqMethod;
|
||||
|
||||
|
||||
break;
|
||||
case Type2:
|
||||
table.UnitId = InterfaceSetModel.AuthUnitIds;
|
||||
@@ -150,36 +142,34 @@ namespace BLL
|
||||
|
||||
public static void UpdateInterFaceLog(Model.InterFaceLog newtable)
|
||||
{
|
||||
|
||||
Model.InterFaceLog table = db.InterFaceLog.FirstOrDefault(x=>x.InterFaceLogId==newtable.InterFaceLogId);
|
||||
if (table != null)
|
||||
|
||||
Model.InterFaceLog table = db.InterFaceLog.FirstOrDefault(x => x.InterFaceLogId == newtable.InterFaceLogId);
|
||||
if (table != null)
|
||||
{
|
||||
table.InterFaceLogId=newtable.InterFaceLogId;
|
||||
table.UserId=newtable.UserId;
|
||||
table.UnitId=newtable.UnitId;
|
||||
table.InterFaceName=newtable.InterFaceName;
|
||||
table.InterFaceUrl=newtable.InterFaceUrl;
|
||||
table.InterFaceMehtod=newtable.InterFaceMehtod;
|
||||
table.InterFaceBody=newtable.InterFaceBody;
|
||||
table.InterFaceReturnData=newtable.InterFaceReturnData;
|
||||
table.InterFaceLogDate=newtable.InterFaceLogDate;
|
||||
table.InterFaceType=newtable.InterFaceType;
|
||||
table.LogSate=newtable.LogSate;
|
||||
table.IP=newtable.IP;
|
||||
table.InterFaceLogId = newtable.InterFaceLogId;
|
||||
table.UserId = newtable.UserId;
|
||||
table.UnitId = newtable.UnitId;
|
||||
table.InterFaceName = newtable.InterFaceName;
|
||||
table.InterFaceUrl = newtable.InterFaceUrl;
|
||||
table.InterFaceMehtod = newtable.InterFaceMehtod;
|
||||
table.InterFaceBody = newtable.InterFaceBody;
|
||||
table.InterFaceReturnData = newtable.InterFaceReturnData;
|
||||
table.InterFaceLogDate = newtable.InterFaceLogDate;
|
||||
table.InterFaceType = newtable.InterFaceType;
|
||||
table.LogSate = newtable.LogSate;
|
||||
table.IP = newtable.IP;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public static void DeleteInterFaceLogById (string InterFaceLogId)
|
||||
{
|
||||
|
||||
Model.InterFaceLog table =Funs.DB.InterFaceLog.FirstOrDefault(x=>x.InterFaceLogId==InterFaceLogId);
|
||||
if (table != null)
|
||||
{
|
||||
public static void DeleteInterFaceLogById(string InterFaceLogId)
|
||||
{
|
||||
Model.InterFaceLog table = Funs.DB.InterFaceLog.FirstOrDefault(x => x.InterFaceLogId == InterFaceLogId);
|
||||
if (table != null)
|
||||
{
|
||||
Funs.DB.InterFaceLog.DeleteOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user